/* ============================================================
   THEME — everything brandable lives in this block.
   To rebrand: change the --accent* values below, and the app's
   display name in index.html, app.html and manifest.webmanifest.
   Dark mode re-assigns these same properties; no rule below the
   block hard-codes a colour.
   ============================================================ */
:root{
  color-scheme: light dark;

  --accent:#1D9E75;
  --accent-strong:#17805E;
  --accent-ink:#FFFFFF;
  --accent-wash:#E1F5EE;

  --bg:#F6F6F3;
  --surface:#FFFFFF;
  --surface-2:#FBFBF9;
  --line:#E5E4DE;
  --line-strong:#D2D1C9;

  --text:#1B1B19;
  --text-soft:#5F5E58;
  --text-mute:#8A8982;

  --ok:#0F6E56;      --ok-wash:#E1F5EE;
  --warn:#854F0B;    --warn-wash:#FAEEDA;
  --danger:#A32D2D;  --danger-wash:#FCEBEB;

  --radius:12px;
  --radius-sm:8px;
  --tap:44px;
  --shell-max:1120px;
  --nav-w:216px;
  
  --shadow-soft:0 1px 2px rgba(0,0,0,0.06);
}

@media (prefers-color-scheme: dark){
  :root{
    --accent:#2DD4A3;
    --accent-strong:#4ADFB4;
    --accent-ink:#04211A;
    --accent-wash:rgba(45,212,163,0.12);

    --bg:#0E1114;
    --surface:#161A1F;
    --surface-2:#1B2027;
    --line:#262B33;
    --line-strong:#343B45;

    --text:#EDF0F3;
    --text-soft:#A7AEB9;
    --text-mute:#78808C;

    --ok:#3DD9A8;     --ok-wash:rgba(45,212,163,0.12);
    --warn:#E9A33C;   --warn-wash:rgba(233,163,60,0.12);
    --danger:#F07171; --danger-wash:rgba(240,113,113,0.12);
    
    --shadow-soft:0 1px 2px rgba(255,255,255,0.10);
  }
}

*,*::before,*::after{ box-sizing:border-box; margin:0; padding:0; }

body{
  font-family:system-ui,-apple-system,'Segoe UI',sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.5;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
}

h1,h2,h3{ font-weight:600; line-height:1.2; }
h2{ font-size:1.25rem; }
h3{ font-size:0.95rem; }
ul{ list-style:none; }
a{ color:var(--accent-strong); }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:0.001ms !important;
    transition-duration:0.001ms !important;
  }
}

/* ---------- shell ---------- */
.shell{ max-width:var(--shell-max); margin:0 auto; }

.main{ padding:20px 16px 96px; }
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-bottom:18px;
}
.wordmark{
  display:flex; align-items:center; gap:9px;
  font-weight:600; font-size:1rem; letter-spacing:-0.01em;
}
.wordmark img{ width:26px; height:26px; border-radius:7px; display:block; }
.h-sub{ color:var(--text-mute); font-size:0.85rem; margin-top:2px; }

/* ---------- nav: bottom bar on phones ---------- */
.nav{
  position:fixed; left:0; right:0; bottom:0; z-index:20;
  display:flex; background:var(--surface);
  border-top:1px solid var(--line);
  padding-bottom:env(safe-area-inset-bottom);
}
.nav__item{
  flex:1; min-height:var(--tap);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; padding:8px 4px;
  background:none; border:none; cursor:pointer;
  color:var(--text-mute); font:inherit; font-size:0.7rem;
}
.nav__item svg{ width:21px; height:21px; stroke-width:1.8; }
.nav__item[aria-current="page"]{ color:var(--accent-strong); font-weight:600; }

@media (min-width:768px){
  .shell{ display:grid; grid-template-columns:var(--nav-w) minmax(0,1fr); }
  .nav{
    position:sticky; top:0; bottom:auto; height:100vh;
    flex-direction:column; align-items:stretch; gap:2px;
    border-top:none; border-right:1px solid var(--line);
    padding:20px 12px;
  }
  .nav__item{
    flex:0 0 auto; flex-direction:row; justify-content:flex-start;
    gap:11px; padding:11px 12px; font-size:0.9rem;
    border-radius:var(--radius-sm);
  }
  .nav__item:hover{ background:var(--surface-2); color:var(--text); }
  .nav__item[aria-current="page"]{ background:var(--accent-wash); color:var(--accent-strong); }
  .main{ padding:28px 28px 48px; }
}

