/*
  Harbor: CRM pipeline dashboard
  1. Tokens, base and browser surfaces. Navy app bar on a warm paper ground.
  2. Overview (readouts + a proportional row of file dividers), toolbar, board of index cards, sortable table.
  3. Deal drawer, then "Components": the themed kit (select, menu, tooltip, toast, confirm card). Drag states and motion at the end.
*/

/* ---------- Tokens ---------- */
:root {
  /* palette */
  --paper: #f7f5f0;
  --paper-2: #efece4;
  --card: #fffdf9;
  --ink: #1b2440;
  --ink-2: #454c66;
  --ink-3: #5f667d;
  --line: #1b244021;
  --line-2: #1b244038;
  --wash: #1b24400b;
  --rule: #1b24401c;      /* the faint ruled lines on a card */
  --edge: #14161c2e;      /* the cut edge of a sheet of card stock */
  --on-ink: #f7f5f0;
  --on-ink-2: #b9bfd2;
  --danger: #a3271b;
  --scrim: #1b244080;     /* ink laid over the desk behind a modal */

  /* stage identifiers: the only place these four colours appear */
  --lilac: #b9a6ec;
  --teal: #58b8a9;
  --marigold: #f2b646;
  --coral: #f18c70;

  /* space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 28px;
  --s7: 40px;
  --gutter: clamp(16px, 2.2vw, 32px);

  /* shape */
  --r-card: 3px;
  --r-ctl: 8px;
  --r-pill: 999px;
  --tab-h: 22px;
  --tab-w: 74px;
  --pitch: 28px;          /* distance between ruled lines */
  --card-head: 34px;      /* the heading strip above the first rule */
  --card-pad: 14px;
  --ctl-h: 36px;

  /* depth */
  /* depth: neutral shadows, always offset downward like paper under a desk lamp */
  --shadow-card: 0 1px 1px #14161c12, 0 3px 5px -2px #14161c1f, 0 9px 12px -9px #14161c38;
  --shadow-hover: 0 1px 1px #14161c14, 0 6px 9px -3px #14161c29, 0 16px 18px -12px #14161c42;
  --shadow-lift: 0 4px 8px -2px #14161c2e, 0 24px 34px -14px #14161c61;
  --shadow-pop: 0 2px 6px -2px #14161c33, 0 16px 36px -12px #14161c52;
  --shadow-drawer: -1px 0 0 #14161c14, -24px 0 48px -24px #14161c4d;

  /* type */
  --sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --med: 320ms;
}

/* --tab-at is where the tab is cut along the top edge: 0 is hard left, 1 is hard right */
[data-stage="lead"] { --stage: var(--lilac); --on-stage: var(--ink); --tab-at: 0.06; }
[data-stage="qualified"] { --stage: var(--teal); --on-stage: var(--ink); --tab-at: 0.28; }
[data-stage="proposal"] { --stage: var(--marigold); --on-stage: var(--ink); --tab-at: 0.5; }
[data-stage="negotiation"] { --stage: var(--coral); --on-stage: var(--ink); --tab-at: 0.72; }
[data-stage="won"] { --stage: var(--ink); --on-stage: var(--on-ink); --tab-at: 0.94; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  accent-color: var(--ink);
  caret-color: var(--ink);
  scrollbar-color: #1b244066 transparent;
  scrollbar-width: thin;
}
/* the same scrollbar for engines that do not read scrollbar-color */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1b244066; border: 3px solid transparent; border-radius: 6px; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #1b244099; }

body {
  margin: 0;
  min-height: 100dvh;
  font-size: 0.875rem;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--ink); color: var(--on-ink); }

h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { text-wrap: balance; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 3px; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

.num, .amt, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
/* large figures are set in the sans with tabular numerals: DM Mono's slashed zero is too loud at this size */
.figure { font-family: var(--sans); font-variant-numeric: tabular-nums; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; left: var(--s3); top: -60px; z-index: 50;
  background: var(--card); color: var(--ink); padding: 10px 14px;
  border-radius: var(--r-ctl); font-weight: 600; box-shadow: var(--shadow-pop);
}
.skip:focus { top: var(--s3); }

.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.avatar { border-radius: 50%; object-fit: cover; background: var(--paper-2); }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-h); padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  background: var(--card); font-weight: 600; white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: #2a3558; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn .i { margin-left: -3px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #8a1f15; border-color: #8a1f15; }
.btn.danger-quiet { color: var(--danger); }
.btn.danger-quiet:hover { border-color: var(--danger); }

.icon-btn {
  display: grid; place-items: center; width: var(--ctl-h); height: var(--ctl-h);
  border: 0; border-radius: var(--r-ctl); background: none; color: var(--ink-2);
  transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--wash); color: var(--ink); }

