/* The kit (PHASE3_PLAN step 2, REDESIGN §5 and §8): the pieces every page is built from, one class
   family each, in tokens only (ops/site/rawcheck.py enforces colours, layers and spacing here).
   Components with behaviour live in src/kit/. Pages move onto these as phase 4 rebuilds them. */

.k-icon-btn { display: inline-grid; place-items: center; min-width: 2.75rem; min-height: 2.75rem; margin: 0; padding: 0;
  background: transparent; border: 0; border-radius: var(--r-panel); color: var(--dim); cursor: pointer; }
.k-icon-btn:hover { background: var(--hover); color: var(--ink); }
.k-icon-btn .ic { width: 1.375rem; height: 1.375rem; }

/* ---- Buttons: main (the one action), plain, big (a full-width main step), icon above. ---- */
.k-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 2.75rem;
  margin: 0; padding: 0 var(--s4); border: 0; border-radius: var(--r-panel); font: inherit; font-weight: var(--w-bold);
  background: var(--panel3); color: var(--ink); cursor: pointer; text-decoration: none; }
.k-btn:hover { background: var(--hover); }
.k-btn.main { background: var(--accent); color: var(--on-accent);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, var(--black)); }
.k-btn.main:hover { background: color-mix(in srgb, var(--accent) 88%, var(--black)); }
.k-btn.big { width: 100%; min-height: 3.25rem; border-radius: var(--r-card); font-size: var(--fs-md); }
.k-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

/* ---- Sheet (src/kit: Sheet, SheetHead): from the bottom on a phone, a panel at the corner from
   600 px; its head stays in view. ---- */
.k-scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: transparent; }

.k-sheet { position: fixed; z-index: var(--z-sheet); left: 0; right: 0; bottom: 0; max-height: 85dvh; overflow-y: auto;
  background: var(--panel); color: var(--ink); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: 0 -8px 24px var(--shade);
  padding: 0 var(--s4) calc(var(--s4) + env(safe-area-inset-bottom)); }
@media (min-width: 600px) {
  .k-sheet { left: auto; right: var(--s4); bottom: var(--s4); width: 26rem; border-radius: var(--r-sheet);
    box-shadow: 0 8px 24px var(--shade); }
}
.k-sheet-head { position: sticky; top: 0; z-index: var(--z-page); display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); margin: 0 calc(-1 * var(--s4)) var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--panel); border-bottom: 1px solid var(--line); }
.k-sheet-head h2 { margin: 0; font-size: var(--fs-md); }
.k-sheet-head h2:focus { outline: none; }

/* ---- Toast: one at a time, above everything, at the foot. ---- */
.k-toast { position: fixed; z-index: var(--z-toast); left: var(--s4); right: var(--s4); bottom: calc(var(--s4) + var(--bottom-bar));
  display: flex; align-items: center; gap: var(--s3); max-width: 32rem; margin: 0 auto; padding: var(--s3) var(--s4);
  background: var(--ink); color: var(--bg); border-radius: var(--r-card); box-shadow: 0 4px 12px var(--shade-deep); }

/* ---- Seg: a segmented control (one choice of a few). ---- */
.k-seg { display: inline-flex; gap: var(--s1); padding: var(--s1); background: var(--panel2); border-radius: var(--r-panel); }
.k-seg button { margin: 0; padding: var(--s2) var(--s3); border: 0; border-radius: var(--r-control); background: transparent;
  color: var(--dim); font: inherit; font-weight: var(--w-bold); cursor: pointer; }
.k-seg button[aria-pressed=true], .k-seg button[aria-selected=true] { background: var(--knob); color: var(--ink); box-shadow: var(--shadow); }

/* ---- Card and Tile (Home): a card leads with a tinted head; tiles are equal and small. ---- */
.k-card { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s3); background: var(--panel);
  border-radius: var(--r-card); box-shadow: var(--shadow); min-width: 0; }
.k-tile { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); background: var(--panel);
  border-radius: var(--r-card); box-shadow: var(--shadow); min-width: 0; color: inherit; text-decoration: none; }
.k-card h3, .k-tile h3 { margin: 0; font-size: var(--fs-sm); }

/* ---- AreaMark: an area's icon on its colour tile (D-AR.17). ---- */
.k-area { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: var(--r-control);
  background: var(--ink); color: var(--bg); }
.k-area.pz { background: var(--pz); color: var(--on-area); }
.k-area.gs { background: var(--gs); color: var(--on-area); }
.k-area.rp { background: var(--rp); color: var(--on-area); }
.k-area.an { background: var(--accent); color: var(--on-accent); }
.k-area .ic { width: 1.125rem; height: 1.125rem; }

