/* AA Systems engine — engine.css
   Tokens, shell, and every primitive. Light and dark. No third-party origins.
   Fonts come from /assets/fonts/fonts.css (Bricolage Grotesque, Public Sans, JetBrains Mono).
*/

/* ============================================================== tokens == */

:root {
  --accent-h: 28;
  --accent-s: 90%;
  --accent-l: 46%;

  --bg: hsl(60 8% 97%);
  --surface: #fff;
  --surface-2: hsl(60 6% 94%);
  --surface-3: hsl(60 6% 91%);
  --ink: hsl(220 14% 8%);
  --ink-2: hsl(220 8% 26%);
  --ink-mute: hsl(220 4% 44%);
  --line: hsl(220 10% 89%);
  --line-2: hsl(220 10% 94%);

  --accent: hsl(var(--accent-h) var(--accent-s) var(--accent-l));
  --accent-ink: hsl(var(--accent-h) 62% 26%);
  --accent-soft: hsl(var(--accent-h) 80% 96%);
  --accent-soft-2: hsl(var(--accent-h) 70% 90%);
  --accent-on: hsl(28 72% 11%);

  --ok: hsl(152 60% 30%);
  --ok-soft: hsl(152 48% 94%);
  --warn: hsl(38 90% 34%);
  --warn-soft: hsl(38 90% 94%);
  --bad: hsl(4 70% 44%);
  --bad-soft: hsl(4 74% 96%);
  --info: hsl(210 70% 40%);
  --info-soft: hsl(210 74% 95%);

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --sans: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px hsl(220 14% 8% / 0.06);
  --shadow-2: 0 8px 24px hsl(220 14% 8% / 0.1);
  --shadow-3: 0 18px 48px hsl(220 14% 8% / 0.16);

  --side-w: 232px;
  --side-w-collapsed: 64px;
  --top-h: 58px;
  --brand-h: 58px;
  --pad: 20px;
  --ease: cubic-bezier(0.22, 0.68, 0.36, 1);
  --t-fast: 130ms;
  --t: 160ms;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: hsl(222 16% 8%);
  --surface: hsl(222 14% 11%);
  --surface-2: hsl(222 13% 14%);
  --surface-3: hsl(222 12% 18%);
  --ink: hsl(220 20% 96%);
  --ink-2: hsl(220 12% 78%);
  --ink-mute: hsl(220 8% 58%);
  --line: hsl(222 12% 21%);
  --line-2: hsl(222 12% 16%);

  --accent: hsl(var(--accent-h) calc(var(--accent-s) - 12%) 58%);
  --accent-ink: hsl(var(--accent-h) 80% 72%);
  --accent-soft: hsl(var(--accent-h) 40% 16%);
  --accent-soft-2: hsl(var(--accent-h) 40% 22%);
  --accent-on: hsl(222 20% 8%);

  --ok: hsl(152 52% 60%);
  --ok-soft: hsl(152 34% 16%);
  --warn: hsl(38 84% 62%);
  --warn-soft: hsl(38 40% 17%);
  --bad: hsl(4 74% 66%);
  --bad-soft: hsl(4 38% 18%);
  --info: hsl(210 74% 66%);
  --info-soft: hsl(210 38% 17%);

  --shadow-1: 0 1px 2px hsl(0 0% 0% / 0.4);
  --shadow-2: 0 10px 28px hsl(0 0% 0% / 0.45);
  --shadow-3: 0 20px 54px hsl(0 0% 0% / 0.55);

  color-scheme: dark;
}

/* =============================================================== base == */

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

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

body.ov-open { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.014em;
  margin: 0;
  color: var(--ink);
}

p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

a { color: var(--accent-ink); }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

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

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

.ta-right { text-align: right; }
.ta-center { text-align: center; }
.t-ok { color: var(--ok); }
.t-bad { color: var(--bad); }
.t-warn { color: var(--warn); }
.t-info { color: var(--info); }
.t-mute { color: var(--ink-mute); }
.t-accent { color: var(--accent-ink); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink-mute) 32%, transparent);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink-mute) 52%, transparent); background-clip: padding-box; }

/* ============================================================== shell == */

#app { height: 100%; }

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--brand-h) minmax(0, 1fr);
  grid-template-areas: "brand top" "side view";
  height: 100%;
  transition: grid-template-columns var(--t) var(--ease);
}
.app.is-collapsed { grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr); }

