/* Talos Circuit Portal. Same dark app shell as Talos ticketing and Helm
   (sidebar, cards, tables, pills), on the Talos brand: ink, wire teal,
   Satoshi and JetBrains Mono. Fonts are self-hosted (see brand/fonts/LICENSES.txt). */

@font-face { font-family: 'Satoshi'; src: url('/brand/fonts/satoshi-500.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('/brand/fonts/satoshi-700.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('/brand/fonts/satoshi-900.woff2') format('woff2'); font-weight: 800 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/brand/fonts/jetbrains-mono-latin.woff2') format('woff2'); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0a0f0e; --bg2: #101716; --bg3: #172120; --bg4: #1f2c2a;
  --border: #22302d; --border2: #2e403c;
  --text: #e8efec; --text2: #a4b3ae; --text3: #7b8b86;
  --wire: #0fa98e; --wire-deep: #0b7a67; --wire-hi: #3fd1b5; --wire-bg: rgba(15, 169, 142, .14);
  --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .13);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .13);
  --crit: #f87171; --crit-bg: rgba(248, 113, 113, .14);
  --radius: 10px; --sidebar: 232px;
  --font: 'Satoshi', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --mono-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M6 8h20M16 8v14M6 8v5M26 8v9'/%3E%3Cg fill='%23000' stroke='none'%3E%3Ccircle cx='16' cy='25' r='2.6'/%3E%3Ccircle cx='6' cy='16' r='2.2'/%3E%3Ccircle cx='26' cy='20' r='2.2'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 500 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--wire-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.02em; line-height: 1.2; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -.005em; }
p { margin: 0 0 10px; }
.mono { font-family: var(--mono); font-size: 12.5px; font-weight: 400; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text2); } .dim { color: var(--text3); } .small { font-size: 12.5px; } .r { text-align: right; } .nowrap { white-space: nowrap; }
.boot { padding: 80px; text-align: center; color: var(--text3); }
:focus-visible { outline: 2px solid var(--wire-hi); outline-offset: 2px; border-radius: 4px; }

/* brand */
.mark { display: inline-block; flex: none; width: 22px; height: 22px; background-color: var(--wire); -webkit-mask: var(--mono-svg) center / contain no-repeat; mask: var(--mono-svg) center / contain no-repeat; }
.lockup { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -.025em; color: var(--text); line-height: 1; }
.lockup:hover { text-decoration: none; }
.lockup .dot { color: var(--wire); }
.lockup .product { font-weight: 500; color: var(--text2); letter-spacing: -.01em; margin-left: -2px; }
.signal { font-family: var(--mono); font-size: 10.5px; font-weight: 400; text-transform: uppercase; letter-spacing: .14em; color: var(--text3); }

/* controls */
button, .btn { font: inherit; font-weight: 600; color: var(--text); background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.2; white-space: nowrap; min-height: 36px; }
button:hover, .btn:hover { background: var(--bg4); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--wire-deep); border-color: var(--wire-deep); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #0d8f79; border-color: #0d8f79; }
button.ghost { background: transparent; border-color: transparent; color: var(--text2); }
button.ghost:hover { background: var(--bg3); color: var(--text); }
button.danger { color: var(--crit); }
button.sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; min-height: 30px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border2); border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--wire); box-shadow: 0 0 0 3px var(--wire-bg); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--wire); flex: none; margin: 0; }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--text2); margin-bottom: 5px; font-weight: 600; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--text3); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text); font-weight: 500; margin: 0; padding: 5px 0; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.error { color: var(--crit); font-size: 13px; margin: 0 0 12px; }

/* shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--bg2); border-right: 1px solid var(--border); padding: 18px 12px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .lockup { padding: 2px 8px 20px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text2); font-weight: 600; margin-bottom: 2px; }
.nav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--wire-bg); color: var(--wire-hi); }
.nav a svg { width: 17px; height: 17px; flex: none; }
.nav .sect { padding: 16px 10px 6px; }
.nav .count { margin-left: auto; font-size: 11px; background: var(--crit-bg); color: var(--crit); padding: 1px 7px; border-radius: 10px; }
.who { margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--border); }
.who .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .org { color: var(--text3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who button { margin-top: 10px; width: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.preview-bar { background: var(--warn-bg); border-bottom: 1px solid rgba(251, 191, 36, .3); color: #fde68a; padding: 9px 26px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.content { padding: 26px 26px 56px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text2); margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--text3); margin-bottom: 8px; }
.crumbs a { color: var(--text2); }
.live { display: inline-flex; align-items: center; gap: 7px; color: var(--text3); font-size: 12.5px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.live.stale i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }

/* cards, stats, tables */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.pad0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card.pad0 .card-head { padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.stat .v { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { margin-bottom: 8px; }
.stat .s { font-size: 12.5px; color: var(--text3); margin-top: 6px; }
.stat.crit { border-color: rgba(248, 113, 113, .45); } .stat.crit .v { color: var(--crit); }
.stat.ok .v { color: var(--ok); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-family: var(--mono); font-size: 10.5px; font-weight: 400; text-transform: uppercase; letter-spacing: .12em; color: var(--text3); white-space: nowrap; background: var(--bg2); }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg3); }
td .t1 { font-weight: 700; color: var(--text); }
td .t2 { font-size: 12.5px; color: var(--text3); margin-top: 1px; }
tfoot td { border-top: 1px solid var(--border2); border-bottom: none; font-weight: 700; }
tr.group td { background: var(--bg); padding: 9px 14px; }
.empty { padding: 44px 20px; text-align: center; color: var(--text3); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { width: 250px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border2); border-radius: 8px; padding: 2px; }
.seg button { border: none; background: transparent; color: var(--text2); min-height: 30px; padding: 4px 11px; font-size: 12.5px; border-radius: 6px; }
.seg button.on { background: var(--bg4); color: var(--text); }

