/* Secure Browser admin — "containment" palette: deep navy ink, cool fog, caution amber. */
:root {
  --ink: #102A43;
  --ink-2: #334E68;
  --ink-3: #627D98;
  --ink-4: #9FB3C8;
  --fog: #F3F6F5;
  --fog-2: #E7ECEA;
  --paper: #FFFFFF;
  --line: #D5DDDA;
  --amber: #F2A900;
  --amber-hi: #FFB91A;
  --amber-wash: #FFF4D6;
  --amber-text: #8A5A00;
  --seal: #1F8A5B;
  --seal-wash: #E3F4EC;
  --breach: #C8372D;
  --breach-wash: #FBE7E5;
  --info-wash: #E6EEF7;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "Ubuntu Mono", Consolas, monospace;
  --r-s: 6px;
  --r-m: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fog); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 17px; font-weight: 650; margin: 0 0 4px; letter-spacing: -0.005em; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #D9E2EC; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; color: #fff; font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.side .brand .mark { width: 26px; height: 26px; border-radius: 6px; border: 2.5px solid var(--amber); flex: none; position: relative; }
.side .brand .mark::after { content: ""; position: absolute; left: 4px; right: 4px; top: 4px; height: 3px; background: var(--amber); border-radius: 1px; }
.side nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; margin: 1px 0; border-radius: var(--r-s); color: #BCCCDC; text-decoration: none; font-size: 14.5px; position: relative; }
.side nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: rgba(255,255,255,.09); color: #fff; font-weight: 600; }
.side nav a.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.side nav a.on svg { opacity: 1; }
.side nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 12px; }
.side .count { margin-left: auto; font-size: 12px; background: var(--amber); color: var(--ink); border-radius: 10px; padding: 0 7px; font-weight: 700; }
.side .me { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 20px 16px; font-size: 13px; }
.side .me .who { color: #fff; font-weight: 600; }
.side .me button { background: none; border: 0; padding: 0; color: #BCCCDC; cursor: pointer; text-decoration: underline; font-size: 13px; margin-right: 12px; }
.side .me button:hover { color: #fff; }
.topbar { display: none; }

main { padding: 30px 40px 60px; min-width: 0; }
.page { max-width: 1180px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { color: var(--ink-2); margin: 6px 0 0; max-width: 680px; }

/* ---------- panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 20px; }
.panel > .ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.panel > .ph p { color: var(--ink-3); font-size: 13.5px; margin: 2px 0 0; }
.panel > .pb { padding: 16px 20px 20px; }
.panel > .pb.flush { padding: 12px 0 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.cols > .panel { margin-bottom: 0; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 14px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--paper); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.4; }
.btn:hover { background: var(--fog); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn.primary:hover { background: var(--amber-hi); border-color: var(--amber-hi); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #243B53; }
.btn.danger { color: var(--breach); }
.btn.danger:hover { background: var(--breach-wash); border-color: #F0C2BD; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--fog-2); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 13px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--fog-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .sub { color: var(--ink-3); font-size: 13px; }
.table tr.detail td { background: var(--fog); padding: 14px 20px; }
.table .trunc { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); }
.tablewrap { overflow-x: auto; }

/* ---------- status badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 9px 2px 8px; border-radius: 20px; background: var(--fog-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--seal-wash); color: var(--seal); }
.badge.warn { background: var(--amber-wash); color: var(--amber-text); }
.badge.bad { background: var(--breach-wash); color: var(--breach); }
.badge.info { background: var(--info-wash); color: #24548F; }
.badge.plain::before { display: none; }

/* ---------- link URL (signature element) */
.url { display: inline; font-family: var(--mono); font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.url .host, .url .code { white-space: nowrap; }
.url .scheme { color: var(--ink-4); }
.url .slash { color: var(--ink-3); padding: 0 1px; }
.url .code span + span { margin-left: .28em; }
.url .code { font-weight: 700; letter-spacing: .02em; }
.copy { border: 0; background: none; padding: 3px; margin-left: 6px; border-radius: 4px; cursor: pointer; color: var(--ink-3); vertical-align: middle; }
.copy:hover { background: var(--fog-2); color: var(--ink); }
.copy svg { width: 15px; height: 15px; display: block; }
.ticket { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); padding: 22px 24px; margin-bottom: 20px; display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: center; border-left: 5px solid var(--amber); }
.ticket .url { font-size: clamp(15px, 1.9vw, 21px); white-space: normal; line-height: 1.45; }
.ticket .label { grid-column: 1 / -1; color: var(--ink-2); font-size: 14px; }

/* ---------- forms */
.field { margin-bottom: 16px; }
.field > label, .field > .lbl { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.field .help { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--paper); font-size: 14.5px; }
textarea.input { min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 13.5px; }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.input[readonly] { background: var(--fog); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.inline { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.inline .input { flex: 1; min-width: 200px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.check .t { font-weight: 600; font-size: 14px; }
.check .d { font-size: 13px; color: var(--ink-3); }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--ink-4); border-radius: 20px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--seal); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
.section { padding: 18px 0; border-top: 1px solid var(--fog-2); }
.section:first-child { border-top: 0; padding-top: 0; }
.section > h3 { margin-bottom: 2px; }
.section > .hint { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.err { color: var(--breach); font-weight: 600; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-s); padding: 6px 10px; cursor: pointer; font-size: 14px; background: var(--paper); }
.chip input { accent-color: var(--ink); }
.chip img { width: 18px; height: 18px; }

/* ---------- callouts */
.callout { border-radius: var(--r-m); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; display: flex; gap: 12px; align-items: flex-start; background: var(--info-wash); }
.callout.warn { background: var(--amber-wash); }
.callout.bad { background: var(--breach-wash); }
.callout.ok { background: var(--seal-wash); }
.callout .grow { flex: 1; }
.callout p:last-child { margin-bottom: 0; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 20px; border-top: 1px solid var(--fog-2); font-size: 14px; }
.todo li:first-child { border-top: 0; }
.todo li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none; }
.todo li span { flex: 1; }

/* ---------- stats */
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--fog-2); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 20px; overflow: hidden; }
.meter { padding: 16px 20px; background: var(--paper); }
.meter .k { font-size: 13px; color: var(--ink-3); }
.meter .v { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.meter .v small { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.bar { height: 5px; background: var(--fog-2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.bar i.hot { background: var(--breach); }
.bar i.warm { background: var(--amber); }

/* ---------- drawer & modal */
.scrim { position: fixed; inset: 0; background: rgba(16, 42, 67, .32); z-index: 50; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--paper); z-index: 51; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(16, 42, 67, .18); animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer .dh { padding: 20px 24px 14px; border-bottom: 1px solid var(--fog-2); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer .db { padding: 20px 24px; overflow-y: auto; flex: 1; }
.drawer .df { padding: 14px 24px; border-top: 1px solid var(--fog-2); display: flex; justify-content: flex-end; gap: 8px; background: var(--fog); }
.modal { position: fixed; z-index: 52; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: var(--paper); border-radius: var(--r-m); box-shadow: 0 20px 60px rgba(16, 42, 67, .3); display: flex; flex-direction: column; }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.modal .mh { padding: 18px 22px 8px; }
.modal .mb { padding: 8px 22px 16px; overflow-y: auto; }
.modal .mf { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.x { border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 4px; color: var(--ink-3); }
.x:hover { background: var(--fog-2); color: var(--ink); }
.x svg { width: 20px; height: 20px; display: block; }
.term { background: #0E2236; color: #D9E2EC; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; padding: 14px 16px; border-radius: var(--r-s); height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.term .ok { color: #7FD4A8; }
.term .bad { color: #FF9C91; }

/* ---------- toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-s); font-size: 14px; max-width: 420px; box-shadow: 0 8px 30px rgba(16, 42, 67, .25); animation: slidein .2s ease; }
.toast.bad { background: var(--breach); }

/* ---------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; }
.login .lp { background: var(--paper); padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.login .lp h1 { margin-bottom: 8px; }
.login .lp .lead { color: var(--ink-2); margin-bottom: 28px; }
.login .art { background: var(--ink); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.login .art .frame { width: min(520px, 70%); aspect-ratio: 16 / 10; border: 3px solid var(--amber); border-radius: 14px; position: relative; }
.login .art .frame::before { content: ""; position: absolute; left: 18px; right: 18px; top: 18px; height: 6px; background: var(--amber); border-radius: 3px; opacity: .9; }
.login .art .frame::after { content: ""; position: absolute; inset: 44px 18px 18px; border: 1.5px dashed rgba(242, 169, 0, .45); border-radius: 6px; }
.login .art p { position: absolute; bottom: 28px; left: 32px; right: 32px; color: #9FB3C8; font-size: 14px; max-width: 460px; }

/* ---------- misc */
.brandline { width: 48px; height: 4px; background: var(--amber); border-radius: 2px; margin-bottom: 22px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.recgrid { display: grid; grid-template-columns: 70px minmax(220px, max-content) 1fr; gap: 6px 18px; font-size: 13.5px; align-items: center; }
.dnsgrid { display: grid; grid-template-columns: max-content 1fr max-content; gap: 6px 18px; font-size: 13.5px; align-items: center; }
.ext-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--fog-2); flex: none; object-fit: contain; }
.namecell { display: flex; gap: 12px; align-items: center; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.spacer { height: 8px; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 9px 14px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--amber); }
.qr-secret { font-family: var(--mono); font-size: 16px; letter-spacing: .08em; background: var(--fog); padding: 10px 14px; border-radius: var(--r-s); word-break: break-all; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 55; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 40; font-weight: 650; }
  .topbar button { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; }
  .topbar svg { width: 22px; height: 22px; display: block; }
  main { padding: 20px 16px 40px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login .art { display: none; }
  .login .lp { padding: 40px 24px; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
