/* EquineSuite Control — tokens from the EquineSuite Admin UI kit. */
:root, :root[data-theme="dark"] {
  --bg: #0C1015; --rail: #0A0D11; --surf: #141920; --surf2: #1C2229; --line: #272E36;
  --ink: #F2F4F0; --mute: #8A9086; --faint: #5E645B;
  --acc: #E2B866; --accT: #E2B866; --accBg: rgba(226,184,102,0.14);
  --ok: #5BE09A; --okBg: rgba(76,211,138,0.15); --info: #6FB2FF; --infoBg: rgba(79,157,255,0.15);
  --warn: #F5B841; --warnBg: rgba(245,184,65,0.16); --bad: #FF6B70; --badBg: rgba(255,90,95,0.14);
  --sh: 0 20px 50px rgba(0,0,0,0.55); color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F2F4F0; --rail: #FFFFFF; --surf: #FFFFFF; --surf2: #F1F3EF; --line: #DDE1DA;
  --ink: #0C1015; --mute: #5E645B; --faint: #8A9086;
  --accT: #8A6420; --accBg: rgba(226,184,102,0.18);
  --ok: #1E8E55; --okBg: rgba(47,191,119,0.14); --info: #2D6FD0; --infoBg: rgba(79,157,255,0.13);
  --warn: #A86A00; --warnBg: rgba(245,184,65,0.2); --bad: #D2373D; --badBg: rgba(229,72,77,0.11);
  --sh: 0 20px 50px rgba(12,16,21,0.16); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Rajdhani', system-ui, sans-serif; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--accT); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.mono, .mono-label, code { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.mono-label { font-size: 10px; letter-spacing: 0.16em; color: var(--mute); text-transform: uppercase; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--mute); } .faint { color: var(--faint); } .ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.num { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.right { text-align: end; } .nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 8px; }
.hide { display: none !important; }

@keyframes es-ring { to { stroke-dashoffset: -68.4; } }
@keyframes es-dot { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.55); opacity: .5; } }
@keyframes es-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes es-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes es-rise { from { transform: translateY(4px); } to { transform: none; } }
@keyframes es-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes es-shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink); }
.loader { width: 56px; height: 56px; } .loader rect { animation: es-ring 1.4s cubic-bezier(.2,.7,.2,1) infinite; } .loader circle { transform-origin: 82px 18px; animation: es-dot 1.4s ease-in-out infinite; }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surf2) 0, var(--line) 50%, var(--surf2) 100%); background-size: 800px 100%; animation: es-shimmer 1.2s linear infinite; }

