/* ASRT IBMS — admin SPA. Layout, components, states. Relies on css/tokens.css. */

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

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

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font: var(--fs-md)/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
p,
figure {
  margin: 0;
}

a {
  color: var(--text-link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--s-2);
  z-index: 999;
  background: var(--bg-surface);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}
.skip-link:focus {
  left: var(--s-2);
}

.muted {
  color: var(--text-muted);
}
.strong {
  font-weight: 600;
}
.tiny {
  font-size: var(--fs-xs);
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  letter-spacing: -0.01em;
}
.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.94em;
  letter-spacing: -0.01em;
}
.caps {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--fs-xxs);
  font-weight: 700;
  color: var(--text-muted);
}
.trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nowrap {
  white-space: nowrap;
}
.right {
  margin-left: auto;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.wrap {
  flex-wrap: wrap;
}
.col {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.spacer {
  flex: 1 1 auto;
}
.center {
  text-align: center;
}
.pos {
  color: var(--ok);
}
.neg {
  color: var(--bad);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ boot ---- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: var(--s-4);
  justify-items: center;
  text-align: center;
  padding: var(--s-6);
}
.boot-mark {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.boot-status {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.spinner {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand-teal);
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: -4px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--brand-teal);
}
[data-theme="dark"] .wordmark {
  color: var(--chart-1);
}
.boot-name {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* ----------------------------------------------------------------- login ---- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-aside {
  background-color: var(--brand-navy);
  /* graph-paper hairlines: quiet texture instead of a colour wash */
  background-image: repeating-linear-gradient(0deg, rgba(208, 226, 245, 0.05) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, rgba(208, 226, 245, 0.05) 0 1px, transparent 1px 30px);
  color: #dbe6f5;
  padding: var(--s-8) var(--s-7);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  justify-content: center;
  border-right: 1px solid rgba(45, 212, 191, 0.25);
}
.auth-aside .wordmark {
  font-size: var(--fs-2xl);
  color: var(--accent-on-dark);
}
.auth-aside h2 {
  font-size: clamp(26px, 3.1vw, 40px);
  line-height: 1.16;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.auth-aside p {
  color: #a8bdd6;
  max-width: 46ch;
  font-size: var(--fs-lg);
}
.auth-facts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--s-3);
  max-width: 48ch;
}
.auth-facts li {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  font-size: var(--fs-sm);
  color: #c3d3e6;
  border-left: 2px solid rgba(45, 212, 191, 0.45);
  padding-left: var(--s-3);
}
.auth-panel {
  display: grid;
  place-content: center;
  padding: var(--s-7) var(--s-5);
  background: var(--bg-surface);
}
.auth-card {
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.auth-card h3 {
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
}
.auth-brand-mobile {
  display: none;
  align-items: baseline;
  gap: var(--s-2);
}
@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    display: none;
  }
  .auth-brand-mobile {
    display: flex;
  }
}

/* ---------------------------------------------------------------- shell ---- */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}
.shell[data-rail="collapsed"] {
  grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr);
}