/* brand ------------------------------------------------------------- */
.brand {
  grid-area: brand;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-on);
}
.brand__mark svg { display: block; }
.brand__txt { min-width: 0; flex: 1; }
.brand__name {
  font-size: 14px;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; margin: 0; }
.brand__tag {
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__collapse {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: var(--surface);
  transition: opacity var(--t-fast) var(--ease);
}
.brand:hover .brand__collapse,
.brand:focus-within .brand__collapse { opacity: 1; }
.is-collapsed .brand { padding: 0 8px; justify-content: center; }
.is-collapsed .brand__txt { display: none; }
.is-collapsed .brand__collapse { position: static; transform: none; opacity: 1; }

/* sidebar ----------------------------------------------------------- */
.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.side__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.side__grp {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 14px 8px 6px;
}
.is-collapsed .side__grp { text-align: center; padding: 12px 0 4px; overflow: hidden; }

.side__i {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.side__i .ic { flex: 0 0 auto; opacity: 0.8; }
.side__il { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__i:hover { background: var(--surface-2); color: var(--ink); }
.side__i.is-on {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.side__i.is-on .ic { opacity: 1; }
.side__i.is-on::before {
  content: "";
  position: absolute;
  left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.side__ib {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: none;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-on);
  font: 600 10.5px/1 var(--mono);
}
.side__ib.is-on { display: grid; }
.is-collapsed .side__i { justify-content: center; padding: 9px 0; }
.is-collapsed .side__il, .is-collapsed .side__ib { display: none; }
.is-collapsed .side__i.is-on::before { left: 0; }

.side__foot {
  border-top: 1px solid var(--line-2);
  padding: 12px 14px 14px;
}
.side__demo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 4px 9px 4px 7px;
}
.side__note {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-mute);
}
.is-collapsed .side__foot { padding: 10px 8px; }
.is-collapsed .side__note { display: none; }
.is-collapsed .side__demo span { display: none; }
.is-collapsed .side__demo { padding: 5px; border-radius: 8px; }

/* topbar ------------------------------------------------------------ */
.top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
}
.top__titles { min-width: 0; flex: 1; }
.top__t {
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top__s {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top__a { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.top__search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px 0 10px;
  min-width: 168px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-mute);
  font: 400 13px var(--sans);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.top__search:hover { border-color: var(--ink-mute); background: var(--surface); }
.top__searcht { flex: 1; text-align: left; }
.top__kbd {
  font: 500 10.5px var(--mono);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  background: var(--surface);
  color: var(--ink-mute);
}

.top__menuwrap { position: relative; flex: 0 0 auto; }
.top__demo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font: 600 12.5px var(--sans);
  cursor: pointer;
}
.top__demo:hover { border-color: var(--ink-mute); color: var(--ink); }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 216px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.menu__i {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font: 500 13px var(--sans);
  text-align: left;
  cursor: pointer;
}
.menu__i:hover { background: var(--surface-2); color: var(--ink); }
.menu__i .ic { opacity: 0.75; flex: 0 0 auto; }
.menu__i > span:nth-of-type(1) { flex: 1; }
.menu__hint { font: 500 11px var(--mono); color: var(--ink-mute); }

/* view -------------------------------------------------------------- */
.view {
  grid-area: view;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: var(--pad);
  scroll-behavior: smooth;
}
.view:focus { outline: none; }

.tabbar { display: none; }

.boot {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 80px 0;
  color: var(--ink-mute);
  font-size: 13px;
}
.boot__s {
  width: 22px; height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ layout ==== */

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1fr) 320px; }
.grid--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ============================================================ buttons == */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 600 13px/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(0.5px); }
.btn[disabled] { opacity: 0.42; cursor: not-allowed; }
.btn .ic { flex: 0 0 auto; }
.btn--block { width: 100%; }
.btn--sm { height: 27px; padding: 0 8px; font-size: 12px; gap: 5px; }
.btn--lg { height: 38px; padding: 0 16px; font-size: 14px; }

.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover:not([disabled]) { border-color: var(--ink-mute); color: var(--ink); }

.btn--quiet { background: transparent; color: var(--ink-mute); }
.btn--quiet:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }

.btn--primary { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.btn--primary:hover:not([disabled]) { background: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) - 6%)); }
[data-theme="dark"] .btn--primary:hover:not([disabled]) { background: hsl(var(--accent-h) var(--accent-s) 66%); }