/* ---------- surfaces ---------- */
.card{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); padding:16px; margin-bottom:16px;
}

/* ---------- forms ---------- */
.field{ margin-bottom:14px; }
.label{
  display:block; font-size:0.8rem; font-weight:600;
  color:var(--text-soft); margin-bottom:6px;
}
.input{
  width:100%; min-height:var(--tap);
  background:var(--surface-2); color:var(--text);
  border:1px solid var(--line-strong); border-radius:var(--radius-sm);
  padding:10px 12px; font:inherit;
}
.input::placeholder{ color:var(--text-mute); }
.input:focus{ border-color:var(--accent); }

.btn{
  min-height:var(--tap); padding:11px 18px;
  border:1px solid var(--line-strong); border-radius:var(--radius-sm);
  background:var(--surface); color:var(--text);
  font:inherit; font-weight:600; cursor:pointer;
}
.btn:hover:not(:disabled){ border-color:var(--text-mute); }
.btn--primary{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.btn--primary:hover:not(:disabled){ background:var(--accent-strong); border-color:var(--accent-strong); }
.btn--ghost{ background:none; border-color:transparent; color:var(--text-soft); font-weight:500; }
.btn--block{ width:100%; }
.btn:disabled{ opacity:0.55; cursor:default; }

/* ---------- segmented control ---------- */
.seg{
  display:flex; gap:4px; padding:4px;
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--radius-sm); margin-bottom:16px;
}
.seg__opt{
  flex:1; min-height:38px; border:none; border-radius:6px;
  background:none; color:var(--text-soft); font:inherit; font-weight:600;
  font-size:0.9rem; cursor:pointer;
}
.seg__opt[aria-pressed="true"]{ background:var(--surface); color:var(--text); box-shadow:var(--shadow-soft); }

/* ---------- picker ---------- */
.picker{
  position:relative;
}
.picker__list{
  display:flex; flex-wrap:wrap; gap:7px;
  max-height:168px; overflow-y:auto; margin-top:10px;
}
.picker__item{
  min-height:38px; padding:8px 13px;
  border:1px solid var(--line-strong); border-radius:999px;
  background:var(--surface); color:var(--text);
  font:inherit; font-size:0.88rem; cursor:pointer;
}
.picker__item:hover{ border-color:var(--text-mute); }
.picker__item[aria-pressed="true"]{
  background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:600;
}

/* ---------- chips, stats, rows ---------- */
.chip{
  display:inline-block; padding:3px 9px; border-radius:999px;
  font-size:0.75rem; font-weight:600;
  background:var(--surface-2); color:var(--text-soft);
}
.chip--ok{ background:var(--ok-wash); color:var(--ok); }
.chip--warn{ background:var(--warn-wash); color:var(--warn); }

.stats{ display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:10px; margin-bottom:16px; }
.stat{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:13px 15px; }
.stat__num{ font-size:1.9rem; font-weight:600; line-height:1.1; letter-spacing:-0.02em; }
.stat__label{ font-size:0.78rem; color:var(--text-mute); margin-top:2px; }

.rows{ display:flex; flex-direction:column; }
.row-item{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:12px 0; border-bottom:1px solid var(--line);
}
.row-item:last-child{ border-bottom:none; }
.row-item__name{ font-weight:600; font-size:0.92rem; }
.row-item__meta{ font-size:0.8rem; color:var(--text-mute); margin-top:1px; }
.row-item__tags{ display:flex; gap:5px; flex-shrink:0; }

.empty{ padding:22px 4px; color:var(--text-mute); font-size:0.9rem; text-align:center; }

/* ---------- messages, banner, bars ---------- */
.msg{ font-size:0.88rem; margin-top:10px; }
.msg--ok{ color:var(--ok); }
.msg--err{ color:var(--danger); }

.banner{
  background:var(--warn-wash); color:var(--warn);
  border:1px solid var(--warn); border-radius:var(--radius-sm);
  padding:10px 13px; font-size:0.85rem; margin-bottom:16px;
}

.bar{ height:7px; border-radius:999px; background:var(--surface-2); overflow:hidden; margin-top:6px; }
.bar__fill{ height:100%; background:var(--accent); border-radius:999px; }
