/* Video Dashboard — white mode, left sidebar layout.
   Style reference: speech-generator (white bg, #333 text, sans-serif,
   rounded corners, one accent color). */

:root {
  --pcolor: #c4302b;          /* YouTube-ish red as the accent */
  --pcolor-dark: #9c1f1b;
  --pcolor-light: #fdeceb;
  --text: #333;
  --muted: #6c757d;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --ok: #1a7f37;
  --ok-bg: #e6f4ea;
  --bad: #b71c1c;
  --bad-bg: #fdeceb;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--pcolor); }

h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.2rem; margin: 24px 0 12px; }
h3 { font-size: 1.05rem; margin: 20px 0 10px; }

/* ---------------- layout: sidebar + main ---------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  font-weight: bold;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  padding: 6px 10px 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar .brand .wordmark { color: var(--text); }
.sidebar .brand .wordmark span { color: var(--pcolor); }
.sidebar .brand .brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.sidebar nav a:hover { background: #eef0f2; }
.sidebar nav a.active {
  background: var(--pcolor-light);
  color: var(--pcolor-dark);
  font-weight: bold;
}

.sidebar .nav-section {
  margin-top: 14px;
  padding: 0 12px 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.main { flex: 1; min-width: 0; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 32px 60px; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  .sidebar .brand { padding: 6px 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .nav-section { display: none; }
  .wrap { padding: 18px 16px 40px; }
}

/* legacy topbar (unused after redesign, kept harmless) */
.topbar { display: none; }

/* ---------------- generic components ---------------- */

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}
.pad { padding: 16px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono, .mono-cell { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.85em; }
.mt { margin-top: 10px; }
.mb { margin-bottom: 10px; }

/* Rendered markdown notes */
.note-body { max-width: 820px; line-height: 1.6; }
.note-body h1 { font-size: 1.5rem; margin: 0 0 12px; }
.note-body h2 {
  font-size: 1.15rem;
  margin: 28px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.note-body h3 { font-size: 1rem; margin: 20px 0 6px; }
.note-body p, .note-body li { color: var(--muted); }
.note-body ul { padding-left: 20px; }
.note-body li { margin-bottom: 4px; }
.note-body hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.note-body code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}
.note-body pre { white-space: pre-wrap; }

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.row-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.tile {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--bg);
}
.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: bold;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: #eef0f2; color: var(--muted); }
.badge.info { background: #e3f2fd; color: #1565c0; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--bg-soft); }
.btn-primary {
  background: var(--pcolor);
  border-color: var(--pcolor);
  color: white;
}
.btn-primary:hover { background: var(--pcolor-dark); }
.btn-disabled { opacity: 0.5; pointer-events: none; }
.btn.small {
  padding: 0 12px;
  font-size: 0.85rem;
  height: 32px;
  line-height: 30px;
}
.r-icon {
  font-size: 1.5rem;
  display: inline-block;
  line-height: 1;
  vertical-align: -2px;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { display: inline; }

.link { color: var(--pcolor); text-decoration: none; }
.link:hover { text-decoration: underline; }

.ok { color: var(--ok); }
.bad, .err { color: var(--bad); }
.err-panel { border-color: #f2b8b5; background: #fffafa; }

.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }

/* ---------------- tables ---------------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th, .tbl td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg-soft);
}
.tbl tr:hover td { background: #fcfcfd; }
.tbl .num { text-align: right; }

/* ---------------- details/summary panels ---------------- */

details.panel > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: bold;
  list-style: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "▸ "; color: var(--muted); }
details.panel[open] > summary::before { content: "▾ "; }

pre.mono {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------- forms ---------------- */

.form label { display: block; margin: 12px 0 4px; font-weight: bold; font-size: 0.88rem; }
.form input[type="text"],
.form input[type="number"],
.form input:not([type]),
.form select,
.form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
  color: var(--text);
}
.form textarea.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--pcolor);
}
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .form .two { grid-template-columns: 1fr; } }

.form .radio, .form .checkbox {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.form .radio input, .form .checkbox input { width: auto; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 2px 10px;
}
.checkbox.small { font-size: 0.8rem; margin: 2px 0; }
.country-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-top: 8px;
  background: var(--bg-soft);
}

.form button[type="submit"] { margin-top: 18px; }

/* ---------------- channels / videos ---------------- */

.channel-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.channel-card img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.channel-card .meta { min-width: 0; }
.channel-card .meta .name { font-weight: bold; }

.video-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}

.status-select {
  padding: 0 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
  height: 32px;
}
