:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --border: #e2e0db;
  --text: #1c1b19;
  --muted: #6b6862;
  --accent: #c2410c;
  --accent-soft: #fdeee6;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --s1: #e8e6e1;
  --s2: #fde68a;
  --s3: #fdba74;
  --s4: #f87171;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1c1b1a;
    --surface-2: #252422;
    --border: #33312e;
    --text: #ecebe8;
    --muted: #9c988f;
    --accent: #fb923c;
    --accent-soft: #3a2416;
    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #f87171;
    --s1: #33312e;
    --s2: #5c4a14;
    --s3: #7a3d14;
    --s4: #7f1d1d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
a:hover { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }

/* layout */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.nav a {
  padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.stat .value { font-size: 1.6rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.85rem; }

/* banners */
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.banner.warn { border-color: var(--warn); }
.banner.info { border-color: var(--accent); }
#jobbar { display: none; }
#jobbar.show { display: block; }
.spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
form.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters label, .field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; min-width: 0;
}
textarea { width: 100%; min-height: 120px; font-family: ui-monospace, monospace; font-size: 0.85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .btn {
  font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); color: #fff; }
button.small, .btn.small { padding: 3px 9px; font-size: 0.82rem; }
button.ghost { border-color: transparent; background: transparent; }
button.danger:hover { border-color: var(--err); color: var(--err); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* video rows */
.vrow { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.vrow:last-child { border-bottom: none; }
.thumb { position: relative; flex: 0 0 168px; }
.thumb img { width: 168px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.thumb .dur { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.8); color: #fff; font-size: 0.72rem; padding: 0 4px; border-radius: 4px; }
.vinfo { flex: 1; min-width: 0; }
.vtitle { font-weight: 600; text-decoration: none; display: block; }
.vmeta { color: var(--muted); font-size: 0.85rem; }
.vactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.compact .thumb { flex-basis: 120px; }
.compact .thumb img { width: 120px; }

.score {
  display: inline-block; min-width: 52px; text-align: center; font-weight: 700; font-size: 0.85rem;
  padding: 2px 8px; border-radius: 999px; background: var(--s1);
}
.score.s2 { background: var(--s2); }
.score.s3 { background: var(--s3); }
.score.s4 { background: var(--s4); }
.tag { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

/* ideas */
.idea { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.idea:last-child { border-bottom: none; }
.idea .strength { flex: 0 0 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); }
.idea .strength.hi { background: var(--accent-soft); color: var(--accent); }
.idea .body { flex: 1; min-width: 0; }
.idea .title { font-size: 1.05rem; font-weight: 600; }
.idea .alts { color: var(--muted); font-size: 0.88rem; margin: 2px 0 6px; }
.idea .why { font-size: 0.9rem; }
.idea .signal { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.idea .acts { display: flex; flex-direction: column; gap: 6px; }
.idea.liked .strength { outline: 2px solid var(--ok); }
.idea.disliked { opacity: 0.5; }
.idea.used .title { text-decoration: line-through; text-decoration-color: var(--muted); }
.copy { cursor: copy; }

label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: 4px; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.clean li:last-child { border-bottom: none; }
ul.bullets { margin: 4px 0 0; padding-left: 18px; }

.chart { width: 100%; height: 160px; }
.chart path { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: var(--accent-soft); stroke: none; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 360px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--err); }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  main { padding: 16px; }
  .grid.two { grid-template-columns: 1fr; }
  .thumb, .compact .thumb { flex-basis: 110px; }
  .thumb img, .compact .thumb img { width: 110px; }
  .idea { flex-wrap: wrap; }
  .idea .acts { flex-direction: row; flex-basis: 100%; }
}