.link {
  border: 0; background: none; padding: 0; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link:hover { text-decoration-thickness: 2px; }

/* ---------- App bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s6);
  height: 56px; padding: 0 var(--gutter);
  background: var(--ink); color: var(--on-ink);
}
.top :focus-visible { outline-color: var(--on-ink); }

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; text-decoration: none;
}

.nav { display: flex; gap: 2px; height: 100%; }
.nav a {
  position: relative; display: flex; align-items: center; padding: 0 12px;
  color: var(--on-ink-2); font-weight: 500; text-decoration: none;
  transition: color var(--fast);
}
.nav a:hover { color: var(--on-ink); }
.nav a[aria-current] { color: var(--on-ink); font-weight: 600; }
/* the current section reads as a paper tab rising out of the bar */
.nav a[aria-current]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 5px;
  background: var(--paper); border-radius: 4px 4px 0 0;
}

.top-end { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.workspace { color: var(--on-ink-2); font-weight: 500; }
.avatar.me { outline: 1px solid #f7f5f066; outline-offset: 2px; }
.nav-toggle {
  display: none; place-items: center; width: 44px; height: 44px; margin-right: -10px;
  border: 0; background: none; color: var(--on-ink); border-radius: var(--r-ctl);
}

.nav-sheet {
  position: fixed; inset: 60px 12px auto auto; margin: 0; width: min(260px, calc(100vw - 24px));
  padding: 0; border: 1px solid var(--edge); border-radius: var(--r-card);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-8px) rotate(-1deg); transform-origin: 100% 0;
  transition: opacity var(--fast), transform 260ms var(--ease), overlay 260ms allow-discrete, display 260ms allow-discrete;
}
.nav-sheet:popover-open { opacity: 1; transform: none; }
@starting-style { .nav-sheet:popover-open { opacity: 0; transform: translateY(-8px) rotate(-1deg); } }
.nav-sheet::backdrop { background: #1b244000; transition: background 260ms, overlay 260ms allow-discrete, display 260ms allow-discrete; }
.nav-sheet:popover-open::backdrop { background: #1b244040; }
@starting-style { .nav-sheet:popover-open::backdrop { background: #1b244000; } }
.nav-sheet a {
  display: flex; align-items: center; height: 46px; padding: 0 16px;
  border-bottom: 1px solid var(--rule); font-weight: 500; text-decoration: none; font-size: 1rem;
}
.nav-sheet a:hover { background: var(--wash); }
.nav-sheet a[aria-current] { font-weight: 700; background: var(--paper-2); }
.nav-sheet p { margin: 0; padding: 12px 16px; color: var(--ink-3); }

/* ---------- Overview ---------- */
main { padding: 24px var(--gutter) 72px; max-width: 1760px; margin: 0 auto; }

.overview-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s5) var(--s7);
}
.title h1 { font-size: clamp(2.5rem, 4.2vw, 3.75rem); line-height: 0.96; font-weight: 700; letter-spacing: -0.04em; }
/* one line that never wraps: the name of the next deal is what gives way, so the board below does not jump */
.title p { display: flex; align-items: baseline; gap: 0.35em; margin-top: 10px; color: var(--ink-2); font-size: 0.9375rem; white-space: nowrap; }
.title p > span { flex: none; }
.title .link { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }

.readouts { display: flex; gap: var(--s7); }
.readouts dt { color: var(--ink-2); font-size: 0.8125rem; font-weight: 500; }
.readouts dd { display: flex; align-items: baseline; gap: 8px; }
.readouts .figure { font-size: 2rem; line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; }
.readouts small { font-size: 0.8125rem; color: var(--ink-3); }

/*
  The strip: five file dividers stood side by side, each as wide as the money filed behind it.
  The tab carries the stage name and steps to the right from one divider to the next, like the cards below.
  Each divider is a button that takes you to its stage on the board.
*/
.strip {
  --seg-tab-w: 108px; --seg-tab-h: 26px;
  display: flex; gap: 3px; height: 78px; margin-top: calc(var(--seg-tab-h) + var(--s5));
  background: var(--wash);
}
.seg {
  position: relative; flex: 0 1 0; min-width: 34px; padding: 0; border: 0; border-radius: 0;
  container-type: inline-size; background: var(--stage); color: var(--on-stage); text-align: left; font: inherit;
  transition: flex-grow 700ms var(--ease), translate var(--med) var(--ease);
}
button.seg:hover, .seg.is-over { translate: 0 -3px; }
.seg.is-bumped { animation: bump 620ms var(--ease); }
.seg:focus-visible { outline-offset: 3px; z-index: 1; }
.seg.is-empty { min-width: 0; }
.seg.is-empty > * { display: none; }
.seg-tab {
  position: absolute; left: calc((100% - var(--seg-tab-w)) * var(--tab-at)); bottom: 100%; isolation: isolate;
  display: grid; place-items: center; width: var(--seg-tab-w); height: var(--seg-tab-h); padding: 4px 12px 0;
  font-size: 0.875rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1; white-space: nowrap; overflow: visible;
}
.seg-tab::before {
  content: ""; position: absolute; inset: 0 0 -1px; z-index: -1; background: var(--stage); border-radius: 7px 7px 0 0;
  transform: perspective(40px) rotateX(15deg); transform-origin: 50% 100%;
}
.seg-body {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  height: 100%; padding: 0 14px 11px; overflow: hidden; white-space: nowrap;
}
.seg-amt { font-size: 1.75rem; line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.seg-meta { font-size: 0.8125rem; font-weight: 500; line-height: 1.5; }
@container (max-width: 250px) { .seg-meta { display: none; } }
@container (max-width: 150px) { .seg-body { padding: 0 10px 11px; } .seg-amt { font-size: 1.25rem; letter-spacing: -0.02em; } }
@container (max-width: 112px) {
  .seg-tab { left: 0; width: 100%; padding-inline: 4px; font-size: 0.75rem; }
  .seg-amt { font-size: 0.9375rem; }
}
@container (max-width: 76px) { .seg-tab { font-size: 0; } .seg-amt { display: none; } }

.legend { display: none; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap;
  margin: var(--s5) 0 var(--s5);
}

.owners { display: flex; align-items: center; gap: 2px; }
.owner {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: none;
}
.owner img { width: 30px; height: 30px; transition: opacity var(--fast), filter var(--fast), transform var(--fast) var(--ease); }
.owner::after {
  content: ""; position: absolute; inset: 2px; border-radius: 50%;
  border: 2px solid transparent; transition: border-color var(--fast);
}
.owner:hover img { transform: scale(1.06); }
.owner[aria-pressed="true"]::after { border-color: var(--ink); }
.owners.has-filter .owner[aria-pressed="false"] img { opacity: 0.45; filter: grayscale(1); }
.owners.has-filter .owner[aria-pressed="false"]:hover img { opacity: 0.8; }

.search {
  position: relative; display: flex; align-items: center; flex: 1 1 200px; max-width: 300px; min-width: 0;
  height: var(--ctl-h); color: var(--ink-3);
}
.search .i { position: absolute; left: 10px; pointer-events: none; }
.search input {
  width: 100%; height: 100%; padding: 0 34px 0 36px;
  border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  background: var(--card); color: var(--ink); appearance: none; -webkit-appearance: none;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.search input:hover { border-color: var(--ink-3); }
.search input:focus-visible { outline: 3px solid #1b244026; outline-offset: 0; border-color: var(--ink); }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search-clear { position: absolute; right: 3px; width: 30px; height: 30px; color: var(--ink-2); }
.search kbd {
  position: absolute; right: 8px; display: grid; place-items: center; width: 20px; height: 20px;
  border: 1px solid var(--line-2); border-radius: 4px; font-size: 0.75rem; color: var(--ink-3);
}
.search:focus-within kbd, .search:has(input:not(:placeholder-shown)) kbd { display: none; }

.filter-status { color: var(--ink-2); display: flex; gap: var(--s2); align-items: baseline; }

.views {
  margin-left: auto; display: flex; padding: 3px; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2);
}
.views button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 9px;
  border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-weight: 600;
  transition: background var(--fast), color var(--fast), box-shadow var(--fast);
}
.views button:hover { color: var(--ink); }
.views button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-card); }

/* ---------- Board ---------- */
.board {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s4);
  align-items: stretch; outline: none;
}

/* Each stage is a tray: a slightly darker sheet the cards sit on */
.col {
  position: relative; min-width: 0; padding: 0 10px 14px;
  background: var(--paper-2); /* square corners: a tray is a sheet under the cards, not another card */
  transition: background var(--med) var(--ease), box-shadow var(--med) var(--ease);
}
.col.is-over { background: #e8e4da; box-shadow: inset 0 0 0 1px var(--line-2); }
.col.is-called { animation: called 900ms var(--ease); }
.col-head {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  padding: 12px 0 0 4px;
}
.col-name { display: flex; align-items: baseline; gap: 8px; font-size: 1.25rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.col-name::before {
  content: ""; align-self: center; width: 18px; height: 12px; background: var(--stage);
  clip-path: polygon(3px 0, calc(100% - 3px) 0, 100% 100%, 0 100%);
}
.col-count { font-family: var(--mono); font-weight: 400; font-size: 0.8125rem; letter-spacing: 0; color: var(--ink-3); }
.col-add { margin: -4px -6px -4px 0; width: 32px; height: 32px; }
.col-sum { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; margin-top: 3px; color: var(--ink-3); font-size: 0.8125rem; }
.col-sum .num { color: var(--ink); font-size: 0.875rem; font-weight: 500; }

.col-list { position: relative; display: flex; flex-direction: column; margin-top: 4px; min-height: 6px; }

/*
  The index card. A sheet of ruled card stock: the client sits on the heading strip above a rule in
  the stage colour, the deal and the amount are written on the faint lines below it, and a tab in the
  stage colour is cut into the top edge, further right for each stage like a set of file dividers.
*/
.card {
  position: relative; margin-top: calc(var(--tab-h) + 10px); padding-bottom: 10px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--pitch) - 1px), var(--rule) calc(var(--pitch) - 1px) var(--pitch))
    0 var(--card-head) / 100% 100% no-repeat,
    var(--card);
  border: 1px solid var(--edge); border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow var(--med) var(--ease), border-color var(--fast), translate var(--med) var(--ease);
}
/* the heading rule, in the stage colour */
.card::before {
  content: ""; position: absolute; inset: calc(var(--card-head) - 2px) 0 auto; height: 2px;
  background: var(--stage); transition: background-color 520ms var(--ease);
}
.card:hover { border-color: #14161c52; box-shadow: var(--shadow-hover); translate: 0 -1px; }
.card:has(:focus-visible) { border-color: var(--ink); }

.card-tab {
  position: absolute; left: calc((100% - var(--tab-w)) * var(--tab-at)); bottom: 100%; isolation: isolate;
  display: grid; place-items: center; width: var(--tab-w); height: var(--tab-h); padding: 5px 12px 0;
  background: var(--stage) content-box; color: var(--on-stage); line-height: 1; /* the colour also backs the text directly */
  font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap;
  transition: left 520ms var(--ease), color 520ms var(--ease), background-color 520ms var(--ease);
}
/* the tab itself: a trapezoid with soft shoulders, tipped back so its sides slope like a real divider */
.card-tab::before {
  content: ""; position: absolute; inset: 0 0 -1px; z-index: -1;
  background: var(--stage); border: 1px solid var(--edge); border-bottom: 0; border-radius: 6px 6px 0 0;
  transform: perspective(36px) rotateX(16deg); transform-origin: 50% 100%;
  transition: background-color 520ms var(--ease);
}
[data-stage="won"] > .card-tab::before { border-color: var(--ink); }

.card-co {
  height: var(--card-head); padding: 0 var(--card-pad); line-height: calc(var(--card-head) - 1px);
  font-size: 0.8125rem; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* text is nudged down so it sits on the ruled line instead of floating between two */
.card h3 {
  padding: 2px var(--card-pad) 0; font-size: 1rem; line-height: var(--pitch); font-weight: 600; letter-spacing: -0.015em;
}
.card-open {
  border: 0; background: none; padding: 0; text-align: left; font-weight: inherit; letter-spacing: inherit; line-height: inherit;
  cursor: inherit; text-wrap: pretty;
}
.card-open::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); } /* whole card opens the deal */
.card-open:focus-visible { outline: none; }
.card:has(.card-open:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.card-foot { display: flex; align-items: center; gap: 7px; height: var(--pitch); padding: 0 var(--card-pad); }
.card .amt { font-size: 0.9375rem; font-weight: 500; margin-right: auto; }
/* the age and the owner sit above the card-wide open target so their labels can be read on hover */
.card-age { position: relative; z-index: 1; font-size: 0.75rem; color: var(--ink-3); font-family: var(--mono); }
.card-foot .avatar { position: relative; z-index: 1; width: 22px; height: 22px; box-shadow: 0 0 0 1.5px var(--card); }
.card-move { position: relative; z-index: 1; width: 28px; height: 28px; margin: 0 -7px 0 -3px; }
.card-move:hover { background: #1b244014; }

.card.is-new { animation: settle 520ms var(--ease); }

.empty {
  margin: 12px 0 0; padding: 20px 14px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-card);
  color: var(--ink-3); font-size: 0.8125rem; text-align: center; text-wrap: balance;
}
.empty strong { display: block; margin-bottom: 2px; color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.col-list:has(.slot) + .empty { display: none; }

/* Quick add: a blank card you fill in */
.quick {
  position: relative; margin-top: calc(var(--tab-h) + 10px); padding: 12px;
  background: var(--card); border: 1px solid var(--ink); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop); display: grid; gap: 10px;
  animation: drop-in 360ms var(--ease);
  scroll-margin: 150px 0 24px;
}
.quick { --tab-at: 0.06; }
.quick .card-tab::before { border-color: var(--ink); }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.field input, textarea {
  width: 100%; min-width: 0; height: var(--ctl-h); padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--ink);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.field input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
.field input:hover, textarea:hover { border-color: var(--ink-3); }
.field input:focus-visible, textarea:focus-visible {
  outline: 3px solid #1b244026; outline-offset: 0; border-color: var(--ink);
}
/* a saved value filled in by the browser keeps the paper white, not the UA's blue or yellow */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--ink); caret-color: var(--ink);
  box-shadow: inset 0 0 0 100px #fff; transition: background-color 99999s;
}
.field [aria-invalid="true"] { border-color: var(--danger); }
.field [aria-invalid="true"]:focus-visible { outline-color: #a3271b26; border-color: var(--danger); }
.amount-wrap { position: relative; }
.amount-wrap::before { content: "$"; position: absolute; left: 10px; top: 50%; translate: 0 -50%; font-family: var(--mono); color: var(--ink-3); }
.amount-wrap input { padding-left: 22px; font-family: var(--mono); }
.err, .field > .err { color: var(--danger); font-size: 0.8125rem; font-weight: 500; line-height: 1.3; }
.quick-actions { display: flex; gap: 8px; }
.quick-actions .btn { flex: 1; }

/* ---------- Table ---------- */
.table-scroll { border-top: 2px solid var(--ink); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0 14px; text-align: left; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 2px; }
th:last-child, td:last-child { padding-right: 2px; }
thead th { height: 42px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
thead button {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; margin: 0 -8px; padding: 0 8px;
  border: 0; border-radius: 6px; background: none; font-weight: inherit; color: inherit;
}
thead button:hover { background: var(--wash); color: var(--ink); }
thead button::after {
  content: ""; width: 14px; height: 14px; opacity: 0.35;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='%231b2440' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 5.5 3-3 3 3M4 8.5l3 3 3-3'/%3E%3C/svg%3E") center / contain no-repeat;
}
th[aria-sort] { color: var(--ink); }
th[aria-sort="ascending"] button::after {
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='%231b2440' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 11.5v-9M3.5 6 7 2.5 10.5 6'/%3E%3C/svg%3E");
}
th[aria-sort="descending"] button::after {
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='%231b2440' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 2.5v9M3.5 8 7 11.5 10.5 8'/%3E%3C/svg%3E");
}
.c-num { text-align: right; }
th.c-num button { flex-direction: row-reverse; }

tbody tr { height: 56px; cursor: pointer; transition: background var(--fast); }
tbody tr:hover { background: var(--wash); }
tbody tr:has(:focus-visible) { background: var(--wash); }
.row-open { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.row-open b { display: block; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.row-open span { display: block; color: var(--ink-3); font-size: 0.8125rem; }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who .avatar { width: 24px; height: 24px; }
td .amt { font-size: 0.9375rem; font-weight: 500; }
td time, td .age { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* a stage label cut like the card tabs: used in table rows and at the top of the drawer */
.tab {
  position: relative; isolation: isolate;
  display: inline-grid; place-items: center; height: 24px; padding: 5px 12px 0; min-width: 96px;
  background: var(--stage) content-box; color: var(--on-stage); line-height: 1; font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.tab::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--stage); border: 1px solid var(--edge); border-bottom: 0; border-radius: 6px 6px 0 0;
  transform: perspective(36px) rotateX(14deg); transform-origin: 50% 100%;
}
.tab[data-stage="won"]::before { border-color: var(--ink); }
td .tab::after { content: ""; position: absolute; inset: auto -3px -1px; height: 1px; background: var(--ink); }

tfoot td { height: 48px; border-bottom: 0; color: var(--ink-2); font-weight: 500; }
tfoot .num { color: var(--ink); font-size: 0.9375rem; font-weight: 500; }
.table-empty { padding: 40px 0; text-align: center; color: var(--ink-2); }

.noscript { margin-top: var(--s5); padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); color: var(--ink-2); }

/* ---------- Drawer ---------- */
.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(460px, 100vw); height: 100dvh; max-width: none; max-height: none;
  border: 0; border-left: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-drawer);
  overflow: hidden; z-index: 30;
  translate: 100% 0;
  transition: translate 380ms var(--ease), overlay 380ms allow-discrete, display 380ms allow-discrete;
}
.drawer[open] { display: flex; flex-direction: column; translate: 0 0; }
@starting-style { .drawer[open] { translate: 100% 0; } }
.scrim {
  position: fixed; inset: 0; z-index: 29; background: #14161c4d;
  opacity: 0; pointer-events: none; transition: opacity 380ms var(--ease);
}
.drawer-open .scrim { opacity: 1; pointer-events: auto; }
html.drawer-open { overflow: hidden; }

.drawer-top {
  flex: none; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 10px 14px 0 24px; border-bottom: 1px solid var(--ink); background: var(--paper);
}
.drawer-top .tab { height: 30px; min-width: 124px; margin-left: 4px; font-size: 0.875rem; }
.drawer-top .icon-btn { margin-bottom: 6px; width: 40px; height: 40px; }

.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px 40px; display: grid; gap: 26px; align-content: start; }
.d-company { color: var(--ink-2); font-weight: 500; font-size: 0.9375rem; }
.d-head h2 { margin-top: 2px; font-size: 1.5rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.d-amount { margin-top: 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; color: var(--ink-2); }
.d-amount .figure { font-size: 1.5rem; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }

.d-stage .select-btn { height: 40px; font-weight: 600; }
.d-email { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.d-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-3); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; padding: 18px 0; border-block: 1px solid var(--line); }
.facts dt { font-size: 0.8125rem; color: var(--ink-3); font-weight: 500; }
.facts dd { margin-top: 2px; font-weight: 500; overflow-wrap: anywhere; }
.facts .who .avatar { width: 20px; height: 20px; }
.facts .wide { grid-column: 1 / -1; }

