/* Fax Portal — quiet office-machine palette, IBM Plex Sans, tabular figures for numbers. */
:root {
  --paper: #f3f5f8;
  --sheet: #ffffff;
  --tray: #e7ebf0;
  --ink: #16233a;
  --ink-2: #566275;
  --rule: #d9dfe7;
  --rule-2: #eef1f5;
  --blue: #2350b8;
  --blue-ink: #ffffff;
  --blue-soft: #e5ecfa;
  --ok: #1d7553;
  --ok-soft: #e2f2ea;
  --warn: #9a610b;
  --warn-soft: #fbf0dc;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --focus: #2350b8;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10161f;
    --sheet: #161e2a;
    --tray: #0c1219;
    --ink: #e6ebf2;
    --ink-2: #9aa6b7;
    --rule: #2a3545;
    --rule-2: #1f2835;
    --blue: #7aa2ff;
    --blue-ink: #0c1424;
    --blue-soft: #1c2a47;
    --ok: #5cc795;
    --ok-soft: #14301f;
    --warn: #e5ad4f;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1714;
    --focus: #7aa2ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---- Shell -------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--tray);
  border-right: 1px solid var(--rule);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 600; font-size: 16px; color: var(--ink); }
.brand svg { flex: none; }
.compose-btn { display: block; text-align: center; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 12.5px; color: var(--ink-2); padding: 0 10px 4px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius); color: var(--ink);
}
.nav a:hover { background: var(--rule-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--sheet); font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.count { font-size: 12.5px; min-width: 22px; text-align: center; padding: 0 6px; border-radius: 10px; background: var(--rule); color: var(--ink); }
.count.alert { background: var(--bad); color: #fff; }
.count.unread { background: var(--blue); color: var(--blue-ink); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.side-foot .who { font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

.main { padding: 24px 32px 48px; max-width: 1180px; width: 100%; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.banner.test { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--ink); }
.banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.banner.err { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ---- Controls ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 500; font-size: 14.5px;
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=search],
input[type=number], input[type=date], select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 5px; }
.field { margin-bottom: 16px; }
.hint { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
.search { display: flex; gap: 8px; }
.search input { width: 260px; }
.inline { display: inline; }

/* ---- Lists -------------------------------------------------------------- */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.pad { padding: 20px 22px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2);
  padding: 10px 14px; border-bottom: 1px solid var(--rule);
}
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr.rowlink { cursor: pointer; }
table.list tbody tr.rowlink:hover td { background: var(--rule-2); }
tr.unread td { font-weight: 600; }
tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.num { white-space: nowrap; }
.who-line { display: block; }
.sub { display: block; font-size: 13px; color: var(--ink-2); font-weight: 400; }
.empty { padding: 48px 22px; text-align: center; color: var(--ink-2); }
.pager { display: flex; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--rule); font-size: 14px; }

.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.state.delivered, .state.received { color: var(--ok); }
.state.failed { color: var(--bad); }
.state.queued, .state.sending { color: var(--warn); }
.state.test_ok { color: var(--ink-2); }

/* ---- Transmission report (the fax detail page) -------------------------- */
.report { position: relative; padding: 0; overflow: hidden; }
.report-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end;
  padding: 24px 26px 20px; border-bottom: 2px solid var(--ink);
  background:
    radial-gradient(circle at 10px -4px, var(--paper) 6px, transparent 6.5px) 0 0 / 20px 10px repeat-x,
    var(--sheet);
}
.report-kind { font-size: 13.5px; color: var(--ink-2); margin-bottom: 2px; }
.report-result { font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.report-result.delivered, .report-result.received { color: var(--ok); }
.report-result.failed { color: var(--bad); }
.report-result.queued, .report-result.sending { color: var(--warn); }
.report-result.test_ok { color: var(--ink-2); }
.report-pages { text-align: right; }
.report-pages b { display: block; font-size: 34px; font-weight: 600; line-height: 1.1; }
.report-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin: 0; border-bottom: 1px solid var(--rule);
}
.report-grid div { padding: 12px 26px; border-bottom: 1px dashed var(--rule); }
.report-grid dt { font-size: 13px; color: var(--ink-2); }
.report-grid dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.report-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.preview { border-right: 1px solid var(--rule); min-height: 520px; background: var(--rule-2); }
.preview iframe { width: 100%; height: 680px; border: 0; display: block; background: #fff; }
.preview .empty { padding-top: 120px; }
.report-side { padding: 20px 22px; display: flex; flex-direction: column; gap: 22px; }
.report-side form .field { margin-bottom: 10px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--rule); }
.timeline li:last-child::after { display: none; }
.timeline .t { display: block; color: var(--ink-2); font-size: 12.5px; }

/* ---- Forms pages -------------------------------------------------------- */
.narrow { max-width: 640px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drop {
  border: 1.5px dashed var(--rule); border-radius: var(--radius); padding: 26px; text-align: center;
  background: var(--paper);
}
.drop.over { border-color: var(--blue); background: var(--blue-soft); }
.drop input[type=file] { margin-top: 10px; }
.secret { font-size: 20px; font-weight: 600; letter-spacing: 0.04em; padding: 14px 16px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--rule); overflow-wrap: anywhere; user-select: all; }
.qr { width: 200px; height: 200px; background: #fff; padding: 6px; border-radius: var(--radius); border: 1px solid var(--rule); }
.qr svg { width: 100%; height: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 2px 8px; border-radius: 10px; background: var(--rule-2); border: 1px solid var(--rule); white-space: nowrap; }
.numbers-pick { display: grid; gap: 6px; }
.stack > * + * { margin-top: 18px; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px; align-items: end; padding: 14px; border-bottom: 1px solid var(--rule); }
.filters label { font-size: 13px; margin-bottom: 3px; }

/* ---- Sign-in ------------------------------------------------------------ */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth { width: 100%; max-width: 380px; }
.auth .brand { justify-content: center; margin-bottom: 18px; font-size: 18px; padding: 0; }
.auth .sheet { padding: 26px; }
.auth .btn { width: 100%; }

/* ---- Small screens ------------------------------------------------------ */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; align-content: start; padding: 12px 16px 0; gap: 10px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .brand { padding: 0; }
  .compose-btn { padding: 7px 12px; }
  .nav { grid-column: 1 / -1; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 2px; margin: 0 -16px; padding: 0 16px 8px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-title { display: none; }
  .nav a { flex: none; padding: 6px 10px; gap: 8px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--blue); }
  .side-foot { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px; margin: 0 -16px; padding: 8px 16px; font-size: 13px; }
  .side-foot .who, .side-foot .muted { display: inline; }
  .side-foot .btn-row { margin: 0 0 0 auto; }
  .main { padding: 18px 16px 40px; }
  .report-head { padding: 20px 18px 16px; }
  .report-grid div { padding: 10px 18px; }
  .report-body { grid-template-columns: 1fr; }
  .preview { border-right: 0; border-bottom: 1px solid var(--rule); }
  .preview iframe { height: 520px; }
  .two, .filters { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .search input { width: 100%; }
  table.list .hide-sm { display: none; }
  table.list th, table.list td { padding-left: 12px; padding-right: 12px; }
  .report-result, .report-pages b { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Spacing utilities (the CSP blocks inline styles) ------------------ */
.mt-6 { margin-top: 6px; }
.mt-14 { margin-top: 14px; }
.mt-22 { margin-top: 22px; }
.mb-8 { margin-bottom: 8px; }
.mb-18 { margin-bottom: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { padding: 0; }
ol.stack { padding-left: 20px; margin: 0; }
.views-toggle { grid-column: 1 / -1; margin: 0; font-weight: 400; }
.checklist { list-style: none; padding: 0; margin: 0 0 14px; }
.checklist li { position: relative; padding: 6px 0 6px 26px; }
.checklist li::before { position: absolute; left: 0; top: 6px; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 600; }
.checklist li.ok::before { content: "✓"; background: var(--ok); }
.checklist li.bad::before { content: "!"; background: var(--bad); }
