/* CF Money — violet theme (v12), light/dark via [data-theme] on <html>.
   Chart + status colors validated with the dataviz palette checker on both
   surfaces; --c-* are the chart mark colors, --pos/--neg are text/status. */
:root {
  /* Frost · Lavender (v31, 13. 9. 2026) — dark. Same variable names as before;
     glass surfaces are translucent whites over a violet field. */
  --page:       #1e1940;
  --page-grad:  linear-gradient(160deg, #181433 0%, #221c48 48%, #2a2352 100%);
  --page-top:   #181433;
  --surface:    rgba(255, 255, 255, 0.07);
  --surface-2:  rgba(255, 255, 255, 0.10);
  --focus-bg:   rgba(255, 255, 255, 0.105);
  --field-bg:   rgba(0, 0, 0, 0.22);
  --ink:        #f2eeff;
  --ink-2:      #cfc7ea;
  --muted:      #a59dcc;
  --grid:       rgba(255, 255, 255, 0.10);
  --border:     rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --ink-a06:    rgba(255, 255, 255, 0.07);
  --ink-a10:    rgba(255, 255, 255, 0.12);
  --av-ring:    rgba(20, 14, 50, 0.7);
  --accent:     #b8a4ff;
  --accent-2:   #a48dff;
  --accent-ink: #1e1a3a;
  --accent-soft: rgba(184, 164, 255, 0.22);
  --sec-grad:   linear-gradient(135deg, #2f2866, #3d3480);
  --sec-ink:    #e6e0ff;
  --sec-soft:   rgba(201, 188, 255, 0.16);
  --sec-text:   #c9bcff;
  --tile-sp:    linear-gradient(135deg, #4a3aa6, #6252c8);
  --pos:        #7fe0a5;
  --neg:        #ff8fa9;
  --warn:       #ffcf7a;
  --danger:     #e5484d;
  --c-violet:   #b8a4ff;
  --c-green:    #3fbf7f;
  --c-red:      #ff7a93;
  --c-blue:     #7fb2ff;
  --c-gray:     #a59dcc;
  --c-pink:     #f08ac0;
  --serif:      "Cormorant", Georgia, "Times New Roman", serif;
  --blue-soft:  rgba(127, 178, 255, 0.16);
  --green-soft: rgba(127, 224, 165, 0.16);
  --amber-soft: rgba(255, 207, 122, 0.16);
  --chip-sp-ink: #c9bcff; --chip-sp-bg: rgba(184, 164, 255, 0.18);
  --chip-os-ink: #e6e0ff; --chip-os-bg: rgba(61, 52, 128, 0.6);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.30);
  --shadow-pop:  0 18px 44px rgba(0, 0, 0, 0.45);
  --glass-blur:  blur(18px) saturate(140%);
  --gtext:      #f2eeff;
  --gsub:       #a59dcc;
  --plank-bg:   rgba(255, 255, 255, 0.10);
  --plank-solid: #2a2254;
  --plank-border: rgba(255, 255, 255, 0.16);
  --plank-ink:  rgba(255, 255, 255, 0.8);
  --plank-active: rgba(255, 255, 255, 0.18);
  --plank-add:  #f2eeff;
  --plank-add-ink: #3b2a8f;
  --radius:     20px;      /* cards, boxes */
  --radius-sm:  12px;      /* inputs */
  /* motion tokens (v30, apple-design audit 12. 9. 2026) */
  --ease-out:   cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press:  120ms;   /* press feedback */
  --dur-fast:   150ms;   /* hover colour, small state */
  --dur-pop:    160ms;   /* menus, popovers */
  --dur-modal:  220ms;   /* dialog enter (exit 160ms) */
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* Frost · Lavender — light (the primary look): violet-to-lilac field, 62 % white glass. */
  --page:       #e6e0fa;
  --page-grad:  linear-gradient(160deg, #8b7cf2 0%, #b1a4f3 46%, #ded6f6 100%);
  --page-top:   #8b7cf2;
  --surface:    rgba(255, 255, 255, 0.62);
  --surface-2:  rgba(255, 255, 255, 0.55);
  --focus-bg:   rgba(255, 255, 255, 0.74);
  --field-bg:   rgba(255, 255, 255, 0.72);
  --ink:        #1e1a3a;
  --ink-2:      #3f3860;
  --muted:      #6c6592;
  --grid:       rgba(30, 26, 58, 0.10);
  --border:     rgba(255, 255, 255, 0.72);
  --border-strong: rgba(30, 26, 58, 0.14);
  --ink-a06:    rgba(30, 26, 58, 0.06);
  --ink-a10:    rgba(30, 26, 58, 0.10);
  --av-ring:    rgba(255, 255, 255, 0.85);
  --accent:     #5b3df5;
  --accent-2:   #4a2fe0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 61, 245, 0.16);
  --sec-grad:   linear-gradient(135deg, #cdc2ff, #e9e3ff);
  --sec-ink:    #2a1d6e;
  --sec-soft:   rgba(91, 61, 245, 0.14);
  --sec-text:   #5b3df5;
  --tile-sp:    linear-gradient(135deg, #7a60f0, #a48dff);
  --pos:        #1d7d4a;
  --neg:        #c3274f;
  --warn:       #a35d00;
  --danger:     #c3274f;
  --c-violet:   #5b3df5;
  --c-green:    #16a34a;
  --c-red:      #dc2626;
  --c-blue:     #2563eb;
  --c-gray:     #6c6592;
  --c-pink:     #d6529a;
  --serif:      "Cormorant", Georgia, "Times New Roman", serif;
  --blue-soft:  rgba(37, 99, 235, 0.12);
  --green-soft: rgba(29, 125, 74, 0.13);
  --amber-soft: rgba(163, 93, 0, 0.13);
  --chip-sp-ink: #5b3df5; --chip-sp-bg: rgba(91, 61, 245, 0.14);
  --chip-os-ink: #2a1d6e; --chip-os-bg: rgba(205, 194, 255, 0.75);
  --shadow-card: 0 10px 30px rgba(60, 40, 140, 0.12);
  --shadow-pop:  0 18px 44px rgba(40, 20, 100, 0.28);
  --glass-blur:  blur(18px) saturate(160%);
  --gtext:      #ffffff;
  --gsub:       rgba(255, 255, 255, 0.86);
  --plank-bg:   rgba(30, 22, 64, 0.62);
  --plank-solid: #2a2260;
  --plank-border: rgba(255, 255, 255, 0.18);
  --plank-ink:  rgba(255, 255, 255, 0.78);
  --plank-active: rgba(255, 255, 255, 0.22);
  --plank-add:  #ffffff;
  --plank-add-ink: #5b3df5;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink-2);
  font: 14px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { color: var(--ink); font-size: 22px; font-weight: 700; letter-spacing: -0.03em; margin: 12px 0 10px; }
h2 { color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 10px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; }

/* Room at the bottom for the floating nav plank. */
main { max-width: 1280px; margin: 0 auto; padding: 6px 18px 130px; position: relative; }
body.bare main { padding: 2px 16px 20px; max-width: none; }
.foot { display: none; }

/* --- brand (login page) + date on the heading row ------------------------ */
.brand { font-weight: 700; color: var(--ink); font-size: 15px; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.brand.big { font-size: 26px; display: block; text-align: center; margin-bottom: 14px; }
.pagedate { position: absolute; top: 22px; right: 18px; color: var(--muted); font-size: 12px; }

/* --- floating bottom nav plank ------------------------------------------ */
.plank {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 4px; padding: 8px;
  background: var(--plank-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--shadow-pop);
}
.pl-item {
  position: relative; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  color: var(--ink-2); background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: none !important;
}
.pl-item svg { width: 20px; height: 20px; display: block; }
.pl-item:hover { background: var(--surface-2); color: var(--ink); }
.pl-item.active { background: var(--surface-2); color: var(--ink); }
.pl-item.pl-add { background: var(--accent); color: #fff; }
.pl-item.pl-add:hover { background: var(--accent-2); }
/* hover label above the plank */
.pl-item::after {
  content: attr(data-label);
  position: absolute; bottom: calc(100% + 14px); left: 50%;
  transform: translateX(-50%) translateY(3px);
  font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border-strong);
  padding: 3px 10px; border-radius: 8px; box-shadow: var(--shadow-card);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.pl-item:focus-visible::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.pl-badge {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 10px; line-height: 16px; font-weight: 700; text-align: center;
  padding: 0 4px; letter-spacing: 0;
}

/* up-opening menus in the plank (Reports, Settings) */
details.plankdrop { position: relative; }
details.plankdrop summary { list-style: none; }
details.plankdrop summary::-webkit-details-marker { display: none; }
details.plankdrop[open] summary::after { display: none; }   /* hide hover label behind the menu */
details.plankdrop[open] summary.pl-item { background: var(--surface-2); color: var(--ink); }
.plankdrop-menu {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  min-width: 172px; z-index: 45;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 6px; box-shadow: var(--shadow-pop);
}
.plankdrop-menu a, .plankdrop-menu button {
  display: flex; align-items: center; gap: 9px;
  color: var(--ink-2); background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; text-align: left; white-space: nowrap;
  padding: 8px 12px; border-radius: 9px; text-decoration: none !important;
}
.plankdrop-menu a svg, .plankdrop-menu button svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }
.plankdrop-menu a:hover, .plankdrop-menu button:hover { background: var(--surface-2); color: var(--ink); }
.plankdrop-menu a.active { background: var(--accent-soft); color: var(--accent); }
/* theme-dependent labels (settings menu) */
:root[data-theme="light"] .only-dark { display: none; }
:root:not([data-theme="light"]) .only-light { display: none; }

/* Phones: lift the plank clear of the gesture bar (safe-area) and avoid the
   iOS Safari repaint lag on fixed elements — no backdrop blur, no transform
   centering (auto margins instead), solid theme surface. */
@media (max-width: 760px) {
  .plank {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0; transform: none; margin: 0 auto; width: max-content;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    background: var(--surface);
  }
}
@media (max-width: 560px) {
  .plank { gap: 2px; padding: 6px; border-radius: 16px; max-width: calc(100vw - 12px); }
  .pl-item { width: 36px; height: 36px; border-radius: 11px; }
  .pl-item svg { width: 19px; height: 19px; }
}

.badge {
  background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px;
  padding: 0 6px; margin-left: 5px; font-weight: 600;
}

/* --- flash -------------------------------------------------------------- */
.flash {
  max-width: 1280px; margin: 10px auto 0; padding: 10px 16px; border-radius: var(--radius); font-size: 13px;
}
.flash.ok   { background: rgba(34, 197, 94, 0.10);  color: var(--pos); border: 1px solid rgba(34, 197, 94, 0.30); }
.flash.err  { background: rgba(220, 80, 80, 0.10);  color: var(--neg); border: 1px solid rgba(220, 80, 80, 0.30); }
.flash.warn { background: rgba(217, 119, 6, 0.10);  color: var(--warn); border: 1px solid rgba(217, 119, 6, 0.30); }

/* --- cards / stats ------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin: 14px 0;
  box-shadow: var(--shadow-card);
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 14px 0; }
.cards .card { margin: 0; }
.stat .stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; letter-spacing: -0.01em; }
.stat .stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.04em; color: var(--ink); margin: 6px 0 3px; }
.stat .stat-value .amt { color: inherit; }   /* big stat numbers stay ink; green is for small deltas */
.stat .stat-value .amt.neg { color: var(--neg); }
.stat .stat-value .cur { color: var(--muted); font-size: 0.62em; font-weight: 500; }
.stat .stat-value.small-value { font-size: 16px; }
.stat.attention { border-color: var(--warn); }
.statfoot { display: flex; gap: 6px; margin-top: 10px; align-items: center; }

/* account stat cards — tinted in the account hue (violet = SP, green = OS) */
.card.stat.acct-sp {
  background: linear-gradient(135deg, rgba(140, 92, 255, 0.22), rgba(140, 92, 255, 0.06));
  border-color: rgba(140, 92, 255, 0.38);
}
.card.stat.acct-sp .stat-label { color: var(--chip-sp-ink); }
.card.stat.acct-os {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.16), rgba(74, 222, 128, 0.05));
  border-color: rgba(74, 222, 128, 0.32);
}
.card.stat.acct-os .stat-label { color: var(--chip-os-ink); }
:root[data-theme="light"] .card.stat.acct-sp {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.10), rgba(124, 58, 237, 0.02));
  border-color: rgba(124, 58, 237, 0.28);
}
:root[data-theme="light"] .card.stat.acct-os {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.09), rgba(22, 163, 74, 0.02));
  border-color: rgba(22, 163, 74, 0.26);
}

/* generic stat-card tints (member portal) — same recipe, theme semantics:
   violet = company/business, green = money in, red = money out, blue = tax */
.card.stat.t-violet {
  background: linear-gradient(135deg, rgba(140, 92, 255, 0.22), rgba(140, 92, 255, 0.06));
  border-color: rgba(140, 92, 255, 0.38);
}
.card.stat.t-violet .stat-label { color: var(--chip-sp-ink); }
.card.stat.t-green {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.16), rgba(74, 222, 128, 0.05));
  border-color: rgba(74, 222, 128, 0.32);
}
.card.stat.t-green .stat-label { color: var(--chip-os-ink); }
.card.stat.t-red {
  background: linear-gradient(135deg, rgba(223, 102, 102, 0.18), rgba(223, 102, 102, 0.05));
  border-color: rgba(223, 102, 102, 0.34);
}
.card.stat.t-red .stat-label { color: var(--neg); }
.card.stat.t-blue {
  background: linear-gradient(135deg, rgba(89, 147, 244, 0.18), rgba(89, 147, 244, 0.05));
  border-color: rgba(89, 147, 244, 0.34);
}
.card.stat.t-blue .stat-label { color: var(--c-blue); }
:root[data-theme="light"] .card.stat.t-violet {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.10), rgba(124, 58, 237, 0.02));
  border-color: rgba(124, 58, 237, 0.28);
}
:root[data-theme="light"] .card.stat.t-green {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.09), rgba(22, 163, 74, 0.02));
  border-color: rgba(22, 163, 74, 0.26);
}
:root[data-theme="light"] .card.stat.t-red {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(220, 38, 38, 0.02));
  border-color: rgba(220, 38, 38, 0.24);
}
:root[data-theme="light"] .card.stat.t-blue {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
  border-color: rgba(37, 99, 235, 0.24);
}

