/* ============================================================
   sw-project-tracker.com — design system

   Two themes. Everything below the token block is written against
   roles, never raw hex, so light and dark swap in one place.

   LIGHT: whites and cool grays.
   DARK:  blacks and whites, after the original team dashboard.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --canvas:        #F7F8F9;
  --canvas-2:      #EFF1F3;
  --card:          #FFFFFF;
  --card-hover:    #FAFBFC;
  --border:        #E3E6E9;
  --border-strong: #CBD1D7;
  --ink:           #16191C;
  --ink-2:         #3D4348;
  --muted:         #6E767D;
  --faint:         #9AA2A9;

  /* Primary action is ink, not a hue — keeps the theme in grays. */
  --accent:        #24282D;
  --accent-text:   #FFFFFF;
  --accent-soft:   #EDF0F3;

  --link:          #2A78D6;
  --blue:          #2A78D6;
  --blue-soft:     #E8F0FB;
  --green:         #008300;
  --green-soft:    #E4F2E4;
  --amber:         #9A6A00;
  --amber-soft:    #FAF0D9;
  --red:           #C0392B;
  --red-soft:      #FAEAE8;
  --slate:         #6E767D;
  --slate-soft:    #EFF1F3;

  /* Pipeline stage. Four hues plus a neutral for Closed — validated
     all-pairs in both themes (normal-vision ΔE 19.6, worst CVD 13.0
     light / 6.9 dark, the latter relieved by the visible site labels). */
  --s1: #2A78D6;   /* Prospect    */
  --s2: #EDA100;   /* Diligence   */
  --s3: #E87BA4;   /* Negotiating */
  --s4: #008300;   /* Exclusivity */
  --s5: #24282D;   /* Closed      */
  --s6: #9AA2A9;   /* Shelved     */

  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 1px 2px rgba(22,25,28,.04), 0 2px 8px rgba(22,25,28,.05);
  --shadow-lg: 0 10px 32px rgba(22,25,28,.14);
  /* Fallback only. app.js measures the real header and overwrites this, so a
     longer nav label or a different zoom level can never sit under the header. */
  --hdr-h:     190px;
}

:root[data-theme="dark"] {
  --canvas:        #0A0A0A;
  --canvas-2:      #161616;
  --card:          #111111;
  --card-hover:    #171717;
  --border:        #1F1F1F;
  --border-strong: #303030;
  --ink:           #FFFFFF;
  --ink-2:         #D6D6D6;
  --muted:         #8A8A8A;
  --faint:         #5E5E5E;

  --accent:        #FFFFFF;
  --accent-text:   #0A0A0A;
  --accent-soft:   #1C1C1C;

  --link:          #6DA7EC;
  --blue:          #6DA7EC;
  --blue-soft:     #13233A;
  --green:         #3FBF3F;
  --green-soft:    #10240F;
  --amber:         #E0A82E;
  --amber-soft:    #2A2008;
  --red:           #E77168;
  --red-soft:      #2E1512;
  --slate:         #8A8A8A;
  --slate-soft:    #1C1C1C;

  --s1: #3987E5;  --s2: #C98500;  --s3: #D55181;
  --s4: #008300;  --s5: #E8E8E8;  --s6: #5E5E5E;

  --shadow:    0 1px 2px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.45);
  --shadow-lg: 0 10px 32px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--canvas); color: var(--ink);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  min-height: 100vh; padding-top: var(--hdr-h);
}
body.no-shell { padding-top: 0; }   /* login page */
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* ---------- FIXED HEADER ---------------------------------- */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.hdr-top {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .85rem 1.75rem; max-width: 2100px; margin: 0 auto;
}
.search-wrap { position: relative; width: 460px; flex-shrink: 0; }
.search-input {
  width: 100%; padding: 11px 16px 11px 42px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--canvas); color: var(--ink);
  font-family: inherit; font-size: 15px; transition: border-color .15s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus { outline: none; border-color: var(--link); }
