/* Kaun TL – brand colours from kaunai.org: navy #0b1a45, teal #0a7782, teal-dark #086570 */
:root {
  --navy: #0b1a45; --navy-2: #13265c; --navy-3: #1c3270;
  --teal: #0a7782; --teal-dark: #086570; --teal-soft: #e3f2f3;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f8f9fc;
  --ink: #0f1a33; --ink-2: #3a4663; --muted: #6b7591; --line: #e2e6ef; --line-2: #eef1f6;
  --green: #12805c; --green-soft: #e4f4ed; --amber: #a15c07; --amber-soft: #fdf1df;
  --red: #b42318; --red-soft: #fdeceb; --grey: #667085; --grey-soft: #eef0f4;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 26, 51, .06), 0 1px 3px rgba(15, 26, 51, .05);
  --shadow-lg: 0 12px 32px rgba(11, 26, 69, .12);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1020; --surface: #111a2e; --surface-2: #0e1628;
    --ink: #e8ecf5; --ink-2: #c0c8db; --muted: #8b95ad; --line: #222d47; --line-2: #1a2440;
    --teal-soft: #0f2b33; --green-soft: #0f2a22; --amber-soft: #2d2210; --red-soft: #2e1515; --grey-soft: #1b2338;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
code { font-size: .92em; background: var(--grey-soft); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  font: 600 13.5px var(--font); border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost-light { background: transparent; color: #c9d3ec; border-color: rgba(255, 255, 255, .18); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 9px 11px; font: 14px var(--font);
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
input:hover, select:hover, textarea:hover { border-color: #c5cbd8; }
.alert { padding: 10px 12px; margin: 0 0 16px; border-radius: var(--radius-sm); background: var(--red-soft);
  color: var(--red); font-weight: 500; border: 1px solid rgba(180, 35, 24, .2); }

/* ---------- sign-in ---------- */
body.auth { min-height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brand { background: radial-gradient(1200px 600px at 0% 0%, var(--navy-3), var(--navy) 60%); color: #dce3f5;
  padding: 64px 56px; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-brand img { margin-bottom: auto; border-radius: 14px; }
.auth-org { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: #8fd3da; margin: 0 0 8px; }
.auth-brand h2 { font-size: 40px; line-height: 1.1; margin: 0 0 14px; color: #fff; letter-spacing: -.02em; }
.auth-brand p:last-child { max-width: 440px; font-size: 15px; color: #b9c4e0; margin: 0; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px; background: var(--surface); }
.auth-logo-sm { display: none; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 28px; }
.auth-form { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-form h1 { margin-bottom: 4px; }
.auth-form > .muted { margin: 0 0 24px; }
.auth-form input { margin-bottom: 16px; height: 42px; }
.auth-form .btn { height: 42px; margin-top: 4px; }
.code-input { letter-spacing: .3em; font-size: 18px; text-align: center; }
.auth-foot { max-width: 380px; margin: 40px auto 0; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo-sm { display: flex; justify-content: center; }
  .auth-panel { padding: 40px 20px; }
}

/* ---------- app shell ---------- */
body.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--navy); color: #c9d3ec; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 10px; }
.brand img { border-radius: 9px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 15px; }
.brand small { font-size: 11.5px; color: #8fa0c9; }
.side-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #7183b3;
  margin: 18px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: #c9d3ec; text-decoration: none; font-size: 13.5px; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link[aria-current] { background: rgba(10, 119, 130, .35); color: #fff; font-weight: 600; }
.side-count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: #8fa0c9; background: rgba(255, 255, 255, .07);
  padding: 1px 8px; border-radius: 999px; }
.side-link .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex-shrink: 0; }
.tone-teal .dot { background: #34b4bf; } .tone-navy .dot { background: #7c96e0; } .tone-amber .dot { background: #f0a43a; }
.tone-red .dot { background: #f06b5d; } .tone-green .dot { background: #35c08e; } .tone-grey .dot { background: #8a93a8; }
.side-foot { margin-top: auto; padding: 16px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; color: #8fa0c9; }
.side-foot strong { color: #dce3f5; font-weight: 600; }
.side-foot p { margin: 0 0 12px; }

.main { padding: 28px 36px 48px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: .1em; }
.search input { width: 280px; margin: 0; height: 38px; background: var(--surface)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7591' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E")
  no-repeat 11px center; padding-left: 34px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 15px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border-top: 3px solid var(--grey); }
.stat:hover { box-shadow: var(--shadow-lg); }
.stat[aria-current] { outline: 2px solid var(--teal); outline-offset: -1px; }
.stat.tone-teal { border-top-color: var(--teal); } .stat.tone-navy { border-top-color: var(--navy-3); }
.stat.tone-amber { border-top-color: #e08f1a; } .stat.tone-red { border-top-color: var(--red); } .stat.tone-green { border-top-color: var(--green); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat-note { font-size: 11.5px; color: var(--muted); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.add-panel summary { padding: 13px 18px; font-weight: 600; cursor: pointer; color: var(--teal); list-style: none; }
.add-panel summary::before { content: "+"; display: inline-block; width: 18px; font-weight: 700; }
.add-panel[open] summary { border-bottom: 1px solid var(--line-2); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; padding: 16px 18px 18px; }
.span-3 { grid-column: 1 / -1; }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2);
  font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.clear { font-weight: 500; }

/* ---------- tasks ---------- */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: start; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.task:first-child { border-top: 0; }
.task:hover { background: var(--surface-2); }
.status-pill { display: inline-flex; justify-content: center; padding: 3px 0; border-radius: 999px; font-size: 11.5px; font-weight: 700; margin-top: 1px; }
.s-proposed { background: var(--teal-soft); color: var(--teal); }
.s-pending { background: #e7ecfb; color: var(--navy-3); }
.s-waiting { background: var(--amber-soft); color: var(--amber); }
.s-blocked { background: var(--red-soft); color: var(--red); }
.s-done { background: var(--green-soft); color: var(--green); }
.s-dismissed { background: var(--grey-soft); color: var(--grey); }
@media (prefers-color-scheme: dark) { .s-pending { background: #1a2550; color: #a9bbf0; } }
.task-body { min-width: 0; }
.task-title { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.tag { background: var(--grey-soft); color: var(--ink-2); padding: 1px 8px; border-radius: 6px; font-weight: 600; font-size: 11.5px; }
.due { color: var(--amber); font-weight: 600; }
.task blockquote { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--teal); background: var(--teal-soft);
  border-radius: 0 6px 6px 0; color: var(--ink-2); font-size: 13px; }
.task-notes { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.task-actions form { margin: 0; }
.empty { padding: 48px 18px; text-align: center; }
.empty p { margin: 4px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-label { width: 100%; }
  .main { padding: 20px 16px 40px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .search input { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .task { grid-template-columns: 1fr; }
  .task-actions { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
}

/* logo is teal line art: give it a light tile so it reads on navy */
.brand img, .auth-brand img, .auth-logo-sm img { background: #fff; padding: 3px; }
.auth-brand img { padding: 8px; border-radius: 16px; }