/* pot sparkline strip at the bottom of a stat card */
.sparkbox { position: relative; height: 38px; margin-top: 8px; }

/* --- dashboard grid (sketch layout) --------------------------------------
   Recents is a full-height right column; the left side stacks stats, a short
   chart, then the three small boxes. Six 1fr tracks let row 1 split in halves
   and row 3 in thirds. */
.dashgrid {
  display: grid; gap: 14px; margin: 14px 0 0;
  grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(300px, 3.3fr);
  /* row 2 is flexible: the chart absorbs whatever height is left over */
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "total total total profit profit profit recent"
    "chart chart chart chart  chart  chart  recent"
    "sp    sp    os    os     pots   pots   recent";
}
.dashgrid .card { margin: 0; }
.a-total  { grid-area: total; }
.a-profit { grid-area: profit; }
.a-recent { grid-area: recent; display: flex; flex-direction: column; min-height: 0; }
.a-chart  { grid-area: chart; display: flex; flex-direction: column; }
.a-chart .chartbox { flex: 1; height: auto; min-height: 150px; }
.a-sp     { grid-area: sp; }
.a-os     { grid-area: os; }
.a-pots   { grid-area: pots; }

/* Dashboard fits the viewport above the plank — no page scroll on desktop;
   the recents list scrolls inside its card instead. */
@media (min-width: 1021px) and (min-height: 540px) {
  body.fit { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  body.fit main { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-bottom: 92px; }
  body.fit .dashgrid { flex: 1; min-height: 0; }
  /* no scrollbar: clip the list and let JS hide rows that don't fully fit */
  body.fit .a-recent .txlist { flex: 1; min-height: 0; overflow: hidden; }
}

@media (max-width: 1020px) {
  .dashgrid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "total profit" "chart chart" "sp os" "recent recent" "pots pots";
  }
  .a-chart .chartbox { min-height: 220px; }
}
@media (max-width: 640px) {
  .dashgrid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "total" "profit" "chart" "sp" "os" "recent" "pots";
  }
}

/* transaction list (dashboard recents) */
.txlist { list-style: none; margin: 4px 0 0; padding: 0; }
.txlist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.txlist li:last-child { border-bottom: 0; }
.tx-main { min-width: 0; flex: 1; }
.tx-desc { display: block; color: var(--ink); font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11.5px; margin-top: 2px; min-width: 0; }
.tx-meta .cat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.tx-right .amt { font-size: 13.5px; white-space: nowrap; }
.txlist .amt.neg { color: var(--ink); }   /* calm list: red reserved */