.search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 15px; pointer-events: none;
}
.search-kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--faint); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; background: var(--card);
  font-weight: 600; pointer-events: none;
}
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: .85rem; flex-shrink: 0; }
.hdr-date { font-size: 15px; color: var(--muted); white-space: nowrap; font-weight: 500; }

.theme-switch {
  display: flex; gap: 2px; background: var(--canvas-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px;
}
.theme-switch button {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 6px 13px; border-radius: 999px; transition: all .15s;
}
.theme-switch button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- TILE NAV -------------------------------------- */
nav.tabs, nav.tiles {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px;
  background: var(--border); border-top: 1px solid var(--border);
  max-width: 2100px; margin: 0 auto;
}
nav.tabs a {
  background: var(--card); padding: .95rem .5rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: background .15s; position: relative; border: none;
}
nav.tabs a:hover { background: var(--card-hover); }
nav.tabs .t-icon { font-size: 20px; line-height: 1; }
nav.tabs .t-name {
  font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: .08em;
  color: var(--ink-2); text-align: center; line-height: 1.1;
}
nav.tabs a:hover .t-name { color: var(--ink); }
nav.tabs a.active { background: var(--accent-soft); }
nav.tabs a.active .t-name { color: var(--ink); }
nav.tabs a.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2.5px; background: var(--accent);
}
nav.tabs .t-count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- LAYOUT ---------------------------------------- */
main { max-width: 2100px; margin: 0 auto; padding: 1.5rem 1.75rem 3.5rem; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin: 2rem 0 1rem;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.section-header:first-child { margin-top: 0; }
.section-label {
  font-family: 'Bebas Neue', sans-serif; font-size: 14px;
  letter-spacing: .2em; color: var(--muted); text-transform: uppercase;
}
.section-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
/* Two filter groups side by side each start with an "All" pill. Without a rule
   between them the two All pills read as one row of eight. */
.section-tools > .filter-row + .filter-row {
  padding-left: .85rem; margin-left: .35rem; border-left: 1px solid var(--border);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: .7rem; min-height: 32px;
}

.page-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 42px;
  letter-spacing: .05em; line-height: 1.04; color: var(--ink);
}
.page-lede { font-size: 14px; color: var(--muted); margin-top: 4px; max-width: 74ch; }

/* ---------- BUTTONS --------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-sm); padding: 9px 16px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s; border: 1px solid transparent;
  white-space: nowrap; line-height: 1.2;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: var(--card); color: var(--ink-2); border-color: var(--border-strong); font-weight: 500; }
.btn-ghost:hover { background: var(--canvas-2); border-color: var(--muted); }
.btn-quiet { background: transparent; color: var(--muted); font-weight: 500; }
.btn-quiet:hover { background: var(--canvas-2); color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red); color: var(--card); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- FILTER PILLS + TOGGLE ------------------------- */
.filter-row { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-btn {
  background: var(--card); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 15px; font-size: 12.5px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.filter-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.filter-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.toggle {
  display: flex; gap: 2px; background: var(--canvas-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px;
}
.toggle button {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 6px 15px; border-radius: 999px; transition: all .15s;
}
.toggle button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- CARDS ----------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 1.35rem 1.5rem; }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.nav-card {
  display: flex; flex-direction: column; gap: 9px;
  padding: 1.5rem 1.4rem; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: all .18s; position: relative; box-shadow: var(--shadow);
}
.nav-card::after {
  content: '→'; position: absolute; right: 1.3rem; top: 1.4rem;
  color: var(--faint); font-size: 16px; transition: all .18s;
}
.nav-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.nav-card:hover::after { right: 1.05rem; color: var(--ink); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 21px;
  letter-spacing: .07em; color: var(--ink); line-height: 1.1;
}
.nav-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; max-width: 90%; }

/* ---------- DASHBOARD: three columns ---------------------- */
.home-grid {
  display: grid; grid-template-columns: 265px minmax(0,1fr) 450px;
  gap: 1.25rem; align-items: start;
}

.stage-stack { display: flex; flex-direction: column; gap: 10px; }
.stage-tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.05rem 1rem; display: flex; align-items: center; gap: 1rem;
  cursor: pointer; transition: all .15s; position: relative; overflow: hidden;
  text-align: left; font-family: inherit; width: 100%;
}
.stage-tile:hover { border-color: var(--border-strong); background: var(--card-hover); }
.stage-tile::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--tile-color);
}
.stage-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.stage-num {
  font-family: 'Bebas Neue', sans-serif; font-size: 46px; line-height: .82;
  color: var(--ink); min-width: 52px;
}
.stage-name {
  font-size: 13px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-2);
}
.stage-mw { font-size: 13px; color: var(--faint); margin-top: 1px; }
.stack-foot { font-size: 12.5px; color: var(--faint); margin-top: .7rem; line-height: 1.6; }

