/*
 * PAUIOps Email Relay — Signal Room
 * A dependency-free operations-console design embedded with the Go binary.
 */
:root {
  --bg: #070A0E;
  --panel: #0E141B;
  --panel2: #111B24;
  --panel3: #14212B;
  --border: #1B2A36;
  --border-strong: #284152;
  --text: #E7F0F5;
  --muted: #94A7B2;
  --faint: #6B808C;
  --accent: #56D9FF;
  --accent2: #8DE7FF;
  --ok: #76F2BE;
  --warn: #FFB45C;
  --danger: #FF6B7A;
  --sans: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", "Roboto Mono", Consolas, "Liberation Mono", monospace;
  --tracking-display: -.045em;
  --tracking-label: .06em;
  --tracking-micro: .1em;
  --sidebar: 218px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  width: 100%;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 72% -20%, rgba(86, 217, 255, .07), transparent 35rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
body::before {
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  content: "";
  opacity: .025;
  background: repeating-linear-gradient(0deg, transparent 0, transparent 3px, #d8f6ff 4px);
}
button, input, select { font: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }
::selection { background: rgba(86, 217, 255, .25); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 120;
  top: 12px;
  left: 12px;
  padding: 9px 13px;
  color: var(--bg);
  background: var(--accent);
  transform: translateY(-160%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

/* Shared shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100dvh;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(86, 217, 255, .025), transparent 28%),
    #0A0F14;
  border-right: 1px solid var(--border);
}
.brand-lockup {
  min-height: 98px;
  padding: 22px 20px 17px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  color: var(--text);
  font-family: var(--mono);
  text-transform: uppercase;
}
.brand:hover { color: var(--text); }
.brand-icon {
  width: 36px;
  height: 36px;
  grid-row: 1 / span 2;
  object-fit: contain;
}
.brand-name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.025em;
  text-transform: none;
  white-space: nowrap;
}
.brand-name b {
  color: var(--accent);
  font-weight: 500;
}
.brand-state {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
}
.brand-state i,
.core-readout i,
.system-state > i,
.login-brand small i,
.login-card-foot i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px rgba(118, 242, 190, .75);
}
.sidebar nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 19px 10px;
}
.sidebar nav a {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 11px;
  align-items: center;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid transparent;
  color: #93A3AD;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .045em;
  text-transform: uppercase;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.sidebar nav a::before {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: -11px;
  width: 2px;
  content: "";
  background: var(--accent);
  box-shadow: 0 0 14px rgba(86, 217, 255, .55);
  opacity: 0;
}
.sidebar nav a svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}
.sidebar nav a small {
  color: var(--faint);
  font-size: 9px;
}
.sidebar nav a:hover {
  color: var(--text);
  background: rgba(86, 217, 255, .035);
  border-color: rgba(86, 217, 255, .08);
}
.sidebar nav a.active {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(86, 217, 255, .09), transparent);
  border-color: rgba(86, 217, 255, .13);
}
.sidebar nav a.active::before { opacity: 1; }
.sidebar nav a.active small { color: var(--accent); }
.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 17px 20px 20px;
  border-top: 1px solid var(--border);
}
.logout-button {
  display: grid;
  grid-template-columns: 19px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  margin: -4px 0 11px;
  color: #AEBCC4;
  background: rgba(17, 27, 36, .72);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.logout-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.logout-button small { color: var(--faint); font-size: 11px; }
.logout-button:hover {
  color: #FFD7DC;
  background: rgba(255, 107, 122, .07);
  border-color: rgba(255, 107, 122, .38);
}
.logout-button:disabled { cursor: wait; opacity: .6; }
.sidebar-foot code {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.core-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.core-readout strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 9.5px;
  font-weight: 500;
}
.nav-scrim, .menu-toggle { display: none; }

.main {
  display: flex;
  grid-column: 2;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(190px, .7fr) minmax(280px, 1fr) auto;
  gap: 28px;
  align-items: center;
  min-height: 98px;
  padding: 17px clamp(20px, 3vw, 42px);
  background: rgba(7, 10, 14, .89);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(15px);
}
.page-heading .eyebrow,
.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 2vw, 29px);
  font-weight: 600;
  letter-spacing: -.035em;
}
.quick-jump {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(100%, 470px);
  min-height: 40px;
  margin: 0 auto;
  padding: 0 11px;
  background: rgba(9, 15, 20, .75);
  border: 1px solid var(--border);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.quick-jump:focus-within {
  border-color: rgba(86, 217, 255, .65);
  box-shadow: 0 0 0 3px rgba(86, 217, 255, .06);
}
.quick-jump > span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}
.quick-jump input {
  width: 100%;
  padding: 9px 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--mono);
  font-size: 13px;
}
.quick-jump input::placeholder { color: var(--faint); }
.quick-jump kbd {
  padding: 2px 5px;
  color: var(--faint);
  background: var(--panel2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
}
.system-state {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-self: end;
  min-width: 138px;
}
.system-state > i {
  width: 8px;
  height: 8px;
}
.system-state span { display: flex; flex-direction: column; }
.system-state strong {
  color: var(--ok);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.system-state small {
  margin-top: 1px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.content {
  width: 100%;
  max-width: 1680px;
  min-width: 0;
  flex: 1;
  padding: clamp(20px, 3vw, 42px);
}
.content > *,
.panel > *,
.panel-head > * { min-width: 0; }
.foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px clamp(20px, 3vw, 42px);
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Surfaces, panels, and page-level data */
.card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(86, 217, 255, .025), transparent 28%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 2px;
}
.card::after {
  position: absolute;
  z-index: 1;
  top: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  content: "";
  background: linear-gradient(45deg, transparent 46%, var(--border) 48%, var(--border) 53%, var(--bg) 55%);
  pointer-events: none;
}
.panel {
  margin-bottom: 18px;
  padding: 20px;
}
.panel + .panel { margin-top: 0; }
.panel-head {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}
.panel-head > div:first-child { min-width: 0; }
.panel h2,
.panel-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.panel-kicker,
.panel-index,
.panel-aside,
.signal-id {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.panel-kicker { display: block; margin-bottom: 2px; color: var(--accent); }
.panel-aside { white-space: nowrap; }
.muted { color: var(--muted); }
.panel > p.muted,
.modal-body > p.muted {
  max-width: 950px;
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.65;
}
.panel p,
.panel label,
.modal-body p,
.modal-body label,
.login-card p { overflow-wrap: anywhere; }
.panel > p.muted b { color: var(--text); font-weight: 600; }
.text-link {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.grid { display: grid; gap: 14px; }
.stats {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 18px;
}
.stats > .card {
  min-height: 112px;
  padding: 18px;
}
.card .k {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.card .v {
  margin-top: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.04em;
}

/* Tables */
.table-shell {
  position: relative;
  z-index: 0;
  isolation: isolate;
  width: calc(100% + 40px);
  margin: 4px -20px -20px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--panel);
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}
.table-shell.is-scrollable-x {
  box-shadow: inset -18px 0 18px -18px rgba(86, 217, 255, .72);
}
.tbl {
  position: relative;
  z-index: 0;
  width: 100%;
  min-width: 670px;
  background: var(--panel);
  border-collapse: separate;
  border-spacing: 0;
}
.tbl thead { position: relative; z-index: 2; }
.tbl tbody { position: relative; z-index: 0; }
.tbl th {
  padding: 10px 13px;
  color: var(--faint);
  /* Sticky table headers must be fully opaque: translucent paint lets moving
     rows remain legible underneath and reads as an overlap. */
  background: #090E13;
  background-clip: padding-box;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .105em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl td {
  height: 48px;
  padding: 9px 13px;
  color: #BECAD1;
  border-bottom: 1px solid rgba(27, 42, 54, .72);
  font-size: 12.5px;
  vertical-align: middle;
}
.tbl tbody tr { transition: background .14s ease; }
.tbl tbody tr:hover { background: rgba(86, 217, 255, .025); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td strong { color: var(--text); font-weight: 500; }
.tbl td.muted {
  height: 80px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
}
code {
  color: #A8BBC6;
  font-family: var(--mono);
  font-size: .92em;
}
.chip {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  color: var(--ok);
  background: rgba(118, 242, 190, .075);
  border: 1px solid rgba(118, 242, 190, .2);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  line-height: 1.2;
  text-transform: uppercase;
}
.chip::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  content: "";
  background: currentColor;
}
/* quota_exhausted is a capacity state, not a fault: the provider is fine, it has
   simply used its window. It must not inherit the default green, which would
   read as healthy while the provider is being skipped. */
.chip.cooldown, .chip.degraded, .chip.partial, .chip.deferred, .chip.quota_exhausted {
  color: var(--warn);
  background: rgba(255, 180, 92, .07);
  border-color: rgba(255, 180, 92, .22);
}
.chip.unavailable, .chip.disabled, .chip.failed, .chip.canceled {
  color: var(--danger);
  background: rgba(255, 107, 122, .07);
  border-color: rgba(255, 107, 122, .22);
}
.live-retry {
  display: block;
  margin-top: 5px;
  color: var(--warn);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .035em;
  line-height: 1.25;
  white-space: nowrap;
}

/* Controls and forms */
.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  color: #B8C6CE;
  background: var(--panel2);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .055em;
  line-height: 1;
  text-transform: uppercase;
  transition: color .14s ease, border-color .14s ease, background .14s ease, transform .14s ease;
}
.btn:hover {
  color: var(--text);
  background: var(--panel3);
  border-color: rgba(86, 217, 255, .55);
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  color: #041016;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.btn.primary:hover {
  color: #02090C;
  background: var(--accent2);
  border-color: var(--accent2);
  box-shadow: 0 0 18px rgba(86, 217, 255, .14);
}
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(86, 217, 255, .05); border-color: var(--border); }
.btn:disabled { cursor: default; filter: grayscale(.5); opacity: .45; transform: none; }
.tbl .btn {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 11.5px;
}
[x-cloak] { display: none !important; }
.row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin: 9px 0;
}
.panel label,
.modal-body label {
  display: block;
  max-width: 520px;
  margin: 14px 0;
  color: #A7B6BF;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.panel label.row,
.modal-body label.row { display: flex; }
.panel input:not([type=checkbox]),
.panel select,
.modal-body input:not([type=checkbox]),
.modal-body select,
.login-card input:not([type=checkbox]) {
  display: block;
  width: 100%;
  max-width: 520px;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 11px;
  color: var(--text);
  background: #090E13;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  outline: 0;
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.panel input:not([type=checkbox]):focus,
.panel select:focus,
.modal-body input:not([type=checkbox]):focus,
.modal-body select:focus,
.login-card input:not([type=checkbox]):focus {
  border-color: rgba(86, 217, 255, .7);
  box-shadow: 0 0 0 3px rgba(86, 217, 255, .06);
}
.panel input::placeholder,
.modal-body input::placeholder,
.login-card input::placeholder { color: #465864; }
.panel select[multiple] { min-height: 150px; }
.smtp-config-table th { width: 220px; }
.smtp-config-table code {
  color: var(--accent2);
  overflow-wrap: anywhere;
}
.smtp-port-details {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}
.smtp-port-details small {
  line-height: 1.45;
}
.smtp-config-value {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.smtp-config-value code { min-width: 0; overflow-wrap: anywhere; }
.smtp-credential-note {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 14px;
  padding: 11px 12px;
  color: var(--muted);
  background: rgba(118, 242, 190, .045);
  border: 1px solid rgba(118, 242, 190, .14);
  border-left: 2px solid var(--ok);
}
.smtp-credential-note > i {
  width: 6px;
  height: 6px;
  margin-top: 6px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(118, 242, 190, .55);
}
.smtp-credential-note > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.smtp-credential-note strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  line-height: 1.4;
  text-transform: uppercase;
}
.smtp-credential-note small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.smtp-credential-note[data-state="warning"] {
  background: rgba(255, 180, 92, .045);
  border-color: rgba(255, 180, 92, .16);
  border-left-color: var(--warn);
}
.smtp-credential-note[data-state="warning"] > i {
  background: var(--warn);
  box-shadow: 0 0 10px rgba(255, 180, 92, .5);
}
.smtp-credential-note[data-state="missing"] {
  background: rgba(107, 128, 140, .045);
  border-color: rgba(107, 128, 140, .18);
  border-left-color: var(--faint);
}
.smtp-credential-note[data-state="missing"] > i {
  background: var(--faint);
  box-shadow: none;
}
.smtp-copy-btn {
  display: inline-grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  color: #8096A3;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: color .14s ease;
}
.smtp-copy-btn:hover:not(:disabled),
.smtp-copy-btn:focus-visible {
  color: var(--accent2);
  background: transparent;
}
.smtp-copy-btn:focus-visible {
  outline: 1px solid var(--accent2);
  outline-offset: 2px;
}
.smtp-copy-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.smtp-copy-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.smtp-copy-btn .check-icon { display: none; }
.smtp-copy-btn.is-copied {
  color: var(--ok);
}
.smtp-copy-btn.is-copied .copy-icon { display: none; }
.smtp-copy-btn.is-copied .check-icon { display: block; }
.smtp-secret-value { user-select: all; }
.panel label.row input:not([type=checkbox]),
.modal-body label.row input:not([type=checkbox]) { width: auto; }
.panel .row input:not([type=checkbox]),
.panel .row select {
  width: auto;
  max-width: 250px;
  margin-top: 0;
}
.tbl select {
  width: auto;
  max-width: 150px;
  min-height: 35px;
  margin-top: 0;
  padding: 5px 8px;
  color: #B7C5CD;
  background: #090E13;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
}
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}
.form-card {
  margin: 14px 0 20px;
  padding: 20px;
  background: var(--panel2);
  border-color: var(--border-strong);
}
.form-card::before {
  display: block;
  margin-bottom: 15px;
  color: var(--accent);
  content: "CONFIGURATION INPUT";
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
}
.err {
  padding: 9px 11px;
  color: var(--danger);
  background: rgba(255, 107, 122, .06);
  border-left: 2px solid var(--danger);
  font-family: var(--mono);
  font-size: 11.5px;
}
.notice {
  padding: 10px 12px;
  margin: 0 0 4px;
  color: var(--ok);
  background: rgba(118, 242, 190, .06);
  border-left: 2px solid var(--ok);
  font-size: 13px;
  line-height: 1.5;
}
.auth-link,
.auth-back-link {
  align-self: flex-start;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .035em;
}
.auth-link { line-height: 1.35; }
.auth-back-link {
  display: inline-flex;
  margin-top: 22px;
}
.recovery-result h3 {
  margin: 8px 0 6px;
  color: var(--text);
  font-size: 22px;
}
.recovery-result p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}
.recovery-result .btn { width: 100%; }
.security-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0 20px;
  max-width: 900px;
}
.security-form label:first-child { grid-column: 1 / -1; }
.security-form .password-guidance,
.security-form .btn,
.security-form .err { grid-column: 1 / -1; }
.security-form .btn { width: fit-content; }
.password-guidance {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.center { text-align: center; }

/* Page-specific composition while preserving the existing form behavior. */
body[data-page="settings"] .content {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 14px;
}
body[data-page="settings"] .content > .panel { margin: 0; }
body[data-page="settings"] .content > .panel:last-child { grid-column: 1 / -1; }
body[data-page="settings"] #buildPanel { grid-column: 1 / -1; }
body[data-page="certificates"] .stats { grid-template-columns: repeat(2, minmax(220px, 340px)); }

@media (min-width: 821px) {
  body[data-page="users"] .form-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 0 20px;
  }
  body[data-page="users"] .form-card > .row,
  body[data-page="users"] .form-card > .err,
  body[data-page="users"] .form-card::before {
    grid-column: 1 / -1;
  }
}

/* Dashboard signature: the live SMTP route */
.signal-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.25fr) minmax(275px, .92fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}
.trace-panel {
  isolation: isolate;
  min-height: 360px;
  padding: 19px 22px 16px;
  overflow: hidden;
}
.trace-panel::before {
  position: absolute;
  z-index: 0;
  inset: 51px 0 0;
  content: "";
  pointer-events: none;
  opacity: .48;
  background-image: radial-gradient(circle, rgba(86, 217, 255, .18) .75px, transparent .9px);
  background-size: 13px 13px;
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}
.trace-head {
  position: relative;
  z-index: 2;
  padding-bottom: 14px;
  margin: 0;
  border-bottom: 1px solid rgba(27, 42, 54, .75);
}
.trace-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trace-head .panel-index {
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.live-state {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--warn);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.live-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.live-state.connected { color: var(--ok); }
.live-state.connected i { animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(118, 242, 190, .5); }
  70% { box-shadow: 0 0 0 6px rgba(118, 242, 190, 0); }
  100% { box-shadow: 0 0 0 0 rgba(118, 242, 190, 0); }
}
.trace-ruler {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 8px 1px 0;
  color: #3E5664;
  font-family: var(--mono);
  font-size: 9px;
}
.trace-stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(35px, 1fr) auto minmax(35px, 1fr) auto minmax(35px, 1fr) auto;
  align-items: start;
  padding: 47px 4% 82px;
}
.trace-node {
  display: flex;
  width: 84px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.trace-provider { position: relative; }
.trace-icon {
  position: relative;
  display: grid;
  width: 55px;
  height: 55px;
  margin-bottom: 10px;
  place-items: center;
  color: var(--accent);
  background: #091119;
  border: 1px solid var(--accent);
  border-radius: 3px;
  box-shadow: inset 0 0 19px rgba(86, 217, 255, .04), 0 0 16px rgba(86, 217, 255, .04);
}
.trace-icon::before, .trace-icon::after {
  position: absolute;
  width: 7px;
  height: 7px;
  content: "";
}
.trace-icon::before { top: -1px; left: -1px; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.trace-icon::after { right: -1px; bottom: -1px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }
.trace-icon svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.7;
}
.trace-node > span {
  color: #8298A5;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.trace-node > strong {
  display: block;
  max-width: 118px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trace-node.delivered .trace-icon,
.trace-node.delivered > strong { color: var(--ok); }
.trace-node.delivered .trace-icon {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(118, 242, 190, .07);
}
.trace-line {
  position: relative;
  height: 1px;
  margin-top: 27px;
  overflow: visible;
  background: rgba(86, 217, 255, .55);
  box-shadow: 0 0 9px rgba(86, 217, 255, .38);
}
.trace-line::after {
  position: absolute;
  inset: -3px 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(86, 217, 255, .25), transparent);
  filter: blur(3px);
}
.trace-line i {
  position: absolute;
  z-index: 2;
  top: -2px;
  left: -2px;
  width: 6px;
  height: 5px;
  background: var(--accent2);
  box-shadow: 0 0 10px var(--accent);
  animation: packet-flow 3s linear infinite;
}
.trace-line i:nth-child(2) { animation-delay: -1s; }
.trace-line i:nth-child(3) { animation-delay: -2s; }
@keyframes packet-flow {
  0% { left: 0; opacity: 0; }
  12%, 86% { opacity: 1; }
  100% { left: calc(100% - 4px); opacity: 0; }
}
.retry-branch {
  position: absolute;
  top: 116px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}
.retry-branch b {
  width: 1px;
  height: 26px;
  border-left: 1px dashed var(--warn);
}
.retry-branch > span {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: var(--warn);
  background: #15120E;
  border: 1px solid var(--warn);
  font-family: var(--mono);
}
.retry-branch em {
  margin-top: 6px;
  color: var(--warn);
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.retry-branch em strong { font-weight: 600; }
.trace-foot {
  position: absolute;
  right: 20px;
  bottom: 12px;
  left: 20px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding-top: 9px;
  color: var(--faint);
  border-top: 1px solid rgba(27, 42, 54, .7);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.trace-foot span { display: flex; gap: 6px; align-items: center; }
.trace-foot span i { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.trace-foot code { color: var(--faint); }

.system-signal {
  isolation: isolate;
  min-height: 360px;
  padding: 19px 0 0;
  overflow: hidden;
}
.system-signal .panel-head {
  position: relative;
  z-index: 4;
  padding: 0 20px 15px;
  margin: 0;
  background: var(--panel);
}
.system-signal .panel-head h2 {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.signal-wave {
  position: relative;
  z-index: 1;
  height: 142px;
  overflow: hidden;
  background: rgba(5, 10, 14, .6);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.signal-wave svg { width: 100%; height: 100%; overflow: hidden; }
.wave-grid { fill: none; stroke: rgba(40, 65, 82, .35); stroke-width: 1; }
.wave-line {
  fill: none;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: .92;
}
.wave-11203 {
  color: var(--accent);
  stroke: var(--accent);
  filter: drop-shadow(0 0 4px rgba(86, 217, 255, .45));
}
.wave-21203 {
  color: #76F2BE;
  stroke: #76F2BE;
  filter: drop-shadow(0 0 4px rgba(118, 242, 190, .4));
}
.wave-2111 {
  color: #FFB45C;
  stroke: #FFB45C;
  filter: drop-shadow(0 0 4px rgba(255, 180, 92, .4));
}
.wave-dot {
  fill: currentColor;
  stroke: none;
}
.wave-legend {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 5px;
  left: 10px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 3px 5px;
  background: linear-gradient(90deg, transparent, rgba(5, 10, 14, .88) 20%);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  pointer-events: none;
}
.wave-legend span { display: inline-flex; gap: 4px; align-items: center; color: var(--faint); }
.wave-legend span.active em { color: #D7E3E9; }
.wave-legend b { color: #A8BAC4; font-weight: 600; }
.wave-legend em { font-style: normal; transition: color .15s ease; }
.wave-key {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}
.signal-list {
  position: relative;
  z-index: 3;
  margin: 0;
  background: var(--panel);
}
.signal-list div {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(27, 42, 54, .85);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.signal-list div:last-child { border-bottom: 0; }
.signal-list dt { display: flex; gap: 9px; align-items: center; color: #899BA5; }
.signal-list dd { margin: 0; color: var(--ok); }
.signal-icon { display: inline-grid; width: 18px; color: #A8BAC4; place-items: center; font-size: 13px; }

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.metric {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  min-height: 99px;
  align-content: center;
  padding: 15px 20px;
  border-right: 1px solid var(--border);
}
.metric:last-child { border-right: 0; }
.metric > div { align-self: center; }
.metric > div span {
  display: block;
  color: #93A4AE;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.metric > div small {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
}
.metric > strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(19px, 2vw, 27px);
  font-weight: 500;
  letter-spacing: -.06em;
}
.metric:first-child > strong, .metric:last-child > strong { color: var(--ok); }
.metric-mark {
  align-self: start;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.metric-mark.success { color: var(--ok); }
.metric-mark.warning { color: var(--warn); }
.dashboard-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(370px, .92fr);
  gap: 14px;
  align-items: stretch;
}
.dashboard-lower .panel {
  isolation: isolate;
  display: flex;
  min-width: 0;
  height: 360px;
  min-height: 0;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
}
.dashboard-lower .panel-head {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  background: var(--panel);
}
.dashboard-lower .table-shell {
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: -20px;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.dashboard-lower .tbl th {
  position: sticky;
  z-index: 5;
  top: 0;
  background: #090E13;
  box-shadow: 0 1px 0 var(--border), 0 8px 14px -14px rgba(0, 0, 0, .95);
}
.transactions-panel .tbl { min-width: 820px; }
.providers-panel .tbl { min-width: 510px; }

/* A maximized desktop dashboard is a single viewport. The summary bands keep
   their natural heights and both lower tables consume the remaining space,
   scrolling internally instead of growing the page. Shorter/narrower screens
   retain normal document scrolling so no dashboard section becomes unreachable. */
@media (min-width: 1181px) and (min-height: 720px) {
  body[data-page="dashboard"] {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  body[data-page="dashboard"] .app,
  body[data-page="dashboard"] .main {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  body[data-page="dashboard"] .topbar,
  body[data-page="dashboard"] .foot {
    flex: 0 0 auto;
  }
  body[data-page="dashboard"] .topbar {
    min-height: 84px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  body[data-page="dashboard"] .foot {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  body[data-page="dashboard"] .content {
    display: grid;
    grid-template-rows:
      /* Both cards share this row. It must contain the three signal lanes and
         the Provider/retry branch without either card overflowing downward. */
      clamp(310px, 42dvh, 382px)
      clamp(86px, 10dvh, 99px)
      minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding-top: clamp(14px, 2dvh, 24px);
    padding-bottom: clamp(14px, 2dvh, 24px);
    overflow: hidden;
  }
  body[data-page="dashboard"] .signal-grid,
  body[data-page="dashboard"] .stats-band {
    min-height: 0;
    margin: 0;
  }
  body[data-page="dashboard"] .dashboard-lower {
    min-height: 0;
  }
  body[data-page="dashboard"] .trace-panel,
  body[data-page="dashboard"] .system-signal {
    height: 100%;
    min-height: 0;
  }
  body[data-page="dashboard"] .metric {
    min-height: 0;
  }
  body[data-page="dashboard"] .dashboard-lower .panel {
    height: 100%;
  }
}

@media (min-width: 1181px) and (min-height: 720px) and (max-height: 899px) {
  body[data-page="dashboard"] .trace-panel {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  body[data-page="dashboard"] .trace-head {
    padding-bottom: 10px;
  }
  body[data-page="dashboard"] .trace-ruler {
    padding-top: 6px;
  }
  body[data-page="dashboard"] .trace-stage {
    padding-top: 34px;
    padding-bottom: 68px;
  }
  body[data-page="dashboard"] .retry-branch {
    top: 102px;
  }
  body[data-page="dashboard"] .system-signal {
    padding-top: 14px;
  }
  body[data-page="dashboard"] .system-signal .panel-head {
    padding-bottom: 10px;
  }
  body[data-page="dashboard"] .signal-wave {
    height: 106px;
  }
  body[data-page="dashboard"] .signal-list div {
    min-height: 34px;
  }
}

/* Login */
.login-page {
  display: block;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 45%, rgba(86, 217, 255, .08), transparent 32rem),
    var(--bg);
}
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(390px, .75fr);
  min-height: 100vh;
}
.login-visual {
  position: relative;
  display: flex;
  min-height: 680px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(28px, 5vw, 74px);
  border-right: 1px solid var(--border);
}
.login-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: .52;
  background-image:
    linear-gradient(rgba(27, 42, 54, .28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 42, 54, .28) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 42% 50%, #000 0, transparent 68%);
}
.login-visual::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 17%;
  width: 1px;
  content: "";
  background: linear-gradient(transparent, rgba(86, 217, 255, .24), transparent);
}
.login-brand {
  position: absolute;
  z-index: 2;
  top: clamp(25px, 4vw, 50px);
  left: clamp(28px, 5vw, 74px);
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: var(--mono);
}
.login-brand:hover { color: var(--text); }
.login-brand > span {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.025em;
}
.login-brand > span b { color: var(--accent); font-weight: 500; }
.login-brand small {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: var(--tracking-micro);
  line-height: 1.35;
  text-transform: uppercase;
}
.login-brief {
  position: relative;
  z-index: 2;
  width: min(100%, 680px);
}
.login-brief h1 {
  margin: 12px 0 18px;
  color: var(--text);
  font-size: clamp(40px, 4.8vw, 68px);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: 1.02;
}
.login-brief h1 > span,
.login-brief h1 > em { display: block; }
.login-brief h1 em {
  color: var(--accent);
  font-style: normal;
  text-shadow: 0 0 32px rgba(86, 217, 255, .12);
}
.login-brief p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.login-trace {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 610px);
  margin-top: 72px;
}
.login-trace::before {
  position: absolute;
  top: 20px;
  right: 12%;
  left: 12%;
  height: 1px;
  content: "";
  background: var(--accent);
  box-shadow: 0 0 10px rgba(86, 217, 255, .5);
}
.login-trace div {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
}
.login-trace i {
  position: absolute;
  top: -20px;
  color: var(--faint);
  font-size: 9px;
  font-style: normal;
}
.login-trace span {
  z-index: 2;
  display: block;
  width: 9px;
  height: 9px;
  margin: 16px 0 13px;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 13px rgba(86, 217, 255, .4);
}
.login-trace div:last-child span { border-color: var(--ok); box-shadow: 0 0 13px rgba(118, 242, 190, .4); }
.login-trace b { font-weight: 500; }
.login-readout {
  position: absolute;
  right: clamp(28px, 5vw, 74px);
  bottom: clamp(25px, 4vw, 50px);
  left: clamp(28px, 5vw, 74px);
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 13px;
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: var(--tracking-label);
}
.login-readout > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.login-readout > span:nth-child(2) { text-align: center; }
.login-readout > span:last-child { text-align: right; }
.login-readout small {
  color: var(--faint);
  font: inherit;
  letter-spacing: inherit;
}
.login-readout b {
  color: var(--ok);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.login-panel {
  display: grid;
  min-height: 680px;
  padding: clamp(28px, 5vw, 70px);
  place-items: center;
  background: rgba(9, 14, 19, .82);
}
.login-card {
  position: relative;
  width: min(100%, 420px);
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
}
.login-card::before {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 17px;
  height: 17px;
  content: "";
  background: linear-gradient(45deg, transparent 46%, var(--border-strong) 48%, var(--border-strong) 53%, #090E13 55%);
}
.login-card-brand {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 196px;
  margin: -13px -13px 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 58% 31%, rgba(255, 126, 17, .22), transparent 32%),
    radial-gradient(circle at 18% 82%, rgba(86, 217, 255, .08), transparent 35%),
    linear-gradient(158deg, #20262C 0%, #10151A 52%, #1B1713 100%);
  border: 1px solid rgba(255, 139, 35, .24);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .055),
    inset 0 -22px 46px rgba(0, 0, 0, .22),
    0 18px 42px rgba(0, 0, 0, .2);
  place-items: center;
}
.login-card-brand::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  content: "";
  opacity: .24;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(125deg, transparent 5%, #000 42%, transparent 88%);
}
.login-card-brand::after {
  position: absolute;
  top: -1px;
  left: 24%;
  width: 52%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, #FF8B23, transparent);
  box-shadow: 0 0 18px rgba(255, 126, 17, .7);
}
.login-card-brand-trace {
  position: absolute;
  z-index: -1;
  right: -9%;
  bottom: 36px;
  left: 9%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 139, 35, .38) 14%, rgba(255, 139, 35, .7) 72%, transparent);
  transform: rotate(-8deg);
}
.login-card-brand-trace i {
  position: absolute;
  top: -3px;
  width: 7px;
  height: 7px;
  background: #10151A;
  border: 1px solid #FF8B23;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 126, 17, .48);
}
.login-card-brand-trace i:first-child { left: 18%; }
.login-card-brand-trace i:nth-child(2) { left: 57%; }
.login-card-brand-trace i:last-child { left: 83%; }
.login-card-logo {
  position: relative;
  display: block;
  width: clamp(168px, 53%, 198px);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 15px 26px rgba(0, 0, 0, .3))
    drop-shadow(0 0 22px rgba(255, 126, 17, .1));
}
.login-card-head { margin-bottom: 24px; }
.login-card-head .panel-index { color: var(--accent); }
.login-card-head h2 {
  margin: 7px 0 6px;
  color: var(--text);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.15;
}
.login-card-head p {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #A7B6BF;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  line-height: 1.35;
  text-transform: uppercase;
}
.login-card label.row {
  flex-direction: row;
  align-items: center;
  gap: 9px;
}
.login-card input:not([type=checkbox]) {
  max-width: none;
  min-height: 44px;
  margin: 0;
}
.password-field {
  display: grid;
  gap: 8px;
}
.password-field label { margin: 0; }
.password-field .auth-link { justify-self: end; }
.login-card .btn.primary {
  width: 100%;
  min-height: 48px;
  justify-content: space-between;
  margin-top: 3px;
  padding-inline: 15px;
}
.login-card .btn.primary b { font-size: 15px; font-weight: 500; }
.remember-row {
  flex-wrap: nowrap !important;
  margin: 0 !important;
  color: var(--muted) !important;
  font-family: var(--sans) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  line-height: 1.4 !important;
  text-transform: none !important;
}
.remember-row input { flex: 0 0 auto; margin: 0; accent-color: var(--accent); }
.login-card-foot {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 25px;
  padding-top: 16px;
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: var(--tracking-label);
  line-height: 1.4;
  text-transform: uppercase;
}
.login-card-foot i { display: block; width: 5px; height: 5px; }
.login-card-foot i.is-plaintext {
  background: var(--warn);
  box-shadow: 0 0 12px rgba(255, 180, 92, .65);
}

/* Responsive states */
@media (max-width: 1180px) {
  .topbar { grid-template-columns: minmax(175px, .7fr) minmax(240px, 1fr) auto; gap: 18px; }
  .system-state { min-width: auto; }
  .system-state small { display: none; }
  .signal-grid { grid-template-columns: 1fr; }
  .system-signal {
    display: grid;
    grid-template-columns: minmax(235px, .9fr) 1fr;
    grid-template-rows: auto 1fr;
    min-height: 190px;
    padding-top: 0;
  }
  .security-form { grid-template-columns: minmax(0, 1fr); }
  .security-form label:first-child,
  .security-form .password-guidance,
  .security-form .btn,
  .security-form .err { grid-column: auto; }
  .security-form .btn { width: 100%; }
  .system-signal .panel-head { grid-column: 1 / -1; padding-top: 15px; border-bottom: 1px solid var(--border); }
  .signal-wave { height: 142px; border-top: 0; border-bottom: 0; border-right: 1px solid var(--border); }
  .signal-list div { min-height: 40px; }
  .dashboard-lower { grid-template-columns: 1fr; }
}

@media (max-width: 940px) {
  :root { --sidebar: min(82vw, 300px); }
  .app { display: block; }
  .sidebar {
    width: var(--sidebar);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    visibility: hidden;
    transform: translateX(-102%);
    transition: visibility .22s, transform .22s ease;
  }
  .nav-scrim {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: block;
    visibility: hidden;
    padding: 0;
    background: rgba(1, 4, 6, .67);
    border: 0;
    opacity: 0;
    transition: visibility .22s, opacity .22s ease;
  }
  body.nav-open {
    position: fixed;
    right: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
  }
  body.nav-open .sidebar { visibility: visible; transform: translateX(0); }
  body.nav-open .nav-scrim { visibility: visible; opacity: 1; }
  .nav-scrim { touch-action: none; }
  .main { grid-column: auto; }
  .topbar { grid-template-columns: auto minmax(150px, 1fr) minmax(230px, 1fr) auto; }
  .menu-toggle {
    display: flex;
    width: 36px;
    height: 36px;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
  }
  .menu-toggle span { display: block; width: 14px; height: 1px; background: currentColor; }
  .menu-toggle b { position: absolute; width: 1px; height: 1px; overflow: hidden; }
  .login-shell { grid-template-columns: 1fr 440px; }
  .login-visual { padding-inline: 38px; }
  .login-brand { left: 38px; }
  .login-readout {
    right: 38px;
    left: 38px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-readout > span:nth-child(2) { text-align: right; }
  .login-readout > span:last-child {
    grid-column: 1 / -1;
    text-align: left;
  }
}

@media (max-width: 760px) {
  body::before { opacity: .018; }
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    min-height: calc(76px + env(safe-area-inset-top));
    padding:
      calc(10px + env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      10px
      max(16px, env(safe-area-inset-left));
  }
  .quick-jump { display: none; }
  .menu-toggle {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }
  .menu-toggle span { width: 17px; }
  .page-heading { overflow: hidden; }
  .page-heading h1 { font-size: 21px; }
  .page-heading .eyebrow {
    overflow: hidden;
    font-size: 9.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .system-state strong { font-size: 10px; }
  .content {
    padding:
      16px
      max(16px, env(safe-area-inset-right))
      calc(20px + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .foot {
    padding:
      14px
      max(16px, env(safe-area-inset-right))
      calc(14px + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .foot span:last-child { display: none; }
  .panel-head {
    flex-direction: column;
    gap: 11px;
    align-items: stretch;
  }
  .panel-head > .row {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 8px;
    margin: 0;
  }
  .panel-head > .row .btn,
  .panel-head > .btn { width: 100%; }
  .panel div.row {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    align-items: stretch;
  }
  .panel div.row > input:not([type=checkbox]),
  .panel div.row > select,
  .panel div.row > .btn,
  .panel div.row > a.btn {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .panel input:not([type=checkbox]),
  .panel select,
  .modal-body input:not([type=checkbox]),
  .modal-body select,
  .login-card input:not([type=checkbox]),
  .tbl select {
    font-size: 16px;
  }
  .btn { min-height: 44px; font-size: 14px; }
  .tbl .btn { min-height: 40px; font-size: 12.5px; }
  .trace-panel { min-height: 382px; padding-inline: 16px; }
  .trace-head {
    flex-direction: row;
    align-items: center;
  }
  .trace-stage { padding-right: 2%; padding-left: 2%; }
  .trace-node { width: 66px; }
  .trace-icon { width: 47px; height: 47px; }
  .trace-line { margin-top: 23px; }
  .trace-node > strong { max-width: 74px; font-size: 12px; }
  .trace-provider > strong { max-width: 78px; }
  .retry-branch { top: 105px; }
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .system-signal { display: block; }
  .system-signal .panel-head { border-bottom: 0; }
  .signal-wave { height: 115px; border-right: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .wave-legend { gap: 8px; font-size: 8px; }
  .login-shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .login-visual {
    min-height: 270px;
    padding:
      calc(88px + env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      28px
      max(24px, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .login-brand {
    top: calc(24px + env(safe-area-inset-top));
    left: max(24px, env(safe-area-inset-left));
  }
  .login-brief h1 { margin-bottom: 0; font-size: clamp(34px, 9vw, 44px); }
  .login-brief p,
  .login-trace,
  .login-readout { display: none; }
  .login-panel {
    min-height: auto;
    padding:
      28px
      max(16px, env(safe-area-inset-right))
      calc(34px + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .login-card { width: 100%; }
  body[data-page="settings"] .content { display: block; }
  body[data-page="settings"] .content > .panel { margin-bottom: 14px; }
  body[data-page="certificates"] .stats { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .system-state span { display: none; }
  .system-state { min-width: 8px; }
  .panel { padding: 16px; }
  .table-shell { width: calc(100% + 32px); margin-right: -16px; margin-bottom: -16px; margin-left: -16px; }
  .tbl { min-width: 620px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
  .trace-panel {
    min-height: 0;
    padding: 16px;
  }
  .trace-head { padding-bottom: 11px; }
  .trace-ruler { display: none; }
  .trace-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 16px 0 14px;
  }
  .trace-node {
    display: grid;
    width: 100%;
    min-height: 65px;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 2px 12px;
    align-items: center;
    padding: 8px 10px;
    background: rgba(7, 12, 17, .58);
    border: 1px solid rgba(27, 42, 54, .7);
    text-align: left;
  }
  .trace-icon {
    grid-row: 1 / 3;
    grid-column: 1;
    width: 44px;
    height: 44px;
    margin: 0;
  }
  .trace-icon svg { width: 33px; height: 33px; }
  .trace-node > span {
    grid-row: 1;
    grid-column: 2;
    align-self: end;
    font-size: 10px;
    letter-spacing: .05em;
  }
  .trace-node > strong {
    grid-row: 2;
    grid-column: 2;
    max-width: 100%;
    margin: 0;
    align-self: start;
    font-size: 14px;
    text-align: left;
  }
  .trace-provider > strong { max-width: 100%; }
  .trace-line {
    width: 1px;
    height: 18px;
    min-width: 0;
    margin: 0 0 0 31px;
    background: rgba(86, 217, 255, .55);
  }
  .trace-line::after {
    inset: 0 -3px;
    background: linear-gradient(180deg, transparent, rgba(86, 217, 255, .28), transparent);
  }
  .trace-line i {
    top: -2px;
    left: -2px;
    width: 5px;
    height: 6px;
    animation-name: packet-flow-mobile;
  }
  @keyframes packet-flow-mobile {
    0% { top: 0; opacity: 0; }
    12%, 86% { opacity: 1; }
    100% { top: calc(100% - 4px); opacity: 0; }
  }
  .retry-branch {
    position: static;
    display: flex;
    grid-row: 3;
    grid-column: 2;
    flex-direction: row;
    gap: 7px;
    align-items: center;
    margin-top: 6px;
    transform: none;
  }
  .retry-branch b {
    width: 18px;
    height: 1px;
    border-top: 1px dashed var(--warn);
    border-left: 0;
  }
  .retry-branch > span { width: 26px; height: 26px; }
  .retry-branch em { margin: 0; font-size: 10px; }
  .trace-foot {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    margin-top: 0;
  }
  .trace-foot code { display: none; }
  .stats-band { grid-template-columns: 1fr; }
  .metric { min-height: 84px; border-right: 0; border-bottom: 1px solid var(--border); }
  .metric:nth-child(3) { border-bottom: 1px solid var(--border); }
  .metric:last-child { border-bottom: 0; }
  .panel-aside { display: none; }
  .dashboard-lower .panel { height: 320px; }
  .login-card { padding: 25px 20px; }
  .login-card-brand { min-height: 180px; margin: -10px -8px 20px; }
  .login-card-logo { width: 162px; }
}

@media (max-width: 390px) {
  .topbar {
    gap: 10px;
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }
  .page-heading h1 { font-size: 19px; }
  .content {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }
  .panel { padding: 14px; }
  .table-shell { width: calc(100% + 28px); margin-right: -14px; margin-bottom: -14px; margin-left: -14px; }
  .metric { padding-inline: 16px; }
  .login-visual { min-height: 225px; }
  .login-card { padding: 23px 17px; }
  .login-card-brand { min-height: 164px; margin-right: -6px; margin-left: -6px; }
  .login-card-logo { width: 148px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Modal ------------------------------------------------------------------
   Modal surfaces are operational command panels: a compact signal header,
   scroll-safe working area, and a stable action rail. Hidden with [hidden]
   rather than a class so a closed dialog is inert to assistive technology. */
body.modal-open { overflow: hidden; }
.modal[hidden] {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(3, 6, 9, .78);
  backdrop-filter: blur(7px) saturate(.8);
  animation: modal-backdrop-in .16s ease-out both;
}
.modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  /* The body scrolls, not the page behind it. */
  max-height: min(88vh, 900px);
  max-height: min(88dvh, 900px);
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(86, 217, 255, .045), transparent 34%),
    var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .68), 0 0 0 1px rgba(86, 217, 255, .025);
  animation: modal-panel-in .2s cubic-bezier(.2, .8, .2, 1) both;
}
.modal-box::before {
  position: absolute;
  z-index: 2;
  top: -1px;
  right: 0;
  left: 0;
  height: 2px;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, var(--accent), rgba(86, 217, 255, .18) 42%, transparent 82%);
}
.modal-box--sm { width: min(540px, 100%); }
.modal-box--wide { width: min(980px, 100%); }
.modal-box--data { width: min(1080px, 100%); }
.modal-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.modal-head {
  display: flex;
  flex: 0 0 auto;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 15px 20px 14px 22px;
  background: rgba(7, 12, 17, .45);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-head .panel-kicker { margin: 0; }
.modal-close {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(86, 217, 255, .055);
  border-color: var(--border-strong);
}
.modal-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}
.modal-body--form { padding-top: 18px; }
.modal-section {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.modal-section + .modal-section {
  padding-top: 20px;
  margin-top: 22px;
  border-top: 1px solid var(--border);
}
.modal-section legend {
  width: 100%;
  padding: 0;
  margin: 0 0 13px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}
.modal-form-grid > label {
  max-width: none;
  margin: 0;
}
.modal-form-grid input:not([type=checkbox]),
.modal-form-grid select { max-width: none; }
.modal-body label small {
  display: block;
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
}
.modal-span-full { grid-column: 1 / -1; }
.modal-choice-grid {
  display: flex;
  gap: 10px 22px;
  align-items: center;
  flex-wrap: wrap;
}
.modal-choice-grid label.row { margin: 0; }
.modal-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.modal-body > .err:last-child { margin: 20px 0 0; }
.modal-body > :first-child { margin-top: 0; }
.modal-body > :last-child { margin-bottom: 0; }
.modal-foot {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  min-height: 70px;
  padding: 13px 20px;
  background: rgba(7, 12, 17, .68);
  border-top: 1px solid var(--border);
}
.modal-foot .btn { min-width: 112px; }
.modal-foot .modal-foot-spacer { margin-right: auto; }
@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
  .modal {
    align-items: flex-end;
    padding: 16px 0 0;
  }
  .modal-box {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
  }
  .modal-head {
    min-height: 68px;
    padding-right: max(15px, env(safe-area-inset-right));
    padding-left: max(17px, env(safe-area-inset-left));
  }
  .modal-body {
    padding-right: max(17px, env(safe-area-inset-right));
    padding-left: max(17px, env(safe-area-inset-left));
  }
  .modal-form-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-span-full { grid-column: auto; }
  .modal-foot {
    padding-right: max(15px, env(safe-area-inset-right));
    padding-bottom: max(13px, env(safe-area-inset-bottom));
    padding-left: max(15px, env(safe-area-inset-left));
  }
}
@media (max-width: 460px) {
  .modal-foot { align-items: stretch; }
  .modal-foot .btn { min-width: 0; flex: 1 1 0; }
  .modal-foot .modal-foot-spacer { margin-right: 0; }
  .modal-choice-grid {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Pagination ------------------------------------------------------------- */
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
}
.pager-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
