:root {
  color-scheme: dark;
  --canvas: #0a0b0d;
  --base: #111317;
  --panel: #15181d;
  --raised: #1d2128;
  --ink-white: #f5f7fa;
  --ink-black: #0a0b0d;
  --line: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .28);
  --cyan: #18c8ff;
  --cyan-dim: rgba(24, 200, 255, .14);
  --yellow: #ffd100;
  --red: #ff474c;
  --text: #f5f7fa;
  --muted: #8b93a0;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --cut: 14px;
  --chamfer: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  --chamfer-dual: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  --contours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 980 620'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.065'%3E%3Cpath d='M-22 515 170 325h75l108-108V63L417 0M-22 551l207-205h75l112-112V81L451 2M-22 587l221-220h76l117-117V96L488 0M-15 620l227-231h79l120-120V116L523 4'/%3E%3Cpath d='M540 620l96-97h98l179-179V214l81-81M576 620l74-76h98l188-188V232l58-58M615 620l51-54h98l190-190V244l40-40'/%3E%3Cpath d='M53 160h18m-9-9v18M842 116h18m-9-9v18M551 363h18m-9-9v18' stroke='%2318c8ff' stroke-opacity='.28'/%3E%3C/g%3E%3C/svg%3E");
  font: 15px/1.55 var(--sans);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--canvas); }
body::before {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(255, 255, 255, .025) 100%) 0 0 / 88px 88px,
    var(--contours) center / cover,
    radial-gradient(circle, rgba(255, 255, 255, .13) 1px, transparent 1px) 0 0 / 22px 22px;
}
body::after {
  position: fixed;
  z-index: 99;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .016) 0 1px, transparent 1px 4px);
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
h1, h2, p, dl, dd { margin: 0; }
small { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.mono, .eyebrow, .section-subtitle, .status, code, pre { font-family: var(--mono); }
.muted, .section-subtitle { color: var(--muted); }
.eyebrow, .section-subtitle { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow { display: inline-flex; align-items: center; gap: .55rem; color: var(--cyan); }
.prts-pill {
  display: inline-block;
  padding: .1rem .44rem;
  background: var(--ink-white);
  color: var(--ink-black);
  font: 800 .66rem/1.3 var(--mono);
  letter-spacing: .1em;
}
.prts-tag {
  padding: .18rem .46rem;
  border: 1px solid var(--line-strong);
  background: #14181e;
  color: var(--ink-white);
  font-size: .64rem;
  letter-spacing: .12em;
}
.signal {
  display: inline-block;
  margin-right: .45em;
  width: .45rem;
  height: .45rem;
  background: var(--cyan);
  transform: rotate(45deg);
  vertical-align: .1em;
  animation: prts-blink 2.4s steps(2, end) infinite;
}
@keyframes prts-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.side-marquee {
  position: fixed;
  inset: 74px 0 0 auto;
  width: 22px;
  overflow: hidden;
  writing-mode: vertical-rl;
  font: .6rem/22px var(--mono);
  letter-spacing: .3em;
  text-align: center;
  white-space: nowrap;
  color: rgba(255, 255, 255, .18);
  pointer-events: none;
}

.brand { position: relative; display: flex; align-items: center; gap: .9rem; min-width: 0; }
.brand strong { display: block; font: 700 clamp(.74rem, 1.3vw, .95rem)/1.25 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.brand strong span { color: var(--cyan); }
.brand small { display: block; margin-top: .22rem; color: var(--muted); font: .65rem var(--mono); letter-spacing: .09em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  background: var(--ink-white);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%, 49% 1%, 49% 7%, 7% 50%, 50% 93%, 93% 50%, 50% 7%, 49% 7%, 49% 1%);
}
.brand::before {
  position: absolute;
  left: 9px;
  width: 18px;
  height: 17px;
  background: var(--cyan);
  clip-path: polygon(50% 4%, 100% 74%, 72% 74%, 50% 41%, 28% 74%, 0 74%, 50% 4%, 23% 85%, 77% 85%, 50% 100%, 23% 85%);
  content: "";
}

.panel {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(to bottom, transparent 2px, var(--line-strong) 2px),
    linear-gradient(90deg, var(--ink-white) 0 28px, var(--cyan) 28px 82px, var(--line-strong) 82px);
  clip-path: var(--chamfer);
}
.panel::before {
  position: absolute;
  z-index: -1;
  inset: 1px;
  background: linear-gradient(45deg, rgba(24, 200, 255, .36) 50%, transparent 50%) left bottom / 9px 9px no-repeat var(--panel);
  clip-path: var(--chamfer);
  content: "";
}
.panel::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 9px;
  height: 9px;
  pointer-events: none;
  border-top: 1px solid rgba(255, 255, 255, .45);
  border-right: 1px solid rgba(255, 255, 255, .45);
  content: "";
}
.panel-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 38px;
  padding: .48rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #101318;
  font-size: .68rem;
  letter-spacing: .14em;
  color: #cfd6e0;
}
.strip-code {
  display: inline-block;
  margin-right: .3rem;
  padding: .06rem .36rem;
  background: var(--ink-white);
  color: var(--ink-black);
  font-weight: 800;
}
.hazard {
  width: 58px;
  height: 8px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 4px, transparent 4px 8px);
  opacity: .88;
}