/* pot list (dashboard reserves card) */
.potlist { list-style: none; margin: 4px 0 0; padding: 0; }
.potlist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.potlist li:last-child { border-bottom: 0; }
.pot-name { flex: 1; min-width: 0; }
.pot-name a { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.pot-spark { position: relative; width: 76px; height: 26px; flex: 0 0 auto; }
.pot-bal { font-size: 13.5px; white-space: nowrap; color: var(--ink); font-variant-numeric: tabular-nums; }

/* --- tables --------------------------------------------------------------- */
.tablewrap {
  overflow-x: auto; margin: 14px 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 10px 8px;
  box-shadow: var(--shadow-card);
}
.card .tablewrap { background: none; border: 0; padding: 0; margin: 6px 0 0; border-radius: 0; box-shadow: none; }
table.data { border-collapse: collapse; width: 100%; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.data thead th {
  color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--surface);
}
/* Sticky column headers on desktop (no topbar anymore → stick to the viewport). */
@media (min-width: 1100px) {
  .tablewrap { overflow-x: visible; }
  table.data thead th {
    position: sticky; top: 0; z-index: 5;
    box-shadow: 0 1px 0 var(--grid);
  }
}
table.data thead th a { color: var(--muted); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td { color: var(--ink); font-weight: 600; border-top: 2px solid var(--border-strong); border-bottom: 0; }
table.data.compact th, table.data.compact td { padding: 6px 8px; font-size: 13px; }
tr.grouphead td { background: var(--surface-2); color: var(--ink); font-weight: 600; }
tr.grouphead td:first-child { border-radius: 10px 0 0 10px; }
tr.grouphead td:last-child { border-radius: 0 10px 10px 0; }
tr.subtotal td { color: var(--ink-2); font-weight: 600; background: var(--accent-soft); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center !important; }
.nowrap { white-space: nowrap; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 12px; margin-top: 1px; }

.amt { font-variant-numeric: tabular-nums; }
.amt.pos { color: var(--pos); }
.amt.neg { color: var(--neg); }
.amt.zero { color: var(--muted); }
/* Calm ledger: in table bodies expenses stay in plain ink — green is reserved
   for money in; red keeps meaning (negative balances, totals, review, danger). */
table.data tbody .amt.neg { color: var(--ink); }
/* …but a genuinely negative bottom line (e.g. a month's net) stays red. */
table.data tbody td.netcol .amt.neg { color: var(--neg); }

/* Mobile transaction lists: tables marked .mstack restack each row into a
   two-line card (desc + amount / date + meta + action) so nothing scrolls
   sideways. Cells opt into slots via c-* classes; c-hide drops a column. */
@media (max-width: 760px) {
  table.mstack, table.mstack tbody, table.mstack tfoot { display: block; }
  table.mstack thead { display: none; }
  table.mstack tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "desc desc amt" "date meta act" "full full full";
    gap: 3px 10px; padding: 10px 2px;
    border-bottom: 1px solid var(--grid);
    align-items: center;
  }
  table.mstack tbody tr:last-child { border-bottom: 0; }
  table.mstack tbody td { display: block; border: 0; padding: 0; }
  table.mstack td.c-date { grid-area: date; color: var(--muted); font-size: 12px; white-space: nowrap; }
  table.mstack td.c-desc { grid-area: desc; }
  table.mstack td.c-amt  { grid-area: amt; text-align: right; white-space: nowrap; align-self: start; }
  table.mstack td.c-meta { grid-area: meta; font-size: 12px; }
  /* Second meta cell for rows with no action button (member lists): takes the
     free act slot instead of colliding with c-meta in the same grid area. */
  table.mstack td.c-meta2 { grid-area: act; font-size: 12px; text-align: right; color: var(--muted); }
  table.mstack td.c-act  { grid-area: act; text-align: right; }
  table.mstack td.c-full { grid-area: full; }
  table.mstack td.c-hide { display: none; }
  table.mstack td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font-size: 11px; }
  table.mstack tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 2px 2px; border-top: 2px solid var(--border-strong); }
  table.mstack tfoot td { display: block; border: 0; padding: 0; }
}

