/* sips design system.
   Layout: an attendant console - a sidebar of sections, a status bar on top, quiet work surfaces;
   state is shown the way phones show it: lamps (green online, amber ringing, red busy).
   Faces: Archivo (headings, labels), IBM Plex Sans (text), IBM Plex Mono (numbers, SIP addresses). */
@import url("/static/fonts/fonts.css");

:root {
  --bg: #eef1ef;            /* enamel grey with a green-blue bias */
  --surface: #ffffff;
  --sunken: #f6f8f7;
  --line: #d7deda;
  --line-strong: #b9c3be;
  --ink: #17201c;
  --muted: #5b6862;
  --accent: #0d6b65;        /* petrol: actions and selection */
  --accent-ink: #ffffff;
  --accent-soft: #dcefec;
  --ok: #23893f;
  --ok-soft: #e0f2e5;
  --warn: #b86a07;
  --warn-soft: #fbeedb;
  --bad: #c2302a;
  --bad-soft: #fbe4e2;
  --lamp-off: #c3ccc8;
  --shadow: 0 1px 2px rgba(20, 35, 30, .06), 0 4px 14px rgba(20, 35, 30, .06);
  --font-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 8px;
  --r-sm: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513; --surface: #171d1b; --sunken: #131917; --line: #27302c; --line-strong: #3a4540;
    --ink: #e2e8e5; --muted: #8e9b95; --accent: #3db3a9; --accent-ink: #06201d; --accent-soft: #143430;
    --ok: #4cc26a; --ok-soft: #15301d; --warn: #e3a23f; --warn-soft: #36280f; --bad: #f0675f; --bad-soft: #3a1917;
    --lamp-off: #3a4540; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101513; --surface: #171d1b; --sunken: #131917; --line: #27302c; --line-strong: #3a4540;
  --ink: #e2e8e5; --muted: #8e9b95; --accent: #3db3a9; --accent-ink: #06201d; --accent-soft: #143430;
  --ok: #4cc26a; --ok-soft: #15301d; --warn: #e3a23f; --warn-soft: #36280f; --bad: #f0675f; --bad-soft: #3a1917;
  --lamp-off: #3a4540; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-stretch: 85%; letter-spacing: -.005em; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--sunken); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; white-space: nowrap; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted, .sub { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.label { font-family: var(--font-display); font-stretch: 85%; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ simple pages (start, phone, me) */
.page { max-width: 1040px; margin: 0 auto; padding-block: 28px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 20px; }
.page.narrow { max-width: 560px; }
.masthead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-accent, var(--ink)); color: var(--bg); display: grid; place-items: center; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: 19px; letter-spacing: .02em; }
.masthead .spacer { flex: 1; }
.pagenav { display: flex; gap: 4px; flex-wrap: wrap; }
.pagenav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); font-size: 14px; }
.pagenav a:hover { color: var(--ink); background: var(--surface); }
.pagenav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

/* ------------------------------------------------------------ surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { flex: 1 1 auto; min-width: fit-content; }
.panel-head .hint { flex: 1 1 260px; }
.lead { color: var(--muted); max-width: 70ch; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 18px 0; }

/* ------------------------------------------------------------ buttons and fields */
button, .btn { font: 500 14px/1 var(--font-body); display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; white-space: nowrap; transition: filter .12s, background .12s; }
button:hover, .btn:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: default; filter: none; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover { background: var(--sunken); filter: none; }
button.quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 7px 9px; }
button.quiet:hover { color: var(--ink); background: var(--sunken); filter: none; }
button.quiet.bad { color: var(--bad); }
button.quiet.bad:hover { background: var(--bad-soft); color: var(--bad); }
button.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.danger:hover { background: var(--bad-soft); filter: none; }
button.green { background: var(--ok); border-color: var(--ok); color: #fff; }
button.red { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { padding: 6px 10px; font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px; }
input, select, textarea { width: 100%; font: 15px/1.4 var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 9px 11px; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > label { margin: 0; }
.field small { color: var(--muted); font-size: 12px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.grid-form .wide { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 140px; }
.check { display: flex; gap: 9px; align-items: flex-start; color: var(--ink); font-size: 14px; margin: 0; cursor: pointer; }
.check input { margin-top: 3px; }

/* switch: a checkbox drawn as a toggle */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; color: var(--ink); font-size: 14px; margin: 0; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--lamp-off); position: relative; cursor: pointer; transition: background .15s; margin: 0; border: 0; padding: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus { box-shadow: none; }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch span small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }

/* ------------------------------------------------------------ lamps and pills */
.lamp { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lamp-off); flex: none; vertical-align: middle; }
.lamp.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.lamp.ring { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }   /* steady: no blinking anywhere */
.lamp.busy { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.lamp.warn { background: var(--warn); }
/* a device registered for push (FCM) glows brighter; offline-but-wakeable shows an accent tint */
.lamp.fcm.on { box-shadow: 0 0 7px 1px var(--ok), 0 0 0 3px color-mix(in srgb, var(--ok) 42%, transparent); }
.lamp.fcm:not(.on) { background: color-mix(in srgb, var(--accent) 55%, var(--lamp-off)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.devs { display: inline-flex; gap: 4px; margin-left: auto; align-items: center; padding-left: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--sunken); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lamp-off); margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--ok); }

/* ------------------------------------------------------------ tables */
.scroll { overflow-x: auto; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--font-display); font-stretch: 85%; font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  padding: 0 12px 3px; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead + tbody tr:first-child td { padding-top: 6px; }   /* the headings sit close to their column */
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
table tr:hover td { background: color-mix(in srgb, var(--sunken) 70%, transparent); }
td:first-child, th:first-child { padding-left: 0; }
.scroll code { white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------------------------------------ dialogs and messages */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); }
dialog form, dialog .dlg { padding: 22px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.msg { min-height: 20px; font-size: 14px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); color: #fff; }

/* language picker */
.langsel { width: auto; padding: 6px 28px 6px 10px; font-size: 13px; background-color: var(--surface); }

/* "install as app" bar (static/app/install.js) */
.installbar { position: fixed; z-index: 50; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px)); margin: 0 auto; max-width: 560px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); font-size: 14px; }
.installbar img { width: 36px; height: 36px; border-radius: 8px; flex: none; }
.installbar span { flex: 1 1 200px; min-width: 0; }