.drawer h3 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 10px; }
textarea { display: block; height: auto; min-height: 84px; padding: 9px 11px; border-radius: 6px; resize: none; overflow: hidden; line-height: 1.45; background: #fff; } /* grows with the note (script.js), so no resize grip */
textarea[aria-invalid="true"] { border-color: var(--danger); }
#note-err { margin-top: 6px; }
.note-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.saved { color: var(--ink-3); font-size: 0.8125rem; }

.timeline { display: grid; }
.timeline li { position: relative; display: grid; grid-template-columns: 22px 1fr; padding-bottom: 16px; }
.timeline li::before {
  content: ""; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%;
  border: 1.6px solid var(--ink); background: var(--card); position: relative; z-index: 1;
}
.timeline li[data-kind="move"]::before, .timeline li[data-kind="won"]::before { background: var(--ink); }
.timeline li::after { content: ""; position: absolute; left: 4px; top: 8px; bottom: -6px; width: 1px; background: var(--line-2); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline p { text-wrap: pretty; }
.timeline .meta { margin-top: 1px; color: var(--ink-3); font-size: 0.8125rem; }
.timeline li.is-new { animation: fade-in 500ms var(--ease); }

/* ==========================================================================
   Components: the themed kit. Nothing below is a browser or OS control.
   Every popup is a piece of card stock (square corners, cut edge, ruled lines), driven by the tokens above.
     1. Select      .select > .select-btn + .select-pop (a ruled card with a tab) > [role=listbox] > [role=option]
     2. Menu        .menu (popover) > button[role=menuitem]
     3. Tooltip     .tip, a typed label; any element with data-tip gets one on hover and on keyboard focus
     4. Toast       .toast, an ink slip with an optional stage mark and an Undo
     5. Confirm     dialog.confirm, the card itself held up before it is removed
   ========================================================================== */

/* ---------- 1. Select ---------- */
.select { position: relative; min-width: 0; }
.select-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; height: var(--ctl-h); padding: 0 6px 0 10px;
  border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--ink); text-align: left; font-weight: 500;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.select-btn:hover { border-color: var(--ink-3); }
.select-btn:focus-visible { outline: 3px solid #1b244026; outline-offset: 0; border-color: var(--ink); border-radius: 6px; }
.select-btn[aria-expanded="true"] { border-color: var(--ink); }
.select-btn > .i { color: var(--ink-2); transition: rotate 260ms var(--ease); }
.select-btn[aria-expanded="true"] > .i { rotate: 180deg; }
.select-value { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select-value .avatar, .select-pop .avatar { flex: none; width: 20px; height: 20px; }
/* the stage mark: a small divider tab in the stage colour */
.stage-mark { flex: none; width: 16px; height: 11px; background: var(--stage); clip-path: polygon(3px 0, calc(100% - 3px) 0, 100% 100%, 0 100%); }

.select-pop {
  position: fixed; inset: auto; margin: 0; padding: 0; overflow: visible;
  border: 1px solid var(--edge); border-radius: var(--r-card);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-6px) rotate(-0.8deg); transform-origin: 20% 0;
  transition: opacity var(--fast), transform 240ms var(--ease), overlay 240ms allow-discrete, display 240ms allow-discrete;
}
.select-pop:popover-open { opacity: 1; transform: none; }
@starting-style { .select-pop:popover-open { opacity: 0; transform: translateY(-6px) rotate(-0.8deg); } }
.select-tab {
  position: absolute; left: 10px; bottom: 100%; isolation: isolate;
  display: grid; place-items: center; height: 22px; min-width: 64px; padding: 5px 12px 0;
  color: var(--on-ink); font-size: 0.75rem; font-weight: 600; line-height: 1; white-space: nowrap;
}
.select-tab::before {
  content: ""; position: absolute; inset: 0 0 -1px; z-index: -1; background: var(--ink); border-radius: 6px 6px 0 0;
  transform: perspective(36px) rotateX(16deg); transform-origin: 50% 100%;
}
.select-pop [role="listbox"] { margin: 0; padding: 0; list-style: none; max-height: inherit; overflow-y: auto; overscroll-behavior: contain; outline: none; border-top: 2px solid var(--ink); }
.select-pop [role="option"] {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
  border-bottom: 1px solid var(--rule); font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.select-pop [role="option"]:last-child { border-bottom: 0; }
.select-pop [role="option"] > span:not(.stage-mark) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.select-pop [role="option"].is-active { background: var(--paper-2); box-shadow: inset 0 0 0 2px var(--ink); }
.select-pop [role="option"][aria-selected="true"] { font-weight: 700; }
.select-pop [role="option"] small { font-family: var(--mono); font-size: 0.75rem; font-weight: 400; color: var(--ink-3); }
.select-pop [role="option"] > .i { visibility: hidden; }
.select-pop [role="option"][aria-selected="true"] > .i { visibility: visible; }

/* ---------- 2. Menu ---------- */
.menu {
  position: fixed; inset: auto; margin: 0; min-width: 204px; padding: 0; overflow: hidden;
  border: 1px solid var(--edge); border-radius: var(--r-card);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-6px) rotate(0.8deg); transform-origin: 80% 0;
  transition: opacity var(--fast), transform 240ms var(--ease), overlay 240ms allow-discrete, display 240ms allow-discrete;
}
.menu:popover-open { opacity: 1; transform: none; }
@starting-style { .menu:popover-open { opacity: 0; transform: translateY(-6px) rotate(0.8deg); } }
.menu-title { height: 34px; padding: 0 12px; line-height: 33px; font-size: 0.8125rem; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid var(--ink); }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px;
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: none; text-align: left; font-weight: 500;
}
.menu button:last-child { border-bottom: 0; }
.menu button::before { content: ""; width: 16px; height: 11px; background: var(--stage); clip-path: polygon(3px 0, calc(100% - 3px) 0, 100% 100%, 0 100%); }
.menu button:hover, .menu button:focus-visible { background: var(--paper-2); }
.menu button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 0; }
.menu button[aria-disabled="true"] { color: var(--ink-3); cursor: default; }
.menu button[aria-disabled="true"]:hover { background: none; }
.menu button small { margin-left: auto; font-size: 0.75rem; color: var(--ink-3); }