.rail {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-4) var(--s-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 30;
}
.rail-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: 0 var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--sidebar-line);
  margin-bottom: var(--s-2);
}
.rail-head .wordmark {
  font-size: var(--fs-lg);
}
.rail-head b {
  color: #fff;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}
.rail-head .tag {
  margin-left: auto;
  font: 700 var(--fs-xxs)/1 var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--accent-on-dark);
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: var(--r-xs);
  padding: 3px 5px;
}
.rail-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: var(--s-3);
}
.rail-group > .caps {
  color: rgba(185, 199, 219, 0.55);
  padding: var(--s-2) var(--s-2) var(--s-1);
}
.rail a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-2);
  border-radius: var(--r-sm);
  color: var(--sidebar-fg);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.rail a:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.rail a.on {
  background: var(--sidebar-hover);
  color: var(--sidebar-fg-active);
  box-shadow: inset 2px 0 0 var(--accent-on-dark);
}
.rail a svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  opacity: 0.9;
}
.rail a .idx {
  flex: 0 0 auto;
  width: 15px;
  font: 700 var(--fs-xxs)/1 var(--font-mono);
  color: rgba(185, 199, 219, 0.45);
  letter-spacing: 0.02em;
}
.rail a.on .idx {
  color: var(--accent-on-dark);
}
.rail a .label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail a .n {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: var(--r-full);
  font: 700 var(--fs-xxs)/1 var(--font-sans);
  padding: 4px 6px;
  min-width: 18px;
  text-align: center;
}
.rail a .n.hot {
  background: var(--bad);
}
.rail-foot {
  margin-top: auto;
  padding: var(--s-3) var(--s-2) 0;
  border-top: 1px solid var(--sidebar-line);
  font-size: var(--fs-xxs);
  color: rgba(185, 199, 219, 0.6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.rail-foot kbd {
  font-family: var(--font-mono);
  border: 1px solid var(--sidebar-line);
  border-radius: var(--r-xs);
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.05);
}
.shell[data-rail="collapsed"] .rail-head b,
.shell[data-rail="collapsed"] .rail-head .tag,
.shell[data-rail="collapsed"] .rail a .label,
.shell[data-rail="collapsed"] .rail a .idx,
.shell[data-rail="collapsed"] .rail a .n,
.shell[data-rail="collapsed"] .rail-group > .caps,
.shell[data-rail="collapsed"] .rail-foot {
  display: none;
}
.shell[data-rail="collapsed"] .rail a {
  justify-content: center;
  padding: 10px 0;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-5);
  background: var(--bg-surface);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar-title {
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.rail-toggle {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-direction: column;
}
.rail-toggle span {
  width: 14px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 9px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}
.search input {
  width: 240px;
  padding: 6px 9px 6px 28px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  font-size: var(--fs-sm);
}
.search input::placeholder {
  color: var(--text-muted);
}
@media (max-width: 1200px) {
  .search input {
    width: 168px;
  }
}
@media (max-width: 720px) {
  .search {
    display: none;
  }
}

.icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-secondary);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}
.icon-btn .dot {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 2px;
  border-radius: var(--r-xs);
  background: var(--bad);
  color: #fff;
  font: 700 var(--fs-xxs)/15px var(--font-mono);
  text-align: center;
}

.pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 372px;
  max-width: calc(100vw - 24px);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}
.pop-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 650;
  font-size: var(--fs-sm);
}
.pop-list {
  max-height: 60vh;
  overflow-y: auto;
}
.notif {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: start;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  width: 100%;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  text-align: left;
  font: inherit;
}
.notif:hover {
  background: var(--bg-hover);
}
.notif.unread {
  background: var(--bg-selected);
}
.notif .mark {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  margin-top: 6px;
  background: var(--neutral);
}
.notif .mark.warn {
  background: var(--warn);
}
.notif .mark.critical {
  background: var(--bad);
}
.notif .mark.read {
  background: transparent;
}
.notif b {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.notif span {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}
.notif time {
  color: var(--text-muted);
  font-size: var(--fs-xxs);
  white-space: nowrap;
}
.pop-foot {
  padding: var(--s-2) var(--s-4) var(--s-3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
}
.pop-anchor {
  position: relative;
}

.who {
  position: relative;
}
.who-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--r-full);
  padding: 4px 10px 4px 4px;
  cursor: pointer;
}
.who-btn:hover {
  background: var(--bg-hover);
}
.avatar {
  width: 27px;
  height: 27px;
  border-radius: var(--r-xs);
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-content: center;
  font: 700 var(--fs-xs)/1 var(--font-mono);
  letter-spacing: 0.02em;
}
.who-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.who-meta b {
  font-size: var(--fs-xs);
  font-weight: 650;
}
.who-meta i {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  font-style: normal;
}
.who-menu {
  padding: var(--s-2);
  width: 268px;
}
.who-menu .idcard {
  padding: var(--s-2) var(--s-3) var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.who-menu button {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border: 0;
  background: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  text-align: left;
  color: var(--text-primary);
}
.who-menu button:hover {
  background: var(--bg-hover);
}
.who-menu button svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}
.who-menu hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--s-2) 0;
}