.status { display: inline-flex; align-items: center; gap: .45rem; width: fit-content; color: var(--muted); font-size: .73rem; letter-spacing: .04em; }
.status::before { width: 6px; height: 6px; flex: 0 0 6px; background: currentColor; content: ""; }
.status[data-state="online"] { color: var(--cyan); }
.status[data-state="warning"] { color: var(--yellow); }
.status[data-state="offline"] { color: var(--red); }

.stack { display: grid; gap: 1rem; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 42px;
  padding: .62rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background-color .09s linear, border-color .09s linear, color .09s linear, transform .08s linear;
}
.button:disabled { opacity: .44; cursor: not-allowed; }
.button-primary {
  background: var(--ink-white);
  color: var(--ink-black);
  border-left: 4px solid var(--cyan);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}
.button-primary:hover:not(:disabled), .button-primary:focus-visible {
  background: var(--cyan);
  color: var(--ink-black);
  border-left-color: var(--ink-white);
}
.button-primary:focus-visible { outline: 2px solid var(--ink-white); outline-offset: 2px; }
.button-primary:active:not(:disabled), .button-secondary:active:not(:disabled) { transform: translate(1px, 1px); }

.button-secondary {
  border-color: var(--line-strong);
  background: #14181e;
  color: var(--ink-white);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
}
.button-secondary:hover:not(:disabled) {
  background: var(--ink-white);
  border-color: var(--ink-white);
  color: var(--ink-black);
}
.button-quiet { min-height: 30px; color: var(--muted); }
.button-quiet:hover:not(:disabled) { color: var(--ink-white); }
.button-danger { color: #ff8e92; border-color: rgba(255, 71, 76, .55); background: #261418; }
.button-danger:hover:not(:disabled) { border-color: var(--red); background: var(--red); color: var(--ink-black); }
.button-small { min-height: 32px; padding: .3rem .68rem; font-size: .76rem; }
.button small, .arrow { font-family: var(--mono); }
.button small { font-size: .64rem; letter-spacing: .06em; opacity: .76; }
.button .arrow { margin-left: auto; font-size: 1.1rem; }

.button-primary::before, .rail-tabs button::before, .hud-key::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(110deg, transparent 33%, rgba(24, 200, 255, .22) 48%, rgba(255, 255, 255, .34) 52%, transparent 67%);
  transform: translateX(-100%);
  pointer-events: none;
  content: "";
}
@media (hover: hover) {
  .button-primary:hover:not(:disabled)::before, .rail-tabs button:hover::before, .hud-key:hover:not(:disabled)::before {
    animation: light-sweep .35s ease-out;
  }
}
@keyframes light-sweep { to { transform: translateX(100%); } }

.field { display: grid; gap: .46rem; min-width: 0; font-size: .85rem; font-weight: 650; }
.field small { margin-left: .35rem; font: .66rem var(--mono); color: var(--muted); letter-spacing: .08em; }
.field-idx {
  display: inline-block;
  margin-right: .35rem;
  padding: 0 .28rem;
  border: 1px solid rgba(24, 200, 255, .45);
  color: var(--cyan);
  font: 700 .64rem/1.45 var(--mono);
  font-style: normal;
}
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 43px;
  padding: .65rem .8rem;
  border: 1px solid #353c48;
  border-left: 3px solid #596373;
  border-radius: 0;
  background: #0c0e12;
  color: var(--ink-white);
  font: .84rem var(--mono);
  transition: border-color .09s linear, background-color .09s linear;
}
.field [type="password"] { letter-spacing: .1em; }
.field textarea { resize: vertical; white-space: pre-wrap; }
.field input::placeholder, .field textarea::placeholder { color: #6c7585; font-size: .76rem; letter-spacing: .04em; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--cyan);
  border-left-color: var(--cyan);
  background: #0e141b;
}
.key-field { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: .4rem; }
.key-toggle { width: 48px; height: 43px; padding: 0; font-size: .72rem; }
.key-toggle[aria-pressed="true"] { border-color: var(--cyan); color: var(--ink-black); background: var(--cyan); }