/* ---------- 3. Tooltip ---------- */
.tip {
  position: fixed; left: 0; top: 0; z-index: 70; max-width: min(300px, calc(100vw - 16px));
  padding: 5px 9px 4px; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-card);
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em;
  pointer-events: none; visibility: hidden; opacity: 0; translate: 0 4px;
  transition: opacity 120ms, translate 220ms var(--ease), visibility 0s 120ms;
}
.tip.is-below { translate: 0 -4px; }
.tip.is-on { visibility: visible; opacity: 1; translate: 0 0; transition-delay: 0s; }

/* ---------- 4. Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 40; translate: -50% 0;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 16px; border-radius: var(--r-card);
  background: var(--ink); color: var(--on-ink); box-shadow: 0 2px 6px -2px #0000004d, 0 16px 32px -12px #00000066;
  animation: toast-in 420ms var(--ease);
}
.toast:has(#toast-undo[hidden]) { padding: 12px 18px 12px 16px; }
.toast-mark { flex: none; width: 18px; height: 12px; background: var(--stage); clip-path: polygon(3px 0, calc(100% - 3px) 0, 100% 100%, 0 100%); }
.toast-mark[data-stage="won"] { background: var(--on-ink); }
.toast button {
  height: 32px; margin-left: 2px; padding: 0 12px; border: 0; border-radius: 2px;
  background: #f7f5f01f; color: var(--on-ink); font-weight: 600;
  transition: background var(--fast);
}
.toast button:hover { background: #f7f5f038; }
.toast button:focus-visible { outline-color: var(--on-ink); }

/* ---------- 5. Confirm ---------- */
.confirm {
  --confirm-w: min(420px, calc(100vw - 40px));
  width: var(--confirm-w); max-width: none; margin: auto; padding: 0; overflow: visible;
  border: 1px solid var(--edge); border-radius: var(--r-card);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(-22px) rotate(-3deg);
  transition: opacity 160ms, transform 460ms var(--ease), overlay 460ms allow-discrete, display 460ms allow-discrete;
}
.confirm[open] { opacity: 1; transform: none; }
@starting-style { .confirm[open] { opacity: 0; transform: translateY(-22px) rotate(-3deg); } }
.confirm::backdrop { background: #1b244000; transition: background 320ms, overlay 460ms allow-discrete, display 460ms allow-discrete; }
.confirm[open]::backdrop { background: var(--scrim); }
@starting-style { .confirm[open]::backdrop { background: #1b244000; } }
.confirm .card-tab { --tab-w: 84px; --tab-h: 24px; }
.confirm .card-tab::before { transition: none; }
.confirm[data-stage="won"] .card-tab::before { border-color: var(--ink); }
.confirm .card-co { height: 40px; line-height: 39px; padding: 0 20px; font-size: 0.875rem; border-bottom: 2px solid var(--stage); }
/* the question is written on the card's ruled lines */
.confirm-body {
  --pitch: 30px;
  padding: 12px 20px 0;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--pitch) - 1px), var(--rule) calc(var(--pitch) - 1px) var(--pitch)) 0 12px;
}
.confirm-body h2 { padding-top: 6px; font-size: 1.25rem; line-height: var(--pitch); font-weight: 700; letter-spacing: -0.025em; text-wrap: pretty; overflow-wrap: anywhere; }
.confirm-body p { padding-bottom: 5px; line-height: var(--pitch); color: var(--ink-2); font-size: 0.9375rem; text-wrap: pretty; }
.confirm-body p b { color: var(--ink); font-weight: 600; font-family: var(--mono); font-size: 0.875rem; letter-spacing: -0.01em; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }
.confirm .btn { height: 40px; padding: 0 16px; }

