/* iComm PBX console. One stylesheet, no inline styles: the page's content
   policy refuses them. Colours and sizes follow the dashboard design. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  --ground: #F3F5F8;
  --card: #FFFFFF;
  --ink: #16202E;
  --muted: #4B5768;
  --line: #DDE2EA;
  --line-soft: #E8ECF1;
  --control: #8591A3;
  --control-soft: #C5CDD9;
  --nav: #0F1B2D;
  --nav-ink: #C9D4E3;
  --nav-muted: #9FB0C8;
  --nav-line: #2B3D57;
  --nav-active: #22324A;
  --accent: #1757D6;
  --accent-dark: #0F3FA3;
  --link: #1747B0;
  --good: #0A5C33;
  --good-bg: #E1F3E8;
  --warn: #7A4300;
  --warn-ink: #5C3200;
  --warn-bg: #FBECD3;
  --warn-line: #E5C48A;
  --bad: #7F1D14;
  --bad-bg: #FBE3E0;
  --bad-line: #A3261C;
  --idle: #3E4A5B;
  --idle-bg: #E9ECF1;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--link); }
a:hover { color: #0F337F; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #7DA7F5; outline-offset: 2px; }
[hidden] { display: none !important; }

.boot { padding: 48px 24px; text-align: center; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.strong { font-weight: 600; }

/* ---- Frame ------------------------------------------------------------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 1 232px; background: var(--nav); color: #E6ECF5; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; }
.wordmark { padding: 0 12px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: #FFFFFF; }
.wordmark span { font-weight: 400; color: var(--nav-muted); }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-label { padding: 0 12px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--nav-muted); }
.nav-customer { margin: 0 0 6px; padding: 10px 12px; border: 1px solid var(--nav-line); border-radius: 8px; color: #FFFFFF; font-weight: 600; overflow-wrap: anywhere; }
.nav-link { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; font-weight: 500; }
.nav-link:hover { color: #FFFFFF; background: #18263A; }
.nav-link[aria-current='page'] { background: var(--nav-active); color: #FFFFFF; font-weight: 600; }
.nav-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--nav-line); display: flex; flex-direction: column; gap: 2px; }
.nav-foot .who { font-weight: 600; color: #FFFFFF; overflow-wrap: anywhere; }
.nav-foot .role { font-size: 12.5px; color: var(--nav-muted); }
.nav-foot .foot-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.nav-foot a, .nav-foot button { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--nav-ink); text-decoration: underline; cursor: pointer; }
.nav-foot a:hover, .nav-foot button:hover { color: #FFFFFF; }

.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; }
.page-head .over { font-size: 13px; color: var(--muted); }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
h1:focus { outline: none; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.columns { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.col-wide { flex: 3 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-side { flex: 2 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-half { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---- Cards ------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.gap-lg { gap: 16px; }
.card.alarm { border-left: 4px solid var(--bad-line); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.empty { padding: 22px 18px; border: 1px dashed #A9B4C4; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.note { padding: 12px 14px; border-radius: 8px; background: var(--ground); color: var(--muted); font-size: 13px; }

.stats { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 210px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat .label, .stat .hint { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 600; font-family: var(--mono); }

/* ---- Banners ----------------------------------------------------------- */
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-radius: 12px; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.banner .text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; }
.banner.bad { border-color: #E3A9A3; background: var(--bad-bg); color: var(--bad); }
.banner.good { border-color: #A9D8BC; background: var(--good-bg); color: var(--good); }
.flash { position: sticky; top: 12px; z-index: 5; }
.form-error { padding: 10px 14px; border-radius: 8px; border: 1px solid #E3A9A3; background: var(--bad-bg); color: var(--bad); }
.form-error ul { margin-top: 4px; padding-left: 18px; list-style: disc; }

/* ---- Buttons ----------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--control-soft); background: #FFFFFF; color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--control); color: var(--ink); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #FFFFFF; }
.btn.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); color: #FFFFFF; }
.btn.danger { border-color: #C9817A; color: var(--bad); }
.btn.danger:hover { border-color: var(--bad-line); background: var(--bad-bg); }
.btn.danger.solid { border-color: var(--bad-line); background: var(--bad-line); color: #FFFFFF; }
.btn.dark { border-color: var(--warn-ink); background: var(--warn-ink); color: #FFFFFF; }
.btn.small { min-height: 44px; padding: 0 14px; }
.btn[disabled], .btn[aria-disabled='true'] { border-color: var(--control-soft); background: var(--ground); color: var(--muted); cursor: not-allowed; }
.linkish { min-height: 44px; padding: 0; border: 0; background: none; color: var(--link); text-decoration: underline; cursor: pointer; }

.switch { flex: none; min-width: 64px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--control); background: #FFFFFF; color: var(--idle); font-weight: 600; cursor: pointer; }
.switch[aria-pressed='true'] { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.switch[disabled] { cursor: not-allowed; opacity: 0.75; }

/* ---- Pills ------------------------------------------------------------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--idle-bg); color: var(--idle); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--control); }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad-line); }

/* ---- Tables ------------------------------------------------------------ */
/* position: relative keeps visually hidden column headings inside the scrolling box, so they cannot widen the page. */
.table-box { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
caption { caption-side: top; text-align: left; padding: 4px 0 8px; font-size: 13px; color: var(--muted); }
th { text-align: left; padding: 8px 10px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.act { padding-top: 8px; padding-bottom: 8px; text-align: right; white-space: nowrap; }
td .sub { font-size: 12.5px; color: var(--muted); }

/* ---- Lists of rows ------------------------------------------------------ */
.rows { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.row .grow { flex: 1 1 200px; min-width: 0; }
.row .big-num { flex: none; font-family: var(--mono); font-size: 20px; font-weight: 500; }
.check { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.check.done { background: var(--good); color: #FFFFFF; }
.check.todo { border: 2px solid var(--control); }
.done-text { font-size: 13px; font-weight: 600; color: var(--good); }

dl.facts { display: flex; flex-direction: column; }
dl.facts > div { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
dl.facts dt { flex: 0 0 150px; color: var(--muted); }
dl.facts dd { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
dl.facts dd.copyable { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* ---- Forms ------------------------------------------------------------- */
form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-weight: 600; }
.field .help { font-size: 13px; color: var(--muted); }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row > .field { flex: 1 1 150px; }
.field-row > .field.narrow { flex: 1 1 110px; }
.field-row > .field.wide { flex: 3 1 180px; }
input[type='text'], input[type='email'], input[type='password'], input[type='tel'], input[type='search'], select {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--control); border-radius: 8px; background: #FFFFFF; color: var(--ink);
}
select { padding: 0 10px; }
input.mono, select.mono { font-family: var(--mono); }
input[disabled], select[disabled] { border-color: var(--control-soft); background: var(--ground); color: var(--muted); }
.with-suffix { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.with-suffix input { flex: 1 1 100px; width: auto; min-width: 0; }
.with-suffix .suffix { font-family: var(--mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.checks { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
.checks label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; border-top: 1px solid var(--line-soft); cursor: pointer; }
.checks label:first-child { border-top: 0; }
.checks input { width: 18px; height: 18px; flex: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
legend { padding: 0; font-weight: 600; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.switch-row:last-child { border-bottom: 1px solid var(--line-soft); }
.switch-row .text { min-width: 0; }
.switch-rows { display: flex; flex-direction: column; }
.danger-zone, .subsection { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---- Sign-in ----------------------------------------------------------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--nav); }
.gate .card { width: 100%; max-width: 420px; padding: 28px; gap: 18px; }
.gate .wordmark { padding: 0; color: var(--ink); }
.gate .wordmark span { color: var(--muted); }

/* ---- Dialog ------------------------------------------------------------ */
dialog { width: min(460px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
dialog::backdrop { background: rgba(15, 27, 45, 0.55); }
dialog .body { display: flex; flex-direction: column; gap: 14px; }
dialog .actions { justify-content: flex-end; }

@media (max-width: 640px) {
  .main { padding: 20px 16px 32px; }
  .nav { padding: 16px 12px; gap: 14px; }
  .nav-foot { margin-top: 0; }
  dl.facts dt { flex-basis: 100%; }
}

/* ---- Platform health strip --------------------------------------------- */
.card.health { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 16px 20px; }
.card.health h2 { font-size: 15px; }
.health-items { display: flex; flex-wrap: wrap; gap: 10px 28px; flex: 1 1 auto; }
.row-inline { display: flex; align-items: center; gap: 8px; }

.block { display: block; }
select.cap { flex: none; width: auto; min-width: 84px; }
.rows > .row:first-child { border-top: 0; }
.card > .rows > .row:first-child { border-top: 1px solid var(--line-soft); }