/* ---- PageHead: Back, the title, an action at the end. ---- */
.k-pagehead { display: flex; align-items: center; gap: var(--s2); min-height: 3rem; margin: 0 0 var(--s3); }
.k-pagehead h1 { flex: 1; margin: 0; font-size: var(--fs-lg); min-width: 0; }

/* ---- Quiet list and table: the dense panes (D-AR.23): thin lines, no shadows. ---- */
.k-quiet { margin: 0; padding: 0; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); }
.k-quiet > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-top: 1px solid var(--line); }
.k-quiet > li:first-child { border-top: 0; }
.k-quiet > li[aria-current=true], .k-quiet > li.chosen { background: var(--acc-soft); }
.k-quiet-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.k-quiet-table th { text-align: left; font-weight: var(--w-bold); color: var(--dim); padding: var(--s2); border-bottom: 1px solid var(--line); }
.k-quiet-table td { padding: var(--s2); border-bottom: 1px solid var(--line); }
.k-quiet-table tr[aria-selected=true] td { background: var(--acc-soft); }

/* ---- Loading and Empty: what a block shows before and without its content. ---- */
.k-loading { padding: var(--s5) var(--s4); color: var(--dim); text-align: center; }
.k-empty { display: grid; justify-items: center; gap: var(--s2); padding: var(--s6) var(--s4); color: var(--dim); text-align: center; }
.k-empty .ic { width: 2rem; height: 2rem; }

/* ---- BoardStage: one board-sizing rule for every board page (D-AR.19, D-AR.23): as big as the
   width allows, never taller than the screen leaves after the page's own bars (--stage-chrome). ---- */
.k-stage { --stage-chrome: var(--board-chrome); width: min(100%, calc(var(--vh) - var(--stage-chrome))); margin: 0 auto; }
.k-stage > * { width: 100%; aspect-ratio: 1; }

/* ---- Menu bar (src/shell/menus.rs; D-AR.19): the desktop's, across the top beside the side bar;
   menus follow the place; search on the right. The focus key (.) hides it and the side bar. ---- */
.menubar-wrap { display: none; }
:root[data-format=desk] { --frame-t: 2.5rem; }
:root[data-format=desk] body { padding-top: var(--frame-t); }
:root[data-format=desk] .menubar-wrap { display: block; position: fixed; z-index: var(--z-bar); top: 0; right: 0; left: var(--frame-l);
  height: var(--frame-t); background: var(--rail); box-shadow: 0 1px 0 var(--line); }
.menubar { display: flex; align-items: center; height: 100%; padding: 0 var(--s2); gap: 0; font-size: var(--fs-sm); }
.mb-menu { position: relative; }
.mb-name { margin: 0; min-height: 0; height: 1.875rem; padding: 0 var(--s3); border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--ink); font: inherit; cursor: default; }
.mb-name:hover, .mb-name[aria-expanded=true] { background: var(--acc-soft); }
.mb-drop { position: absolute; z-index: var(--z-sheet); top: calc(100% + var(--s1)); left: 0; min-width: 16rem; display: grid;
  padding: var(--s1); background: var(--panel); border-radius: var(--r-panel); box-shadow: 0 8px 24px var(--shade); }
.mb-item { display: flex; align-items: center; gap: var(--s5); width: 100%; margin: 0; min-height: 0; padding: var(--s1) var(--s3);
  border: 0; border-radius: var(--r-control); background: transparent; color: var(--ink); font: inherit; text-align: left;
  text-decoration: none; white-space: nowrap; cursor: default; }
.mb-item:hover, .mb-item:focus-visible { background: var(--accent); color: var(--on-accent); outline: none; }
.mb-key { margin-left: auto; border: 0; background: none; padding: 0; color: inherit; opacity: 0.7; }
.mb-key.none { display: none; }
.mb-sep { margin: var(--s1) var(--s2); border: 0; border-top: 1px solid var(--line); }
.mb-gap { flex: 1; }
.mb-search { display: inline-flex; align-items: center; gap: var(--s2); margin: 0; min-height: 0; height: 1.875rem; width: 20rem;
  padding: 0 var(--s2) 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--panel);
  color: var(--dim); font: inherit; cursor: text; }
.mb-search span { flex: 1; text-align: left; }
.mb-search kbd { font-size: var(--fs-xs); }
/* Focus (.): the side bar and menus step aside; Esc brings them back. */
:root[data-focus] { --frame-l: 0px; --frame-t: 0px; }
:root[data-focus] .frame, :root[data-focus] .menubar-wrap { display: none; }
/* You holds the small print and colours itself. */
body:has(.you-list) footer { display: none; }