.error, .notice { padding: .68rem .85rem; border: 1px solid rgba(255, 71, 76, .52); border-left: 3px solid var(--red); background: #231216; color: #ffd4d6; font-size: .82rem; overflow-wrap: anywhere; }
.notice { border-color: rgba(24, 200, 255, .42); border-left-color: var(--cyan); background: #101d26; color: var(--ink-white); white-space: pre-wrap; }
#login-error.login-shake { animation: login-shake .24s linear; }
@keyframes login-shake { 25% { transform: translateX(-5px); } 55% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }

.access-page { display: grid; grid-template-rows: auto 1fr auto; min-height: 100svh; }
.access-page .side-marquee { bottom: 46px; }
.access-hud, .access-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem clamp(1.1rem, 4vw, 4.75rem);
  background: rgba(10, 11, 13, .92);
}
.access-hud {
  position: relative;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
}
.access-hud::before, .console-hud::before, .browser-hud::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, var(--ink-white) 0 64px, var(--cyan) 64px 190px, var(--yellow) 190px 206px, transparent 206px);
  pointer-events: none;
}
.hud-status { display: flex; gap: .78rem; align-items: center; font-size: .76rem; white-space: nowrap; }
.hud-status .status { padding-right: .8rem; border-right: 1px solid var(--line); }