.btn--soft { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.btn--soft:hover:not([disabled]) { background: var(--accent-soft-2); }

.btn--danger { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn--danger:hover:not([disabled]) { background: var(--bad); color: #fff; }

.btn--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn--ok:hover:not([disabled]) { background: var(--ok); color: var(--surface); }

.btnbar { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.btnbar .btn { border: 0; border-radius: 0; height: 30px; }
.btnbar .btn + .btn { border-left: 1px solid var(--line); }
.btnbar .btn.is-on { background: var(--accent-soft); color: var(--accent-ink); }

/* =============================================================== bits == */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge--neutral { background: var(--surface-2); color: var(--ink-2); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge--outline { background: transparent; border: 1px solid var(--line); color: var(--ink-mute); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  font: 500 11.5px/1 var(--sans);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip .ic { opacity: 0.75; }
.chip--ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); background: var(--ok-soft); }
.chip--bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); background: var(--bad-soft); }
.chip--warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); background: var(--warn-soft); }
.chip--info { border-color: color-mix(in srgb, var(--info) 40%, transparent); color: var(--info); background: var(--info-soft); }
.chip--accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-ink); background: var(--accent-soft); }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: hsl(var(--av-h) 62% 24%);
  background: hsl(var(--av-h) 58% 86%);
  box-shadow: inset 0 0 0 1px hsl(var(--av-h) 40% 70% / 0.55);
  user-select: none;
}
[data-theme="dark"] .avatar {
  color: hsl(var(--av-h) 70% 84%);
  background: hsl(var(--av-h) 32% 24%);
  box-shadow: inset 0 0 0 1px hsl(var(--av-h) 40% 44% / 0.6);
}
.avstack { display: inline-flex; }
.avstack .avatar + .avatar { margin-left: -7px; }

.prog {
  height: 6px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.prog i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width var(--t) var(--ease); }
.prog--ok i { background: var(--ok); }
.prog--bad i { background: var(--bad); }
.prog--warn i { background: var(--warn); }

/* =============================================================== card == */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
}
.card__titles { flex: 1; min-width: 0; }
.card__title { font-size: 13.5px; font-weight: 700; letter-spacing: -0.005em; }
.card__sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.card__actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.card__body { padding: 16px; flex: 1; min-width: 0; }
.card__body--flush { padding: 0; }

.sec-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}
.sec-head__t { font-size: 15px; }
.sec-head__s { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; }
.sec-head__a { margin-left: auto; display: flex; gap: 6px; }

.kv { display: flex; gap: 10px; padding: 6px 0; align-items: baseline; }
.kv__k { flex: 0 0 116px; font-size: 12px; color: var(--ink-mute); }
.kv__v { flex: 1; min-width: 0; font-size: 13px; color: var(--ink); word-break: break-word; }

.panel {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.divider { height: 1px; background: var(--line-2); margin: 14px 0; border: 0; }

/* =============================================================== stat == */

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px 14px;
  box-shadow: var(--shadow-1);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}
