:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #24303a;
  --muted: #6b7680;
  --accent: #2b5f7a;
  --accent-dark: #1f4759;
  --border: #e1ddd4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--accent-dark);
  color: #fff;
  padding: 12px 20px;
}
.topnav a { color: #dce7ec; text-decoration: none; padding: 4px 2px; }
.topnav a.active, .topnav a:hover { color: #fff; border-bottom: 2px solid #fff; }
.topnav .brand { font-weight: 700; margin-right: 12px; }
.topnav .spacer { flex: 1; }
.topnav .user-email { color: #b9c9d1; font-size: 0.9em; }

h1 { margin-top: 0; }

.auth-box {
  max-width: 360px;
  margin: 60px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}
.auth-box form { display: flex; flex-direction: column; gap: 12px; }
.auth-box label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; color: var(--muted); }

input, select, button {
  font-size: 1em;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash-error { background: #fbe4e2; color: #8c2f27; }
.muted { color: var(--muted); }

.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input[type=search] { flex: 1; min-width: 200px; }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.video-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #ddd; }
.thumb-placeholder { background: linear-gradient(135deg, #dfe6ea, #cdd8de); }
.video-info { padding: 10px 12px; flex: 1; }
.video-title { font-weight: 600; text-decoration: none; color: var(--text); display: block; margin-bottom: 6px; }
.video-title:hover { color: var(--accent); }
.video-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.8em; color: var(--muted); }
.video-meta span:not(:last-child)::after { content: "\2022"; margin-left: 8px; }
.video-actions { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); gap: 8px; }
.watched-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.85em; }
.add-to-project { font-size: 0.85em; max-width: 140px; }

.inline-form { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; }

.project-list { list-style: none; padding: 0; }
.project-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.project-list a { color: var(--text); font-weight: 600; text-decoration: none; }
.project-list a:hover { color: var(--accent); }

.todo-list { list-style: none; padding: 0; }
.todo-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.todo-item.done a { text-decoration: line-through; color: var(--muted); }
.todo-item a { color: var(--text); flex: 1; }
.tag { font-size: 0.75em; background: #eef2f4; color: var(--muted); padding: 2px 8px; border-radius: 12px; }
.delete-form button { background: transparent; color: var(--muted); font-size: 1.1em; padding: 2px 8px; }
.delete-form button:hover { color: #a33; background: transparent; }

.back-link { text-decoration: none; color: var(--accent); display: inline-block; margin-bottom: 10px; }
.danger-form { margin-top: 30px; }
.danger-form button { background: #a33; }
.danger-form button:hover { background: #822; }