.access-main {
  width: min(1160px, 100%);
  margin: auto;
  padding: clamp(2rem, 6.5vh, 5rem) clamp(1.15rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(340px, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5.5rem);
}
.access-visual {
  position: relative;
  isolation: isolate;
  min-height: clamp(420px, 60vh, 535px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 0 0 1.35rem;
  border-left: 1px solid var(--line);
}
.access-visual::before {
  position: absolute;
  left: .8rem;
  bottom: 1.8rem;
  z-index: -2;
  content: "RHODES\A PRTS";
  white-space: pre;
  font: 900 clamp(4.8rem, 10vw, 8.6rem)/.88 var(--mono);
  letter-spacing: .06em;
  pointer-events: none;
  user-select: none;
}
.access-visual::before, .view-header::after, .offline-watermark {
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .07);
}
.access-visual::after {
  position: absolute;
  top: 0;
  left: -3px;
  width: 5px;
  height: 44px;
  background: var(--ink-white);
  content: "";
}
.access-heading { position: relative; z-index: 1; }
.access-heading h1 {
  margin: .85rem 0 .75rem;
  width: fit-content;
  font-size: clamp(2.55rem, 5.2vw, 4.85rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.03em;
}
.access-heading h1 span { color: var(--cyan); animation: cursor-blink 1.1s steps(2, end) infinite; }
.access-heading p {
  display: inline-block;
  padding-bottom: .35rem;
  border-bottom: 2px solid var(--ink-white);
  color: #cfd6e0;
  font-size: .88rem;
  letter-spacing: .16em;
}
.access-telemetry {
  display: grid;
  gap: .32rem;
  width: fit-content;
  margin: 1.35rem 0 0;
  padding: .45rem .8rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--cyan);
  background: rgba(10, 11, 13, .76);
  list-style: none;
  color: var(--muted);
  font-size: .67rem;
  letter-spacing: .08em;
}
.access-telemetry span { color: var(--ink-white); margin-right: .45rem; }
.access-heading > :where(.eyebrow, h1, p), .access-telemetry li, .access-terminal {
  animation: access-enter .28s cubic-bezier(.2, .8, .2, 1) both;
}
.access-heading h1 { animation-delay: .04s; }
.access-heading p { animation-delay: .08s; }
.access-terminal { animation-delay: .1s; }
.access-telemetry li:nth-child(1) { animation-delay: .13s; }
.access-telemetry li:nth-child(2) { animation-delay: .17s; }
.access-telemetry li:nth-child(3) { animation-delay: .21s; }
@keyframes access-enter { from { opacity: 0; transform: translateY(6px); } }

.access-emblem { position: absolute; width: clamp(70px, calc(100% - 15.5rem), 335px); right: -1.4rem; bottom: -.45rem; z-index: -1; opacity: .88; }
.emblem-scan { transform-origin: 260px 215px; animation: scan 30s linear infinite; }
@keyframes scan { to { transform: rotate(360deg); } }
.visual-detail { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .69rem; letter-spacing: .12em; }
.visual-detail b { color: var(--ink-white); }
.crosshair { color: var(--cyan); font-size: 1rem; }

.access-terminal { --cut: 18px; width: 100%; }
.terminal-content { padding: clamp(1.4rem, 3.2vw, 2.45rem); }
.prts-greeting {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-bottom: 1.05rem;
  padding: .24rem .55rem;
  border-left: 2px solid var(--cyan);
  background: #0e1319;
  color: var(--cyan);
  font-size: .7rem;
  letter-spacing: .08em;
}
.cursor {
  display: inline-block;
  width: 7px;
  height: .9em;
  background: var(--cyan);
  animation: cursor-blink 1s steps(2, end) infinite;
}
@keyframes cursor-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.terminal-content h2 { font-size: 1.78rem; letter-spacing: -.02em; }
.terminal-content .section-subtitle { margin: .2rem 0 1.45rem; }
.terminal-content .notice { margin-bottom: 1rem; }
.terminal-submit { margin-top: .4rem; min-height: 48px; justify-content: flex-start; }
.terminal-submit[aria-busy="true"]::after {
  position: absolute;
  inset: auto -1px -1px -4px;
  height: 3px;
  background: linear-gradient(135deg, var(--cyan) 25%, #0e2430 25% 50%, var(--cyan) 50% 75%, #0e2430 75%) 0 0 / 16px 16px;
  animation: submit-stripes .45s linear infinite;
  pointer-events: none;
  content: "";
}
@keyframes submit-stripes { to { background-position: 16px 0; } }
.terminal-destination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  margin-top: 1.55rem;
  padding-top: .8rem;
  border-top: 1px dashed var(--line);
}
.destination { color: var(--muted); font-size: .69rem; overflow-wrap: anywhere; }
.access-footer { border-top: 1px solid var(--line); min-height: 46px; color: var(--muted); font-size: .66rem; letter-spacing: .12em; }
.access-footer .status { font-size: inherit; }

.offline-page { min-height: 100svh; display: grid; place-items: center; }
.offline-main { position: relative; isolation: isolate; width: 100%; display: grid; place-items: center; padding: 1.5rem 1rem; }
.offline-watermark {
  position: absolute;
  z-index: -1;
  inset: 50% 0 auto;
  overflow: hidden;
  transform: translateY(-50%);
  font: 900 min(21vw, 18rem)/1 var(--mono);
  text-align: center;
  pointer-events: none;
  user-select: none;
}
.offline-panel { width: min(600px, 100%); }
.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
  padding: .2rem .55rem;
  border: 1px solid rgba(255, 71, 76, .48);
  background: #241216;
  color: #ff8e92;
  font-size: .74rem;
  letter-spacing: .06em;
}
.offline-badge span {
  padding: .05rem .35rem;
  background: var(--red);
  color: var(--ink-black);
  font-weight: 800;
}
.offline-panel h1 { margin: 0 0 .55rem; font-size: clamp(1.45rem, 3.8vw, 2rem); }
.offline-tips {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: .85rem .95rem;
  display: grid;
  gap: .55rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  background: #0d1015;
  color: #cfd6e0;
  font-size: .83rem;
}
.offline-tips li { display: flex; gap: .6rem; align-items: baseline; }
.offline-tips li > span { color: var(--cyan); font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.offline-tips code { padding: .08rem .32rem; border: 1px solid var(--line); background: #161b22; color: var(--ink-white); font-size: .76rem; }
.offline-panel .button-row { margin-top: 1.35rem; }

.browser-terminal { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.browser-terminal::before, .browser-terminal::after { display: none; }
.browser-hud {
  position: relative;
  display: flex;
  align-items: center;
  gap: .85rem;
  flex: 0 0 42px;
  padding: 0 .75rem;
  border-left: 4px solid var(--cyan);
  border-bottom: 1px solid var(--line-strong);
  background: #0c0f13;
  font-size: .8rem;
  white-space: nowrap;
}
.browser-hud::before { left: -4px; }
.hud-brand { display: inline-flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.hud-wordmark {
  padding: .1rem .44rem;
  background: var(--ink-white);
  color: var(--ink-black);
  font: 800 .72rem var(--mono);
  letter-spacing: .12em;
}
.hud-title { font-weight: 700; color: var(--ink-white); letter-spacing: .04em; }
.hud-identity, .hud-timer {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  padding-left: .8rem;
  border-left: 1px solid var(--line);
}
.hud-timer { flex-shrink: 0; }
.hud-meta-label { color: var(--muted); font-size: .74rem; }
#operator-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-weight: 700; color: var(--ink-white); }
.hud-role { padding: .06rem .35rem; border: 1px solid rgba(24, 200, 255, .5); color: var(--cyan); font-size: .68rem; }
.hud-role[data-role="admin"] { border-color: rgba(255, 209, 0, .65); color: var(--yellow); }
.hud-countdown { font-family: var(--mono); font-weight: 700; color: var(--cyan); font-variant-numeric: tabular-nums; }
.hud-expiring { color: var(--yellow); }
.browser-actions { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
.hud-key, .hud-restore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 .68rem;
  border: 1px solid var(--line-strong);
  background: #151920;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  font-size: .76rem;
  font-weight: 600;
  color: var(--ink-white);
  cursor: pointer;
  transition: background-color .08s linear, color .08s linear, border-color .08s linear;
}
.hud-key {
  position: relative;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hud-key:hover, .hud-restore:hover { border-color: var(--ink-white); background: var(--ink-white); color: var(--ink-black); }
.hud-key-accent {
  background: var(--ink-white);
  border-color: var(--ink-white);
  border-left: 3px solid var(--cyan);
  color: var(--ink-black);
}
.hud-key-accent:hover { background: var(--cyan); border-color: var(--cyan); color: var(--ink-black); }
.hud-key-danger { border-color: rgba(255, 71, 76, .48); color: #ff9fa2; background: #221316; }
.hud-key-danger:hover { border-color: var(--red); background: var(--red); color: var(--ink-black); }
.hud-key:focus-visible, .hud-restore:focus-visible { outline-offset: -2px; }
.hud-key:disabled { opacity: .5; cursor: wait; }
.hud-restore {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 8px;
  height: 28px;
  padding-inline: .75rem;
  border-color: var(--cyan);
  background: #0c0f13;
  color: var(--ink-white);
  font-size: .74rem;
  letter-spacing: .04em;
}
.browser-view { display: flex; flex: 1; min-height: 0; }
#browser-frame { display: block; width: 100%; border: 0; }
.terminal-alert { position: absolute; z-index: 1; top: 48px; right: .6rem; max-width: min(340px, calc(100% - 1rem)); }

.console-hud {
  position: sticky;
  z-index: 3;
  top: 0;
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem clamp(1rem, 3vw, 2.4rem);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 11, 13, .94);
}
.hud-controls { display: flex; gap: .68rem; align-items: center; }
.hud-controls .status { margin-right: .35rem; padding: .35rem .58rem; border: 1px solid var(--line); background: #12151a; }
.console-shell { min-height: calc(100svh - 70px); display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.rail {
  position: sticky;
  top: 70px;
  align-self: start;
  min-height: calc(100svh - 70px);
  display: flex;
  flex-direction: column;
  padding: 1.65rem .75rem 1rem;
  background: #0d0f13;
  border-right: 1px solid var(--line);
}
.rail-header { padding: 0 .6rem 1rem; font-size: .64rem; color: var(--muted); }
.rail-tabs { display: grid; gap: .38rem; counter-reset: rail-idx; }
.rail-tabs button {
  position: relative;
  counter-increment: rail-idx;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 58px;
  padding: .52rem 1.85rem .52rem .75rem;
  width: 100%;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  text-align: left;
  background: transparent;
  color: #b7c0ce;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  transition: background-color .09s linear, color .09s linear, border-color .09s linear;
}
.rail-tabs button::after {
  position: absolute;
  right: .62rem;
  top: .52rem;
  content: "0" counter(rail-idx);
  font: 700 .64rem var(--mono);
  color: rgba(139, 147, 160, .46);
  letter-spacing: .06em;
}
.rail-tabs button:hover {
  background: #1a1e25;
  border-left-color: var(--cyan);
  color: var(--ink-white);
}
.rail-tabs button[aria-selected="true"] {
  background: var(--ink-white);
  border-color: var(--ink-white);
  border-left-color: var(--cyan);
  color: var(--ink-black);
}
.rail-tabs button small { display: block; margin-top: .14rem; color: var(--muted); font: .61rem var(--mono); letter-spacing: .06em; }
.rail-tabs button[aria-selected="true"] small { color: #39414d; }
.tab-icon { display: flex; flex: 0 0 16px; color: var(--cyan); }
.rail-tabs button[aria-selected="true"] .tab-icon { color: var(--ink-black); }
.rail-tabs button[aria-selected="true"] .tab-icon::after {
  position: absolute;
  top: 50%;
  right: 0;
  width: 7px;
  height: 10px;
  transform: translateY(-50%);
  background: var(--cyan);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  content: "";
}
.rail-tabs button[aria-selected="true"]::after { color: var(--ink-black); }
.rail-footer { margin-top: auto; padding: .9rem .65rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .66rem; overflow-wrap: anywhere; }
.rail-clock { display: block; margin: .35rem 0 0 .95rem; color: #cfd6e0; }

.console-main { max-width: 1560px; padding: clamp(1.1rem, 3vw, 2.55rem); width: 100%; min-width: 0; }
.console-main > .error { margin-bottom: 1rem; }
.console-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .45rem; }
.restart-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem 1rem;
  margin-bottom: 1rem;
  padding: .72rem .9rem;
  border: 1px solid rgba(255, 209, 0, .45);
  border-left: 4px solid var(--yellow);
  background: #1a180f;
}
.restart-notice h2 { color: var(--yellow); font-size: .84rem; letter-spacing: .04em; }
.restart-notice p { margin-top: .24rem; color: #dcd8c8; font-size: .77rem; }
.restart-notice code { color: var(--ink-white); overflow-wrap: anywhere; }
.restart-notice #dismiss-restart { font-size: 1.1rem; }
.clipboard-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.view { animation: reveal .18s linear both; }
@keyframes reveal { from { opacity: .45; transform: translateY(4px); } }
.view-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: 1.35rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.view-header::after {
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  content: attr(data-watermark) / "";
  font: 900 4.5rem/1 var(--mono);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.view-header h1 { margin-top: .38rem; font-size: clamp(1.55rem, 2.8vw, 2.45rem); line-height: 1.2; letter-spacing: -.02em; }
.stamp { flex-shrink: 0; padding: .35rem .58rem; border: 1px solid var(--line); background: #101318; color: var(--muted); font-size: .68rem; }
.stamp .signal { width: 6px; height: 6px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; counter-reset: metric-idx; }
.metric { padding: 1.05rem 1rem .95rem; overflow: hidden; counter-increment: metric-idx; }
.metric::after {
  top: auto;
  right: .68rem;
  bottom: .1rem;
  width: auto;
  height: auto;
  border: 0;
  content: "0" counter(metric-idx);
  font: 900 2.55rem/1 var(--mono);
  letter-spacing: -.04em;
  color: rgba(255, 255, 255, .04);
}
.metric-label, .card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.metric-label h2 { font-size: .8rem; color: #dbe2ea; }
.metric-label span { color: var(--cyan); font: 700 .64rem var(--mono); letter-spacing: .12em; }
.metric-value { margin: .48rem 0 .45rem; font: 700 clamp(1.55rem, 3.1vw, 2.6rem)/1.1 var(--mono); letter-spacing: -.05em; white-space: nowrap; }
.metric-value.uptime { letter-spacing: -.08em; }
.metric-detail { display: block; margin-top: .62rem; font: .67rem/1.4 var(--mono); color: var(--muted); }
.metric-warning { background: linear-gradient(90deg, var(--red) 0 60px, rgba(255, 71, 76, .48) 60px); }
.metric-warning::before { background-color: #1f1317; }
.metric-warning .metric-value { color: #ff7c80; }

meter, .uptime-rule { display: block; width: 100%; height: 7px; border: 0; }
meter { appearance: none; background: #232832; }
meter::-webkit-meter-bar { background: repeating-linear-gradient(90deg, #272d38 0 8px, #12151a 8px 10px); border: 0; border-radius: 0; height: 7px; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value { background: repeating-linear-gradient(90deg, var(--cyan) 0 8px, #0f2630 8px 10px); }
meter::-webkit-meter-even-less-good-value { background: repeating-linear-gradient(90deg, var(--red) 0 8px, #311418 8px 10px); }
meter::-moz-meter-bar { background: repeating-linear-gradient(90deg, var(--cyan) 0 8px, #0f2630 8px 10px); }
.metric-warning meter::-moz-meter-bar { background: repeating-linear-gradient(90deg, var(--red) 0 8px, #311418 8px 10px); }
.uptime-rule { background: repeating-linear-gradient(90deg, var(--cyan) 0 8px, #12151a 8px 10px); opacity: .7; }

.overview-grid { display: grid; grid-template-columns: 1fr 1.14fr; gap: .8rem; margin-top: .85rem; }
.overview-card, .policy-preview, .user-card { padding: 1.05rem 1.15rem; min-width: 0; }
.card-title h2 { font-size: .96rem; font-weight: 700; letter-spacing: .02em; }
.uplink { display: flex; align-items: center; gap: .95rem; margin-top: .95rem; min-height: 65px; }
.uplink-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; background: #101820; border: 1px solid rgba(24, 200, 255, .45); }
.uplink-icon span { width: 22px; height: 14px; border: 1px solid var(--cyan); position: relative; }
.uplink-icon span::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: -5px; height: 1px; background: var(--cyan); }
.uplink p { margin-top: .35rem; font-size: .76rem; }

.policy-summary { display: grid; gap: .38rem; margin-top: .75rem; }
.policy-summary div { display: grid; grid-template-columns: 5.3rem 1fr; align-items: baseline; gap: .25rem; }
.policy-summary dt { font-size: .76rem; color: var(--muted); }
.policy-summary dd { font: .76rem/1.5 var(--mono); overflow-wrap: anywhere; }
.policy-preview { margin-top: .85rem; }
.policy-preview h2 { font-family: var(--mono); }
.policy-preview h2 span { color: var(--cyan); margin-right: .25rem; }
.policy-preview pre {
  margin: .75rem 0 0;
  max-height: 300px;
  overflow: auto;
  padding: .8rem .95rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-white);
  background: #0b0d11;
  color: #c2e7f7;
  font-size: .75rem;
  tab-size: 2;
}

.operations-panel { margin-top: .85rem; }
.operations-panel h2 .eyebrow { display: inline-block; margin-left: .4rem; }
.operations-panel .error { margin-top: .7rem; }
.operations-panel td:nth-child(3), .operations-panel time { font-family: var(--mono); }
.audit-log {
  display: grid;
  grid-template-columns: max-content max-content max-content minmax(11rem, 1fr);
  gap: .26rem .85rem;
  max-height: 285px;
  overflow: auto;
  margin: .75rem 0 0;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  background: #0b0d11;
  color: #c7d1dc;
  list-style: none;
  font-size: .72rem;
}
.audit-log li:has(time) { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; padding: .16rem .25rem; }
.audit-log li:has(time):hover { background: rgba(24, 200, 255, .08); }
.audit-log time, .audit-log li > span { color: var(--muted); }
.audit-log strong { color: var(--cyan); letter-spacing: .04em; }
.audit-log [data-event="LOGIN_FAIL"], .audit-log [data-event="RATE_LIMIT"] { color: var(--red); }
.audit-log [data-event="SESSION_REVOKE"], .audit-log [data-event="USER_DELETE"] { color: var(--yellow); }

.settings-card { padding: 1.3rem; }
.settings-card + .settings-card { margin-top: .85rem; }
.settings-card > .card-title { padding-bottom: .55rem; border-bottom: 1px solid var(--line); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; cursor: pointer; }
.toggle-row strong { display: block; font-size: .85rem; }
.toggle-row small { display: block; margin-top: .18rem; color: var(--muted); font: .71rem/1.35 var(--mono); overflow-wrap: anywhere; }
.toggle-list { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem 1.5rem; }
.toggle-list .toggle-row { border-bottom: 1px solid var(--line); }

.switch {
  appearance: none;
  display: grid;
  align-items: center;
  width: 44px;
  height: 22px;
  padding: 2px;
  flex: 0 0 44px;
  margin: 0;
  border: 1px solid #596270;
  background: #0c0e12;
  cursor: pointer;
  transition: border-color .09s linear, background-color .09s linear;
}
.switch::before { width: 16px; height: 16px; background: #778191; content: ""; transition: transform .12s linear, background-color .09s linear; }
.switch:checked { border-color: var(--cyan); background: #0e2430; }
.switch:checked::before { transform: translateX(22px); background: var(--cyan); }

.field-grid { display: grid; grid-template-columns: minmax(135px, .6fr) minmax(0, 1fr); gap: 1rem; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .7rem; }
.field-help { font-size: .76rem; }
.domain-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.domain-list li {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--cyan);
  padding: .28rem .45rem .28rem .72rem;
  background: #101318;
  font-size: .8rem;
}
.domain-list code { overflow-wrap: anywhere; }
.domain-list button { flex-shrink: 0; }

.table-scroll { overflow: auto; margin-top: .85rem; }
table { width: 100%; min-width: 570px; border-collapse: collapse; text-align: left; font-size: .81rem; }
td, th { border-bottom: 1px solid var(--line); padding: .68rem .6rem; white-space: nowrap; }
thead { border-top: 2px solid var(--ink-white); background: #191d24; color: #cfd6e0; font: 700 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
tbody tr:hover { background: rgba(255, 255, 255, .025); box-shadow: inset 2px 0 var(--cyan); }
tbody th, tbody td:nth-child(2) { font-family: var(--mono); }
td .button + .button { margin-left: .35rem; }

.operator-dialog { width: min(470px, calc(100vw - 2rem)); max-height: calc(100svh - 2rem); padding: 0; border: 0; color: var(--text); }
.operator-dialog::backdrop { background: rgba(6, 8, 10, .86); }
.operator-dialog h2 { font-size: 1.35rem; }

.toast {
  position: fixed;
  z-index: 4;
  right: 1rem;
  bottom: 1rem;
  max-width: min(390px, calc(100vw - 2rem));
  padding: .72rem .95rem;
  border: 1px solid var(--cyan);
  border-left: 4px solid var(--ink-white);
  background: #0d161e;
  color: var(--ink-white);
  font: .8rem var(--mono);
}
.toast[data-state="offline"] { border-color: var(--red); border-left-color: var(--red); background: #261216; }

@media (width < 970px) {
  .side-marquee { display: none; }
}
@media (max-width: 970px) {
  .console-shell { grid-template-columns: 192px minmax(0, 1fr); }
  .rail { padding-inline: .55rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 730px) {
  .access-main { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .access-visual { min-height: 225px; padding-top: .5rem; }
  .access-emblem { right: -.25rem; bottom: -.6rem; }
  .access-heading h1 { font-size: clamp(2.35rem, 8.5vw, 3.75rem); }
  .visual-detail { margin-top: .8rem; }
  .console-hud { position: static; flex-wrap: wrap; gap: .55rem; }
  .hud-controls { width: 100%; justify-content: flex-end; gap: .45rem; }
  .hud-controls .status { margin-right: auto; }
  .console-shell { display: block; }
  .rail { position: static; min-height: auto; padding: .55rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-header, .rail-footer { display: none; }
  .rail-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail-tabs button { min-height: 44px; padding-right: .75rem; }
  .rail-tabs button::after, .view-header::after { display: none; }
  .rail-tabs button small { font-size: .57rem; }
  .offline-watermark { top: 1.5rem; transform: translateY(-73%); }
}
@media (max-width: 820px) {
  .hud-title, .hud-meta-label { display: none; }
  .browser-hud { gap: .45rem; padding: 0 .45rem; }
  .hud-identity, .hud-timer { padding-left: .45rem; }
  .hud-key { padding: 0 .45rem; font-size: .72rem; }
}
@media (max-width: 540px) {
  .hud-role, #toggle-fullscreen { display: none; }
  .browser-hud { gap: .3rem; }
  .hud-identity, .hud-timer { padding-left: .3rem; }
  .browser-actions { gap: .2rem; }
  .hud-key { padding-inline: .3rem; }
}
@media (max-width: 445px) {
  .access-hud { flex-wrap: wrap; gap: .5rem; padding-block: .7rem; }
  .hud-status { margin-left: auto; }
  .access-footer { flex-direction: column; gap: .2rem; font-size: .57rem; letter-spacing: 0; text-align: center; }
  .terminal-submit small { display: none; }
  .view-header { align-items: flex-start; flex-wrap: wrap; }
  .overview-grid, .domain-list, .toggle-list, .field-grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .inline-form button { justify-self: start; }
  .card-title .eyebrow { font-size: .62rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
