/* ContentWorks — Knowledge Tanker + content planner (dark-first)
   Palette: emerald work + violet highlights · Fira Sans / Fira Code
   Deliberately different from Competitor Watch's blue so the two tools are
   never confused at a glance. */

:root, :root[data-theme="dark"] {
  --bg: #0A1310;
  --bg-raised: #0F1D18;
  --bg-hover: #152720;
  --bg-input: #08110E;
  --border: #1D332B;
  --border-strong: #2A4739;
  --text: #E3EFE9;
  --text-muted: #8AA39A;
  --placeholder: #4C6A5E;
  --primary: #10B981;
  --primary-strong: #059669;
  --on-primary: #04140F;
  --accent: #A78BFA;
  --ok: #34D399;
  --ok-bg: rgba(52, 211, 153, .12);
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, .12);
  --warn: #FBBF24;
  --warn-bg: rgba(251, 191, 36, .12);
  --ring: #34D399;
  --sidebar-1: #0C1714;
  --sidebar-2: #08110E;
  --nav-active-bg: rgba(16, 185, 129, .14);
  --nav-active-text: #6EE7B7;
  --chip-violet: #C4B5FD;
  --chip-amber: #FCD34D;
  --quote-bg: rgba(167, 139, 250, .08);
  --radius: 10px;
  --radius-sm: 6px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px;
  --font: 'Fira Sans', system-ui, -apple-system, sans-serif;
  --mono: 'Fira Code', ui-monospace, 'Cascadia Code', monospace;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
}

:root[data-theme="light"] {
  --bg: #F2F7F4;
  --bg-raised: #FFFFFF;
  --bg-hover: #EAF3EE;
  --bg-input: #FFFFFF;
  --border: #DFEAE4;
  --border-strong: #C3D8CD;
  --text: #10241C;
  --text-muted: #55705F;
  --placeholder: #90A99C;
  --primary: #047857;
  --primary-strong: #036049;
  --on-primary: #FFFFFF;
  --accent: #6D28D9;
  --ok: #047857;
  --ok-bg: rgba(4, 120, 87, .1);
  --danger: #DC2626;
  --danger-bg: rgba(220, 38, 38, .08);
  --warn: #B45309;
  --warn-bg: rgba(180, 83, 9, .1);
  --ring: #047857;
  --sidebar-1: #FFFFFF;
  --sidebar-2: #F5FAF7;
  --nav-active-bg: rgba(4, 120, 87, .1);
  --nav-active-text: #036049;
  --chip-violet: #6D28D9;
  --chip-amber: #92400E;
  --quote-bg: rgba(109, 40, 217, .06);
  --shadow: 0 1px 2px rgba(16,40,30,.05), 0 6px 18px rgba(16,40,30,.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-5) var(--s-4) var(--s-4); color: var(--text); font-size: 15px;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; color: var(--primary); flex: none; }
.brand b { color: var(--primary); font-weight: 700; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--s-2); overflow-y: auto; flex: 1; }
.nav-label {
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--placeholder); padding: var(--s-4) var(--s-3) var(--s-1); font-weight: 600;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px var(--s-3); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--nav-active-bg); color: var(--nav-active-text); }
.sidebar nav a svg { width: 17px; height: 17px; flex: none; }
.sidebar nav a .pill {
  margin-left: auto; background: var(--accent); color: var(--bg);
  border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700;
}
.sidebar-foot { padding: var(--s-3); border-top: 1px solid var(--border); display: flex; gap: var(--s-2); }
.theme-btn, .logout {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius-sm); padding: 7px; font: inherit; font-size: 12px; cursor: pointer;
}
.theme-btn:hover, .logout:hover { background: var(--bg-hover); color: var(--text); }
.theme-btn svg { width: 15px; height: 15px; }
:root[data-theme="dark"] .ic-sun, :root[data-theme="light"] .ic-moon { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-5) var(--s-5) var(--s-4); border-bottom: 1px solid var(--border);
  background: var(--bg-raised); flex-wrap: wrap;
}
.topbar h1 { font-size: 20px; }
.topbar .sub { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; max-width: 70ch; }
.topbar-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.content { padding: var(--s-5); max-width: 1400px; width: 100%; }

/* ---------- cards & grids ---------- */
.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-4); box-shadow: var(--shadow);
}
.card + .card { margin-top: var(--s-4); }
.card h2 { font-size: 15px; margin-bottom: var(--s-3); }
.card h2 .muted { font-weight: 400; color: var(--text-muted); font-size: 13px; }
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4); }
.stat .n { font-size: 26px; font-weight: 700; font-family: var(--mono); line-height: 1.1; }
.stat .l { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.stat.good .n { color: var(--primary); }
.stat.warn .n { color: var(--warn); }
.stat.dead .n { color: var(--text-muted); }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
label .hint { font-weight: 400; color: var(--text-muted); }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; font: inherit; font-size: 13.5px;
}
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ring); outline-offset: -1px; border-color: var(--ring); }
::placeholder { color: var(--placeholder); }
.field { margin-bottom: var(--s-4); }
.row { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary);
  border-radius: var(--radius-sm); padding: 9px 15px; font: inherit; font-size: 13.5px;
  font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--primary-strong); border-color: var(--primary-strong); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-hover); }
