:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --border: #e2e4dd;
  --text: #1c211f;
  --muted: #69716c;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --ok: #9fb8ad;
  --fail: #c2410c;
  --fail-soft: #fdeee6;
  --dec: #b45309;
  --dec-bar: #e2a33b;
  --dec-soft: #fdf3e0;
  --good: #15803d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 4px 16px rgba(20, 30, 25, .04);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --grid: #e9ebe5;
  color-scheme: light;
}
/* Dark theme: forced by the user (data-theme=dark) or following Windows (system) */
:root[data-theme="dark"] {
    --bg: #111217;
    --surface: #181b1f;
    --surface-2: #202226;
    --border: #2c3036;
    --text: #d8d9e0;
    --muted: #8e8e9e;
    --accent: #818cf8;
    --accent-ink: #ffffff;
    --ok: #3d6e4f;
    --fail: #f2495c;
    --fail-soft: #3b1d22;
    --dec: #ff9830;
    --dec-bar: #e0861f;
    --dec-soft: #3a2a17;
    --good: #73bf69;
    --shadow: none;
    --grid: rgba(204, 204, 220, .07);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111217;
      --surface: #181b1f;
      --surface-2: #202226;
      --border: #2c3036;
      --text: #d8d9e0;
      --muted: #8e8e9e;
      --accent: #818cf8;
      --accent-ink: #ffffff;
      --ok: #3d6e4f;
      --fail: #f2495c;
      --fail-soft: #3b1d22;
      --dec: #ff9830;
      --dec-bar: #e0861f;
      --dec-soft: #3a2a17;
      --good: #73bf69;
      --shadow: none;
      --grid: rgba(204, 204, 220, .07);
      color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 17px; }
h2 { font-size: 14px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; }
button, select, input { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand p { font-size: 12px; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7'/%3E%3C/svg%3E");
  position: relative; }
.logo::after { content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 18h5l3-8 4 13 3-5h3' stroke='white' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 550; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.btn { border: 1px solid var(--border); background: var(--surface); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 550; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.icon { padding: 4px 10px; }
.btn.small { padding: 3px 10px; font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.banner { margin: 12px 24px 0; padding: 10px 14px; border-radius: 10px; background: var(--fail-soft); color: var(--fail); border: 1px solid color-mix(in srgb, var(--fail) 30%, transparent); }
.banner.warn { background: var(--dec-soft); color: var(--dec); border-color: color-mix(in srgb, var(--dec) 30%, transparent); }

main { padding: 20px 24px 40px; display: grid; gap: 16px; max-width: 1440px; margin: 0 auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 680; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.alert .value { color: var(--fail); }
.kpi.warn .value { color: var(--dec); }
.kpi.good .value { color: var(--good); }

.grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr 1fr; } .grid .wide { grid-column: 1 / -1; } }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } main, .topbar { padding-left: 16px; padding-right: 16px; } .banner { margin-left: 16px; margin-right: 16px; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 12px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.ok { background: var(--ok); } .sw.fail { background: var(--fail); } .sw.dec { background: var(--dec-bar); }

.chart { height: 220px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .grid-line { stroke: var(--border); }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; gap: 4px; }
.bars .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bars .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .row b { font-variant-numeric: tabular-nums; }
.bars .track { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--fail); border-radius: 99px; }
.bars .cat { color: var(--muted); font-size: 11px; }

.count { color: var(--muted); font-weight: 500; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select, .dlg-side select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.filters input { width: 240px; max-width: 100%; }

.table-wrap { overflow-x: auto; margin: 0 -16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; text-align: right; }
th { color: var(--muted); font-weight: 550; font-size: 12px; position: sticky; top: 0; background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.reason { white-space: normal; min-width: 220px; max-width: 360px; }
td.reason small { display: block; color: var(--muted); }
td .mono { font-family: var(--mono); font-size: 12px; }
tbody tr:hover { background: var(--surface-2); }
tr.new { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: var(--fail-soft); } to { background: transparent; } }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 650; letter-spacing: .03em; }
.chip.FAILED { background: var(--fail-soft); color: var(--fail); }
.chip.DECLINE { background: var(--dec-soft); color: var(--dec); }
.empty { text-align: center; color: var(--muted); padding: 24px; margin: 0; }
.skeleton { color: var(--muted); }

dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--text); width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 14, 12, .45); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-h { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 8px; }
.dlg-h h2 { font-size: 16px; }
.tabs { display: flex; gap: 6px; padding: 0 18px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--border); background: transparent; border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: 12px; font-weight: 550; color: var(--muted); }
.tabs button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.dlg-body { display: grid; grid-template-columns: 1fr 220px; gap: 18px; padding: 14px 18px 18px; overflow: auto; }
@media (max-width: 640px) { .dlg-body { grid-template-columns: 1fr; } }
.dlg-side { display: grid; gap: 10px; align-content: start; }
.dlg-side label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }

/* On-screen receipt preview: a strip of thermal paper */
.paper { justify-self: center; width: 100%; max-width: 340px; background: #fffef9; color: #111; padding: 18px 16px 22px; border-radius: 4px;
  box-shadow: 0 1px 0 #e7e4d8, 0 8px 24px rgba(0,0,0,.12); font-family: var(--mono); font-size: 12px; line-height: 1.45; position: relative; }
.paper::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px;
  background: linear-gradient(-45deg, transparent 6px, #fffef9 0) 0 0 / 12px 8px repeat-x, linear-gradient(45deg, transparent 6px, #fffef9 0) 0 0 / 12px 8px repeat-x; }
.paper pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 13px; z-index: 20; }
#printFrame { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }

/* ---------- auto-print pill + settings ---------- */
.pill { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.pill.on { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.pill.err { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, transparent); background: var(--fail-soft); }
#settingsDlg { width: min(720px, calc(100vw - 24px)); }
.dlg-scroll { overflow: auto; padding: 4px 18px 8px; display: grid; gap: 14px; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
legend { font-weight: 650; padding: 0 6px; }
fieldset label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
fieldset input:not([type=checkbox]), fieldset select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; color: var(--text); width: 100%; min-width: 0; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
label.switch { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; cursor: pointer; }
label.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.jobs { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.jobs li { display: flex; gap: 8px; }
.jobs .ok { color: var(--good); } .jobs .bad { color: var(--fail); }
.dlg-f { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
[hidden] { display: none !important; }

/* ---------- filter bar ---------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 57px; z-index: 4; }
.filterbar .spacer { flex: 1; }
.custom-range { display: inline-flex; gap: 6px; align-items: center; }
.custom-range input[type=date], .inline input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; color: var(--text); }
.dropdown { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 10px; min-width: 280px; display: grid; gap: 8px; }
.export-menu { left: auto; right: 0; min-width: 240px; }
.menu-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.menu-f { display: flex; justify-content: flex-end; }
.menu input[type=search] { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text); }
.export-menu a { display: block; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); text-decoration: none; }
.export-menu a:hover { background: var(--surface-2); }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 12px; }
.checklist { display: grid; gap: 2px; max-height: 300px; overflow: auto; }
.checklist.boxed { border: 1px solid var(--border); border-radius: 10px; padding: 6px; max-height: 190px; }
.ck { display: grid !important; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13px !important; color: var(--text) !important; }
.ck:hover { background: var(--surface-2); }
.ck.all { border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; font-weight: 600; }
.ck input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.ck .tid { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.label-like { margin: 2px 0 6px; font-size: 12px; color: var(--muted); }
label.inline { display: inline-flex !important; gap: 6px; align-items: center; }
@media (max-width: 700px) { .filterbar { padding: 10px 16px; position: static; } }

/* ---------- terminal table ---------- */
.term-table tbody tr { cursor: pointer; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.rate-track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; max-width: 120px; }
.rate-fill { height: 100%; border-radius: 99px; background: var(--good); }
.rate.warn .rate-fill { background: var(--dec-bar); } .rate.alert .rate-fill { background: var(--fail); }
.rate span { font-variant-numeric: tabular-nums; font-size: 12px; min-width: 38px; }
.rate.alert span { color: var(--fail); font-weight: 600; }

/* ---------- settings tabs ---------- */
.stabs { display: flex; gap: 4px; padding: 0 18px 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stabs button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 550; color: var(--muted); }
.stabs button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.dlg-scroll > section { display: grid; gap: 14px; }
#settingsDlg { width: min(760px, calc(100vw - 24px)); }
.jobs a { color: var(--accent); }
.term-table th:last-child, .term-table td:last-child { text-align: left; }

/* ---------- access check ---------- */
#accessDlg { width: min(1100px, calc(100vw - 24px)); }
.small-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.small-kpis .kpi { padding: 10px 12px; box-shadow: none; }
.small-kpis .kpi .value { font-size: 21px; }
.table-wrap.flush { margin: 0; border: 1px solid var(--border); border-radius: 10px; }
.access-table td { vertical-align: middle; }
.access-table .acc { color: var(--muted); font-size: 12px; }
.access-table tr.acc-row td { background: var(--surface-2); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.yes { color: var(--good); font-weight: 600; } .no { color: var(--fail); font-weight: 600; }
.note { padding: 8px 12px; border-radius: 8px; background: var(--dec-soft); color: var(--dec); font-size: 13px; margin: 0 0 10px; }
.note.bad { background: var(--fail-soft); color: var(--fail); }
.access-table tr.acc-row td { text-align: left; }
.access-table .rate { min-width: 110px; }
.access-table .rate-track { max-width: 70px; }

/* ---------- all spaces ---------- */
.seglink { padding: 5px 12px; border-radius: 6px; color: var(--muted); font-weight: 550; text-decoration: none; font-size: 14px; }
.seglink.on { background: var(--accent); color: var(--accent-ink); }
.search-input, .mini-input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text); }
.search-input { width: 200px; }
.mini-input { width: 58px; padding: 4px 6px; }
.setup-card { display: grid; gap: 10px; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.setup-card h2 { font-size: 17px; }
.setup-card p, .setup-card ul { margin: 0; }
.sw.line { height: 3px; border-radius: 2px; background: var(--accent); vertical-align: 3px; }
.chart .target-line { stroke: var(--accent); stroke-dasharray: 4 4; opacity: .55; }
.chart .rate-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.small-chart { height: 170px; }
.spark path { fill: none; stroke: var(--good); stroke-width: 1.8; stroke-linejoin: round; }
.spark.warn path { stroke: var(--dec-bar); } .spark.alert path { stroke: var(--fail); }
.spark-target { stroke: var(--border); stroke-dasharray: 3 3; }
.net-table th[data-sort] { cursor: pointer; user-select: none; }
.net-table th.sorted::after { content: ' ' attr(data-dir); font-size: 10px; }
.net-table tr.acc-line { background: var(--surface-2); cursor: pointer; }
.net-table tr.acc-line td { border-bottom: 1px solid var(--border); }
.net-table tr.space-line { cursor: pointer; }
.net-table td.indent { padding-left: 40px !important; }
.net-table th:last-child, .net-table td:last-child { text-align: left; }
.caret { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px 0 0; font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.two-col h3 { font-size: 13px; margin: 0 0 8px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
#spaceDlg { width: min(1000px, calc(100vw - 24px)); }
a.btn { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }

/* ---------- v1.4: branding, login, user menu ---------- */
.logo-img { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; display: block; flex: none; }
.app-footer { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; padding: 14px 24px 22px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.copyright-text { white-space: normal; line-height: 1.55; color: var(--muted); }
.copyright-dlg { width: min(560px, calc(100vw - 24px)); }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent), var(--bg); }
.login-wrap { width: min(400px, calc(100vw - 32px)); display: grid; gap: 14px; padding: 0; }
.login-card { display: grid; gap: 14px; padding: 26px; box-shadow: 0 12px 40px rgba(0,0,0,.12); }
.login-card label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.login-card input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-size: 14px; color: var(--text); }
.login-card .btn.primary { padding: 9px; font-size: 14px; justify-content: center; }
.login-brand { display: grid; justify-items: center; gap: 8px; text-align: center; margin-bottom: 4px; }
.login-brand h1 { font-size: 20px; }
.login-brand h1.sub { font-size: 15px; color: var(--muted); font-weight: 600; }
.login-logo { width: 190px; border-radius: 14px; display: block; }
.logo-img.big { width: 64px; height: 64px; border-radius: 14px; }
.login-msg { color: var(--fail); font-size: 13px; margin: 0; min-height: 1em; }
.login-foot { text-align: center; }
.user-menu { left: auto; right: 0; min-width: 240px; display: grid; gap: 4px; padding: 8px; }
.user-menu > a { display: block; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text); text-decoration: none; }
.user-menu > a:hover { background: var(--surface-2); }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.theme-pick button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 6px 4px; font-size: 12px; cursor: pointer; color: var(--muted); }
.theme-pick button.on { border-color: var(--accent); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.role-chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.role-chip.admin { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.small-dlg { width: min(480px, calc(100vw - 24px)); }
dialog:has(.small-dlg) { width: min(480px, calc(100vw - 24px)); }

/* ---------- alarm banner ---------- */
.alarm-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 24px; background: #c4162a; color: #fff; font-size: 13px; animation: alarmPulse 1.6s ease-in-out infinite; }
.alarm-banner.acked { background: color-mix(in srgb, #c4162a 70%, #000); animation: none; }
.alarm-banner .alarm-text { flex: 1; min-width: 240px; }
.alarm-banner .alarm-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.alarm-banner .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.alarm-banner .btn.primary { background: #fff; color: #c4162a; border-color: #fff; font-weight: 650; }
.alarm-icon { font-size: 18px; }
@keyframes alarmPulse { 50% { background: #e02f44; } }
@media (prefers-reduced-motion: reduce) { .alarm-banner { animation: none; } }

/* ---------- Grafana-style panels ---------- */
.panels-card .card-h h2 { margin-right: auto; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); min-width: 0; padding: 6px 8px 4px; }
.panel.wide { grid-column: 1 / -1; }
.panel-h { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; padding: 2px 4px 6px; }
.uplot-host { min-height: 120px; }
.uplot { font-family: var(--sans); }
.uplot .u-legend { font-size: 12px; color: var(--text); text-align: left; padding: 2px 0 0; }
.uplot .u-legend .u-series { padding: 1px 8px 1px 0; cursor: pointer; }
.uplot .u-legend .u-series > * { padding: 2px 3px; }
.uplot .u-legend .u-value { font-variant-numeric: tabular-nums; color: var(--muted); }
.uplot .u-legend .u-off > * { opacity: .35; }
.uplot .u-select { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.uplot .u-cursor-x, .uplot .u-cursor-y { border-color: var(--muted) !important; }
.src-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } .hide-sm { display: none; } }

/* ---------- admin ---------- */
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 20px; max-width: 1300px; margin: 0 auto; padding: 20px 24px 40px; }
.admin-nav { display: grid; gap: 2px; align-content: start; position: sticky; top: 12px; }
.admin-nav a { padding: 9px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px; }
.admin-nav a:hover { background: var(--surface); color: var(--text); }
.admin-nav a.on { background: var(--surface); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.admin-main { min-width: 0; padding: 0; display: block; max-width: none; margin: 0; width: 100%; }
.admin-main > .card { display: grid; gap: 14px; }
.admin-main h3 { font-size: 13px; margin: 6px 0 0; }
.pane-f { display: flex; justify-content: flex-end; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.admin-main hr { border: 0; border-top: 1px solid var(--border); width: 100%; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.btn.danger { color: var(--fail); }
.users-table tr.disabled td { opacity: .55; }
.mod-chips { display: flex; flex-wrap: wrap; gap: 4px; white-space: normal; max-width: 520px; }
.mod-chip { display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--border); border-radius: 99px; padding: 2px 9px 2px 6px; font-size: 12px; cursor: pointer; color: var(--muted); }
.mod-chip.on { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.mod-chip input { margin: 0; accent-color: var(--accent); }
.module-help { font-size: 12px; color: var(--muted); }
.module-help ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.src-list { display: grid; gap: 8px; }
.src-card { display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 10px 0; overflow: hidden; }
.src-card.off { opacity: .6; }
.src-swatch { align-self: stretch; }
.src-main { display: grid; gap: 3px; min-width: 0; }
label.switch.small { font-size: 12px; gap: 4px; }
label.switch.small input { width: 15px; height: 15px; }
.rules-table input, .rules-table select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 4px 6px; color: var(--text); }
.rules-table td { padding: 6px 6px; }
.rules-table .w-name { width: 150px; } .rules-table .w-num { width: 62px; }
.sound-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sound-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.sound-opt { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 9px; padding: 5px 6px 5px 10px; cursor: pointer; font-size: 13px; }
.sound-opt span { flex: 1; }
.sound-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sound-opt.disabled { opacity: .45; cursor: default; }
.sound-opt input { accent-color: var(--accent); margin: 0; }
.sound-side { display: grid; gap: 10px; align-content: start; }
.sound-side > label:not(.switch) { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.upload-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.file-btn { cursor: pointer; }
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.logo-previews { display: flex; gap: 10px; margin-bottom: 10px; }
.logo-prev { display: grid; justify-items: center; gap: 6px; padding: 16px 22px 8px; border-radius: 12px; border: 1px solid var(--border); font-size: 11px; }
.logo-prev img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; }
.logo-prev.light { background: #f4f5f2; color: #69716c; } .logo-prev.dark { background: #111217; color: #8e8e9e; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
label.field input, label.field textarea, .admin-main fieldset textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; color: var(--text); font: inherit; }
.cr-preview { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; display: grid; gap: 6px; color: var(--muted); }
.cr-preview b { color: var(--text); }
.color-in { padding: 2px !important; height: 34px; width: 100%; }
@media (max-width: 860px) { .admin-wrap { grid-template-columns: 1fr; } .admin-nav { position: static; grid-auto-flow: column; overflow-x: auto; } .sound-grid, .brand-grid { grid-template-columns: 1fr; } }
.user-drop .menu { z-index: 60; }
.topbar { z-index: 50; }

/* ---------- v1.6: authorization details, terminals, final balance ---------- */
.auth-link { text-align: left; color: var(--text); display: inline-flex; gap: 6px; align-items: baseline; }
.auth-link small { color: var(--muted); font-size: 12px; white-space: normal; max-width: 180px; display: inline-block; }
.auth-link:hover small { color: var(--accent); }
.rc { background: var(--fail-soft); color: var(--fail); padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.auth-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 10px; font-size: 13px; }
.auth-dl dt { color: var(--muted); }
.auth-dl dd { margin: 0; }
.auth-labels { font-size: 12px; border: 1px solid var(--border); border-radius: 8px; }
.auth-labels td { padding: 5px 10px; white-space: normal; word-break: break-word; }
.auth-labels td:first-child { color: var(--muted); padding-left: 10px; width: 45%; }
.auth-labels td:last-child { text-align: left; padding-right: 10px; }
.auth-box { border-top: 1px solid var(--border); padding-top: 10px; }
.auth-box .auth-dl { grid-template-columns: 1fr; gap: 2px; }
.auth-box .auth-dl dd { margin-bottom: 6px; }
#receiptDlg .dlg-body { grid-template-columns: 1fr 280px; }
.inline-controls { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.space-pick select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; color: var(--text); max-width: 320px; }
#termSel { width: auto; max-width: 260px; }
.tid-table th[data-sort] { cursor: pointer; user-select: none; }
.tid-table th.sorted::after { content: ' ' attr(data-dir); font-size: 10px; }
.tid-table td.wrap { white-space: normal; min-width: 160px; max-width: 260px; }
.tid-table .tid { font-size: 13px; font-weight: 600; }
.tid-table th:last-child, .tid-table td:last-child { text-align: right; }
.chip.st { background: var(--surface-2); color: var(--muted); text-transform: capitalize; }
.chip.st.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.chip.st.warn { background: var(--dec-soft); color: var(--dec); }
.bal-table tr.bal-line { cursor: pointer; }
.bal-table tr.bal-line.open td { background: var(--surface-2); }
.bal-table td.num b { font-variant-numeric: tabular-nums; }
.bal-table > tbody > tr.bal-detail > td { background: var(--surface-2); padding: 8px 16px 14px 40px; text-align: left; }
.brand-table th, .brand-table td { text-align: left; }
.brand-table th.num, .brand-table td.num { text-align: right; }
.brand-table th:first-child, .brand-table td:first-child { padding-left: 10px; }
main > section[data-pane] { display: grid; gap: 16px; }
.brand-table { width: auto; min-width: 420px; font-size: 12px; }
.brand-table th, .brand-table td { padding: 5px 10px; }
.dlg-side .brand-table { min-width: 0; width: 100%; }
#balDlg { width: min(900px, calc(100vw - 24px)); }
#balDlg .dlg-body { grid-template-columns: 1fr 300px; }
.paper pre { font-size: 12px; }
@media (max-width: 760px) { #receiptDlg .dlg-body, #balDlg .dlg-body { grid-template-columns: 1fr; } }

/* ---------- v1.7: tips ---------- */
.tips-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.tips-grid h3 { font-size: 13px; margin: 6px 0 8px; }
.tips-grid h3:not(:first-child) { margin-top: 16px; }
.tips-grid table td, .tips-grid table th { padding: 7px 12px; }
tr.total-row td { border-top: 2px solid var(--border); background: var(--surface-2); }
.tips-cell { color: var(--good); }
#tipDlg { width: min(760px, calc(100vw - 24px)); }
.tip-preview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.tip-frame { width: 100%; height: 420px; border: 0; display: block; background: #fff; }
@media (max-width: 900px) { .tips-grid { grid-template-columns: 1fr; } }

/* ---------- v1.8: customizable dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-grid > .widget { grid-column: span 12; min-width: 0; position: relative; }
.dash-grid > .widget[data-size="s"] { grid-column: span 3; }
.dash-grid > .widget[data-size="m"] { grid-column: span 4; }
.dash-grid > .widget[data-size="l"] { grid-column: span 6; }
.dash-grid > .widget[data-size="xl"] { grid-column: span 8; }
.dash-grid > .widget[data-size="full"] { grid-column: span 12; }
@media (max-width: 1100px) {
  .dash-grid > .widget[data-size="s"], .dash-grid > .widget[data-size="m"], .dash-grid > .widget[data-size="l"] { grid-column: span 6; }
  .dash-grid > .widget[data-size="xl"] { grid-column: span 12; }
}
@media (max-width: 760px) { .dash-grid > .widget { grid-column: span 12 !important; } }
.widget[data-widget="kpis"] { padding-bottom: 14px; }
.widget .card-h { position: relative; }
.w-note { margin-left: auto; }
.w-body { min-height: 60px; position: relative; }
.dash-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 10px 14px; border: 1px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.hidden-widgets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; }
.dash-actions { display: flex; gap: 6px; }
.chip-btn { border: 1px dashed var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
#customizeBtn.on { border-color: var(--accent); color: var(--accent); }
body.dash-editing .widget { outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; cursor: grab; }
body.dash-editing .widget.dragging { opacity: .45; }
body.dash-editing .widget.drop-before { box-shadow: -4px 0 0 var(--accent); }
body.dash-editing .widget.drop-after { box-shadow: 4px 0 0 var(--accent); }
body.dash-editing .widget[data-size="full"].drop-before { box-shadow: 0 -4px 0 var(--accent); }
body.dash-editing .widget[data-size="full"].drop-after { box-shadow: 0 4px 0 var(--accent); }
.w-tools { display: inline-flex; gap: 2px; align-items: center; margin-right: 6px; order: -1; }
.w-handle { cursor: grab; color: var(--muted); font-size: 16px; padding: 0 4px; user-select: none; }
.w-panel { position: absolute; top: 44px; left: 12px; z-index: 35; width: 300px; max-width: calc(100% - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.25); padding: 12px; display: grid; gap: 10px; cursor: default; }
.w-panel-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.w-panel label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.w-panel input:not([type=color]), .w-panel select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.type-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.type-pick button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 4px 9px; font-size: 12px; cursor: pointer; }
.type-pick button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.color-pick label { display: flex !important; align-items: center; gap: 5px; font-size: 11px; }
.color-pick input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
/* charts */
.ch { display: block; width: 100%; height: auto; overflow: visible; }
.ch .axis { fill: var(--muted); font-size: 11px; }
.ch .grid-line { stroke: var(--grid, var(--border)); }
.ch-cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.ch-tip { position: absolute; pointer-events: none; z-index: 20; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.18); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.ch-tip i, .ch-legend i, .ch-pie-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); padding: 6px 4px 0; }
.ch-hbar { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ch-hbar li { display: grid; gap: 3px; }
.ch-hbar .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.ch-hbar .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-hbar .row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-hbar .track { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.ch-hbar .fill { height: 100%; border-radius: 99px; }
.ch-hbar .cat { color: var(--muted); font-size: 11px; }
.ch-pie { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }
.ch-pie svg { flex: none; }
.ch-total { fill: var(--text); font-size: 15px; font-weight: 700; }
.ch-total-l { fill: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.ch-pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 12px; min-width: 170px; flex: 1; }
.ch-pie-legend li { display: grid; grid-template-columns: 14px 1fr auto 38px; align-items: center; gap: 4px; }
.ch-pie-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pie-legend b { font-variant-numeric: tabular-nums; }
.ch-pie-legend em { font-style: normal; color: var(--muted); text-align: right; }
.ch-table { font-size: 13px; }
.perf-table td { vertical-align: middle; }
.perf-table tbody tr { cursor: pointer; }
.perf-bar { display: flex; gap: 2px; height: 4px; margin-top: 5px; max-width: 220px; }
.perf-bar i { display: block; height: 100%; border-radius: 99px; min-width: 0; }

/* ---------- activation ---------- */
.activate-wrap { width: min(520px, calc(100vw - 32px)); }
.machine-box { display: grid; gap: 4px; }
.machine-id { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.machine-id code { font-family: var(--mono); font-size: 16px; font-weight: 700; letter-spacing: .06em; }
.login-card textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font: 12px/1.4 var(--mono); color: var(--text); resize: vertical; word-break: break-all; }
.license-box { display: grid; gap: 6px; font-size: 14px; }

.ch-pie.stack { flex-direction: column; align-items: stretch; }
.ch-pie.stack svg { align-self: center; }
body.dash-editing .widget .card-h { justify-content: flex-start; }
body.dash-editing .widget .card-h .w-note, body.dash-editing .widget .card-h > .muted { margin-left: auto; }

/* ---------- v1.9: modules ---------- */
.feat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.feat { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; opacity: .65; }
.feat.on { opacity: 1; border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.feat input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; }

.list-sums { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.list-sums b { color: var(--text); }
.list-more { display: flex; justify-content: center; padding: 12px 0 2px; }
.chip.COMPLETED, .chip.FULFILL { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.chip.AUTHORIZED { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.chip.PENDING, .chip.PROCESSING, .chip.CONFIRMED, .chip.VOIDED { background: var(--surface-2); color: var(--muted); }
#balBrands { overflow-x: auto; } .dlg-side { min-width: 0; }

/* Infinity Merchant: spaces */
.menu-note { margin: 0 2px 6px; }
.spaces-edit { width: 100%; border-collapse: collapse; font-size: 13px; }
.spaces-edit th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 6px; }
.spaces-edit td { padding: 4px 6px; vertical-align: middle; }
.spaces-edit input { width: 100%; }
.spaces-edit .w-num { max-width: 120px; }

/* Infinity Print */
.print-main { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; }
.print-intro { margin: 0 0 16px; font-size: 14px; }
.print-grid { display: grid; gap: 16px; }
.print-grid h2 { margin: 0 0 12px; font-size: 16px; }
.print-grid .card { display: grid; gap: 12px; }
.print-on { border-color: var(--accent); }
.big-switch { font-size: 15px; font-weight: 600; color: var(--text); }
.big-switch input { width: 22px !important; height: 22px !important; }

/* ---------- Loading tab (local database) ---------- */
.loading-page { display: grid; gap: 16px; }
.load-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 4px; }
.space-pick-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.space-pick-list:empty { display: none; }
.ld-jobs { display: grid; gap: 10px; }
.job { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); margin-bottom: 10px; }
.ld-jobs .job { margin-bottom: 0; }
.job-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.job-h .spacer { flex: 1; }
.job-f { margin-top: 6px; }
.job-err { margin-top: 6px; color: var(--fail); }
.jstate { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.jstate.run { color: var(--accent); border-color: var(--accent); }
.jstate.ok { color: var(--good); border-color: var(--good); }
.jstate.warn { color: var(--dec); border-color: var(--dec); }
.jstate.bad { color: var(--fail); border-color: var(--fail); }
.pbar { height: 10px; border-radius: 99px; background: var(--grid); overflow: hidden; }
.pbar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s ease; }
.pbar.done > span { background: var(--good); }
.pbar.paused > span, .pbar.cancelled > span { background: var(--muted); }
.pbar.error > span { background: var(--fail); }
.job.running .pbar > span { background-image: linear-gradient(90deg, transparent 0, rgba(255,255,255,.25) 50%, transparent 100%); background-size: 200px 100%; animation: pbar-move 1.4s linear infinite; }
@keyframes pbar-move { from { background-position: -200px 0; } to { background-position: 200px 0; } }
@media (prefers-reduced-motion: reduce) { .job.running .pbar > span { animation: none; } }
.db-spaces { display: grid; gap: 14px; }
.db-space { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.db-space:last-child { border-bottom: 0; padding-bottom: 0; }
.cover { margin: 4px 0 6px; }
.cover-bar { position: relative; height: 14px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.cover-bar > span { position: absolute; top: 0; bottom: 0; background: var(--good); opacity: .85; }
.cover-axis { display: flex; justify-content: space-between; margin-top: 2px; }
.banner a.btn { margin-left: 8px; }

/* ---------- Admin → Backup & restore ---------- */
[data-pane="backup"] h3 { margin: 22px 0 8px; font-size: 14px; }
[data-pane="backup"] .kpis { margin: 12px 0 4px; }
.bk-form { display: grid; gap: 10px; }
.bk-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.bk-table td { vertical-align: middle; }
.bk-table .row-actions { justify-content: flex-end; }
.tagc { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); margin-right: 4px; }
#bkUpProg { margin-top: 6px; }
#bkUpProg .pbar > span { width: 0; transition: width .2s; }

/* ---------- live chart (Revenue & tips over time → Live) ---------- */
.lv-wrap { position: relative; }
.lv .lv-move { will-change: transform; }
.lv .lv-now { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.lv .lv-now-l { fill: var(--accent); font-weight: 600; }
.lv .lv-tick { stroke: var(--grid, var(--border)); stroke-dasharray: 2 4; }
.lv .lv-fresh rect:not(.lv-hit) { animation: lv-pop 2.4s ease-out; transform-box: fill-box; transform-origin: bottom; }
@keyframes lv-pop { 0% { transform: scaleY(0); filter: brightness(1.6); } 25% { transform: scaleY(1.08); filter: brightness(1.5); } 100% { transform: scaleY(1); filter: none; } }
@media (prefers-reduced-motion: reduce) { .lv .lv-move { transition: none !important; } .lv .lv-fresh rect { animation: none; } }
.lv-empty { position: absolute; inset: 40% 0 auto 0; text-align: center; pointer-events: none; margin: 0; }
.lv-ctrl { display: inline-flex; align-items: center; gap: 6px; }
.lv-ctrl .seg button { padding: 3px 9px; font-size: 12px; }
.lv-ctrl select { font-size: 12px; padding: 3px 6px; }
.lv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--fail); margin-right: 5px; vertical-align: 0; animation: lv-blink 1.2s infinite; }
.lv-dot.off { background: var(--muted); animation: none; }
@keyframes lv-blink { 50% { opacity: .25; } }
/* Grafana-style live time series */
.lv .grid-line { stroke: var(--grid, var(--border)); }
.lv .lv-tick { stroke: var(--grid, var(--border)); stroke-dasharray: none; }
.lv .axis { font-size: 11px; font-variant-numeric: tabular-nums; }
.lv .lv-cross-l { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .8; }
.lv .lv-hover { cursor: crosshair; }
.lv .lv-pulse { animation: lv-pulse 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes lv-pulse { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(3.2); } }
@media (prefers-reduced-motion: reduce) { .lv .lv-pulse { animation: none; } }
.lv-legend-t { border-collapse: collapse; font-size: 12px; margin: 6px 0 0 6px; font-variant-numeric: tabular-nums; }
.lv-legend-t th { color: var(--accent); font-weight: 600; text-align: right; padding: 2px 0 2px 22px; }
.lv-legend-t th:first-child { padding-left: 0; }
.lv-legend-t td { padding: 2px 0 2px 22px; color: var(--text); white-space: nowrap; }
.lv-legend-t td:first-child { padding-left: 0; color: var(--muted); }
.lv-legend-t td.num, .lv-legend-t th.num { text-align: right; }
.lv-legend-t i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.ch-tip .lv-tip-h { font-weight: 600; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.ch-tip .lv-tip-r { display: flex; align-items: center; gap: 6px; min-width: 150px; }
.ch-tip .lv-tip-r b { margin-left: auto; padding-left: 14px; }
.ch-tip .lv-tip-r i { width: 12px; height: 3px; border-radius: 2px; }
.lv-legend .lv-legend-t { width: auto; }

/* ---------- Terminals → Tips & DCC ---------- */
[data-pane="tips"] { display: grid; gap: 14px; }
[data-pane="tips"][hidden] { display: none; }
.td-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.td-head .spacer { flex: 1; }
.td-note { margin: -4px 0 0; }
.td-cur select { margin-left: 6px; }
.td-kpis .kpi { position: relative; }
.td-sw { position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.td-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.td-table th.sortable.on { color: var(--accent); }
.td-table td.td-tips { color: var(--good); }
.td-table td.td-dcc { color: #8f5bd8; }
:root[data-theme="dark"] .td-table td.td-dcc { color: #c99ef0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .td-table td.td-dcc { color: #c99ef0; } }
.td-tools { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; order: -1; }
.td-tools select { font-size: 12px; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }

/* ---------- Transactions widget: fits its width ---------- */
.tx-table td, .tx-table th { padding: 8px 9px; }
.tx-table td small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.tx-table .t-id .mono { font-size: 12px; }
.tx-table .t-id small, .tx-table td.term small { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.tx-table td.reason { white-space: normal; min-width: 140px; max-width: 240px; }
.tx-table td.resp { white-space: normal; min-width: 90px; max-width: 170px; }
.tx-table td.term { white-space: normal; min-width: 120px; max-width: 200px; }
.tx-table td.wrap { white-space: normal; }
.tx-table .icon-btn { min-width: 30px; padding-left: 6px; padding-right: 6px; }
.list-more { display: flex; gap: 8px; justify-content: center; }
[data-widget="failures"] .card-h { flex-wrap: wrap; }
[data-widget="failures"] .filters { flex-wrap: wrap; }
[data-widget="failures"] #search { min-width: 180px; flex: 1 1 220px; }
@media (max-width: 1050px) {
  .tx-table { font-size: 12px; }
  .tx-table td, .tx-table th { padding: 7px 6px; }
  .tx-table td.reason { min-width: 110px; max-width: 180px; }
  .tx-table td.term { min-width: 100px; max-width: 150px; }
  .tx-table td.resp { min-width: 80px; max-width: 130px; }
}

/* ---------- tab colours (Admin → Tabs) ---------- */
.seg .tab-colored.on, .seglink.tab-colored.on { background: var(--tab-c); color: var(--tab-ink); }
.seg .tab-colored:not(.on), .seglink.tab-colored:not(.on) { box-shadow: inset 0 -3px 0 var(--tab-c); color: var(--text); }
.tab-rows { display: grid; gap: 8px; }
.tab-rows h3 { margin: 14px 0 2px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tab-row { display: grid; grid-template-columns: 260px minmax(160px, 1fr) auto; gap: 14px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.tab-row label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.tab-row input[data-f="label"] { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.tab-prev .seg { display: inline-flex; }
.tab-colors { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tab-colors .sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px var(--border); display: inline-grid; place-items: center; font-size: 10px; }
.tab-colors .sw.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }
.tab-colors .sw.std { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tab-colors .sw.custom { width: auto; padding: 0 6px; border-radius: 11px; background: var(--surface); position: relative; overflow: hidden; }
.tab-colors .sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
@media (max-width: 900px) { .tab-row { grid-template-columns: 1fr; } }
.tab-prev .seg button { white-space: nowrap; }
/* instant response-code alarms */
.code-table .w-code { width: 120px; text-transform: uppercase; }
.code-clear { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.code-clear select, .code-clear input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; color: var(--text); }
.alarm-dlg .dlg { width: min(1040px, 96vw); max-width: 96vw; }

/* ---------- All spaces: Wallee ⇄ Worldline link tile ---------- */
.link-kpis { display: contents; }
.link-kpi { cursor: pointer; position: relative; min-width: 0; }
.link-kpi .label { letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-kpi:hover { border-color: var(--accent); }
.link-kpi .link-svg { display: block; width: 100%; max-width: 300px; height: 48px; margin: 6px 0 2px; overflow: visible; }
.link-kpi .node rect { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; transition: stroke .3s; }
.link-kpi .node text { font-size: 11px; font-weight: 650; text-anchor: middle; fill: var(--text); }
.link-kpi .wire { stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.link-kpi .value { font-size: 20px; }
.link-kpi.up .value { color: var(--good); }
.link-kpi.up .node rect { stroke: var(--good); }
.link-kpi.up .wire { stroke: color-mix(in srgb, var(--good) 55%, transparent); }
.link-kpi.up .pkt { fill: var(--good); }
.link-kpi .p1, .link-kpi .p2 { animation: link-right 1.8s linear infinite; }
.link-kpi .p2 { animation-delay: .9s; }
.link-kpi .p3, .link-kpi .p4 { animation: link-left 1.8s linear infinite; animation-delay: .45s; }
.link-kpi .p4 { animation-delay: 1.35s; }
@keyframes link-right { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateX(94px); opacity: 0; } }
@keyframes link-left { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateX(-94px); opacity: 0; } }
.link-kpi.up .n1 rect, .link-kpi.up .n2 rect { animation: link-node 1.8s ease-in-out infinite; }
.link-kpi.up .n2 rect { animation-delay: .9s; }
@keyframes link-node { 50% { stroke-width: 3; } }
.link-kpi.down { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 9%, var(--surface)); }
.link-kpi.down .value { color: var(--fail); }
.link-kpi.down .node rect { stroke: var(--fail); }
.link-kpi.down .wire { stroke: var(--fail); stroke-dasharray: 4 5; }
.link-kpi.down .spark { stroke: var(--fail); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; animation: link-spark .7s steps(2) infinite; }
.link-kpi.down .link-svg { animation: link-shake 2.5s ease-in-out infinite; }
@keyframes link-spark { 50% { opacity: .15; } }
@keyframes link-shake { 0%, 86%, 100% { transform: translateX(0); } 88% { transform: translateX(-3px); } 90% { transform: translateX(3px); } 92% { transform: translateX(-2px); } 94% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .link-kpi .pkt, .link-kpi .node rect, .link-kpi .spark, .link-kpi .link-svg { animation: none !important; } }
/* email method choice */
.em-methods > .em-method[hidden] { display: none; }
.em-methods { display: grid; gap: 8px; margin: 4px 0 10px; }
.em-methods > .em-method { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface-2); }
.em-method.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.em-method span { display: grid; gap: 2px; }
.em-method small { color: var(--muted); font-size: 12px; font-weight: 400; }
.em-method input { margin-top: 3px; }
.em-methods > .em-method { flex-direction: row; justify-content: flex-start; text-align: left; grid-template-columns: none; }
.em-methods > .em-method > input { width: auto; flex: 0 0 auto; margin: 3px 0 0; }
.em-methods > .em-method > span { flex: 1 1 auto; color: var(--text); }

/* Admin: one panel per monitored link */
.link-panels { display: grid; gap: 12px; margin: 8px 0; }
.link-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.link-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.link-head .w-end { width: 130px; font-weight: 650; }
.link-head .w-name { flex: 1 1 200px; min-width: 0; }
.link-head .link-arrows { font-size: 18px; color: var(--muted); }
.link-head .switch span:empty { display: none; }

/* Sources: Wallee / Switchio application users */
.src-dlg { width: min(680px, calc(100vw - 24px)); }
dialog:has(.src-dlg) { width: min(680px, calc(100vw - 24px)); }
.src-type { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.src-type[hidden] { display: none; }
.src-type-opt { display: flex !important; flex-direction: row !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface-2); }
.src-type-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.src-type-opt input { margin-top: 3px; }
.src-type-opt span { display: grid; gap: 2px; }
.src-type-opt small { color: var(--muted); font-weight: 400; }
#fsSwitchio[hidden], #fsWallee[hidden], #swAuthNameL[hidden], #swAuthUserL[hidden] { display: none; }
.sw-adv { margin: 10px 0; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.sw-adv[open] { display: grid; gap: 10px; }
.sw-adv summary { cursor: pointer; font-weight: 600; }
.sw-adv h4 { margin: 8px 0 0; font-size: 13px; }
.sw-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.sw-cents { align-self: end; }
.sw-test { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; background: var(--surface-2); overflow-wrap: anywhere; }
.sw-url { overflow-wrap: anywhere; }
.sw-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sw-chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.sw-chip.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.sw-sample { max-height: 260px; overflow: auto; font-size: 12px; background: var(--surface); padding: 8px; border-radius: 8px; }
.badge-sw { font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, #e8590c 15%, transparent); color: #e8590c; }
.sw-latest tr.bad td { color: var(--fail); }
@media (max-width: 560px) { .src-type { grid-template-columns: 1fr; } }
.sw-preset { border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; margin-bottom: 4px; }
.sw-preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sw-preset-row input { flex: 1 1 180px; min-width: 0; }

/* ---------- System Health (All spaces): widgets, Live, pop-out display ---------- */
#nwGrid { margin-top: 4px; }
.nw-bare { background: none; border: 0; padding: 0; box-shadow: none; }
.nw-bare > .card-h { display: none; }
body.dash-editing .nw-bare > .card-h { display: flex; }
.nw-w .uplot-host { min-height: 200px; }
.lv-host { min-height: 250px; }
.live-off { padding: 26px 10px; text-align: center; color: var(--muted); }
.live-off p { max-width: 560px; margin: 0 auto 12px; }
.live-seg .lv-dot { margin-right: 6px; }
.live-seg button.on[data-live="on"] { background: var(--fail); color: #fff; }
.live-seg button.on[data-live="on"] .lv-dot { background: #fff; }
.clock { display: none; font-variant-numeric: tabular-nums; font-weight: 650; font-size: 20px; }
.show-display { display: none !important; }
#fsDrop .menu { right: 0; left: auto; min-width: 260px; }
#fsDrop .menu a { display: block; padding: 7px 12px; cursor: pointer; }
#fsDrop .menu a:hover { background: var(--surface-2); }

/* the pop-out display (second monitor / wall screen) */
.display-mode .hide-display { display: none !important; }
.display-mode .show-display { display: inline-flex !important; }
.display-mode .clock { display: inline-block; }
.display-mode .topbar nav.seg, .display-mode #liveSeg { display: none; }
.display-mode .filterbar { display: none; }
.display-mode body.show-filters .filterbar { display: flex; }
.display-mode main { max-width: none; padding-top: 10px; }
.display-mode .topbar { padding-top: 8px; padding-bottom: 8px; }
.display-mode .kpi .value { font-size: 30px; }
.display-mode .lv-host { min-height: 320px; }
.display-mode .nw-w .uplot-host { min-height: 240px; }
.display-mode body.is-fullscreen .topbar { opacity: .25; transition: opacity .3s; }
.display-mode body.is-fullscreen .topbar:hover { opacity: 1; }
.display-mode .link-kpi .value { font-size: 22px; }
.display-mode .kpi { min-width: 0; }
/* System Health: Customize → 🎨 colours */
.nw-colors { left: auto; right: 12px; top: 52px; width: min(340px, calc(100% - 24px)); }
.nw-colors .w-panel-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.nw-color-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.nw-colors .nw-color { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text); }
.nw-color input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; flex: none; }
.nw-color span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* System Health → Cyprus internet */
.isp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }
.isp-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.isp-chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.isp-chip.good { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.isp-chip.warn { border-color: var(--dec); background: color-mix(in srgb, var(--dec) 8%, var(--surface-2)); }
.isp-chip.alert { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 10%, var(--surface-2)); }
.isp-chip .good { color: var(--good); } .isp-chip .warn { color: var(--dec); } .isp-chip .alert { color: var(--fail); font-weight: 650; }
.isp-src { margin: 6px 0 0; }