/* ---------- Drag states ---------- */
.card.is-dragging {
  position: fixed; z-index: 60; margin: 0; pointer-events: none; cursor: grabbing;
  border-color: #14161c66; box-shadow: var(--shadow-lift); translate: none;
  transition: box-shadow var(--med) var(--ease);
  will-change: transform;
}
.card.is-dropping { transition: transform 300ms var(--ease), box-shadow 300ms var(--ease); box-shadow: var(--shadow-card); }
.card.is-flying { z-index: 5; box-shadow: var(--shadow-lift); }
.card.just-dropped { animation: settle 460ms var(--ease); }
.slot {
  margin-top: calc(var(--tab-h) + 10px); border: 1.5px dashed #1b24405c; border-radius: var(--r-card);
  background: #1b24400d;
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
body.is-dragging .card:not(.is-dragging):hover { translate: none; border-color: var(--edge); box-shadow: var(--shadow-card); }

@keyframes settle {
  0% { transform: rotate(-1.4deg) scale(1.02); box-shadow: var(--shadow-lift); }
  55% { transform: rotate(0.5deg) scale(1); }
  100% { transform: none; box-shadow: var(--shadow-card); }
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-8px) rotate(-1deg); } }
@keyframes toast-in { from { opacity: 0; translate: -50% 12px; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes bump { 30% { translate: 0 -7px; } }
@keyframes called { 0%, 35% { background: #e2ddd0; box-shadow: inset 0 0 0 2px var(--ink); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .readouts { gap: var(--s6); }
  .readouts small { display: none; }
  .readouts .figure { font-size: 1.75rem; }
  .board {
    grid-template-columns: repeat(5, minmax(244px, 1fr));
    margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) 8px;
    overflow-x: auto; scroll-padding-inline: var(--gutter); overscroll-behavior-x: contain;
  }
}

@media (max-width: 900px) {
  .overview-head { grid-template-columns: minmax(0, 1fr); }
  .readouts { justify-content: flex-start; }
}

@media (max-width: 760px) {
  :root { --ctl-h: 44px; }
  .top { height: 52px; gap: var(--s3); }
  .brand { height: 44px; }
  .nav, .workspace { display: none; }
  .nav-toggle { display: grid; }
  .avatar.me { width: 30px; height: 30px; }

  main { padding-top: var(--s5); }
  .overview-head { gap: var(--s5); }
  .title h1 { font-size: 2.75rem; }
  .title p { margin-top: 8px; font-size: 0.875rem; }
  .title-dates { display: none; }
  .title .link { padding: 4px 0; }
  .readouts { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: var(--s3); }
  .readouts dt { font-size: 0.8125rem; }
  .readouts .figure { font-size: 1.375rem; }

  /* the dividers keep their stepped tabs but lose the writing: the legend below carries the figures */
  .strip { --seg-tab-h: 9px; height: 44px; margin-top: calc(var(--seg-tab-h) + var(--s4)); }
  .seg { min-width: 26px; }
  .seg-tab { width: min(36px, 76%); left: calc((100% - min(36px, 76%)) * var(--tab-at)); padding: 0; font-size: 0; }
  .seg-tab::before { border-radius: 4px 4px 0 0; transform: perspective(24px) rotateX(18deg); }
  .seg-body { display: none; }
  .legend {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--s5); margin-top: var(--s3);
    font-size: 0.8125rem;
  }
  .legend li { display: flex; align-items: center; gap: 7px; }
  .legend li::before { content: ""; width: 12px; height: 9px; border-radius: 3px 3px 0 0; background: var(--stage); }
  .legend li.total::before { background: none; border: 1px solid var(--line-2); border-radius: 2px; }
  .legend .num { margin-left: auto; }

  .toolbar { gap: var(--s3); margin: var(--s5) 0; }
  .search { order: 1; flex: 1 1 180px; max-width: none; }
  .search input { padding-right: 12px; text-overflow: ellipsis; }
  .search-clear { right: 0; width: 44px; height: 44px; }
  .search kbd { display: none; }
  .toolbar > .btn.primary { order: 2; flex: none; }
  .btn-more { display: none; }
  .owners { order: 3; margin-left: -6px; }
  .owners { gap: 0; }
  .owner { width: 44px; height: 44px; }
  .owner img { width: 34px; height: 34px; }
  .owner::after { inset: 2px; }
  .views { order: 4; }
  .views { padding: 0; border-radius: var(--r-ctl); }
  .views button { height: 44px; padding: 0 16px; border-radius: var(--r-ctl); }
  .views button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-card); }
  .views .i { display: none; }
  .filter-status { order: 5; flex: 1 0 100%; }

  .board {
    grid-template-columns: repeat(5, min(82vw, 320px)); gap: var(--s4);
    scroll-snap-type: x mandatory;
  }
  .col { scroll-snap-align: start; }
  .col-add { width: 44px; height: 44px; margin: -8px -8px -8px 0; }
  .card { --pitch: 32px; --card-head: 36px; }
  .card h3 { padding-top: 1px; font-size: 1.0625rem; }
  .card .amt { font-size: 1rem; }
  .card-move { width: 44px; height: 44px; margin: -6px -13px -6px -6px; }
  .card-foot .avatar { width: 24px; height: 24px; }

  .c-owner, .c-close, .c-age { display: none; }
  th, td { padding: 0 8px; }
  tbody tr { height: 62px; }
  td .tab { min-width: 0; }
  thead button { height: 44px; }

  .drawer { border-left: 0; }
  .drawer-top { padding-left: 16px; padding-right: 8px; }
  .drawer-top .icon-btn { width: 44px; height: 44px; }
  .drawer-body { padding: 20px 16px 40px; }
  .field input, .select-btn { font-size: 1rem; }
  .select-pop [role="option"] { height: 46px; font-size: 1rem; }
  .confirm-actions .btn { flex: 1; height: 44px; }
  .d-foot { flex-wrap: wrap; }
  textarea, .search input { font-size: 1rem; }

  .toast { bottom: 56px; width: max-content; }
  .toast button { height: 44px; padding: 0 16px; }
  .menu button { height: 46px; font-size: 1rem; }
}

@media (max-width: 380px) {
  .readouts .figure { font-size: 1.1875rem; }
  .views button { padding: 0 10px 0 8px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}