.table-wrap { overflow-x: auto; }

/* ---------- chips ---------- */
.chip {
  display: inline-block; border-radius: 999px; padding: 1px 8px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--border-strong);
  color: var(--text-muted); white-space: nowrap;
}
.chip.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.chip.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.chip.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.chip.type { color: var(--chip-violet); border-color: var(--chip-violet); }
.chip.dead { text-decoration: line-through; opacity: .75; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* the exact borrowed wording — always shown as a quote, never as our text */
.quote {
  font-family: var(--mono); font-size: 12.5px; background: var(--quote-bg);
  border-left: 3px solid var(--accent); padding: 6px 10px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: block;
}

/* ---------- progress ---------- */
.bar { height: 6px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.progress-note { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

/* ---------- notices ---------- */
.notice { border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13px; margin-bottom: var(--s-4); border: 1px solid; }
.notice.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.notice.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.notice.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.notice.info { color: var(--text-muted); border-color: var(--border-strong); background: var(--bg-hover); }
.empty { text-align: center; color: var(--text-muted); padding: var(--s-6) var(--s-4); }
.empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: var(--s-3); }

/* ---------- review (tick keep or drop) ---------- */
.src-group { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: var(--s-4); overflow: hidden; }
.src-head {
  background: var(--bg-hover); padding: 10px var(--s-4); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
}
.src-head .u { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.cand { display: flex; gap: var(--s-3); padding: 10px var(--s-4); border-bottom: 1px solid var(--border); align-items: flex-start; }
.cand:last-child { border-bottom: 0; }
.cand:hover { background: var(--bg-hover); }
.cand input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); margin-top: 3px; flex: none; cursor: pointer; }
.cand .body { min-width: 0; flex: 1; }
.cand .t { font-size: 13.5px; }
.cand .meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; display: flex; gap: var(--s-3); flex-wrap: wrap; }
.sticky-bar {
  position: sticky; bottom: 0; background: var(--bg-raised); border-top: 1px solid var(--border-strong);
  padding: var(--s-3) var(--s-4); display: flex; gap: var(--s-3); align-items: center;
  margin: 0 calc(var(--s-5) * -1) calc(var(--s-5) * -1); flex-wrap: wrap;
}

/* ---------- plan sections ---------- */
.sec { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-3); margin-bottom: var(--s-3); background: var(--bg-raised); }
.sec-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.sec-head .num { font-family: var(--mono); color: var(--text-muted); font-size: 12px; }
.sec-head input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.sec .row { gap: var(--s-2); }
.sec .row > * { min-width: 140px; }
.sec label { font-size: 11px; margin-bottom: 3px; }
.gap-list { margin: 0; padding-left: 18px; }
.gap-list li { margin-bottom: 4px; }

/* ---------- written page ---------- */
.page-out {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-5); font-size: 15px; line-height: 1.7; max-width: 76ch;
}
.page-out h1 { font-size: 24px; margin: 0 0 var(--s-4); }
.page-out h2 { font-size: 18px; margin: var(--s-5) 0 var(--s-2); }
.page-out h3 { font-size: 15px; margin: var(--s-4) 0 var(--s-2); }
.page-out p { margin: 0 0 var(--s-3); }
.page-out ul, .page-out ol { margin: 0 0 var(--s-3); padding-left: 22px; }
.page-out li { margin-bottom: 4px; }
.page-out .todo { color: var(--warn); font-weight: 600; }

pre.raw {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-4); overflow-x: auto; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.7; white-space: pre-wrap; word-wrap: break-word;
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s-4); background: var(--bg); }
.login-card {
  width: 100%; max-width: 370px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 14px; padding: var(--s-6); box-shadow: var(--shadow);
}
.login-card .brand { padding: 0 0 var(--s-5); font-size: 18px; }

/* ---------- filter bar ---------- */
.filters { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--s-4); }
.filters .f { min-width: 130px; }
.filters .f.grow { flex: 1; min-width: 200px; }
.filters label { font-size: 11px; }
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); margin-bottom: var(--s-4); }
.tabs a {
  padding: 8px 13px; color: var(--text-muted); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; overflow-x: auto; }
  .nav-label { display: none; }
  .content { padding: var(--s-4); }
  .sticky-bar { margin: 0 calc(var(--s-4) * -1) calc(var(--s-4) * -1); }
}

/* ---------- website groups (My websites) ---------- */
.sitecols { display: grid; grid-template-columns: 215px 1fr; gap: var(--s-4); align-items: start; }
.grouplist { display: flex; flex-direction: column; gap: 2px; }
.grouplist a {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-2);
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted);
}
.grouplist a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.grouplist a.on { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600; }
.grouplist a span.n { font-family: var(--mono); font-size: 11px; opacity: .8; }
.grouplist .sep { height: 1px; background: var(--border); margin: var(--s-2) 0; }

@media (max-width: 900px) {
  .sitecols { grid-template-columns: 1fr; }
  .grouplist { flex-direction: row; flex-wrap: wrap; }
  .grouplist .sep { display: none; }
}