/* ---------- auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px; background: radial-gradient(circle at 50% 30%, rgba(226,184,102,0.14) 0%, transparent 55%); }
.auth-card { width: 100%; max-width: 420px; background: var(--surf); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh); padding: 30px; display: flex; flex-direction: column; gap: 18px; animation: es-rise .25s ease; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 44px; height: 44px; }
.brand b { display: block; font-weight: 700; font-size: 22px; line-height: .9; letter-spacing: .06em; } .brand b span { font-weight: 500; }
.brand small { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .24em; color: var(--accT); }
.pw { position: relative; }
.pw .inp { padding-inline-end: 46px; }
.pw .pw-eye { position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); }
.code-input { height: 56px; border-radius: 12px; border: 1.5px solid var(--acc) !important; font-family: 'IBM Plex Mono', monospace !important; font-weight: 600; font-size: 26px !important; letter-spacing: .5em; text-align: center; }
.qr { background: #fff; padding: 12px; border-radius: 12px; align-self: center; line-height: 0; }
.secret { font-family: 'IBM Plex Mono', monospace; font-size: 13px; letter-spacing: .12em; background: var(--surf2); padding: 10px 12px; border-radius: 9px; word-break: break-all; text-align: center; user-select: all; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--rail); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; }
.rail .brand { padding: 18px 16px 14px; gap: 10px; } .rail .brand svg { width: 32px; height: 32px; } .rail .brand b { font-size: 17px; } .rail .brand small { font-size: 8.5px; }
.nav { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.nav h6 { margin: 0; padding: 6px 10px 2px; font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 9px; letter-spacing: .16em; color: var(--faint); }
.nav a { height: 34px; padding: 0 10px; border-radius: 8px; color: var(--mute); display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; text-decoration: none; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surf2); color: var(--ink); }
.nav a.on { background: var(--accBg); color: var(--accT); box-shadow: inset 3px 0 0 var(--acc); }
.nav a .ico { width: 17px; height: 17px; }
.nav a span { flex: 1; }
.badge { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--accBg); color: var(--accT); }
.badge.bad { background: var(--badBg); color: var(--bad); } .badge.warn { background: var(--warnBg); color: var(--warn); }
.me { padding: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--acc); color: #0C1015; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sq { border-radius: 9px; color: #0C1015; }
.avatar.horse-tile { background: var(--surf2); color: var(--ink); border: 1px solid var(--line); }
.horse-tile .ico { width: 62%; height: 62%; }
.me b { display: block; font-size: 14px; } .me small { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: var(--mute); text-transform: uppercase; }
.ibtn { width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--mute); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ibtn:hover { background: var(--surf2); color: var(--ink); }
.ibtn.bd { border: 1px solid var(--line); }

main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; height: 60px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.gsearch { position: relative; flex: 1; max-width: 460px; }
.gsearch .field { height: 38px; border-radius: 9px; background: var(--surf); border: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--mute); }
.gsearch input { flex: 1; min-width: 0; border: none; background: transparent; font-weight: 600; font-size: 14.5px; outline: none; color: var(--ink); }
.gsearch kbd { font-family: 'IBM Plex Mono', monospace; font-size: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--faint); }
.gresults { position: absolute; top: 44px; inset-inline: 0; background: var(--surf); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh); padding: 6px; max-height: 60vh; overflow: auto; }
.gresults a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.gresults a:hover, .gresults a.sel { background: var(--surf2); }
.sys { margin-inline-start: auto; height: 32px; padding: 0 11px; border-radius: 8px; display: flex; align-items: center; gap: 7px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: .06em; white-space: nowrap; }
.sys i { width: 6px; height: 6px; border-radius: 3px; background: currentColor; animation: es-pulse 1.6s infinite; }
.sys.ok { background: var(--okBg); color: var(--ok); } .sys.warn { background: var(--warnBg); color: var(--warn); } .sys.bad { background: var(--badBg); color: var(--bad); }
.menu-btn { display: none; }

.page { padding: 24px; display: flex; flex-direction: column; gap: 18px; max-width: 1480px; width: 100%; animation: es-rise .18s ease; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head .over { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .16em; color: var(--accT); text-transform: uppercase; }
.head h1 { margin: 4px 0 0; font-weight: 700; font-size: 32px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.head .sub { margin-top: 6px; color: var(--mute); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .08em; color: var(--mute); }
.crumbs a { color: var(--mute); } .crumbs a:hover { color: var(--accT); }

/* ---------- buttons & inputs */
.btn { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surf); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 700; font-size: 13.5px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; transition: filter .12s, background .12s, transform .06s; }
.btn:hover { background: var(--surf2); } .btn:active { transform: translateY(1px); }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #0C1015; } .btn.pri:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); } .btn.danger:hover { background: var(--badBg); }
.btn.dangerfill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.busy { pointer-events: none; opacity: .7; }
.inp, .sel, .ta { width: 100%; height: 42px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); padding: 0 12px; font-weight: 600; font-size: 15px; outline: none; transition: border-color .12s, box-shadow .12s; }
.ta { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.inp:focus, .sel:focus, .ta:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--accBg); }
.inp[readonly] { color: var(--mute); background: var(--surf2); }
.inp.mono { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.lbl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lbl > span { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em; color: var(--mute); text-transform: uppercase; }
.lbl > small { color: var(--faint); font-size: 12.5px; }
.lbl.req > span::after { content: ' *'; color: var(--accT); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; min-height: 42px; }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 11px; transition: background .15s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; width: 16px; height: 16px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 8px; transition: transform .15s; }
.switch input:checked + i { background: var(--acc); } .switch input:checked + i::after { transform: translateX(16px); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.pill.on { border-color: var(--acc); background: var(--accBg); color: var(--accT); }
.pill i { width: 8px; height: 8px; border-radius: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.err-box { padding: 10px 12px; border-radius: 10px; background: var(--badBg); color: var(--bad); font-weight: 600; font-size: 14px; }
.info-box { padding: 10px 12px; border-radius: 10px; background: var(--infoBg); color: var(--info); font-weight: 600; font-size: 14px; }
.warn-box { padding: 10px 12px; border-radius: 10px; background: var(--warnBg); color: var(--warn); font-weight: 600; font-size: 14px; }
.ok-box { padding: 10px 12px; border-radius: 10px; background: var(--okBg); color: var(--ok); font-weight: 600; font-size: 14px; }

/* ref picker */
.picker { position: relative; }
.picker .list { position: absolute; z-index: 40; top: 46px; inset-inline: 0; background: var(--surf); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh); max-height: 260px; overflow: auto; padding: 4px; }
.picker .list div { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.picker .list div:hover, .picker .list div.sel { background: var(--surf2); }
.picker .clear { position: absolute; inset-inline-end: 6px; top: 6px; }

/* ---------- cards & KPIs */
.card { background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.tight { padding: 0; gap: 0; overflow: hidden; }
.card h3 { margin: 0; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.card h3 small { font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 10px; color: var(--mute); letter-spacing: .1em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surf); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; text-decoration: none; color: var(--ink); transition: border-color .12s; }
a.kpi:hover { border-color: var(--acc); text-decoration: none; }
.kpi .k { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .14em; color: var(--mute); }
.kpi .v { font-weight: 700; font-size: 30px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--mute); margin-inline-end: 4px; }
.kpi .d { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mute); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.grid2e { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: .06em; white-space: nowrap; text-transform: uppercase; background: var(--surf2); color: var(--mute); }
.chip.ok { background: var(--okBg); color: var(--ok); } .chip.info { background: var(--infoBg); color: var(--info); } .chip.warn { background: var(--warnBg); color: var(--warn); } .chip.bad { background: var(--badBg); color: var(--bad); } .chip.acc { background: var(--accBg); color: var(--accT); } .chip.ink { color: var(--ink); }
.dots { display: flex; gap: 4px; flex-wrap: wrap; } .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.appchip { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.appmark { color: var(--ink); flex: none; display: inline-block; vertical-align: middle; }
.appmark-bg { fill: var(--surf2); stroke: var(--line); stroke-width: 1; }
.dots .appmark { margin-inline-end: -2px; }

/* list rows (attention, activity) */
.lrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surf2); color: var(--ink); text-decoration: none; min-width: 0; }
a.lrow:hover { text-decoration: none; filter: brightness(1.05); outline: 1px solid var(--line); }
.lrow .t { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .s { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mute); white-space: nowrap; }
.feed { display: flex; flex-direction: column; }
.feed > div { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed > div:last-child { border-bottom: none; }
.feed .when { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mute); padding-top: 2px; }
.feed b { font-weight: 700; }
.empty { padding: 28px 16px; text-align: center; color: var(--mute); font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 28px; height: 28px; color: var(--faint); }

/* ---------- tables */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { height: 44px; padding: 0 12px; border: none; background: transparent; color: var(--mute); cursor: pointer; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; box-shadow: inset 0 -2px 0 transparent; white-space: nowrap; text-transform: capitalize; }
.tabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--acc); }
.tabs button .n { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--faint); }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .inp { height: 36px; max-width: 320px; font-size: 14px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: start; font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 9.5px; letter-spacing: .14em; color: var(--mute); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; text-transform: uppercase; user-select: none; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--ink); } .tbl th.sorted { color: var(--accT); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 360px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.click { cursor: pointer; } .tbl tbody tr.click:hover { background: var(--surf2); }
.tbl .main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tbl .main b { display: block; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .main small { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--mute); flex-wrap: wrap; }

/* ---------- drawer, modal */
.scrim { position: fixed; inset: 0; background: rgba(5,8,11,.55); z-index: 50; animation: es-in .12s ease; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(620px, 100vw); background: var(--surf); border-inline-start: 1px solid var(--line); box-shadow: var(--sh); z-index: 51; display: flex; flex-direction: column; animation: es-slide .2s ease; }
.drawer.wide { width: min(980px, 100vw); }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 22px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal { position: fixed; z-index: 61; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--surf); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh); padding: 22px; display: flex; flex-direction: column; gap: 14px; animation: es-in .15s ease; }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.modal h2 { margin: 0; font-size: 22px; }
.modal-scrim { z-index: 60; }
#toasts { position: fixed; z-index: 80; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 11px; font-weight: 700; font-size: 14px; box-shadow: var(--sh); animation: es-in .18s ease; max-width: min(560px, 92vw); display: flex; gap: 10px; align-items: center; }
.toast.bad { background: var(--bad); color: #fff; }

/* key/value + detail tabs */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 14.5px; }
.kv dt { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .1em; color: var(--mute); text-transform: uppercase; padding-top: 3px; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.subtabs { display: flex; gap: 4px; background: var(--surf2); padding: 4px; border-radius: 11px; overflow-x: auto; scrollbar-width: none; }
.subtabs button { height: 34px; padding: 0 12px; border: none; border-radius: 8px; background: transparent; color: var(--mute); cursor: pointer; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.subtabs button.on { background: var(--surf); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 200px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bars .stack { flex: 1; width: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.bars .stack span { border-radius: 3px; min-height: 0; transition: height .3s; }
.bars .b label { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: var(--faint); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 5px; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: var(--mute); }
.legend i { width: 9px; height: 9px; border-radius: 2px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 110px; align-items: center; gap: 10px; font-size: 14px; }
.hbar .track { height: 10px; background: var(--surf2); border-radius: 5px; overflow: hidden; } .hbar .track i { display: block; height: 100%; border-radius: 5px; }
.meter { height: 6px; background: var(--surf2); border-radius: 3px; overflow: hidden; min-width: 60px; } .meter i { display: block; height: 100%; background: var(--acc); border-radius: 3px; }
.status-list > div { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-weight: 600; } .status-list > div:last-child { border: none; }
.status-list .sd { width: 8px; height: 8px; border-radius: 4px; flex: none; }

/* release board */
.rel-app { display: grid; grid-template-columns: 220px repeat(3, minmax(0, 1fr)); gap: 10px; align-items: stretch; padding: 12px; border-bottom: 1px solid var(--line); }
.rel-app:last-child { border: none; }
.rel-slot { background: var(--surf2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 76px; }
.rel-slot .v { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 15px; }

/* invoice paper */
.paper { background: #fff; color: #0C1015; border-radius: 6px; padding: 40px; font-family: 'Rajdhani', sans-serif; box-shadow: var(--sh); }
.paper table { width: 100%; border-collapse: collapse; font-size: 14px; }
.paper th { text-align: start; font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em; color: #5E645B; border-bottom: 1.5px solid #0C1015; padding: 8px 6px; }
.paper td { padding: 9px 6px; border-bottom: 1px solid #DDE1DA; }
.paper .tot td { border: none; padding: 4px 6px; }
.paper .grand td { font-weight: 700; font-size: 18px; border-top: 1.5px solid #0C1015; }
.lines-table td { padding: 6px 4px; vertical-align: top; } .lines-table .inp { height: 38px; font-size: 14px; }

/* misc */
.cmsgrid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; }
.msg { padding: 12px 14px; border-radius: 12px; background: var(--surf2); max-width: 85%; display: flex; flex-direction: column; gap: 4px; }
.msg.staff { align-self: flex-end; background: var(--accBg); } .msg.internal { background: var(--warnBg); border: 1px dashed var(--warn); }
.msg small { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--mute); }
.diff { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; background: var(--surf2); padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--infoBg); color: var(--info); font-weight: 600; }
.banner .ico { width: 18px; height: 18px; }
.perm-grid td, .perm-grid th { text-align: center; } .perm-grid td:first-child, .perm-grid th:first-child { text-align: start; }
.live-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--bad); animation: es-pulse 1.2s infinite; display: inline-block; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .grid3, .cmsgrid { grid-template-columns: minmax(0, 1fr); }
  .rel-app { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sh); }
  .shell.open .rail { transform: none; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 16px; } .page { padding: 16px; }
  .sys span { display: none; }
  .form-grid, .grid2e { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  .head h1 { font-size: 26px; }
  .kpi .v { font-size: 22px; }
  .gsearch kbd { display: none; }
  .hbar { grid-template-columns: 90px 1fr 90px; }
  .paper { padding: 20px; }
}
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none !important; border-radius: 0 !important; }
  .drawer, .modal { position: static; box-shadow: none; border: none; }
}