.stat--btn { cursor: pointer; font: inherit; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.stat--btn:hover { border-color: var(--ink-mute); box-shadow: var(--shadow-2); }
.stat__top { display: flex; align-items: center; gap: 8px; }
.stat__l {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat__ic { color: var(--ink-mute); opacity: 0.7; display: grid; }
.stat__v {
  font-size: 25px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.028em;
  color: var(--ink);
}
.stat__b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat__d { display: inline-flex; align-items: center; gap: 1px; font: 600 11.5px var(--mono); }
.stat__d.is-up { color: var(--ok); }
.stat__d.is-down { color: var(--bad); }
.stat__s { font-size: 11.5px; color: var(--ink-mute); }
.spark { width: 100%; height: 26px; margin-top: 6px; display: block; }
.spark__l { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.spark__f { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }

/* ============================================================== table == */

.tbl {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tbl__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
}
.tbl__search {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  max-width: 320px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-mute);
}
.tbl__search:focus-within { border-color: var(--accent); background: var(--surface); }
.tbl__searchi {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: 400 13px var(--sans);
  color: var(--ink);
  outline: none;
}
.tbl__tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tbl__scroll { overflow: auto; max-height: 100%; }
.tbl__t { width: 100%; border-collapse: separate; border-spacing: 0; }

.tbl__th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  height: 34px;
  text-align: left;
  font: 700 10.5px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
}
.tbl__th.ta-right { text-align: right; }
.tbl__th.ta-center { text-align: center; }
.tbl__sortb {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.tbl__th.ta-right .tbl__sortb { flex-direction: row-reverse; }
.tbl__sorti { opacity: 0.4; }
.tbl__sortb:hover { color: var(--ink); }
.tbl__sortb:hover .tbl__sorti { opacity: 0.8; }
.tbl__th[aria-sort] .tbl__sorti { opacity: 1; color: var(--accent-ink); }

.tbl__c {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--ink-2);
  vertical-align: middle;
}
.tbl--dense .tbl__c { padding: 6px 12px; font-size: 12.5px; }
.tbl__c.ta-right { text-align: right; }
.tbl__c.ta-center { text-align: center; }
.tbl__r:last-child .tbl__c { border-bottom: 0; }
.tbl__r--click { cursor: pointer; }
.tbl__r--click:hover .tbl__c { background: var(--surface-2); }
.tbl__r--click:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tbl__emptycell { padding: 0 !important; border-bottom: 0 !important; }

.tbl__foot {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid var(--line-2);
  min-height: 0;
}
.tbl__foot:empty { display: none; }
.tbl__pg { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; }
.tbl__pgt { font: 500 11.5px var(--mono); color: var(--ink-mute); }
.tbl__pgb { margin-left: auto; display: flex; gap: 5px; }

.cellmain { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cellmain__t { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cellmain__s { font-size: 11.5px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cellmain__txt { min-width: 0; }

/* ============================================================= kanban == */

.kb { display: flex; flex-direction: column; min-width: 0; }
.kb__live { position: absolute; }
.kb__board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  align-items: flex-start;
}
.kb__col {
  flex: 1 0 232px;
  min-width: 232px;
  max-width: 320px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  max-height: 100%;
}
.kb__head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 8px;
  flex: 0 0 auto;
}
.kb__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.kb__t {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb__n {
  font: 600 10.5px/1 var(--mono);
  color: var(--ink-mute);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 6px;
}
.kb__sum { margin-left: auto; font-size: 11px; color: var(--ink-mute); font-weight: 500; }
.kb__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 8px 10px;
  overflow-y: auto;
  min-height: 60px;
  flex: 1;
}
.kb__none {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-mute);
}
.kb__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  box-shadow: var(--shadow-1);
  cursor: grab;
  touch-action: none;
  transition: box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.kb__card:hover { border-color: var(--ink-mute); box-shadow: var(--shadow-2); }
.kb__card.is-dragging { opacity: 0.35; }
.kb__card.is-grabbed { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft-2); }
.kb__ghost {
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  pointer-events: none;
  transform: rotate(1.5deg);
  box-shadow: var(--shadow-3);
  border-color: var(--accent);
  opacity: 0.96;
}
.kb__ph {
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  flex: 0 0 auto;
}
body.kb-dragging { cursor: grabbing; user-select: none; }
body.kb-dragging .kb__card { cursor: grabbing; }

