@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-ext-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  /* Theme accent (overridden by [data-theme] and by an inline custom colour) */
  --accent: #15935a;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #ffffff);
  --accent-dark: color-mix(in srgb, var(--accent) 80%, #0a140f);
  --accent-tint: color-mix(in srgb, var(--accent) 6%, #ffffff);
  --topbar: color-mix(in srgb, var(--accent) 22%, #0c1611);
  --topbar-2: color-mix(in srgb, #ffffff 15%, var(--topbar));

  --paper: #edf1ef;
  --panel: #ffffff;
  --panel-2: #f6f9f8;
  --line: #dce3e0;
  --line-soft: #e8edeb;
  --text: #16222b;
  --muted: #5d6a72;
  --muted-2: #7c8890;
  --good: #1a7a4a;
  --warn: #9a6612;
  --bad: #b3312b;
  --bad-soft: #f8e5e3;
  --good-soft: #e2f1e9;
  --radius: 11px;
  --radius-sm: 8px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 2px rgba(16,32,24,.05), 0 1px 1px rgba(16,32,24,.04);
  --shadow-md: 0 2px 4px rgba(16,32,24,.05), 0 6px 18px rgba(16,32,24,.07);
  --shadow-lg: 0 18px 44px rgba(12,26,18,.22);

  /* legacy names mapped to the accent so every existing component follows the theme */
  --ink: color-mix(in srgb, var(--accent) 14%, #11201a);
  --ink-2: var(--topbar-2);
  --steel: var(--accent);
  --steel-soft: var(--accent-soft);
  --amber: var(--accent);
  --amber-soft: var(--accent-soft);
}
[data-theme="green"]  { --accent: #15935a; }
[data-theme="blue"]   { --accent: #2c6ca3; }
[data-theme="violet"] { --accent: #6d49c4; }
[data-theme="slate"]  { --accent: #41556b; }
[data-theme="teal"]   { --accent: #0d8a8a; }
[data-theme="rose"]   { --accent: #c13b63; }
[data-theme="amber"]  { --accent: #c67711; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 14px/1.55 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---- top bar ---- */
.topbar { background: linear-gradient(180deg, var(--topbar-2), var(--topbar)); color: #eaf1ec; position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 0 rgba(255,255,255,.05), 0 6px 18px rgba(0,0,0,.14); }
.topbar-inner { max-width: 1520px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 22px; height: 60px; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 800; font-size: 19px; font-stretch: 112%; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow-sm); }
.brand .mark svg { width: 18px; height: 18px; }
.brand b { color: #fff; } .brand span.lt { color: color-mix(in srgb, #fff 74%, var(--accent)); font-weight: 600; }

.topnav { display: flex; align-items: center; gap: 2px; margin-left: 16px; flex: 1; }
.navitem { position: relative; }
.navlink { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; color: #d9e6de; background: none; border: 0; font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: background .14s, color .14s; }
.navlink:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.navitem.on > .navlink { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 -2px 0 color-mix(in srgb, #fff 55%, var(--accent)); }
.navlink .ic { width: 15px; height: 15px; opacity: .92; }
.navlink .caret { width: 9px; height: 9px; opacity: .7; transition: transform .15s; }
.navitem.open .navlink .caret { transform: rotate(180deg); }
.menu { position: absolute; top: calc(100% + 7px); left: 0; min-width: 196px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 7px; display: none; z-index: 50; }
.navitem.open .menu, .navitem:hover .menu { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 11px; border-radius: 8px; color: var(--text); background: none; border: 0; font: 500 13.5px var(--font); cursor: pointer; transition: background .12s; }
.menu a:hover, .menu button:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.menu .ic { width: 15px; height: 15px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 11px 3px; font-weight: 700; }

.topright { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; background: none; border: 0; color: #d9e6de; cursor: pointer; transition: background .14s; }
.icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.icon-btn svg { width: 18px; height: 18px; }
.profile { position: relative; }
.profile-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 22px; background: rgba(255,255,255,.1); border: 0; color: #eaf1ec; cursor: pointer; font: 600 13px var(--font); transition: background .14s; }
.profile-btn:hover { background: rgba(255,255,255,.18); }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; text-transform: uppercase; box-shadow: var(--shadow-sm); }
.profile .menu { left: auto; right: 0; min-width: 212px; }
.hamburger { display: none; }

.main { max-width: 1520px; margin: 0 auto; padding: 24px 22px 64px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 25px; font-weight: 750; font-stretch: 106%; margin: 0; line-height: 1.18; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 680; margin: 0 0 10px; letter-spacing: -.005em; }
.sub { color: var(--muted); margin: 5px 0 0; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 3px; }

/* ---- blocks ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 19px; min-width: 0; box-shadow: var(--shadow-sm); }
.panel + .panel, .grid + .panel, .panel + .grid, .grid + .grid { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid > .panel, .grid > div > .panel:first-child { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.hint { color: var(--muted); font-size: 12.5px; }

/* KPI strip: individual cards on a tidy grid */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .28; }
.kpi .v { font-size: 27px; font-weight: 700; font-stretch: 92%; line-height: 1.1; letter-spacing: -.01em; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.kpi .d { font-size: 12px; margin-top: 5px; color: var(--muted-2); }
.up { color: var(--good); } .down { color: var(--bad); }

/* ---- live operations board (Live calls pages) ---- */
.live { background: linear-gradient(165deg, color-mix(in srgb, var(--ink) 92%, #000), var(--ink)); color: #dfe6eb; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-md); }
.live-top { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.live-count { font-size: 56px; line-height: .95; font-weight: 750; font-stretch: 85%; color: #fff; }
.live-count small { display: block; font-size: 13px; font-weight: 500; font-stretch: 100%; color: #a7b7c1; margin-top: 7px; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #35d08a; margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 0 rgba(53,208,138,.6); }
.live.ok .pulse { animation: blink 2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.live-meta { color: #a7b7c1; font-size: 12.5px; margin-left: auto; text-align: right; }
.trunks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 26px; margin-top: 18px; }
.trunk-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13px; }
.trunk-row .n { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trunk-row .c { color: #a7b7c1; }
.ports { grid-column: 1 / -1; height: 8px; background: #26333f; border-radius: 3px; overflow: hidden; display: flex; }
.ports i { display: block; height: 100%; background: #35c07e; }
.ports i.hot { background: #e2574c; }
.live-msg { color: #f3c77a; font-size: 13px; margin-top: 12px; }
.live details { margin-top: 14px; }
.live summary { cursor: pointer; color: #c9d3da; font-size: 13px; }
.live table { color: #dfe6eb; }
.live th { color: #a7b7c1; border-color: #2c3c4a; background: transparent; }
.live td { border-color: #2c3c4a; }
.live tbody tr:hover td { background: rgba(255,255,255,.03); }

/* ---- dashboard "Now" panel (calm gateways) ---- */
.now-panel { padding: 0; overflow: hidden; }
.now-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 18px 20px; background: linear-gradient(165deg, color-mix(in srgb, var(--ink) 92%, #000), var(--ink)); color: #eaf1ec; }
.now-stat { display: flex; align-items: baseline; gap: 10px; }
.now-stat .n { font-size: 40px; font-weight: 750; font-stretch: 85%; line-height: 1; color: #fff; }
.now-stat .n.sm { font-size: 26px; }
.now-stat .cap { font-size: 12.5px; color: #a7b7c1; max-width: 9ch; }
.now-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.now-tools .live-meta { color: #a7b7c1; margin: 0; }
.now-tools .search input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; width: 170px; }
.now-tools .search input::placeholder { color: #9fb0bc; }
.now-tools .btn.ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.now-tools .btn.ghost:hover { background: rgba(255,255,255,.18); }
.now-body { padding: 16px 20px 20px; }
.now-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 0 0 11px; }
.gw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 11px; }
.gw-card { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 11px 13px; text-decoration: none; color: inherit; display: block; transition: border-color .14s, box-shadow .14s; }
.gw-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-sm); }
.gw-card .n { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-card .m { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.gw-card .bar { height: 5px; border-radius: 3px; background: var(--line-soft); margin-top: 9px; overflow: hidden; }
.gw-card .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.gw-card.live { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-tint); }
.gw-card.live .n::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 7px; vertical-align: middle; }
.now-empty { text-align: center; padding: 30px 16px; }
.now-empty .big { font-weight: 700; font-size: 17px; font-stretch: 95%; }
.now-empty .small { color: var(--muted); font-size: 13px; margin-top: 6px; max-width: 460px; margin-inline: auto; }

/* ---- hourly chart ---- */
.chart { width: 100%; height: 170px; display: block; }
.chart .bar-all { fill: color-mix(in srgb, var(--line) 70%, var(--panel)); }
.chart .bar-ok { fill: var(--accent); }
.chart .bar-now { fill: var(--accent-dark); }
.chart text { font: 11px var(--font); fill: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -19px; padding: 0 19px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 650; color: var(--muted); padding: 9px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); position: sticky; top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td { padding: 9px 11px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-tint); }
.live tbody tr:hover td { background: rgba(255,255,255,.03); }
td.r, th.r { text-align: right; }
td.mono, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.wrap-cell { max-width: 260px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.good { color: var(--good); font-weight: 650; } .warn { color: var(--warn); font-weight: 650; } .bad { color: var(--bad); font-weight: 650; }
.neg { color: var(--bad); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--good-soft); color: var(--good); }
.pill.off { background: var(--bad-soft); color: var(--bad); }
.pill.neutral { background: var(--accent-soft); color: var(--accent-dark); }

.meter { display: flex; align-items: center; gap: 8px; }
.meter .track { flex: 1; height: 6px; background: var(--line-soft); border-radius: 3px; min-width: 60px; overflow: hidden; }
.meter .track i { display: block; height: 100%; background: var(--accent); }

/* ---- detail lists ---- */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- forms ---- */
form.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 11px 12px; align-items: end; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 550; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c6cfcb; border-radius: var(--radius-sm); background: #fff; color: var(--text);
  font: 14px var(--font); font-variant-numeric: tabular-nums; transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[disabled], select[disabled] { background: #f1f3f2; color: var(--muted); }
.field { margin-bottom: 13px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.req { color: var(--bad); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: 650 13.5px var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .14s, box-shadow .14s, transform .02s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--accent-dark); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); box-shadow: none; }
.btn.danger { background: #fff; color: var(--bad); border-color: #d9a39f; box-shadow: none; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.ok { background: var(--good); border-color: var(--good); color: #fff; }
.btn.ok:hover { background: color-mix(in srgb, var(--good) 85%, #000); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.dot-ok { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-right: 5px; vertical-align: middle; }
/* SIP trace */
tr.rowsel > td { background: var(--accent-soft); }
details.flow { border: 1px solid var(--line); border-radius: 11px; margin: 8px 0; background: var(--panel); box-shadow: var(--shadow-sm); }
details.flow > summary { cursor: pointer; padding: 11px 13px; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.flow > summary::-webkit-details-marker { display: none; }
details.flow[open] > summary { border-bottom: 1px solid var(--line); }
details.flow .arrow { color: var(--muted); }
table.ladder td, table.ladder th { padding: 6px 10px; vertical-align: top; }
table.ladder .small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sipline { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.sipline.req { color: var(--accent-dark); font-weight: 650; }
.sipline.resp { color: var(--text); }
details.raw { margin-top: 3px; }
details.raw > summary { cursor: pointer; font-size: 11px; color: var(--muted); }
details.raw pre { white-space: pre-wrap; word-break: break-word; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 6px 0 2px; font-size: 11.5px; max-height: 360px; overflow: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { display: flex; gap: 8px; }
.search input { width: 240px; }

.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; box-shadow: var(--shadow-sm); }
.flash.ok { background: var(--good-soft); border-color: #b5dcc6; color: #165c39; }
.flash.error { background: var(--bad-soft); border-color: #e7b9b5; color: #8a241f; }
.notice { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, #fff); color: var(--accent-dark); padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13px; }
.notice + * { margin-top: 12px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 13px; }

.bars { display: grid; gap: 9px; }
.bars .row { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; }
.bars .track { grid-column: 1 / -1; height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--bad); opacity: .72; }

/* ---- modal + theme picker ---- */
.overlay { position: fixed; inset: 0; background: rgba(12,22,16,.55); display: none; place-items: center; z-index: 100; padding: 16px; backdrop-filter: blur(2px); }
.overlay.show { display: grid; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 21px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 19px 21px; }
.modal-x { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.swatch { border: 2px solid transparent; border-radius: 11px; padding: 10px 6px 7px; background: #fff; cursor: pointer; text-align: center; font: 650 12px var(--font); color: var(--muted); transition: background .12s; }
.swatch:hover { background: var(--panel-2); }
.swatch.sel { border-color: var(--text); color: var(--text); }
.swatch .dot { width: 100%; height: 26px; border-radius: 7px; margin-bottom: 6px; }
.custom-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.custom-row input[type=color] { width: 44px; height: 34px; padding: 2px; cursor: pointer; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--paper); }
.login-hero { background: linear-gradient(150deg, var(--topbar), var(--accent-dark)); color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%); pointer-events: none; }
.login-hero .brand { font-size: 26px; position: relative; }
.login-hero .mark { width: 40px; height: 40px; font-size: 19px; }
.login-art { width: 100%; max-width: 360px; height: auto; margin: 0 0 20px -6px; position: relative; }
.login-hero h1 { font-size: 35px; line-height: 1.14; margin: 0 0 14px; max-width: 12ch; position: relative; }
.login-hero p { color: rgba(255,255,255,.84); font-size: 15px; max-width: 42ch; margin: 0; position: relative; }
.login-hero .pts { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 11px; position: relative; }
.login-hero .pts li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.92); font-size: 14px; }
.login-hero .pts svg { width: 18px; height: 18px; color: #fff; flex: none; }
.login-hero .foot { color: rgba(255,255,255,.62); font-size: 12.5px; position: relative; }
.login-side { display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 360px; }
.login h2 { font-size: 23px; margin: 0 0 5px; }
.login .lead { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login .field { margin-bottom: 14px; }
.login input { padding: 11px 13px; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g3, .g-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .hamburger { display: grid; }
  .topnav { position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 8px; background: var(--topbar); box-shadow: 0 12px 24px rgba(0,0,0,.25); display: none; max-height: calc(100vh - 60px); overflow-y: auto; }
  .topnav.open { display: flex; }
  .navitem { position: static; }
  .navlink { width: 100%; justify-content: space-between; }
  .navitem.on > .navlink { box-shadow: none; }
  .menu { position: static; display: none; box-shadow: none; border: 0; background: rgba(255,255,255,.06); margin: 2px 0 6px; padding: 2px; }
  .menu a, .menu button { color: #d7e4dc; } .menu a:hover, .menu button:hover { background: rgba(255,255,255,.12); color: #fff; }
  .menu .ic { color: #9fb3a6; } .menu-label { color: #9fb3a6; }
  .navitem.open .menu { display: block; }
  .navitem:hover .menu { display: none; } .navitem.open:hover .menu { display: block; }
  .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; }
}
@media (max-width: 820px) {
  .head .actions, .head .search { width: 100%; }
  .main { padding: 18px 15px 48px; }
  .grid > .panel, .grid > div > .panel:first-child { margin-top: 0; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-count { font-size: 44px; }
  .now-stat .n { font-size: 34px; }
  .search input { width: 100%; }
  .now-tools .search input { width: 100%; }
  .table-wrap { margin: 0 -15px; padding: 0 15px; }
}
@media (prefers-reduced-motion: reduce) { .live.ok .pulse { animation: none; } .btn:active { transform: none; } }

/* Language select in the user menu */
.menu-lang { width: calc(100% - 20px); margin: 2px 10px 6px; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); font-size: 13px; cursor: pointer; }

/* ---- Right-to-left languages (Arabic) ---- */
[dir=rtl] body { text-align: right; }
[dir=rtl] .menu { left: auto; right: 0; text-align: right; }
[dir=rtl] .profile .menu, [dir=rtl] .topright .menu { right: auto; left: 0; }
[dir=rtl] th, [dir=rtl] td { text-align: right; }
[dir=rtl] .kpi::before { left: auto; right: 0; }
/* keep numbers, codes, times and money left-to-right so they read correctly */
[dir=rtl] .r, [dir=rtl] .mono, [dir=rtl] .num, [dir=rtl] .nowrap, [dir=rtl] .kpi .v, [dir=rtl] .now-stat .n { direction: ltr; }
[dir=rtl] th.r, [dir=rtl] td.r { text-align: left; }
[dir=rtl] .now-tools { margin-left: 0; margin-right: auto; }
[dir=rtl] .crumb a::before { content: none; }
[dir=rtl] .search input, [dir=rtl] .field input, [dir=rtl] .field select { text-align: right; }

/* ===================== premium visual layer ===================== */
:root{
  --radius:14px; --radius-sm:10px;
  --shadow-sm:0 1px 2px rgba(18,38,28,.06), 0 1px 1px rgba(18,38,28,.04);
  --shadow-md:0 4px 10px rgba(18,38,28,.05), 0 12px 28px rgba(18,38,28,.07);
  --shadow-lg:0 24px 60px rgba(12,32,20,.22);
  --accent-grad:linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
}
body{
  background:
    radial-gradient(1100px 460px at 88% -12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    radial-gradient(800px 360px at -8% -6%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 55%),
    var(--paper);
  background-attachment:fixed;
}
.brand .mark{background:linear-gradient(145deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent));}

/* buttons: subtle gradient + lift */
.btn{background:var(--accent-grad); box-shadow:var(--shadow-sm); transition:transform .08s, box-shadow .16s, filter .16s;}
.btn:hover{box-shadow:var(--shadow-md); filter:brightness(1.04);}
.btn:active{transform:translateY(1px);}

/* panels & cards: depth + hover lift */
.panel{transition:box-shadow .18s, transform .18s;}
.kpi{position:relative; overflow:hidden; transition:transform .16s, box-shadow .16s;}
.kpi:hover{transform:translateY(-3px); box-shadow:var(--shadow-md);}

/* KPI trend chip */
.kpi .chip{position:absolute; top:13px; right:13px; display:inline-flex; align-items:center; gap:3px;
  font-size:11.5px; font-weight:800; padding:2px 8px; border-radius:999px; letter-spacing:.01em;}
.kpi .chip.up{color:var(--good); background:var(--good-soft);}
.kpi .chip.down{color:var(--bad); background:var(--bad-soft);}
/* KPI sparkline (themed via currentColor) */
.kpi .spark{display:block; width:100%; height:26px; margin-top:10px; color:var(--accent);}
.kpi .spark svg{width:100%; height:100%; display:block;}

/* hero: first KPI as a rich accent tile */
.kpis .kpi:first-child{border-color:transparent; color:#eafff4;
  background:linear-gradient(155deg, color-mix(in srgb, var(--accent) 58%, #0a3b27), color-mix(in srgb, var(--accent) 32%, #082a1c));}
.kpis .kpi:first-child::before{display:none;}
.kpis .kpi:first-child .l{color:color-mix(in srgb, #fff 68%, var(--accent));}
.kpis .kpi:first-child .v{color:#fff;}
.kpis .kpi:first-child .spark{color:color-mix(in srgb, #fff 60%, var(--accent));}

/* gateway cards: lift + live sparkline */
.gw-card{transition:transform .16s, box-shadow .16s, border-color .16s;}
.gw-card:hover{transform:translateY(-3px); box-shadow:var(--shadow-md);}
.gw-card .top{display:flex; align-items:center; justify-content:space-between; gap:8px;}
.gw-card .top .nm{font-weight:700; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.gw-card .top .nm .dot{width:7px; height:7px; border-radius:50%; background:var(--good); display:inline-block; margin-right:7px; vertical-align:middle;}
.gw-card .asr{font-size:11.5px; font-weight:700; padding:1px 7px; border-radius:999px; background:var(--panel-2); color:var(--muted); white-space:nowrap;}
.gw-card .asr.g{color:var(--good); background:var(--good-soft);} .gw-card .asr.w{color:var(--warn); background:var(--warn-soft, #f7efdd);} .gw-card .asr.b{color:var(--bad); background:var(--bad-soft);}
.gw-card .mid{display:flex; align-items:flex-end; justify-content:space-between; gap:8px; margin-top:9px;}
.gw-card .cc{font-size:20px; font-weight:800; letter-spacing:-.02em; line-height:1;}
.gw-card .cc small{font-size:12px; font-weight:600; color:var(--muted-2);}
.gw-card .spk{width:74px; height:22px; flex:none; color:var(--accent);}
.gw-card .spk svg{width:100%; height:100%; display:block;}
.gw-card.live .spk{color:var(--accent);}

/* gradient hour chart */
.chart .bar-ok{fill:url(#okg);}
.chart .g0{stop-color:color-mix(in srgb, var(--accent) 68%, #fff);} .chart .g1{stop-color:var(--accent);}

/* restrained load motion */
@media (prefers-reduced-motion:no-preference){
  .kpis .kpi, .gw-grid .gw-card{opacity:0; animation:prise .5s cubic-bezier(.2,.7,.2,1) forwards;}
  .kpis .kpi:nth-child(1){animation-delay:.02s} .kpis .kpi:nth-child(2){animation-delay:.06s}
  .kpis .kpi:nth-child(3){animation-delay:.10s} .kpis .kpi:nth-child(4){animation-delay:.14s}
  .kpis .kpi:nth-child(5){animation-delay:.18s} .kpis .kpi:nth-child(6){animation-delay:.22s}
  @keyframes prise{to{opacity:1; transform:none;}}
}
[dir=rtl] .kpi .chip{right:auto; left:13px;}

/* ======================= light polish pass (2026-12) ======================= */
:root{
  --line:#d6e0db; --line-soft:#e4ebe8; --panel-2:#f4f8f6;
  --shadow-sm:0 1px 2px rgba(18,38,28,.05), 0 1px 1px rgba(18,38,28,.03);
  --shadow-md:0 6px 16px rgba(18,38,28,.06), 0 2px 5px rgba(18,38,28,.04);
  --shadow-lg:0 24px 60px rgba(12,32,20,.20);
}
/* page title: a small accent tick gives each page a clear anchor */
.main .head h1{position:relative; padding-left:15px;}
.main .head h1::before{content:""; position:absolute; left:0; top:.18em; bottom:.18em; width:5px;
  border-radius:4px; background:var(--accent-grad); box-shadow:0 1px 3px color-mix(in srgb,var(--accent) 35%,transparent);}

/* panel section headers: subtle leading dot for scan-ability */
.panel-head h2{position:relative; padding-left:14px;}
.panel-head h2::before{content:""; position:absolute; left:0; top:50%; transform:translateY(-50%);
  width:7px; height:7px; border-radius:50%; background:var(--accent); opacity:.85;}

/* KPI cards: a touch of depth + clearer labels */
.kpi{background:linear-gradient(180deg,#ffffff, var(--panel-2));}
.kpi .l{font-weight:560; letter-spacing:.005em;}
.kpis .kpi:first-child{background:linear-gradient(155deg, color-mix(in srgb, var(--accent) 58%, #0a3b27), color-mix(in srgb, var(--accent) 30%, #082a1c));}

/* tables: roomier rows, soft zebra, crisper header — easier to scan */
.panel td{padding:11px 13px;}
.panel th{padding:10px 13px; background:linear-gradient(180deg, var(--panel-2), color-mix(in srgb,var(--panel-2) 55%,#fff));}
.panel tbody tr:nth-child(even) td{background:color-mix(in srgb, var(--panel-2) 55%, #fff);}
.panel tbody tr:hover td{background:var(--accent-tint);}
.live tbody tr:nth-child(even) td{background:transparent;}
.live tbody tr:hover td{background:rgba(255,255,255,.04);}

/* inputs & buttons: a hair softer, clearer focus */
input,select,textarea{border-color:#cdd7d2; border-radius:9px;}
.btn,.btn.ghost,.btn.danger{border-radius:9px;}
input:focus,select:focus,textarea:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 16%,transparent);}

/* empty states: calmer, centred, a little more inviting */
.empty{padding:30px 0; font-size:13.5px;}

/* gentle entrance for panels (respects reduced-motion) */
@media (prefers-reduced-motion:no-preference){
  .main > .panel, .main > .grid > .panel{opacity:0; animation:rise .45s cubic-bezier(.2,.7,.2,1) forwards;}
  @keyframes rise{from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:none;}}
}

/* demo ribbon */
.demo-ribbon{position:fixed;z-index:9999;left:50%;transform:translateX(-50%);bottom:16px;
  background:rgba(9,40,25,.94);color:#fff;padding:8px 18px;border-radius:999px;font-size:12.5px;
  letter-spacing:.01em;box-shadow:0 10px 30px rgba(6,24,15,.35);}
.demo-ribbon b{font-weight:650;}
@media (max-width:640px){.demo-ribbon{font-size:11.5px;padding:7px 13px;bottom:10px;}}

/* static gateway editor */
.form-card{max-width:740px;}
.back{font-weight:650;}
.head .actions{justify-content:flex-end;}
#gw-empty[hidden],#demo-note[hidden],#gw-table tr[hidden]{display:none;}