/* ----------------------------------------------------------------- view ---- */
.view {
  padding: var(--s-4);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  outline: none;
  min-height: calc(100vh - var(--topbar-h));
}
@media (max-width: 640px) {
  .view {
    padding: var(--s-3);
    gap: var(--s-4);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.022em;
}
.page-head .sub {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-top: 2px;
}
.page-actions {
  margin-left: auto;
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
}
.crumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.crumb a {
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------- cards ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card > header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  min-height: 44px;
}
.card > header h2,
.card > header h3 {
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.card > header .hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.card > header .actions {
  margin-left: auto;
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}
.card > .body {
  padding: var(--s-4);
}
.card > .body.tight {
  padding: 0;
}
.card > .body.flush {
  padding: 0;
}
.card.flat {
  box-shadow: none;
}

.grid {
  display: grid;
  gap: var(--s-4);
}
.grid.kpi {
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
}
.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid.charts {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: var(--s-4) auto var(--s-4) 0;
  width: 2px;
  background: var(--brand-teal);
  opacity: 0.5;
}
.kpi .k-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.kpi .k-value {
  font-size: var(--fs-money);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi .k-value.small {
  font-size: var(--fs-xl);
}
.kpi .k-foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.kpi .k-delta {
  font-weight: 700;
  border-radius: var(--r-xs);
  padding: 1px 5px;
  font-size: var(--fs-xxs);
}
.kpi .k-delta.up {
  color: var(--ok);
  background: var(--ok-bg);
}
.kpi .k-delta.down {
  color: var(--bad);
  background: var(--bad-bg);
}
.kpi.warn::after {
  background: var(--warn);
  opacity: 0.8;
}
.kpi.bad::after {
  background: var(--bad);
  opacity: 0.8;
}
.kpi.info::after {
  background: var(--info);
  opacity: 0.8;
}

.money-lines {
  display: grid;
  gap: var(--s-2);
}
.money-line {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  font-size: var(--fs-sm);
}
.money-line .lbl {
  color: var(--text-muted);
  min-width: 3.5em;
  font-weight: 700;
  font-size: var(--fs-xs);
}

/* -------------------------------------------------------------- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
  box-shadow: none;
}
.btn:hover {
  background: var(--bg-hover);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn.pri {
  background: var(--brand-teal);
  border-color: var(--brand-teal-strong);
  color: #fff;
}
.btn.pri:hover {
  background: var(--brand-teal-strong);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}
.btn.ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn.danger {
  background: var(--bg-surface);
  border-color: var(--bad-line);
  color: var(--bad);
}
.btn.danger:hover {
  background: var(--bad-bg);
  border-color: var(--bad);
}
.btn.outline-danger {
  color: var(--bad);
  border-color: var(--bad-line);
  background: var(--bad-bg);
}
.btn.sm {
  padding: 5px 9px;
  font-size: var(--fs-xs);
  border-radius: var(--r-xs);
}
.btn.xs {
  padding: 3px 7px;
  font-size: var(--fs-xxs);
}
.btn.block {
  width: 100%;
}
.btn.on {
  border-color: var(--border-focus);
  color: var(--brand-teal);
  background: var(--ok-bg);
}
[data-theme="dark"] .btn.on {
  color: var(--chart-1);
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.seg button {
  border: 0;
  background: none;
  padding: 7px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--border-subtle);
}
.seg button:last-child {
  border-right: 0;
}
.seg button.on {
  background: var(--bg-selected);
  color: var(--text-primary);
}
.seg button:hover {
  background: var(--bg-hover);
}

/* ---------------------------------------------------------------- chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xxs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  opacity: 0.9;
}
.chip.bare::before {
  display: none;
}
.chip.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-line);
}
.chip.warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.chip.bad {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: var(--bad-line);
}
.chip.info {
  color: var(--info);
  background: var(--info-bg);
  border-color: var(--info-line);
}
.chip.grey,
.chip {
  color: var(--neutral);
  background: var(--neutral-bg);
  border-color: var(--neutral-line);
}
.chip.lg {
  padding: 3px 8px;
  font-size: var(--fs-xs);
}
.chipcount {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}
.chipwrap {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
}
button.chip {
  cursor: pointer;
}
button.chip:hover {
  filter: brightness(0.97);
}
button.chip.on {
  box-shadow: 0 0 0 2px var(--border-focus);
}

/* --------------------------------------------------------------- tables ---- */
.tablewrap {
  overflow: auto;
  max-height: calc(100vh - 220px);
  border-radius: var(--r-md);
}
.tablewrap.short {
  max-height: 460px;
}
.tablewrap.autosize {
  max-height: none;
  overflow: visible;
}
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px var(--s-4);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.data thead th.num {
  text-align: right;
}
table.data thead th.sortable {
  cursor: pointer;
  user-select: none;
}
table.data thead th.sortable:hover {
  color: var(--text-primary);
}
table.data thead th .arrow {
  display: inline-block;
  margin-left: 5px;
  font-size: 9px;
  color: var(--text-muted);
  vertical-align: 1px;
}
table.data thead th .arrow.on {
  color: var(--brand-teal);
}
table.data tbody td {
  padding: 8px var(--s-4);
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: middle;
}
table.data tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.data tbody tr:hover td {
  background: var(--bg-hover);
}
table.data tbody tr.clickable {
  cursor: pointer;
}
table.data tbody tr.selected td {
  background: var(--bg-selected);
}
table.data tfoot td {
  padding: 12px var(--s-4);
  border-top: 1px solid var(--border-strong);
  font-weight: 700;
  background: var(--bg-surface-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.data tfoot td.num {
  text-align: right;
}
table.data tr.expand-row td {
  background: var(--bg-surface-2);
  padding: var(--s-4) var(--s-5);
}
table.data .cell-title {
  font-weight: 600;
  color: var(--text-primary);
}
table.data .cell-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
table.data td .actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  flex-wrap: wrap;
}
table.data.compact tbody td,
table.data.compact thead th {
  padding: 8px var(--s-3);
}

.filters {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.filters .search input {
  width: 220px;
  border-radius: var(--r-sm);
  background: var(--bg-input);
  padding: 7px 10px 7px 28px;
}
.filters select,
.filters input[type="date"],
.filters input[type="text"] {
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  font-size: var(--fs-sm);
  color: var(--text-primary);
}
.filters .label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 600;
}

.pager {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.pager .pages {
  margin-left: auto;
  display: flex;
  gap: var(--s-1);
  align-items: center;
}
.pager select {
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--bg-input);
  font-size: var(--fs-xs);
}
.pager button.page {
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--r-xs);
  cursor: pointer;
  font-size: var(--fs-xs);
}
.pager button.page.on {
  background: var(--bg-selected);
  border-color: var(--border-focus);
  font-weight: 700;
}
.pager button.page:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- forms ---- */
.form {
  display: grid;
  gap: var(--s-4);
}
.form.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field > label {
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.field > label .req {
  color: var(--bad);
}
.field input,
.field select,
.field textarea {
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field textarea {
  resize: vertical;
  min-height: 78px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.55;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.field input[type="checkbox"] {
  width: auto;
}
.field .hint {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}
.field .err {
  font-size: var(--fs-xxs);
  color: var(--bad);
  font-weight: 600;
}
.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--bad);
}
.field.inline {
  flex-direction: row;
  align-items: center;
  gap: var(--s-2);
}
.field.span-all {
  grid-column: 1 / -1;
}
.checkline {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
}
.input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.input-group .adorn {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--bg-surface-3);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.input-group input {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
fieldset.group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin: 0;
  display: grid;
  gap: var(--s-3);
}
fieldset.group legend {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0 var(--s-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.readonly-value {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  padding: 2px 0;
  min-height: 1.4em;
}

/* --------------------------------------------------------------- modal ----- */
.veil {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: var(--s-4);
  z-index: 100;
  animation: fade 0.14s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: pop 0.16s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes pop {
  from {
    transform: translateY(10px) scale(0.99);
    opacity: 0.6;
  }
}
.modal.wide {
  width: min(940px, 100%);
}
.modal.xwide {
  width: min(1200px, 100%);
}
.modal > header {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
}
.modal > header h3 {
  font-size: var(--fs-lg);
  font-weight: 650;
}
.modal > header .sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.modal > .body {
  padding: var(--s-4);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.modal > footer {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  flex-wrap: wrap;
}
.modal > footer .note {
  margin-right: auto;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  max-width: 46ch;
  align-self: center;
}

/* --------------------------------------------------------------- toasts ---- */
.toasts {
  position: fixed;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: min(420px, calc(100vw - 24px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--neutral);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-sm);
  animation: slidein 0.18s ease;
}
@keyframes slidein {
  from {
    transform: translateX(14px);
    opacity: 0;
  }
}
.toast > div {
  flex: 1 1 auto;
  min-width: 0;
}
.toast .x {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  padding: 0 2px;
}
.toast.ok {
  border-left-color: var(--ok);
}
.toast.bad {
  border-left-color: var(--bad);
}
.toast.warn {
  border-left-color: var(--warn);
}
.toast.info {
  border-left-color: var(--info);
}

/* ----------------------------------------------------------- skeletons ----- */
.sk {
  background: var(--skeleton);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  display: inline-block;
  min-width: 40px;
  height: 12px;
  vertical-align: middle;
  user-select: none;
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
.sk.w-lg {
  width: 70%;
}
.sk.w-xl {
  width: 100%;
}
.sk.tall {
  height: 22px;
}
.sk.block {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: var(--r-lg);
}
.sk-area {
  min-height: 210px;
  border-radius: var(--r-lg);
  background: var(--skeleton);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
.loading-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-teal), transparent);
  background-size: 220% 100%;
  animation: shimmer 1s linear infinite;
}

/* ------------------------------------------------------ empty / error ------ */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-7) var(--s-5);
  text-align: center;
  /* ledger paper grid — decoration is allowed only in empty states */
  background-image: repeating-linear-gradient(0deg, var(--paper-grid) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, var(--paper-grid) 0 1px, transparent 1px 24px);
}
.state .glyph {
  width: 38px;
  height: 38px;
  border-radius: var(--r-xs);
  display: grid;
  place-content: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
}
.state .glyph svg {
  width: 21px;
  height: 21px;
}
.state h4 {
  font-size: var(--fs-lg);
  font-weight: 650;
}
.state p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  max-width: 56ch;
}
.state.error .glyph {
  border-color: var(--bad-line);
  color: var(--bad);
}
.state .code {
  font-family: var(--font-mono);
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}
.banner {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  border: 1px solid var(--neutral-line);
  background: var(--neutral-bg);
  color: var(--text-primary);
}
.banner svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 2px;
}
.banner.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}
.banner.bad {
  background: var(--bad-bg);
  border-color: var(--bad-line);
  color: var(--bad);
}
.banner.ok {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok);
}
.banner.info {
  background: var(--info-bg);
  border-color: var(--info-line);
  color: var(--info);
}
.banner .body {
  color: var(--text-primary);
  flex: 1 1 auto;
}

/* ----------------------------------------------------------------- tabs ---- */
.tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  padding: 0 var(--s-5);
  background: var(--bg-surface);
}
.tabs button {
  border: 0;
  background: none;
  padding: var(--s-3) var(--s-2);
  margin-right: var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs button:hover {
  color: var(--text-primary);
}
.tabs button.on {
  color: var(--brand-teal);
  border-bottom-color: var(--brand-teal);
}
[data-theme="dark"] .tabs button.on {
  color: var(--chart-1);
  border-bottom-color: var(--chart-1);
}
.tabs button .count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: 5px;
  font-size: var(--fs-xxs);
}
.tab-body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* --------------------------------------------------------------- meta ------ */
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--s-4);
}
.meta .m {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.meta .m > i {
  font-style: normal;
  font-size: var(--fs-xxs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.meta .m > b {
  font-weight: 600;
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.totals {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 260px;
  margin-left: auto;
  width: min(340px, 100%);
}
.totals .t {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 7px var(--s-3);
  font-size: var(--fs-sm);
  border-radius: var(--r-xs);
}
.totals .t span {
  color: var(--text-secondary);
}
.totals .t b {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.totals .t.grand {
  border-top: 1px solid var(--border-strong);
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  font-size: var(--fs-lg);
  background: var(--bg-surface-2);
}
.totals .t.grand b {
  font-weight: 700;
}
.totals .t.neg b {
  color: var(--bad);
}

/* ------------------------------------------------------------ timeline ----- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.timeline .ev {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  position: relative;
}
.timeline .ev + .ev::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -10px;
  bottom: auto;
  height: 20px;
  width: 1px;
  background: var(--border-strong);
}
.timeline .ev .ico {
  width: 26px;
  height: 26px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: grid;
  place-content: center;
  z-index: 1;
  background: var(--bg-surface);
}
.timeline .ev .ico svg {
  width: 14px;
  height: 14px;
}
.timeline .ev.ok .ico {
  border-color: var(--ok-line);
  color: var(--ok);
}
.timeline .ev.warn .ico {
  border-color: var(--warn-line);
  color: var(--warn);
}
.timeline .ev.bad .ico {
  border-color: var(--bad-line);
  color: var(--bad);
}
.timeline .ev.info .ico {
  border-color: var(--info-line);
  color: var(--info);
}
.timeline .ev b {
  font-size: var(--fs-sm);
  font-weight: 600;
}
.timeline .ev p {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}
.timeline .ev time {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ------------------------------------------------------------ variance ----- */
.bar {
  height: 6px;
  border-radius: var(--r-xs);
  background: var(--bg-surface-3);
  overflow: hidden;
  position: relative;
  min-width: 90px;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0;
}
.bar.over > i {
  background: var(--bad);
}
.bar .cap {
  position: absolute;
  inset: 0;
  border-left: 2px solid var(--text-primary);
  opacity: 0.4;
}
.vrow {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(90px, 1fr) auto auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------- kanban ------ */
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-4);
  align-items: start;
}
.kcol {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  min-height: 160px;
}
.kcol > header {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  font-weight: 650;
}
.kcol > header .n {
  margin-left: auto;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: var(--fs-xs);
}
.kcol .cards {
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.task {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  cursor: pointer;
}
.task:hover {
  border-color: var(--border-strong);
}
.task b {
  font-size: var(--fs-sm);
  font-weight: 600;
}
.task p {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.task .foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}
.task .due.overdue {
  color: var(--bad);
  font-weight: 700;
}
.task.p-high {
  border-left: 3px solid var(--bad);
}
.task.p-med {
  border-left: 3px solid var(--warn);
}
.task.p-low {
  border-left: 3px solid var(--neutral);
}

/* -------------------------------------------------------------- charts ----- */
.chart-card .canvas-holder {
  position: relative;
  height: 300px;
  padding: var(--s-3) var(--s-4) var(--s-4);
}
.chart-card .canvas-holder canvas {
  max-width: 100%;
}
.chart-note {
  padding: 0 var(--s-5) var(--s-4);
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}
.offline-note {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
}

/* ------------------------------------------------------------ financial ---- */
.fin-table td.label {
  padding-left: calc(var(--s-4) + var(--indent, 0) * 18px);
}
.fin-table tr.section td {
  background: var(--bg-surface-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--fs-xs);
}
.fin-table tr.total td {
  border-top: 1px solid var(--border-strong);
  font-weight: 700;
}
.fin-table tr.grand td {
  border-top: 2px solid var(--text-secondary);
  border-bottom: 3px double var(--text-secondary);
  font-weight: 700;
  font-size: var(--fs-md);
}
.je-lines {
  display: grid;
  gap: 1px;
  font-size: var(--fs-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.je-lines .l {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 110px 110px minmax(0, 1fr);
  gap: var(--s-3);
  padding: 6px var(--s-3);
  border-bottom: 1px solid var(--border-subtle);
}
.je-lines .l:last-child {
  border-bottom: 0;
}
.je-lines .l.head {
  background: var(--bg-surface-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}
.balance-check {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--ok-line);
  background: var(--ok-bg);
  color: var(--ok);
}
.balance-check.out {
  border-color: var(--bad-line);
  background: var(--bad-bg);
  color: var(--bad);
}

/* -------------------------------------------------------------- wizard ----- */
.steps {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.steps .s {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-muted);
}
.steps .s .b {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  display: grid;
  place-content: center;
  background: var(--bg-surface-3);
  font-size: var(--fs-xxs);
  font-weight: 700;
}
.steps .s.on {
  color: var(--text-primary);
}
.steps .s.on .b {
  background: var(--brand-teal);
  color: #fff;
}
.steps .s.done .b {
  background: var(--ok);
  color: #fff;
}
.steps hr {
  flex: 1 1 24px;
  border: 0;
  border-top: 1px solid var(--border-strong);
  min-width: 16px;
}

/* ------------------------------------------------------------ line items --- */
.lines {
  display: grid;
  gap: var(--s-2);
}
.line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 128px 128px 34px;
  gap: var(--s-2);
  align-items: center;
}
.line input,
.line select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  font-size: var(--fs-sm);
  width: 100%;
}
.line .rm {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  height: 32px;
  cursor: pointer;
  color: var(--text-muted);
}
.line .rm:hover {
  color: var(--bad);
  border-color: var(--bad-line);
}
.line.head-labels {
  font-size: var(--fs-xxs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  grid-template-columns: minmax(0, 1fr) 84px 128px 128px 34px;
}
@media (max-width: 780px) {
  .line,
  .line.head-labels {
    grid-template-columns: minmax(0, 1fr) 70px;
  }
}

/* ------------------------------------------------------------ picker ------- */
.picker {
  position: relative;
}
.picker .menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 264px;
  overflow: auto;
  z-index: 70;
}
.picker .menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border-subtle);
}
.picker .menu button:hover {
  background: var(--bg-hover);
}
.picker .menu button i {
  display: block;
  font-style: normal;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.pill-list {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.pill {
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  border-radius: var(--r-xs);
  padding: 4px 9px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.pill.on {
  background: var(--bg-selected);
  border-color: var(--border-focus);
  color: var(--brand-teal);
}
[data-theme="dark"] .pill.on {
  color: var(--chart-1);
}

/* ------------------------------------------------------------ misc --------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: var(--s-4);
  align-items: start;
}
.split-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--s-4);
  align-items: start;
}
@media (max-width: 1080px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}
.hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--s-1) 0;
}
.copyable {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  word-break: break-all;
}
pre.json {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-4);
  max-height: 340px;
  overflow: auto;
}
.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-link);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linklike:hover {
  color: var(--brand-teal);
}

/* ------------------------------------------------------- mobile rail ------- */
@media (max-width: 860px) {
  .shell,
  .shell[data-rail="collapsed"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail-toggle {
    display: inline-flex;
  }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-w);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .shell[data-rail="open"] .rail {
    transform: none;
  }
  .shell[data-rail="open"]::after {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 20;
  }
  .workspace {
    grid-column: 1;
  }
  .tablewrap {
    max-height: none;
  }
  .who-meta {
    display: none;
  }
  .topbar {
    padding: 0 var(--s-3);
  }
  .card > header,
  .tab-body,
  .filters {
    padding-left: var(--s-3);
    padding-right: var(--s-3);
  }
}

/* ------------------------------------------------------------- print ------- */
@media print {
  .rail,
  .topbar,
  .page-actions,
  .filters,
  .pager,
  .toasts,
  .no-print {
    display: none !important;
  }
  .shell {
    display: block;
  }
  body {
    background: #fff;
    font-size: 12px;
  }
  .view {
    padding: 0;
    max-width: none;
  }
  .card {
    border: 0;
    box-shadow: none;
    break-inside: avoid;
  }
  .tablewrap {
    overflow: visible;
    max-height: none;
  }
}