/* ---------------------------------------------------------------- skin "tech" (chosen per browser, i18n.js)
   square corners everywhere, labels as solid blocks with white bold text (.tech-label) */
:root[data-skin="tech"] {
  --r: 0; --r-sm: 0;
  --tl-neutral: #4a5550; --tl-ok: #1f7a3a; --tl-warn: #9a5800; --tl-bad: #b42318; --tl-accent: #0b5e59;
}
:root[data-skin="tech"] *, :root[data-skin="tech"] *::before, :root[data-skin="tech"] *::after { border-radius: 0 !important; }
:root[data-skin="tech"] .lamp { border-radius: 50% !important; }
/* switches stay round in the tech skin, a little smaller */
:root[data-skin="tech"] .switch input { width: 30px; height: 17px; border-radius: 9px !important; }
:root[data-skin="tech"] .switch input::after { top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50% !important; }
:root[data-skin="tech"] .switch input:checked::after { transform: translateX(13px); }
.tech-label,
:root[data-skin="tech"] .pill, :root[data-skin="tech"] .setchip, :root[data-skin="tech"] .linechip, :root[data-skin="tech"] .qagent {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; min-height: 23px; border-radius: 0;
  color: #fff; font-size: 12px; font-weight: 650; line-height: 16px; border: 0;
}
.tech-label, :root[data-skin="tech"] .pill { background: var(--tl-neutral, #4a5550); }
:root[data-skin="tech"] .pill.ok { background: var(--tl-ok); color: #fff; }
:root[data-skin="tech"] .pill.warn { background: var(--tl-warn); color: #fff; }
:root[data-skin="tech"] .pill.bad { background: var(--tl-bad); color: #fff; }
:root[data-skin="tech"] .pill.accent { background: var(--tl-accent); color: #fff; }
:root[data-skin="tech"] .setchip.none { background: var(--tl-neutral); color: #fff; }
:root[data-skin="tech"] .linechip, :root[data-skin="tech"] .qagent { background: var(--tl-neutral); }
:root[data-skin="tech"] .qagent small, :root[data-skin="tech"] .linechip .iconbtn { color: rgba(255, 255, 255, .8); }
:root[data-skin="tech"] .qagent .lamp { box-shadow: none; }
.skinsel { margin-top: 6px; }

/* tech skin: buttons as solid labels too (white bold 12px, compact) - action buttons only, not menus/tabs */
:root[data-skin="tech"] :is(button, .btn).secondary:not(.iconbtn),
:root[data-skin="tech"] :is(.form-foot, .dlg-foot, .sec-head, .pstools, .psadd) button:not(.quiet):not(.iconbtn) {
  min-height: 27px; padding: 4px 11px; font-size: 12px; font-weight: 650; line-height: 16px; gap: 6px;
  border: 0; border-radius: 0; color: #fff; background: var(--tl-accent);
}
:root[data-skin="tech"] :is(button, .btn).secondary:not(.iconbtn) { background: var(--tl-neutral); }
:root[data-skin="tech"] :is(button, .btn).secondary.bad:not(.iconbtn) { background: var(--tl-bad); color: #fff; }
:root[data-skin="tech"] :is(button, .btn).secondary:not(:disabled):hover,
:root[data-skin="tech"] :is(.form-foot, .dlg-foot, .sec-head) button:not(.quiet):not(:disabled):hover { filter: brightness(1.15); }
:root[data-skin="tech"] :is(button, .btn).secondary .ico { width: 14px; height: 14px; }
.choices { display: grid; gap: 6px; margin-top: 12px; }
.choices button { justify-content: flex-start; }