.map-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
/* Heights hang off the measured header so the map and the side column always
   end at the same place, whatever the header ends up being. */
#map { height: calc(100vh - var(--hdr-h) - 148px); min-height: 480px; }
.map-page #map { height: calc(100vh - var(--hdr-h) - 100px); min-height: 520px; }
:root[data-theme="dark"] .leaflet-tile {
  filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92);
}
.leaflet-container { background: var(--canvas-2); font-family: 'DM Sans', sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-tooltip {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.leaflet-tooltip::before { display: none; }
.leaflet-popup-tip { background: var(--card); }
.leaflet-bar a { background: var(--card); color: var(--ink); border-color: var(--border); }
.mk { background: none !important; border: none !important; }

.map-legend {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  padding: .65rem .85rem; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.leg-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 4px 11px 4px 8px; font-family: inherit; font-size: 12.5px;
  color: var(--muted); cursor: pointer; transition: all .14s;
}
.leg-btn:hover { background: var(--canvas-2); color: var(--ink); }
.leg-btn.on { background: var(--accent-soft); border-color: var(--border-strong); color: var(--ink); font-weight: 600; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.side-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  height: calc(100vh - var(--hdr-h) - 105px); min-height: 523px; overflow-y: auto;
}

/* ---------- KPI STRIP (project tracker) ------------------- */
.kpi-strip {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.kpi-card {
  background: var(--card); padding: 1.4rem 1.35rem;
  display: flex; flex-direction: column; gap: 4px; transition: background .15s;
}
.kpi-card.clickable { cursor: pointer; }
.kpi-card.clickable:hover { background: var(--card-hover); }
.kpi-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.kpi-value { font-family: 'Bebas Neue', sans-serif; font-size: 52px; line-height: 1; color: var(--ink); }
.kpi-desc { font-size: 12px; color: var(--faint); line-height: 1.45; }
.kpi-accent { height: 3px; border-radius: 2px; width: 28px; margin-bottom: 2px; }

/* ---------- BADGES ---------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 5px; white-space: nowrap;
}
.b-green  { background: var(--green-soft); color: var(--green); }
.b-blue   { background: var(--blue-soft);  color: var(--blue); }
.b-amber  { background: var(--amber-soft); color: var(--amber); }
.b-red    { background: var(--red-soft);   color: var(--red); }
.b-slate  { background: var(--slate-soft); color: var(--slate); }
.b-accent { background: var(--accent); color: var(--accent-text); }

/* Hashtags read as a solid ink block, inverted in dark. */
.hash {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent-text); background: var(--accent);
  border-radius: 4px; padding: 2.5px 8px; cursor: pointer;
}
.hash:hover { opacity: .82; }
.tag { font-size: 11px; color: var(--muted); background: var(--canvas-2); border-radius: 4px; padding: 2px 7px; }

/* ---------- TABLES ---------------------------------------- */
.table-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow);
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  font-family: 'Bebas Neue', sans-serif; font-size: 12.5px; font-weight: 400;
  letter-spacing: .13em; color: var(--muted); text-align: left;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: var(--canvas-2); position: sticky; top: 0; z-index: 2;
  white-space: nowrap; cursor: pointer; user-select: none;
}
table.data th:hover { color: var(--ink); }
table.data th .sort-arrow { color: var(--ink); margin-left: 3px; }
table.data td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  color: var(--ink-2); vertical-align: middle;
}
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--canvas-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.strong { color: var(--ink); font-weight: 600; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }

/* ---------- FORMS ----------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; font-family: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--link);
}
.field-row { display: grid; gap: .9rem; }
.hint { font-size: 11.5px; color: var(--faint); }

/* ---------- DRAWER ---------------------------------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(10,10,12,.42);
  backdrop-filter: blur(2px); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: clamp(560px, 50vw, 1150px); max-width: 94vw;
  background: var(--canvas); z-index: 201; box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .24s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--card);
}
.drawer-title { font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: .06em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.drawer-foot {
  display: flex; gap: .6rem; justify-content: flex-end;
  padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--card);
}
.icon-btn {
  background: transparent; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 4px 8px;
  border-radius: 6px; transition: all .15s;
}
.icon-btn:hover { background: var(--canvas-2); color: var(--ink); }

/* ---------- SEARCH RESULTS -------------------------------- */
.search-panel {
  position: fixed; top: calc(var(--hdr-h) - 8px); left: 1.75rem;
  width: min(700px, 92vw); max-height: 68vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 150; display: none; padding: .5rem;
}
.search-panel.open { display: block; }
.sr-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--faint); padding: 10px 12px 5px;
}
.sr-item { display: block; padding: 9px 12px; border-radius: var(--radius-sm); transition: background .12s; cursor: pointer; }
.sr-item:hover, .sr-item.cursor { background: var(--canvas-2); }
.sr-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.sr-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.sr-snip {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
mark { background: var(--accent); color: var(--accent-text); border-radius: 2px; padding: 0 2px; }

/* ---------- NOTES ----------------------------------------- */
.note-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow); transition: all .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.note-card:hover { border-color: var(--border-strong); }
.note-card.pinned { border-left: 3px solid var(--accent); }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.note-title { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.note-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--faint); }
.note-body { font-size: 13px; color: var(--ink-2); line-height: 1.65; white-space: pre-wrap; }
.note-body.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.note-tags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- TO-DO ROWS ------------------------------------ */
.todo-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 14px; border-bottom: 1px solid var(--border); transition: background .12s;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--card-hover); }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--faint); }
.todo-check {
  width: 17px; height: 17px; border: 1.5px solid var(--border-strong);
  border-radius: 5px; cursor: pointer; flex-shrink: 0; margin-top: 2px;
  background: var(--card); transition: all .15s;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent;
}
.todo-check:hover { border-color: var(--accent); }
.todo-check.checked { background: var(--green); border-color: var(--green); color: #fff; }
.todo-main { flex: 1; min-width: 0; }
.todo-title { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.todo-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 11.5px; color: var(--faint); }
.due-over { color: var(--red); font-weight: 700; }
.due-soon { color: var(--amber); font-weight: 700; }

/* ---------- ATTACHMENTS ----------------------------------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--canvas-2); padding: 1.4rem 1rem; text-align: center;
  cursor: pointer; transition: all .15s; position: relative;
}
.dropzone:hover, .dropzone.over { border-color: var(--link); background: var(--card-hover); }
.dropzone.over { border-style: solid; }
.dropzone.busy { pointer-events: none; opacity: .6; }
.dropzone-inner { display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 13px; color: var(--muted); }
.dropzone-icon { font-size: 20px; color: var(--faint); line-height: 1; }
.dropzone-progress { font-size: 12.5px; color: var(--link); font-weight: 600; margin-top: 6px; }

.file-list { display: flex; flex-direction: column; margin-top: .75rem; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: background .12s;
}
.file-row:last-of-type { border-bottom: none; }
.file-row:hover { background: var(--canvas-2); }
.file-icon { font-size: 17px; line-height: 1; flex-shrink: 0; }
.file-main { flex: 1; min-width: 0; }
.file-name { font-size: 13.5px; font-weight: 500; color: var(--ink); word-break: break-word; display: block; }
.file-name:hover { color: var(--link); text-decoration: underline; }
.file-meta { font-size: 11.5px; color: var(--faint); margin-top: 1px; }

/* ---------- TAG CLOUD ------------------------------------- */
.cloud { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.cloud-tag {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 13px; cursor: pointer;
  font-family: inherit; color: var(--ink-2); transition: all .15s;
}
.cloud-tag:hover { border-color: var(--border-strong); color: var(--ink); }
.cloud-tag.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.cloud-tag .n { font-size: 10.5px; opacity: .6; font-variant-numeric: tabular-nums; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; max-height: 132px; overflow-y: auto; }
.tag-pick {
  font-size: 11.5px; background: var(--canvas-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; color: var(--muted);
  font-family: inherit; transition: all .12s;
}
.tag-pick:hover { border-color: var(--border-strong); color: var(--ink); }
.tag-pick.used { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- LINK CARDS ------------------------------------ */
.link-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.05rem 1.15rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 7px; position: relative; transition: all .16s;
}
.link-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.link-card.pinned { border-left: 3px solid var(--accent); }
.link-title { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.link-title a:hover { color: var(--link); }
.link-host { font-size: 11.5px; color: var(--faint); word-break: break-all; }
.link-desc {
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.link-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.link-card:hover .link-tools { opacity: 1; }

/* ---------- LOGIN ----------------------------------------- */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.login { width: 100%; max-width: 390px; }
.login-brand { text-align: center; margin-bottom: 1.75rem; }
.login-mark { font-family: 'Bebas Neue', sans-serif; font-size: 46px; letter-spacing: .18em; color: var(--ink); line-height: 1; }
.login-sub { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-top: 2px; }
.login-card { padding: 1.75rem 1.6rem; }
.login-card .field input { text-align: center; letter-spacing: .08em; padding: 11px; }
.err { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12.5px; margin-top: .9rem; display: none; }
.err.show { display: block; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 1.1rem; }

/* ---------- MISC ------------------------------------------ */
.empty {
  text-align: center; padding: 3.5rem 1.5rem; color: var(--faint);
  background: var(--card); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty-icon { font-size: 30px; margin-bottom: 10px; opacity: .5; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(160%);
  background: var(--accent); color: var(--accent-text);
  padding: 11px 22px; border-radius: 999px; font-size: 13px; font-weight: 600;
  z-index: 300; transition: transform .25s cubic-bezier(.4,0,.2,1); box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }

.spinner {
  width: 26px; height: 26px; border: 2px solid var(--border);
  border-top-color: var(--ink); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 3rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ---------- RESPONSIVE ------------------------------------ */
@media (max-width: 1560px) {
  .home-grid { grid-template-columns: 240px minmax(0,1fr) 390px; }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1280px) {
  .home-grid { grid-template-columns: 1fr; }
  .side-card { height: auto; max-height: 620px; }
  #map { height: 520px; }
  nav.tabs { grid-template-columns: repeat(4, 1fr); }
  :root { --hdr-h: 240px; }
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .search-wrap { width: 340px; }
}
@media (max-width: 820px) {
  :root { --hdr-h: 300px; }
  main { padding: 1.25rem 1rem 4rem; }
  .hdr-top { padding: .7rem 1rem; flex-wrap: wrap; gap: .75rem; }
  .search-wrap { width: 100%; order: 3; }
  .hdr-right { margin-left: 0; width: 100%; justify-content: space-between; }
  nav.tabs { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 32px; }
  .search-panel { left: 1rem; right: 1rem; width: auto; }
  .search-kbd { display: none; }
}

@media print {
  header, nav.tabs, .section-tools, .btn, .toggle { display: none !important; }
  body { padding-top: 0; background: #fff; }
  .card, .table-wrap, .note-card { box-shadow: none; }
}