.tag {
  display: inline-block; font-size: 10.5px; border: 1px solid var(--border-strong); color: var(--ink-2);
  border-radius: 999px; padding: 0 8px; margin-left: 5px; vertical-align: 1px; white-space: nowrap;
  letter-spacing: 0;
}
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.nives { border-color: #ec7fb2; color: #ec7fb2; }        /* full amount is hers — pink */
.tag.nives-shared { border-color: #c25b8c; color: #d183ab; } /* shared amount — magenta */
.tag.tax { border-color: var(--c-blue); color: var(--c-blue); }  /* waiting on tax-model confirmation */
.tag.split { border-color: var(--accent); color: var(--accent); } /* has split subitems */
.tag.ddv { border-color: var(--c-green); color: var(--c-green); }  /* company invoice — VAT back from FURS */
:root[data-theme="light"] .tag.nives { border-color: #db2777; color: #db2777; }
:root[data-theme="light"] .tag.nives-shared { border-color: #be185d; color: #be185d; }

/* Split subitems shown under a ledger row */
details.subs { margin-top: 3px; }
details.subs summary { cursor: pointer; font-size: 11.5px; color: var(--muted); list-style: none; display: inline-block; }
details.subs summary::-webkit-details-marker { display: none; }
details.subs summary::before { content: "▸ "; }
details.subs[open] summary::before { content: "▾ "; }
details.subs ul { list-style: none; margin: 4px 0 2px; padding: 0; max-width: 460px; }
details.subs li { display: flex; align-items: center; font-size: 12px; color: var(--ink-2); padding: 1px 0; }
details.subs li .subs-amt { margin-left: auto; padding-left: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* account chips — same hues as the chart lines (violet = SP, green = OS) */
.chip {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  border-radius: 999px; padding: 1px 8px; letter-spacing: 0.3px;
}
.chip.sp { color: var(--chip-sp-ink); background: var(--chip-sp-bg); }
.chip.os { color: var(--chip-os-ink); background: var(--chip-os-bg); }
.chip.tab { color: var(--warn); background: var(--amber-soft); }

/* pot effects */
.up { color: var(--pos); }
.dn { color: var(--neg); }

/* category kind dots */
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px; background: var(--muted);
}
.dot.income { background: var(--pos); }
.dot.expense { background: var(--neg); }
.dot.transfer { background: var(--muted); }
.dot.neutral { background: var(--warn); }

/* --- forms ---------------------------------------------------------------- */
input, select, textarea, button { font: inherit; letter-spacing: inherit; }
input[type="text"], input[type="password"], input[type="date"], input[type="search"],
input[type="number"], input[type="email"], input[type="datetime-local"], select, textarea {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 11px; width: 100%;
  min-width: 0;   /* let controls shrink inside grid/flex tracks (native date inputs otherwise overflow on mobile) */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
/* Native <input type=date> on mobile: min-width:0 (above) lets it shrink;
   left-align the value and pin the picker icon right. No -webkit-appearance
   reset — that would drop the calendar icon on desktop. */
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { margin-left: auto; opacity: 0.65; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 3px; }
label.check { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 13px; }
label.check input { width: auto; margin: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
textarea { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; border-radius: var(--radius-sm); }

/* Compact auto-fit grid: as many ~180px fields per row as fit → no scrolling. */
.form .formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2px 16px; }
.form .formgrid > * { min-width: 0; }   /* tracks must be allowed to shrink or a native date input overflows them */
.form .span-all { grid-column: 1 / -1; }
.form .checks { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 4px 0 2px; }
.form.narrow { max-width: 460px; }
.formfoot { margin-top: 12px; display: flex; gap: 8px; }

/* Edit form: sticky top-right action bar (Save / Delete / Cancel). */
.form-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 2px 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}
.form-topbar h1 { margin: 0; }
.form-actions { display: flex; gap: 8px; flex: 0 0 auto; }
body.bare .form-topbar { position: sticky; top: 0; z-index: 8; background: var(--page); }

/* Split-into-subitems editor */
.split { margin-top: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px 14px; }
.split-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.split-head h2 { margin: 0; }
.split-remainder { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-remainder.over { color: var(--neg); }
.split-row { display: grid; grid-template-columns: 1fr 170px 120px auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.split-row input, .split-row select { margin-top: 0; }
#split-rows:empty { display: none; }
.sub-del {
  background: none; border: 1px solid var(--border-strong); color: var(--muted);
  border-radius: 999px; width: 28px; height: 28px; cursor: pointer; font-size: 12px; line-height: 1;
}
.sub-del:hover { color: var(--neg); border-color: var(--neg); }
@media (max-width: 620px) {
  .split-row { grid-template-columns: 1fr 92px auto; }
  .split-row select { grid-column: 1 / -1; }
}

/* Payment schedule editor (project form): label · amount · due · status · del */
.pay-row { display: grid; grid-template-columns: 1fr 110px 150px 120px auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.pay-row input, .pay-row select { margin-top: 0; }
#pay-rows:empty { display: none; }
@media (max-width: 620px) {
  .pay-row { grid-template-columns: 1fr 92px auto; }
  .pay-row input[type="date"], .pay-row select { grid-column: 1 / -1; }
}

/* Projection progress bar (By project) */
.progcell { min-width: 120px; }
.progress { height: 8px; border-radius: 999px; background: var(--border-strong); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0;
  box-shadow: var(--shadow-card);
}
.filters input, .filters select { width: auto; min-width: 110px; }
.filters input[type="search"] { flex: 1; min-width: 180px; }

.rowform { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rowform select { width: auto; max-width: 170px; }
.inline, .inline-form { display: inline; }

/* --- buttons (pills) ----------------------------------------------------------- */
.btn {
  display: inline-block; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 7px 16px;
  cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: none !important;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: none; color: var(--neg); border-color: var(--neg); }
.btn.danger:hover { background: rgba(220, 80, 80, 0.12); }
.btn.ghost { background: none; color: var(--ink-2); }
.btn.tiny { padding: 2px 10px; font-size: 11.5px; }
.btn.wide { width: 100%; }

/* --- tabs / layout ------------------------------------------------------------ */
.tabs { display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid var(--border); margin: 14px 0; padding-bottom: 10px; }
.tabs a { color: var(--ink-2); padding: 5px 13px; border-radius: 999px; font-size: 13px; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.active { background: var(--accent); color: #fff; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
}
.hidden { display: none !important; }

/* --- charts --------------------------------------------------------------------- */
.chartbox { position: relative; height: 260px; }
.chartbox.tall { height: 320px; }

/* --- edit popup --------------------------------------------------------------------- */
body.bare { background: var(--page); }
body.bare h1 { font-size: 17px; margin: 10px 0 8px; }
dialog.edit-modal {
  width: min(880px, 94vw); height: auto; max-height: min(88vh, 860px);
  padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--page); overflow: hidden; color: var(--ink-2);
}
dialog.edit-modal[open] { display: flex; flex-direction: column; }
dialog.edit-modal::backdrop { background: rgba(0, 0, 0, 0.62); }
/* enter/exit (v30): scale 0.97->1 + fade, scrim fades with it; exit is faster
   than enter (asymmetric: the system's response snaps). modal.js waits for
   the exit transition before removing the node. */
dialog.edit-modal {
  opacity: 0; transform: scale(0.97);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out),
              display 160ms allow-discrete, overlay 160ms allow-discrete;
}
dialog.edit-modal[open] {
  opacity: 1; transform: scale(1);
  transition-duration: var(--dur-modal);
}
@starting-style { dialog.edit-modal[open] { opacity: 0; transform: scale(0.97); } }
dialog.edit-modal::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background-color 160ms ease, display 160ms allow-discrete, overlay 160ms allow-discrete;
}
dialog.edit-modal[open]::backdrop { background: rgba(0, 0, 0, 0.62); transition-duration: var(--dur-modal); }
@starting-style { dialog.edit-modal[open]::backdrop { background: rgba(0, 0, 0, 0); } }
.edit-modal-close {
  align-self: flex-end; margin: 8px 10px 0 0; flex: 0 0 auto;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 13px;
}
.edit-modal-close:hover { color: var(--ink); border-color: var(--muted); }
/* Height starts as a sensible default and is set precisely from the iframe's
   reported content height (modal.js) so the popup wraps its content with no
   empty space; tall forms cap at the dialog max-height and scroll inside. */
dialog.edit-modal iframe { width: 100%; border: 0; height: 600px; }

/* --- member portal ---------------------------------------------------------------- */
.projcards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.projcards .card h2 { margin: 0; font-size: 16px; }
.kv {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.kv:last-of-type { border-bottom: 0; }
.kv > span:first-child { color: var(--muted); font-size: 12.5px; font-weight: 500; }
/* per-person earnings block on each project card (member portal) */
.earnrows { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.earnrows .kv { border-bottom: 0; padding: 3px 0; }
.earnrows .kv > span:first-child { color: var(--accent); font-weight: 600; }
.earnrows .amt { font-weight: 700; }
/* projected "→ €X" hint after the realized amount */
.proj-earn { color: var(--muted); font-weight: 500; margin-left: 2px; }
.proj-earn .amt { color: var(--muted); font-weight: 500; }
.proj-earn .cur { color: inherit; }
/* projected total under a stat-card value */
.stat-proj { margin-top: 3px; font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-proj .amt { color: var(--muted); font-weight: 600; }
.stat-proj .cur { color: inherit; }
.stat-proj .lbl { font-weight: 500; opacity: 0.85; }
.btn.proj-open { margin-top: 10px; align-self: flex-start; }

/* --- login ------------------------------------------------------------------------ */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
body.login-body main { padding: 0; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 30px; width: 330px; box-shadow: var(--shadow-pop);
}
.login-card .flash { margin: 0 0 12px; }

/* ==================================================================================
   CF Hub suite (v24): shared avatars · Home · Tasks · Calendar · popover
   ================================================================================== */

/* --- avatars (Jernej violet / Nives pink / David blue) ---------------------------- */
.av {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 10.5px; font-weight: 700; color: #fff;
  border: 2px solid var(--surface);
  vertical-align: middle; letter-spacing: 0;
}
.av.av-j { background: var(--accent); }
.av.av-n { background: var(--c-pink); }
.av.av-d { background: var(--c-blue); }
.who { display: inline-flex; align-items: center; }
.who .av { margin-left: -6px; }
.who .av:first-child { margin-left: 0; }

/* shared project tag pill (tasks / calendar / home) */
.ptag {
  display: inline-block; font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 1px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
/* Per-project colored tag: hue comes from a `--ph` custom property set inline
   (project_tag_html / project_hue). Dark values are the default; light overrides
   below. Semi-transparent tint keeps every hue readable on both surfaces. */
.ptag.pcolor {
  background: hsl(var(--ph) 55% 62% / 0.18);
  color: hsl(var(--ph) 82% 78%);
  box-shadow: inset 0 0 0 1px hsl(var(--ph) 60% 60% / 0.34);
}
:root[data-theme="light"] .ptag.pcolor {
  background: hsl(var(--ph) 68% 45% / 0.13);
  color: hsl(var(--ph) 60% 34%);
  box-shadow: inset 0 0 0 1px hsl(var(--ph) 52% 46% / 0.30);
}
.ptag.noproj { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--grid); }
/* Sort control in the task chip row */
.sortsep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--grid); }
.sortlbl {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); align-self: center;
}
/* Project group headers (Sort = Project) */
.tasklist-full.grouped .taskgroup {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px 7px; border-bottom: 1px solid var(--grid);
  background: var(--surface-2);
}
.tasklist-full.grouped .taskgroup:first-child { border-top: none; }
.tasklist-full.grouped .taskgroup .ptag { font-size: 12px; padding: 2px 11px; }
.taskgroup .gcount {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10.5px; color: var(--muted);
}
/* due-date labels */
.tdue { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tdue.over { color: var(--neg); }
.tdue.today { color: var(--warn); }

/* --- Home ------------------------------------------------------------------------- */
.homewrap { max-width: 1080px; margin: 0 auto; }
.greet {
  text-align: center;
  padding: clamp(24px, 5vw, 52px) 12px clamp(20px, 3vw, 34px);
  margin-bottom: clamp(28px, 5vw, 64px);
}
.greet .gdate {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin-bottom: 10px;
}
.greet .ghead {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 1.02;
  letter-spacing: 0.005em; margin: 0; color: var(--ink); text-wrap: balance;
}
.greet .gname {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-style: normal; font-weight: 800; font-size: 0.8em;
  letter-spacing: -0.03em; color: var(--accent);
}
.greet .gsub { color: var(--muted); font-size: 14px; margin: 14px auto 0; max-width: 52ch; }
.greet .gsub b { color: var(--ink); font-weight: 650; }

.homegrid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: clamp(14px, 2.4vw, 22px); align-items: stretch;
}
.homegrid .card { margin: 0; }
/* Staff Home has no money column — two equal columns (Tasks · Up next). */
.homegrid.duo { grid-template-columns: 1fr 1fr; }
.homemoney { display: grid; gap: clamp(14px, 2.4vw, 22px); grid-template-rows: 1fr 1fr; }
/* Home events card: reuses the calendar .uprow look, but rows aren't clickable (no popover here). */
.homeevents .uplist { margin: 6px -8px 0; }
.homeevents .uprow { cursor: default; padding: 11px 12px; }
.homeevents .uprow:hover { background: none; }

.card-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; }
.card-head .ic { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; }
.card-head .lbl {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.card-head .more {
  margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.card-head .more svg { width: 14px; height: 14px; }
.card-head .more:hover { text-decoration: none; opacity: 0.85; }

.tasklist-mini { list-style: none; margin: 6px -8px 0; padding: 0; }
.tasklist-mini .trow {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 12px; border-radius: 11px; color: inherit;
  text-decoration: none !important;
}
.tasklist-mini .trow:hover { background: var(--surface-2); }
.tdot { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); }
.tdot.doing { border-color: var(--warn); border-style: dashed; }
.tasklist-mini .tinfo { flex: 1; min-width: 0; display: block; }
.tasklist-mini .tname {
  display: block; color: var(--ink); font-weight: 600; font-size: 13.5px;
  letter-spacing: -0.015em; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tasklist-mini .tmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tasklist-mini .who { margin-left: auto; flex: 0 0 auto; }
.tasklist-mini .trow:hover .av { border-color: var(--surface-2); }

.homestat { display: flex; flex-direction: column; }
.homestat .lbl {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.homestat .lbl svg { width: 15px; height: 15px; }
.homestat .val {
  font-size: clamp(1.9rem, 4.4vw, 2.5rem); font-weight: 800; letter-spacing: -0.03em;
  margin: auto 0 0; padding-top: 14px; font-variant-numeric: tabular-nums;
}
.homestat .val .amt { color: inherit; }
.homestat .val .cur { color: var(--muted); font-weight: 600; font-size: 0.62em; }
.homestat .foot { font-size: 12px; color: var(--muted); margin-top: 7px; }
.card.homestat.hs-green {
  background: linear-gradient(160deg, var(--green-soft), transparent 70%), var(--surface);
  border-color: rgba(74, 222, 128, 0.32);
}
.card.homestat.hs-green .val { color: var(--pos); }
.card.homestat.hs-violet {
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface);
  border-color: rgba(140, 92, 255, 0.38);
}
.card.homestat.hs-violet .val { color: var(--accent); }
:root[data-theme="light"] .card.homestat.hs-green { border-color: rgba(22, 163, 74, 0.26); }
:root[data-theme="light"] .card.homestat.hs-violet { border-color: rgba(124, 58, 237, 0.28); }

@media (max-width: 1080px) {
  .homegrid { grid-template-columns: 1fr 1fr; }
  .homemoney { grid-column: 1 / -1; grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .homegrid { grid-template-columns: 1fr; }
  .homegrid.duo { grid-template-columns: 1fr; }
  .homemoney { grid-column: auto; grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .homemoney { grid-template-columns: 1fr; }
}

/* --- Tasks ------------------------------------------------------------------------ */
.taskpanel { padding: 0; overflow: hidden; max-width: 820px; }
.taskform { max-width: 820px; }
.taskhead { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; flex-wrap: wrap; }
.taskhead h2 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 16px; }
.taskhead h2 svg { width: 18px; height: 18px; color: var(--accent); }
.count-pill {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 11px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.spacer { flex: 1; }
.btn-newtask { display: inline-flex; align-items: center; gap: 6px; }
.btn-newtask svg { width: 14px; height: 14px; }

.taskchips { display: flex; gap: 7px; padding: 0 20px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--grid); }
.tchip {
  font-size: 12.5px; font-weight: 550; color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 12px;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important;
}
.tchip .n { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; opacity: 0.7; }
.tchip:hover { color: var(--ink); border-color: var(--muted); }
.tchip.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.tchip.on .n { opacity: 0.85; }

.tasklist-full { list-style: none; margin: 0; padding: 0; }
.tasklist-full .task { border-bottom: 1px solid var(--grid); }
.tasklist-full .task:last-child { border-bottom: none; }
.task-main {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 14px 20px; cursor: pointer; transition: background-color var(--dur-fast) ease;
}
.task-main:hover { background: var(--surface-2); }
.checkform { flex: none; margin-top: 1px; }
/* Scoped to .checkform: bare .check would also hit label.check form checkboxes. */
.checkform .check {
  width: 21px; height: 21px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: none; padding: 0;
  display: grid; place-items: center; color: transparent; cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}
.checkform .check svg { width: 12px; height: 12px; }
.task[data-status="doing"] .check { border-color: var(--warn); border-style: dashed; }
.task[data-status="done"] .check { background: var(--c-green); border-color: var(--c-green); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { color: var(--ink); font-size: 14px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 6px; }
.task[data-status="done"] .task-title {
  color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong);
}
.task-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.status-pill {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 9px; border-radius: 999px;
}
.status-pill.open { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.status-pill.doing { background: var(--amber-soft); color: var(--warn); }
.status-pill.done { background: var(--green-soft); color: var(--pos); }
.commentcount { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); opacity: 0.65; }
.commentcount.has { opacity: 1; }
.commentcount svg { width: 13px; height: 13px; }
.task-main .task-edit { opacity: 0; flex: 0 0 auto; transition: opacity var(--dur-fast) ease; }
.task-main:hover .task-edit, .task.open-thread .task-edit { opacity: 1; }
.task-main:hover .av, .task.open-thread .av { border-color: var(--surface-2); }

.thread { display: none; padding: 4px 20px 18px 54px; background: var(--page); border-top: 1px solid var(--grid); }
.task.open-thread .thread { display: block; }
.task.open-thread .task-main { background: var(--surface-2); }
.task-note { font-size: 13px; color: var(--ink-2); padding: 12px 0 0; line-height: 1.55; }
.thread-label {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); padding: 14px 0 8px;
}
.comment { display: flex; gap: 10px; padding: 7px 0; }
.comment .av { flex: none; border-color: var(--page); }
.c-body { flex: 1; min-width: 0; }
.c-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.c-name { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.c-time { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--muted); }
.c-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.c-text a { border-bottom: 1px solid var(--accent-soft); word-break: break-all; }
.c-text a:hover { border-bottom-color: var(--accent); text-decoration: none; }
.add-comment { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.add-comment input[type="text"] { border-radius: 999px; padding: 8px 15px; background: var(--surface); }
.add-comment .send {
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted);
  border-radius: 50%; width: 36px; height: 36px;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.add-comment .send:hover { color: var(--accent); border-color: var(--accent); }
.add-comment .send svg { width: 16px; height: 16px; }
.thread-del { margin-top: 12px; text-align: right; }

@media (max-width: 560px) {
  .thread { padding-left: 20px; }
  .task-main .task-edit { opacity: 1; }
}

/* --- Calendar --------------------------------------------------------------------- */
.calhead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.calhead h1 { margin-bottom: 0; }
.monthnav { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.monthnav .m {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 13px; color: var(--ink); min-width: 118px; text-align: center;
}
.navbtn {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--muted);
  display: grid; place-items: center; text-decoration: none !important;
}
.navbtn svg { width: 15px; height: 15px; }
.navbtn:hover { color: var(--ink); border-color: var(--muted); }
.today-btn { margin-left: 4px; padding: 5px 13px; font-size: 12.5px; }

.callegend { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0 14px; font-size: 12px; color: var(--muted); }
.callegend .lg { display: inline-flex; align-items: center; gap: 6px; }
.callegend .sw { width: 10px; height: 10px; border-radius: 3px; }
.callegend .sw-ev { background: var(--c-blue); }
.callegend .sw-tk { background: var(--accent); border-radius: 50%; }
.callegend .sw-pay { background: var(--c-green); }
.callegend .src {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10px; color: var(--muted); opacity: 0.75;
}

.calwrap { display: grid; grid-template-columns: 1.55fr 1fr; gap: clamp(14px, 2vw, 22px); align-items: start; }
.month {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--grid); }
.dow span {
  text-align: center; padding: 10px 0;
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.week { display: grid; grid-template-columns: repeat(7, 1fr); }
.day {
  min-width: 0; min-height: 84px; padding: 7px 8px;
  border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid);
  display: flex; flex-direction: column; gap: 4px;
}
.week .day:last-child { border-right: none; }
.weeks .week:last-child .day { border-bottom: none; }
.day.out { background: var(--page); }
.day.out .dnum { color: var(--muted); opacity: 0.6; }
.dnum { font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.day.today .dnum {
  background: var(--accent); color: #fff; width: 23px; height: 23px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
}
.marks { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mk {
  font-size: 10.5px; font-weight: 600; letter-spacing: -0.01em; padding: 2px 6px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35;
  display: flex; align-items: center; gap: 4px; cursor: pointer;
}
.mk::before { content: ""; width: 6px; height: 6px; border-radius: 2px; flex: none; }
@media (hover: hover) and (pointer: fine) { .mk:hover { filter: brightness(1.14); } }
.mk.ev { background: var(--blue-soft); color: var(--c-blue); }
.mk.ev::before { background: var(--c-blue); }
.mk.tk { background: var(--accent-soft); color: var(--accent); }
.mk.tk::before { background: var(--accent); border-radius: 50%; }
.mk.pay { background: var(--green-soft); color: var(--pos); }
.mk.pay::before { background: var(--c-green); }
.mk.dim { opacity: 0.5; }
.mk .t { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 9.5px; opacity: 0.85; flex: none; }
.mk .txt { overflow: hidden; text-overflow: ellipsis; }
.more-mk { font-size: 10px; color: var(--muted); padding-left: 6px; }

.upnext { padding: 16px 4px 6px; position: sticky; top: 20px; margin: 0; }
.up-head { padding: 0 16px 6px; }
.up-head h2 { margin: 0; font-size: 16px; }
.up-head p {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 3px 0 0;
}
.uprow { display: flex; gap: 12px; padding: 13px 16px; cursor: pointer; border-radius: 12px; }
.uprow + .uprow { border-top: 1px solid var(--grid); }
.uprow:hover { background: var(--surface-2); }
.whenc { flex: none; width: 52px; text-align: right; padding-top: 2px; }
.whenc .d1 { font-size: 12px; font-weight: 750; letter-spacing: -0.02em; color: var(--ink); }
.whenc .d1.tdy { color: var(--accent); }
.whenc .d2 { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.tok {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; background: var(--blue-soft); color: var(--c-blue);
}
.tok svg { width: 19px; height: 19px; }
.tok.tok-tk { background: var(--accent-soft); color: var(--accent); }
.ubody { flex: 1; min-width: 0; }
.utitle { color: var(--ink); font-size: 13.5px; font-weight: 650; letter-spacing: -0.015em; margin: 1px 0 6px; }
.umeta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.join {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  background: var(--c-blue); color: #fff !important; font-size: 12px; font-weight: 650;
  padding: 6px 12px; border-radius: 999px; text-decoration: none !important;
}
.join svg { width: 14px; height: 14px; }
.join:hover { filter: brightness(1.08); }
.up-foot { padding: 10px 16px 8px; }
.up-foot a { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.up-foot a svg { width: 14px; height: 14px; }
.calfoot { max-width: 68ch; margin: 24px auto 0; line-height: 1.6; }

@media (max-width: 860px) {
  .calwrap { grid-template-columns: 1fr; }
  .upnext { position: static; }
  .day { min-height: 62px; padding: 5px 5px; }
  .mk .txt { display: none; }
  .mk { padding: 2px 4px; }
}

/* --- popover (calendar detail) ---------------------------------------------------- */
#pop {
  position: fixed; z-index: 100; left: 0; top: 0; width: 304px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: var(--shadow-pop); padding: 15px 16px;
  opacity: 0; pointer-events: none; transform: scale(0.93);
  transition: opacity var(--dur-pop) var(--ease-out), transform var(--dur-pop) var(--ease-out);
}
#pop.show { opacity: 1; pointer-events: auto; transform: scale(1); }
@media (prefers-reduced-motion: reduce) { #pop { transition: none; } }
.pop-top { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.pop-chip {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 3px 9px; border-radius: 999px;
}
.pop-chip.event { background: var(--blue-soft); color: var(--c-blue); }
.pop-chip.task { background: var(--accent-soft); color: var(--accent); }
.pop-chip.payment { background: var(--green-soft); color: var(--pos); }
.pop-src {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.pop-x {
  margin-left: auto; width: 26px; height: 26px; border-radius: 8px; border: none;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.pop-x:hover { background: var(--surface-2); color: var(--ink); }
.pop-x svg { width: 15px; height: 15px; }
.pop-title { color: var(--ink); font-size: 15px; font-weight: 750; letter-spacing: -0.02em; margin: 0 0 9px; text-wrap: balance; }
.pop-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 6px 0; }
.pop-line svg { width: 14px; height: 14px; flex: none; opacity: 0.85; }
.pop-line.amt { color: var(--pos); font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-weight: 500; }
.pop-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.pop-people { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.pop-join {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 13px;
  background: var(--c-blue); color: #fff !important; font-size: 12.5px; font-weight: 650;
  padding: 8px 14px; border-radius: 999px; text-decoration: none !important;
}
.pop-join svg { width: 15px; height: 15px; }
.pop-desc {
  font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 12px;
  padding-top: 11px; border-top: 1px solid var(--grid);
  overflow-wrap: anywhere; max-height: 130px; overflow-y: auto;
}
.pop-open {
  display: block; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--grid);
  font-size: 12.5px; font-weight: 600;
}

/* wide plank (13 owner tabs): allow wrapping into two rows on narrow phones */
@media (max-width: 560px) {
  .plank { flex-wrap: wrap; justify-content: center; }
}

/* --- Leads (v27) ------------------------------------------------------------------ */
/* Board/table pipeline per mockups/leads-mockup.html. Freshly-grepped names:
   .board/.col/.st/.stmenu/.lead/.ltag were free; filter chips reuse .tchip,
   avatars reuse .av. */
.leadstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 14px 0; }
.card.stat.t-amber { background: linear-gradient(135deg, var(--amber-soft), var(--surface) 55%); }
.card.stat.t-amber .stat-label { color: var(--warn); }
.stat .stat-value .of-total { font-size: 0.5em; color: var(--muted); font-weight: 500; }

.leadbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 14px; }
.leadbar .btn.vbtn { padding: 5px 14px; font-size: 12.5px; }
.leadbar .btn.vbtn.on { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }

.board { display: grid; grid-template-columns: repeat(5, minmax(228px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; }
.board[hidden], .closedrow[hidden] { display: none; }   /* display:grid would beat the hidden attribute */
.colhead { display: flex; align-items: center; gap: 7px; padding: 4px 6px 8px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.colhead .cnt { color: var(--muted); font-weight: 600; }
/* .ldot, not .dot — bare .dot is the ledger's category-kind dot (7px + margin) */
.ldot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ldot.d-new { background: var(--c-gray); }
.ldot.d-contacted { background: var(--c-blue); }
.ldot.d-meeting { background: var(--warn); }
.ldot.d-proposal { background: #f0883e; }
.ldot.d-won { background: var(--pos); }
.ldot.d-lost, .ldot.d-noshow, .ldot.d-notforus { background: var(--c-red); }
.colbody { display: flex; flex-direction: column; gap: 9px; }

.lead {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 13px 11px; cursor: pointer; transition: border-color var(--dur-fast) ease;
}
.lead:hover { border-color: var(--accent); }
.lead .nm { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.lead .nm a { color: var(--ink); text-decoration: none; }
.lead .br { color: var(--muted); font-size: 12px; margin-top: 1px; }
.lead .contact { font-size: 11.5px; color: var(--ink-2); margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.lead .contact span { display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead .contact svg { width: 11px; height: 11px; color: var(--muted); flex: 0 0 auto; }
.lead .note {
  font-size: 11.5px; color: var(--muted); font-style: italic; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ltags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ltag {
  font-size: 10.5px; font-weight: 600; border-radius: 999px; padding: 1.5px 8px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.ltag.src { color: var(--c-pink); }
.ltag.bud { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.ltag.svc { color: var(--ink-2); }
.ltag.todo { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.lead .foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.lead .meet { font-size: 11.5px; color: var(--c-blue); display: flex; align-items: center; gap: 4px; }
.lead .meet svg { width: 12px; height: 12px; }
.lead .off { font-size: 11.5px; color: #f0883e; }
.lead .foot .grow { flex: 1; }
.won-note { font-size: 11.5px; color: var(--pos); margin-top: 8px; }
.av.av-none { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border-strong); }

.closedrow { margin-top: 14px; }
.closedrow summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; list-style: none; }
.closedrow summary::before { content: "▸ "; }
.closedrow[open] summary::before { content: "▾ "; }
.closedrow .colbody { flex-direction: row; flex-wrap: wrap; margin-top: 9px; }
.closedrow .lead { width: 250px; opacity: 0.65; }

/* clickable status pills (board + table) */
.st {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; border: 0;
  font-family: inherit; cursor: pointer; letter-spacing: -0.01em;
}
.st::after { content: " ▾"; font-size: 9px; opacity: 0.6; }
.st:hover { outline: 1px solid currentColor; }
.st.s-new { background: color-mix(in srgb, var(--c-gray) 15%, transparent); color: var(--c-gray); }
.st.s-contacted { background: var(--blue-soft); color: var(--c-blue); }
.st.s-meeting { background: var(--amber-soft); color: var(--warn); }
.st.s-proposal { background: rgba(240, 136, 62, 0.15); color: #f0883e; }
.st.s-won { background: var(--green-soft); color: var(--pos); }
.st.s-lost, .st.s-noshow, .st.s-notforus { background: color-mix(in srgb, var(--c-red) 12%, transparent); color: var(--c-red); }

/* status picker menu */
.stmenu {
  position: absolute; z-index: 90; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 6px; box-shadow: var(--shadow-pop); min-width: 176px;
}
.stmenu[hidden] { display: none; }
.stmenu button {
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: none; border: 0; border-radius: 8px; padding: 6px 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.stmenu button:hover { background: var(--surface-2); color: var(--ink); }
.stmenu .sep { height: 1px; background: var(--grid); margin: 3px 4px; }

/* table view */
#leadtable td { vertical-align: top; }
#leadtable td.lnm a { color: var(--ink); font-weight: 600; }
#leadtable td.lnm a:hover { color: var(--accent); }
#leadtable td.lnotes { white-space: normal; min-width: 200px; max-width: 320px; color: var(--muted); font-size: 12px; }

@media (max-width: 1080px) {
  .leadstats { grid-template-columns: 1fr 1fr; }
  .board { grid-template-columns: repeat(5, 248px); }
}
@media (max-width: 760px) {
  .leadstats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .leadstats .stat .stat-value { font-size: 24px; }
}

/* ============================================================================
   Motion pass v30 -- apple-design + improve-animations audit, 12. 9. 2026.
   See plans/000-motion-audit-2026-09-12.md. Rules: respond on pointer-down,
   transform/opacity only, ease-out on enter, menus grow from their trigger,
   UI under 300ms, reduced-motion keeps feedback but drops travel.
   ========================================================================== */

/* 1 . press feedback on every pressable (scale 0.97 on :active) */
.btn, .pl-item, .checkform .check, .tchip, .navbtn, .st, .tabs a,
.add-comment .send, .pop-x, .edit-modal-close, .pop-join, .join, .card-head .more,
.plankdrop-menu a, .plankdrop-menu button, .stmenu button, .sub-del {
  transition: transform var(--dur-press) var(--ease-out),
              background-color var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              color var(--dur-fast) ease;
}
.btn:active, .pl-item:active, .checkform .check:active, .tchip:active, .navbtn:active,
.st:active, .tabs a:active, .add-comment .send:active, .pop-x:active, .edit-modal-close:active,
.pop-join:active, .join:active, .card-head .more:active, .plankdrop-menu a:active,
.plankdrop-menu button:active, .stmenu button:active, .sub-del:active {
  transform: scale(0.97);
}
.checkform .check:active { transform: scale(0.9); }   /* small target, needs a bigger dip to read */

/* 7 . hover label above the plank: pointer devices only (touch taps stick) */
@media (hover: hover) and (pointer: fine) {
  .pl-item:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 5 . plank menus grow up out of their trigger */
.plankdrop-menu {
  transform-origin: 50% 100%;
  transition: opacity var(--dur-pop) var(--ease-out), transform var(--dur-pop) var(--ease-out);
}
@starting-style {
  details.plankdrop[open] .plankdrop-menu { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.96); }
}

/* 6 . lead status picker grows from the pill (origin flipped in leads.php when it opens upward) */
.stmenu {
  transform-origin: 0 0;
  transition: opacity var(--dur-pop) var(--ease-out), transform var(--dur-pop) var(--ease-out);
}
@starting-style {
  .stmenu:not([hidden]) { opacity: 0; transform: translateY(-4px) scale(0.96); }
}

/* 4 . task thread: fade + 4px rise on open, instant on close */
.task.open-thread .thread {
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
@starting-style {
  .task.open-thread .thread { opacity: 0; transform: translateY(-4px); }
}

/* 10 . ease the dark/light switch (footer.php toggles html.theming for 350ms) */
html.theming, html.theming *, html.theming *::before, html.theming *::after {
  transition: background-color 280ms ease, color 280ms ease, border-color 280ms ease, fill 280ms ease !important;
}

/* 8 . accessibility: reduced motion keeps opacity feedback, drops travel;
       reduced transparency makes the plank solid */
@media (prefers-reduced-motion: reduce) {
  :root { --ease-out: ease; --ease-in-out: ease; --dur-press: 0ms; }
  dialog.edit-modal, dialog.edit-modal[open], .plankdrop-menu, .stmenu, .task.open-thread .thread, #pop, .pl-item::after {
    transition-property: opacity, background-color, border-color, color;
  }
  @starting-style {
    dialog.edit-modal[open] { transform: scale(1); }
    details.plankdrop[open] .plankdrop-menu { transform: translateX(-50%); }
    .stmenu:not([hidden]) { transform: none; }
    .task.open-thread .thread { transform: none; }
  }
  html.theming, html.theming * { transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .plank { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}

/* ============================================================================
   Frost · Lavender component layer (v31, 13. 9. 2026).
   Design directions: artifacts "Hub Design Directions" → "Frost Variants" (A)
   → "Lavender Layout Studies" (A · Bento) → "Hub in Frost Lavender".
   Rules: one 4-px spacing scale; glass cards (translucent white + blur) on a
   violet field; one quiet secondary (a tint of the violet) for money-in, the
   "due in" tile and today; violet stays the action colour; dark mode
   desaturates instead of glowing. Motion pass v30 stays as is.
   ========================================================================== */

/* --- field + shell --------------------------------------------------------- */
html { background: var(--page-top) var(--page-grad) no-repeat; background-size: 100% 100%; min-height: 100%; }
body { background: transparent; min-height: 100vh; }
body.bare { background: transparent; }
/* helper text that sits directly on the field, outside any card */
main > .muted, main > p.muted, .callegend, .callegend .lg, .callegend .src, .monthnav .m, .up-head p { color: var(--gsub); }
.monthnav .m { color: var(--gtext); }
.card .up-head p { color: var(--muted); }
main { max-width: 1180px; padding: 18px clamp(16px, 3vw, 40px) 130px; }
h1 {
  color: var(--gtext); font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 800;
  letter-spacing: -0.045em; line-height: 1; margin: 14px 0 18px;
  text-shadow: 0 2px 22px rgba(60, 40, 140, 0.22);
}
body.bare h1 { color: var(--ink); text-shadow: none; }
.pagedate {
  top: 26px; color: var(--gsub);
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
.brand.big { font-weight: 800; letter-spacing: -0.04em; font-size: 24px; }
.flash { background: var(--surface); border-color: var(--border); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-radius: var(--radius-sm); }

/* --- glass surfaces --------------------------------------------------------- */
.card, .tablewrap, .month, .filters, .login-card, .upnext, .lead, .plankdrop-menu, .stmenu, #pop {
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.card { border-radius: var(--radius); padding: 20px 24px 24px; }
.card .tablewrap, .card .month { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.tablewrap { border-radius: var(--radius); padding: 6px 16px 10px; }
.login-card { border-radius: 24px; box-shadow: var(--shadow-pop); background: var(--focus-bg); }
.upnext { border-radius: var(--radius); }
.plankdrop-menu, .stmenu { box-shadow: var(--shadow-pop); border-radius: 16px; }
#pop { border-radius: 18px; box-shadow: var(--shadow-pop); }
h2 { color: var(--ink); }

/* account / semantic stat tiles: business = violet gradient, money-in = lavender.
   The :root[data-theme="light"] prefix is needed to beat the old light tint rules above. */
:root[data-theme="light"] .card.stat.acct-sp, :root[data-theme="light"] .card.stat.t-violet { background: var(--tile-sp); border-color: transparent; }
:root[data-theme="light"] .card.stat.acct-os, :root[data-theme="light"] .card.stat.t-green { background: var(--sec-grad); border-color: transparent; }
:root[data-theme="light"] .card.stat.t-red, :root[data-theme="light"] .card.stat.t-blue, :root[data-theme="light"] .card.stat.t-amber { background: var(--surface); border-color: var(--border); }
.card.stat.acct-sp .stat-sub, .card.stat.t-violet .stat-sub, .card.stat.acct-sp .muted, .card.stat.t-violet .muted, .card.stat.acct-sp .note, .card.stat.t-violet .note { color: rgba(255, 255, 255, 0.8); }
.card.stat.acct-os .stat-sub, .card.stat.t-green .stat-sub, .card.stat.acct-os .muted, .card.stat.t-green .muted, .card.stat.acct-os .note, .card.stat.t-green .note, .card.stat.acct-os .stat-proj, .card.stat.t-green .stat-proj, .card.stat.acct-os .stat-proj .amt, .card.stat.t-green .stat-proj .amt { color: var(--sec-ink); opacity: 0.8; }
.card.stat.acct-sp .stat-value .of-total, .card.stat.t-violet .stat-value .of-total { color: rgba(255, 255, 255, 0.7); }
.card.stat.acct-os .stat-value .of-total, .card.stat.t-green .stat-value .of-total { color: var(--sec-ink); opacity: 0.6; }
.card.stat.acct-sp, .card.stat.t-violet, .homestat.hs-violet { background: var(--tile-sp); border-color: transparent; }
.card.stat.acct-sp .stat-label, .card.stat.t-violet .stat-label, .card.stat.acct-sp .small, .card.stat.t-violet .small,
.card.stat.acct-sp .stat-proj, .card.stat.t-violet .stat-proj, .card.stat.acct-sp .stat-proj .amt, .card.stat.t-violet .stat-proj .amt { color: rgba(255, 255, 255, 0.8); }
.card.stat.acct-sp .stat-value, .card.stat.t-violet .stat-value, .card.stat.acct-sp .stat-value .cur, .card.stat.t-violet .stat-value .cur,
.card.stat.acct-sp .stat-value .amt, .card.stat.t-violet .stat-value .amt { color: #fff; }
.card.stat.acct-os, .card.stat.t-green { background: var(--sec-grad); border-color: transparent; }
.card.stat.acct-os .stat-label, .card.stat.t-green .stat-label, .card.stat.acct-os .small, .card.stat.t-green .small { color: var(--sec-ink); opacity: 0.8; }
.card.stat.acct-os .stat-value, .card.stat.t-green .stat-value, .card.stat.acct-os .stat-value .cur, .card.stat.t-green .stat-value .cur,
.card.stat.acct-os .stat-value .amt, .card.stat.t-green .stat-value .amt { color: var(--sec-ink); }
.card.stat.t-red, .card.stat.t-blue, .card.stat.t-amber { background: var(--surface); border-color: var(--border); }
.card.stat.t-red .stat-label { color: var(--neg); } .card.stat.t-blue .stat-label { color: var(--c-blue); }
.stat .stat-value { font-weight: 800; letter-spacing: -0.05em; }

/* --- buttons · chips · tabs · fields ------------------------------------- */
.btn { background: var(--field-bg); border-color: var(--border-strong); color: var(--ink); padding: 8px 16px; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.tiny { padding: 3px 10px; }
.tabs { border-bottom-color: var(--border); }
.tabs a { color: var(--gsub); }
.tabs a:hover { background: var(--surface); color: var(--ink); }
.tabs a.active { background: var(--accent); color: var(--accent-ink); }
.tchip { background: var(--field-bg); border-color: var(--border-strong); color: var(--ink-2); padding: 6px 12px; }
.tchip.on { background: var(--ink); color: var(--page); border-color: var(--ink); }
.tchip.on .n { opacity: 0.7; }
.navbtn, .sub-del, .add-comment .send, .pop-x, .edit-modal-close { background: var(--field-bg); border-color: var(--border-strong); }
input[type="text"], input[type="password"], input[type="date"], input[type="search"],
input[type="number"], input[type="email"], input[type="datetime-local"], select, textarea {
  background: var(--field-bg); border-color: var(--border-strong); border-radius: var(--radius-sm); padding: 9px 13px;
}
label { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; }
label input, label select, label textarea { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 13.5px; letter-spacing: -0.01em; text-transform: none; margin-top: 6px; }
label.check { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 13px; letter-spacing: -0.01em; text-transform: none; }
.filters { border-radius: var(--radius); padding: 12px 16px; }
.split { border-color: var(--border-strong); }
.form-topbar { border-bottom-color: var(--grid); }
body.bare .form-topbar { background: transparent; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }

/* --- tables ------------------------------------------------------------------ */
table.data th, table.data td { padding: 11px 12px; border-bottom-color: var(--grid); }
table.data thead th {
  background: transparent; font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em;
}
@media (min-width: 1100px) {
  table.data thead th { background: var(--surface); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--grid); }
}
table.data tbody tr:hover { background: var(--surface-2); }
tr.grouphead td { background: var(--ink-a06); }
.tag { border-color: var(--border-strong); background: var(--ink-a06); font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10px; letter-spacing: 0.04em; padding: 1px 7px; }
.tag.warn, .tag.nives, .tag.nives-shared, .tag.tax, .tag.split, .tag.ddv { background: transparent; }

/* --- avatars · project tags · pills ---------------------------------------- */
.av { border-color: var(--av-ring); }
.tasklist-mini .trow:hover .av, .task-main:hover .av, .task.open-thread .av { border-color: var(--av-ring); }
.ptag { font-weight: 600; }
.status-pill.open { background: var(--ink-a06); }

/* --- plank (dark glass on the light field, light glass in dark mode) -------- */
.plank { background: var(--plank-bg); border-color: var(--plank-border); border-radius: 999px; padding: 8px; gap: 4px; box-shadow: var(--shadow-pop); }
.pl-item { color: var(--plank-ink); border-radius: 999px; }
.pl-item:hover, .pl-item.active, details.plankdrop[open] summary.pl-item { background: var(--plank-active); color: #fff; }
.pl-item.pl-add { background: var(--plank-add); color: var(--plank-add-ink); }
.pl-item.pl-add:hover { background: var(--plank-add); filter: brightness(1.05); }
.pl-item::after { background: var(--plank-solid); border-color: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: var(--shadow-pop); }
.pl-badge { background: var(--danger); }
@media (max-width: 760px) { .plank { background: var(--plank-solid); border-radius: 999px; } }
@media (max-width: 560px) { .plank { border-radius: 24px; padding: 6px; } .pl-item { border-radius: 999px; } }
.plankdrop-menu a:hover, .plankdrop-menu button:hover { background: var(--surface-2); }
.plankdrop-menu a.active { background: var(--accent-soft); color: var(--accent); }

/* --- Home (Bento) ---------------------------------------------------------- */
.homewrap { max-width: 1180px; }
.greet { padding: clamp(14px, 3vw, 28px) 12px clamp(20px, 3vw, 32px); margin-bottom: 0; }
.greet .gdate { color: var(--gsub); font-size: 11px; }
.greet .ghead {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-weight: 800;
  font-size: clamp(2.1rem, 6vw, 4rem); letter-spacing: -0.045em; line-height: 1.02;
  color: var(--gtext); text-shadow: 0 2px 22px rgba(60, 40, 140, 0.22);
}
.greet .gname { font-size: 1em; font-weight: 800; color: var(--gtext); opacity: 0.78; letter-spacing: -0.045em; }
.greet .gsub { color: var(--gsub); font-size: 14.5px; }
.greet .gsub b { color: var(--gtext); font-weight: 700; }

.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.bento > * { min-width: 0; margin: 0; }
.b-hero  { grid-column: 1 / 8;  grid-row: 1 / 3; display: flex; flex-direction: column; }
.b-kpis  { grid-column: 8 / 13; grid-row: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.b-acct  { grid-column: 8 / 13; grid-row: 2; }
.b-tasks { grid-column: 1 / 6;  grid-row: 3 / 5; }
.b-next  { grid-column: 6 / 13; grid-row: 3 / 5; }
.b-week  { grid-column: 1 / 13; grid-row: 5; }
.bento.nomoney .b-kpis { grid-column: 1 / 13; grid-row: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bento.nomoney .b-tasks { grid-row: 2 / 4; } .bento.nomoney .b-next { grid-row: 2 / 4; } .bento.nomoney .b-week { grid-row: 4; }
.b-hero .bignum { font-weight: 800; font-size: clamp(38px, 4.4vw, 56px); letter-spacing: -0.05em; line-height: 1; color: var(--ink); margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.b-hero .bignum .amt { color: inherit; }
.b-hero .bignum .cur { color: var(--muted); font-size: 0.5em; font-weight: 600; vertical-align: 0.32em; margin-right: 2px; }
.b-hero .sub, .b-acct .sub, .kpi .sub { color: var(--muted); font-size: 12.5px; }
.b-hero .sub b, .b-acct .sub b { color: var(--ink); font-weight: 650; }
.b-hero .sub .amt { color: var(--ink); font-weight: 650; }
.spark { margin-top: auto; padding-top: 16px; }
.spark svg { width: 100%; height: 72px; display: block; overflow: visible; }
.spark .months { display: flex; justify-content: space-between; margin-top: 8px; }
.spark .months span { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--muted); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); display: grid; gap: 4px; align-content: start; box-shadow: var(--shadow-card); }
.kpi .lbl { display: flex; align-items: center; gap: 6px; font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kpi .lbl i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.kpi.warn .lbl i { background: var(--neg); }
.kpi.sec .lbl i { background: var(--sec-text); }
.kpi .n { font-weight: 800; font-size: 28px; letter-spacing: -0.05em; color: var(--ink); line-height: 1; }
.stack { height: 14px; border-radius: 999px; overflow: hidden; display: flex; background: var(--ink-a06); margin: 12px 0 8px; }
.stack i { display: block; height: 100%; }
.stack .sp { background: var(--tile-sp); }
.stack .os { background: var(--sec-grad); }
.legend { display: flex; gap: 20px; flex-wrap: wrap; }
.legend span { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.legend span i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend span b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.b-next .uplist { margin: 0; }
.b-next .uprow { cursor: default; padding: 12px 0; border-radius: 0; }
.b-next .uprow:hover { background: none; }
.b-next .uprow + .uprow { border-top: 1px solid var(--grid); }
.wstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.wday { border-radius: 14px; padding: 12px; min-height: 96px; display: grid; align-content: start; gap: 8px; background: var(--ink-a06); }
.wday.tdy { background: var(--sec-grad); }
.wday .d { display: flex; justify-content: space-between; align-items: baseline; }
.wday .d span { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.wday .d b { font-size: 15px; color: var(--ink); }
.wday.tdy .d span { color: var(--sec-ink); opacity: 0.75; }
.wday.tdy .d b { color: var(--sec-ink); }
.wev { font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 5px 9px; display: flex; gap: 6px; align-items: baseline; min-width: 0; text-decoration: none !important; }
.wev small { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 10.5px; font-weight: 500; color: var(--muted); flex: none; }
.wev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wev.task { background: transparent; border-style: dashed; border-color: var(--border-strong); color: var(--ink-2); }
.wday.tdy .wev { background: rgba(255, 255, 255, 0.55); border-color: transparent; color: var(--sec-ink); }
.wday.tdy .wev small { color: var(--sec-ink); opacity: 0.7; }
:root:not([data-theme="light"]) .wday.tdy .wev { background: rgba(255, 255, 255, 0.10); }
@media (max-width: 900px) {
  .b-hero .card-head .lbl .lbl-x { display: none; }
  .bento { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .bento > * { grid-column: auto !important; grid-row: auto !important; }
  .b-kpis { gap: 8px; }
  .kpi { padding: 12px; } .kpi .n { font-size: 22px; }
  .wstrip { grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; margin: 12px -24px 0; padding: 0 24px 6px; scroll-snap-type: x proximity; }
  .wday { scroll-snap-align: start; }
}

/* --- Tasks --------------------------------------------------------------------- */
.taskchips { border-bottom-color: var(--grid); }
.taskgroup, .tasklist-full.grouped .taskgroup { background: var(--ink-a06); border-bottom-color: var(--grid); }
.tasklist-full .task { border-bottom-color: var(--grid); }
.task-main:hover, .task.open-thread .task-main { background: var(--surface-2); }
.thread { background: var(--ink-a06); border-top-color: var(--grid); }
.checkform .check { border-color: var(--border-strong); }
.add-comment input[type="text"] { background: var(--field-bg); }

/* --- Calendar ---------------------------------------------------------------- */
.month { border-radius: var(--radius); }
.dow { border-bottom-color: var(--grid); }
.day { border-right-color: var(--grid); border-bottom-color: var(--grid); }
.day.out { background: var(--ink-a06); }
.day.today .dnum { background: var(--accent); color: var(--accent-ink); }
.mk.wev { background: var(--sec-soft); color: var(--sec-text); }
.mk.ev::before { background: var(--sec-text); }
.tok { background: var(--sec-soft); color: var(--sec-text); }
.uprow + .uprow { border-top-color: var(--grid); }
.upnext { top: 20px; }

/* --- Leads ---------------------------------------------------------------- */
.lead { border-radius: 14px; }
.lead:hover { border-color: var(--accent); }
.colhead { color: var(--gtext); }
.colhead .cnt { color: var(--gsub); }
.leadstats .card.stat { padding: 16px 20px; }
.stmenu button:hover { background: var(--surface-2); }

/* --- Dashboard -------------------------------------------------------------- */
.txlist li, .potlist li { border-bottom-color: var(--grid); }
.dashgrid { gap: 20px; }

/* --- Dialog ------------------------------------------------------------------- */
dialog.edit-modal { background: var(--page); border-color: var(--border-strong); border-radius: var(--radius); }
dialog.edit-modal[open]::backdrop { background: rgba(20, 14, 50, 0.55); }

/* --- Popover (calendar) ------------------------------------------------------- */
.pop-desc, .pop-open { border-top-color: var(--grid); }

/* --- reduced transparency: solid surfaces --------------------------------- */
@media (prefers-reduced-transparency: reduce) {
  :root { --surface: #262052; --surface-2: #2e2860; --focus-bg: #2a2458; --glass-blur: none; }
  :root[data-theme="light"] { --surface: #f4f1ff; --surface-2: #ece7ff; --focus-bg: #ffffff; --glass-blur: none; }
  body { background: var(--page); }
}