.kbc__top { display: flex; align-items: flex-start; gap: 8px; }
.kbc__t { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.kbc__v { font: 600 12px var(--mono); color: var(--ink); white-space: nowrap; }
.kbc__m { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.kbc__s { font-size: 11.5px; color: var(--ink-mute); display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.kbc__s span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbc__age { margin-left: auto; font: 500 10.5px var(--mono); color: var(--ink-mute); white-space: nowrap; }
.kbc__age.is-stale { color: var(--bad); }

/* =========================================================== calendar == */

.cal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cal__scroll { overflow: auto; position: relative; max-height: min(660px, calc(100vh - 220px)); }
.cal__inner { display: flex; flex-direction: column; min-width: 100%; }
.cal__head {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 5;
}
.cal__gutterhead {
  flex: 0 0 56px;
  border-right: 1px solid var(--line-2);
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--surface-2);
}
.cal__dh {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 6px 5px;
  border-left: 1px solid var(--line-2);
  text-align: center;
}
.cal__dh.is-today { background: var(--accent-soft); }
.cal__dhd {
  display: block;
  font: 700 10px/1.4 var(--sans);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal__dhn { display: block; font: 600 15px/1.2 var(--mono); color: var(--ink); }
.cal__dhn--sm { font-size: 10.5px; color: var(--ink-mute); font-weight: 500; }
.cal__dh.is-today .cal__dhn { color: var(--accent-ink); }
.cal__lanes { display: flex; margin-top: 4px; }
.cal__lane {
  flex: 1 1 0;
  min-width: 0;
  font: 600 9px/14px var(--mono);
  color: var(--ink-mute);
  border-top: 2px solid var(--lane-c, var(--line));
  overflow: hidden;
  white-space: nowrap;
}

.cal__grid { display: flex; position: relative; }
.cal__gutter {
  flex: 0 0 56px;
  border-right: 1px solid var(--line-2);
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
}
.cal__hr {
  height: 63px;
  position: relative;
}
.cal__hr span {
  position: absolute;
  top: -7px;
  right: 8px;
  font: 500 10.5px var(--mono);
  color: var(--ink-mute);
}
.cal__hr:first-child span { top: 2px; }
.cal__day { flex: 1 1 0; min-width: 0; display: flex; border-left: 1px solid var(--line-2); position: relative; }
.cal__day.is-today { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.cal__lanecol { flex: 1 1 0; min-width: 0; position: relative; }
.cal__lanecol + .cal__lanecol { border-left: 1px dotted var(--line); }
.cal__slot {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-2);
  background: none;
  padding: 0;
  cursor: pointer;
}
.cal__slot:nth-child(even) { border-bottom-style: dashed; }
.cal__slot:hover { background: var(--accent-soft); }
.cal__slot:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.cal__ev {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 5px;
  border: 0;
  border-left: 3px solid var(--ev-c);
  border-radius: 4px;
  background: color-mix(in srgb, var(--ev-c) 16%, var(--surface));
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  font: 600 11px/1.25 var(--sans);
  transition: box-shadow var(--t-fast) var(--ease);
}
.cal__ev:hover { box-shadow: var(--shadow-2); z-index: 4; }
.cal__ev.is-dragging { opacity: 0.85; box-shadow: var(--shadow-3); z-index: 20; }
.cal__evt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.cal__evs { font-weight: 400; font-size: 10px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__evh { font: 500 9.5px var(--mono); color: var(--ink-mute); }
.cal__ev--done { opacity: 0.62; }
body.cal-dragging { user-select: none; cursor: grabbing; }

.cal__now {
  position: absolute;
  left: 0; right: 0;
  height: 0;
  border-top: 2px solid var(--bad);
  z-index: 5;
  pointer-events: none;
}
.cal__now::before {
  content: "";
  position: absolute;
  left: -4px; top: -4px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bad);
}

.calm { padding: 10px; }
.calm__head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.calm__head span { text-align: center; font: 700 10px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.calm__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calm__c {
  aspect-ratio: 1.25;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
}
.calm__c.is-out { opacity: 0.4; }
.calm__c.is-today { border-color: var(--accent); background: var(--accent-soft); }
.calm__n { font: 600 12px var(--mono); }
.calm__dots { display: flex; gap: 2px; }
.calm__dots i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.calm__more { font: 500 9px var(--mono); color: var(--ink-mute); }

/* =============================================================== form == */

.form { display: flex; flex-direction: column; min-width: 0; }
.form__grid { display: grid; grid-template-columns: 1fr; gap: 13px; }
.form__grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form__grid .span2 { grid-column: 1 / -1; }
.form__heading {
  font: 700 10.5px var(--sans);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-top: 6px;
  border-top: 1px solid var(--line-2);
  margin-top: 2px;
}
.form__grid > .form__heading:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__l { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; gap: 3px; }
.field__req { color: var(--bad); }
.field__h { font-size: 11.5px; color: var(--ink-mute); line-height: 1.35; }
.field__e { font-size: 11.5px; color: var(--bad); font-weight: 600; }
.field__e:empty { display: none; }
.field__static { font-size: 13px; color: var(--ink); padding: 6px 0; }
.field__wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.field__wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field__wrap .input { border: 0 !important; box-shadow: none !important; border-radius: 0; }
.field__pre, .field__suf {
  padding: 0 9px;
  font: 500 12.5px var(--mono);
  color: var(--ink-mute);
  background: var(--surface-2);
  align-self: stretch;
  display: grid;
  place-items: center;
}
.field__suf { border-left: 1px solid var(--line); }
.field__pre { border-right: 1px solid var(--line); }
.field__pre:empty, .field__suf:empty { display: none; }

.input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 400 13.5px var(--sans);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--ink-mute); opacity: 0.75; }
.input--area { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; font-family: var(--sans); }
.input--money { font-family: var(--mono); font-variant-numeric: tabular-nums; }
select.input { appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field.is-bad .input, .field.is-bad .field__wrap { border-color: var(--bad); }

.field--toggle { flex-direction: row; align-items: center; gap: 10px; }
.field--toggle .field__l { order: 2; flex: 1; }
.field--toggle .field__h { order: 3; flex-basis: 100%; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 auto; cursor: pointer; }
.switch__i { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__t {
  position: absolute; inset: 0;
  border-radius: 22px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease);
}
.switch__t::after {
  content: "";
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease);
}
.switch__i:checked + .switch__t { background: var(--accent); border-color: var(--accent); }
.switch__i:checked + .switch__t::after { transform: translateX(16px); }
.switch__i:focus-visible + .switch__t { outline: 2px solid var(--accent); outline-offset: 2px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 34px;
}
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tags__t {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 4px 0 8px;
  border-radius: 5px;
  background: var(--surface-2);
  font: 500 12px var(--sans);
  color: var(--ink-2);
}
.tags__x { border: 0; background: none; padding: 1px; cursor: pointer; color: var(--ink-mute); display: grid; border-radius: 3px; }
.tags__x:hover { background: var(--bad-soft); color: var(--bad); }
.tags__i { flex: 1; min-width: 100px; border: 0; background: none; outline: none; font: 400 13px var(--sans); color: var(--ink); }

.lookup { position: relative; }
.lookup__m {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
}
.lookup__o {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: none;
  text-align: left;
  cursor: pointer;
  font: 400 13px var(--sans);
  color: var(--ink);
}
.lookup__o:hover, .lookup__o:focus-visible { background: var(--accent-soft); }
.lookup__ol { font-weight: 600; }
.lookup__os { font-size: 11.5px; color: var(--ink-mute); margin-left: auto; }
.lookup__none { padding: 10px; font-size: 12.5px; color: var(--ink-mute); text-align: center; }

/* ======================================================= drawer/modal == */

.ov { position: fixed; inset: 0; z-index: 120; }
.drawer__scrim, .modal__scrim {
  position: absolute;
  inset: 0;
  background: hsl(220 14% 8% / 0.34);
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.ov.is-in .drawer__scrim, .ov.is-in .modal__scrim { opacity: 1; }
.ov.is-out .drawer__scrim, .ov.is-out .modal__scrim { opacity: 0; }
[data-theme="dark"] .drawer__scrim, [data-theme="dark"] .modal__scrim { background: hsl(0 0% 0% / 0.6); }

.drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(var(--ov-w, 520px), 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  transform: translateX(101%);
  transition: transform var(--t) var(--ease);
}
.ov.is-in .drawer__panel { transform: translateX(0); }
.ov.is-out .drawer__panel { transform: translateX(101%); }

.modal__panel {
  position: absolute;
  left: 50%;
  top: 8vh;
  transform: translate(-50%, 8px);
  width: min(var(--ov-w, 560px), calc(100vw - 32px));
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  opacity: 0;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.ov.is-in .modal__panel { opacity: 1; transform: translate(-50%, 0); }
.ov.is-out .modal__panel { opacity: 0; transform: translate(-50%, 8px); }

.drawer__head, .modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line-2);
  flex: 0 0 auto;
}
.drawer__titles, .modal__titles { flex: 1; min-width: 0; }
.drawer__title, .modal__title { font-size: 16px; line-height: 1.25; }
.drawer__sub, .modal__sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 3px; }
.drawer__x, .modal__x {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-mute);
  cursor: pointer;
}
.drawer__x:hover, .modal__x:hover { background: var(--surface-2); color: var(--ink); }