/* status */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px 3px 8px; border-radius: 20px; background: var(--bg4); color: var(--text2); white-space: nowrap; line-height: 1.5; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.up { background: var(--ok-bg); color: var(--ok); }
.pill.down { background: var(--crit-bg); color: var(--crit); }
.pill.degraded { background: var(--warn-bg); color: var(--warn); }
.pill.lg { font-size: 13.5px; padding: 5px 14px 5px 11px; }
.pill.up i { animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); } 70%, 100% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); } }
@media (prefers-reduced-motion: reduce) { .pill.up i { animation: none; } }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--bg4); color: var(--text2); white-space: nowrap; }
.tag.wire { background: var(--wire-bg); color: var(--wire-hi); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.crit { background: var(--crit-bg); color: var(--crit); }
.alert { border: 1px solid rgba(248, 113, 113, .4); background: var(--crit-bg); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.alert .t { font-weight: 700; color: #fecaca; }
.alert ul { margin: 4px 0 0; padding: 0; list-style: none; color: var(--text2); font-size: 13px; }
.notice { border: 1px solid var(--border2); background: var(--bg3); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--text2); }
.notice.wire { border-color: rgba(15, 169, 142, .4); background: var(--wire-bg); color: var(--text); }

/* uptime */
.upbar { display: flex; gap: 2px; height: 26px; align-items: stretch; }
.upbar.mini { height: 16px; gap: 1px; min-width: 96px; }
.upbar span { flex: 1; border-radius: 2px; background: var(--bg4); min-width: 2px; }
.upbar span.ok { background: var(--ok); opacity: .85; }
.upbar span.warn { background: var(--warn); }
.upbar span.crit { background: var(--crit); }
.upmeta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text3); margin-top: 6px; }
.upcell { display: flex; align-items: center; gap: 10px; }
.upcell .pct { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.spark { width: 100%; height: 54px; display: block; }
.spark polyline { fill: none; stroke: var(--wire-hi); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark path { fill: var(--wire-bg); stroke: none; }

/* detail */
.hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.hero .meta { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--text2); margin-top: 8px; align-items: center; }
.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 9px 16px; margin: 0; }
.kv dt { color: var(--text3); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.big { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.lines { width: 100%; }
.lines td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 16px; }
.lines tr.total td { border-bottom: none; border-top: 1px solid var(--border2); font-weight: 700; font-size: 16px; padding-top: 12px; }
.lines .sub { color: var(--text3); font-size: 12.5px; }
.term { height: 8px; background: var(--bg4); border-radius: 4px; overflow: hidden; margin: 14px 0 6px; }
.term i { display: block; height: 100%; background: var(--wire); border-radius: 4px; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.events li:last-child { border-bottom: none; }
.events .when { color: var(--text3); font-size: 12.5px; white-space: nowrap; margin-left: auto; }
.events b.down { color: var(--crit); } .events b.up { color: var(--ok); } .events b.degraded { color: var(--warn); }
.doc { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc:last-child { border-bottom: none; }
.doc .ico { width: 34px; height: 34px; border-radius: 8px; background: var(--bg4); display: grid; place-items: center; color: var(--wire-hi); flex: none; }
.doc .ico svg { width: 17px; height: 17px; }
.note { white-space: pre-wrap; color: var(--text); }

/* admin editor */
.linerow { display: grid; grid-template-columns: minmax(0, 1fr) 128px auto 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.linerow.fee { grid-template-columns: minmax(0, 1fr) 92px 148px auto 36px; }
.linerow button { padding: 0; width: 36px; }
.linerow .check { font-size: 12.5px; color: var(--text2); white-space: nowrap; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 18px; }

/* modal, toast */
.modal-bg { position: fixed; inset: 0; background: rgba(4, 8, 7, .72); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 70px 20px; overflow: auto; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: 12px; width: 100%; max-width: 520px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.modal .m-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.modal .m-body { padding: 20px; }
.modal .m-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
.copybox { display: flex; gap: 8px; }
.copybox input { font-family: var(--mono); font-size: 12px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg3); border: 1px solid var(--border2); border-left: 4px solid var(--wire); padding: 11px 15px; border-radius: 8px; min-width: 240px; max-width: 400px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 13.5px; }
.toast.err { border-left-color: var(--crit); }

/* sign-in */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; padding: 44px 52px; display: flex; flex-direction: column; background: radial-gradient(900px 520px at 18% 12%, rgba(15, 169, 142, .2), transparent 62%), var(--bg2); border-right: 1px solid var(--border); }
.auth-hero::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 44px 44px; -webkit-mask-image: radial-gradient(640px 460px at 30% 30%, #000, transparent 75%); mask-image: radial-gradient(640px 460px at 30% 30%, #000, transparent 75%); opacity: .7; pointer-events: none; }
.auth-hero > * { position: relative; }
.auth-hero .lockup { font-size: 20px; }
.auth-hero .lockup .mark { width: 26px; height: 26px; }
.auth-hero h1 { font-size: clamp(32px, 3.6vw, 46px); font-weight: 900; letter-spacing: -.035em; line-height: 1.05; margin: auto 0 18px; max-width: 12em; }
.auth-hero h1 em { font-style: normal; color: var(--wire-hi); }
.auth-hero .lede { color: var(--text2); font-size: 16px; max-width: 34em; margin-bottom: 30px; }
.feats { display: grid; gap: 14px; margin: 0 0 auto; padding: 0; list-style: none; max-width: 30em; }
.feats li { display: flex; gap: 13px; align-items: flex-start; }
.feats .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--wire-bg); color: var(--wire-hi); display: grid; place-items: center; flex: none; }
.feats .ico svg { width: 17px; height: 17px; }
.feats b { display: block; }
.feats span { color: var(--text2); font-size: 13.5px; }
.auth-hero .foot { color: var(--text3); font-size: 12.5px; margin-top: 30px; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 24px; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card .sub { color: var(--text2); margin-bottom: 24px; }
.auth-card button.primary { width: 100%; min-height: 42px; margin-top: 4px; }
.auth-card .help { color: var(--text3); font-size: 12.5px; margin-top: 20px; }
.auth-card .only-narrow { display: none; margin-bottom: 30px; }

@media (max-width: 1040px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side, .grid.c2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 14px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sidebar .lockup { padding: 0 8px 0 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav .sect { display: none; }
  .nav a { margin: 0; padding: 7px 9px; }
  .who { margin: 0 0 0 auto; border: none; padding: 0; display: flex; align-items: center; gap: 10px; }
  .who .name, .who .org { display: none; }
  .who button { margin: 0; width: auto; }
  .content { padding: 18px 16px 44px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 23px; }
  .preview-bar { padding: 9px 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-card .only-narrow { display: inline-flex; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 9px; }
  .linerow, .linerow.fee { grid-template-columns: minmax(0, 1fr) 110px 36px; }
  .linerow .check { grid-column: 1 / -1; }
  .linerow.fee select { grid-column: 1 / 2; }
  .toolbar input[type=search] { width: 100%; }
}