.drawer__body, .modal__body { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.drawer__foot, .modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.confirm__b { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

.modal--pal .modal__head { display: none; }
.modal--pal .modal__body { padding: 0; }
.modal--pal .modal__panel { top: 12vh; }
.pal { display: flex; flex-direction: column; }
.pal__top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-mute);
}
.pal__i {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font: 400 16px var(--sans);
  color: var(--ink);
}
.pal__l { max-height: 52vh; overflow: auto; padding: 6px; }
.pal__o {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  text-align: left;
  cursor: pointer;
  font: 400 13.5px var(--sans);
  color: var(--ink);
}
.pal__o.is-hi, .pal__o:hover { background: var(--accent-soft); }
.pal__oi { color: var(--ink-mute); display: grid; flex: 0 0 auto; }
.pal__ot { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal__os { font-size: 11.5px; color: var(--ink-mute); white-space: nowrap; }
.pal__or { margin-left: auto; font-size: 11.5px; color: var(--ink-mute); }

.export__ta {
  width: 100%;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-2);
  font: 400 11.5px/1.55 var(--mono);
  padding: 10px;
  resize: vertical;
}
.about__body p { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); margin-bottom: 10px; }
.about__h { font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-mute); margin: 16px 0 8px; }
.about__try li {
  position: relative;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.about__try li::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.about__meta { display: grid; grid-template-columns: 116px 1fr; gap: 5px 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.about__meta dt { font-size: 11.5px; color: var(--ink-mute); }
.about__meta dd { font-size: 12.5px; color: var(--ink-2); }

.morelist { display: flex; flex-direction: column; gap: 2px; }
.morelist__i {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: 600 14px var(--sans);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.morelist__i:hover { background: var(--surface-2); }
.morelist__i span { flex: 1; }
.morelist__i .ic:last-child { color: var(--ink-mute); }

/* ============================================================= toasts == */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: min(560px, calc(100vw - 24px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 13px;
  border-radius: var(--radius);
  background: hsl(220 16% 12%);
  color: hsl(220 16% 96%);
  box-shadow: var(--shadow-3);
  font-size: 13px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
[data-theme="dark"] .toast { background: hsl(222 12% 22%); border: 1px solid var(--line); }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast.is-out { opacity: 0; transform: translateY(6px); }
.toast__ic { display: grid; flex: 0 0 auto; opacity: 0.9; }
.toast--ok .toast__ic { color: hsl(152 60% 62%); }
.toast--bad .toast__ic { color: hsl(4 80% 68%); }
.toast__m { flex: 1; min-width: 0; }
.toast__u {
  border: 1px solid hsl(0 0% 100% / 0.24);
  background: hsl(0 0% 100% / 0.08);
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  font: 700 12px var(--sans);
  cursor: pointer;
  flex: 0 0 auto;
}
.toast__u:hover { background: hsl(0 0% 100% / 0.16); }
.toast__x {
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  display: grid;
  padding: 3px;
  border-radius: 4px;
  flex: 0 0 auto;
}
.toast__x:hover { opacity: 1; background: hsl(0 0% 100% / 0.1); }

/* ============================================================== empty == */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 38px 24px;
  text-align: center;
}
.empty__ic {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.empty__t { font: 700 14px var(--display); color: var(--ink); letter-spacing: -0.01em; }
.empty__b { font-size: 12.5px; color: var(--ink-mute); max-width: 42ch; line-height: 1.5; }
.empty__a { margin-top: 6px; }

/* =========================================================== timeline == */

.tl { display: flex; flex-direction: column; }
.tl__i { display: flex; gap: 11px; position: relative; padding-bottom: 15px; }
.tl__i:last-child { padding-bottom: 0; }
.tl__i:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 12px; top: 26px; bottom: 2px;
  width: 1px;
  background: var(--line);
}
.tl__d {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 25px; height: 25px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-mute);
  border: 1px solid var(--line);
  z-index: 1;
}
.tl__d--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tl__d--bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tl__d--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tl__d--info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tl__d--accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tl__b { flex: 1; min-width: 0; padding-top: 2px; }
.tl__t { font-size: 13px; font-weight: 600; color: var(--ink); }
.tl__x { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; }
.tl__m { font: 500 11px var(--mono); color: var(--ink-mute); margin-top: 4px; }

/* ============================================================= charts == */

.chartw { margin: 0; min-width: 0; }
.chartw__c { font-size: 11.5px; color: var(--ink-mute); margin-top: 6px; text-align: center; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart__grid { stroke: var(--line-2); stroke-width: 1; }
.chart__ay, .chart__ax { font: 500 10px var(--mono); fill: var(--ink-mute); }
.chart__bar { fill: var(--accent); transition: opacity var(--t-fast) var(--ease); }
.chart__bar:hover { opacity: 0.8; }
.chart__bar.t-ok { fill: var(--ok); }
.chart__bar.t-bad { fill: var(--bad); }
.chart__bar.t-mute { fill: var(--ink-mute); }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__area { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }
.chart__pt { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.chart__seg { stroke: var(--surface); stroke-width: 1.5; }
.chart__cv { font: 600 20px var(--mono); fill: var(--ink); }
.chart__cs { font: 500 10px var(--sans); fill: var(--ink-mute); letter-spacing: .06em; text-transform: uppercase; }
.chart__lg { font: 500 12px var(--sans); fill: var(--ink-2); dominant-baseline: middle; }
.chart__lgv { font: 600 12px var(--mono); fill: var(--ink); dominant-baseline: middle; }

/* =============================================================== tabs == */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.tabs__t {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--ink-mute);
  font: 600 12.5px var(--sans);
  cursor: pointer;
}
.tabs__t:hover { color: var(--ink); }
.tabs__t.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs__n { font: 600 10.5px var(--mono); color: var(--ink-mute); }
.tabs__t.is-on .tabs__n { color: var(--accent-ink); }

/* ========================================================= photo tile == */

.phototile { margin: 0; flex: 0 0 auto; width: 180px; }
.phototile__img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.phototile__c { font-size: 11px; color: var(--ink-mute); margin-top: 5px; line-height: 1.35; }
.photostrip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }

/* ========================================================== responsive == */

@media (max-width: 1180px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--sidebar, .grid--main { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  :root { --pad: 14px; }

  .app {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 46px 50px minmax(0, 1fr) auto;
    grid-template-areas: "brand" "top" "view" "tabbar";
  }
  .brand { border-right: 0; padding: 0 12px; }
  .brand__collapse { display: none; }
  .brand__mark { width: 26px; height: 26px; }
  .brand__name { font-size: 13px; }
  .brand__tag { display: none; }
  .side { display: none; }

  .top { padding: 0 var(--pad); gap: 7px; }
  .top__t { font-size: 15.5px; }
  .top__s { display: none; }
  .top__search { min-width: 0; width: 32px; padding: 0; justify-content: center; }
  .top__searcht, .top__kbd { display: none; }
  .top__demo span { display: none; }
  .top__demo { padding: 0 7px; }
  .top__demo .ic:last-child { display: none; }
  .top__titles { flex: 0 1 auto; }
  .top__a {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 4px 0;
  }
  .top__a::-webkit-scrollbar { display: none; }
  .top__a > * { flex: 0 0 auto; }

  .view { padding: var(--pad) var(--pad) 18px; -webkit-overflow-scrolling: touch; }

  .tabbar {
    grid-area: tabbar;
    display: flex;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .tabbar__i {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 7px 2px 8px;
    border: 0;
    background: none;
    color: var(--ink-mute);
    text-decoration: none;
    font: 600 10px var(--sans);
    cursor: pointer;
  }
  .tabbar__i span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar__i.is-on { color: var(--accent-ink); }

  .grid--2, .grid--3, .grid--4, .grid--5 { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  .drawer__panel { width: 100vw; border-left: 0; }
  .modal__panel { top: auto; bottom: 0; left: 0; transform: translateY(12px); width: 100vw; max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .ov.is-in .modal__panel { transform: translateY(0); }
  .ov.is-out .modal__panel { transform: translateY(12px); }
  .modal--pal .modal__panel { top: 0; bottom: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
  .toasts { bottom: 78px; }

  .form__grid--2 { grid-template-columns: minmax(0, 1fr); }
  .form__grid .span2 { grid-column: auto; }

  /* tables become cards */
  .tbl__scroll { overflow: visible; }
  .tbl__t, .tbl__t tbody, .tbl__r { display: block; width: 100%; }
  .tbl__t thead { display: none; }
  .tbl__r {
    border-bottom: 1px solid var(--line-2);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  .tbl__r:last-child { border-bottom: 0; }
  .tbl__c {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 1px 0;
    text-align: right !important;
  }
  .tbl__c::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font: 700 10px var(--sans);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-mute);
    text-align: left;
  }
  .tbl__c:first-child { padding-bottom: 4px; }
  .tbl__c:first-child::before { display: none; }
  .tbl__c:first-child { text-align: left !important; }
  .tbl__c.hide-sm { display: none; }
  .tbl__emptycell { display: block; }
  .tbl__emptycell::before { display: none; }

  .kb__board { margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 6px; scroll-snap-type: x mandatory; }
  .kb__col { flex: 0 0 79%; min-width: 0; max-width: 79%; }

  .cal__gutterhead, .cal__gutter { flex-basis: 44px; }
  .cal__hr span { font-size: 9.5px; right: 4px; }
  .cal__dhn { font-size: 13px; }
  .cal__lanes { display: flex; }
  .cal__ev { font-size: 10px; }

  .chart { min-height: 180px; }
  .about__meta { grid-template-columns: 1fr; gap: 1px 0; }
  .about__meta dd { margin-bottom: 8px; }
}

@media (max-width: 560px) {
  .kb__col { flex: 0 0 86%; max-width: 86%; }
}

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

@media print {
  .side, .top, .tabbar, .brand__collapse { display: none; }
  .view { overflow: visible; }
}
