:root {
  color-scheme: dark;
  --bg: #101014;
  --surface: #18181d;
  --surface-raised: #202026;
  --terminal: #111115;
  --line: #303038;
  --text: #f1f0f2;
  --muted: #aaa9b4;
  --orange: #ffab55;
  --orange-hover: #ffc080;
  --orange-soft: #33251b;
  --good: #68deaa;
  --danger: #ff9a93;
  --mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
  font: 15px/1.55 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button, summary { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.056em; }
h2 { font-size: 1.12rem; line-height: 1.25; letter-spacing: -.022em; }
code, pre { font-family: var(--mono); }
.category { color: var(--orange); font: 700 .72rem/1.4 var(--mono); letter-spacing: .12em; margin-bottom: .5rem; }
.muted, .support { color: var(--muted); }
.support { font-size: .92rem; margin-top: .35rem; }
.accent { color: var(--orange); }
.wordmark { display: inline-flex; align-items: center; gap: .7rem; font-weight: 750; letter-spacing: -.038em; font-size: 1.16rem; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 37px; aspect-ratio: 1; border-radius: 9px; background: var(--orange); color: #24160b; font: 800 .94rem/1 var(--mono); box-shadow: 0 1px 0 #ffcf9c inset; }
.screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .54rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-raised); color: var(--text); font-weight: 650; white-space: nowrap; transition: background .15s, border-color .15s; }
.button:hover:not(:disabled) { background: #2b2b34; border-color: #4c4b56; }
.button.primary { background: var(--orange); border-color: var(--orange); color: #25170c; }
.button.primary:hover:not(:disabled) { background: var(--orange-hover); border-color: var(--orange-hover); }
.button.danger-button { color: var(--danger); }
.button.compact { min-height: 34px; padding: .34rem .65rem; font-size: .84rem; }
.quiet { display: inline-block; border: 0; background: transparent; padding: .2rem 0; color: var(--muted); text-align: left; font-size: .88rem; }
.quiet:hover { color: var(--orange); }
input:not([type=checkbox]), select { color: var(--text); background: var(--terminal); border: 1px solid #3b3a45; border-radius: 8px; padding: .62rem .78rem; min-height: 43px; width: 100%; }
input::placeholder { color: #8a8996; }
label { display: grid; gap: .35rem; font-weight: 630; color: var(--text); font-size: .91rem; }
.check { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-weight: 500; }
.check input { accent-color: var(--orange); inline-size: 16px; block-size: 16px; margin: 0; }
.notice { border: 1px solid #795131; background: var(--orange-soft); border-radius: 9px; margin: 1rem 0; padding: .7rem .85rem; }
.notice.danger { border-color: #754343; background: #352124; color: #ffd3cf; }

.auth-layout { display: grid; grid-template-columns: minmax(320px, .89fr) minmax(420px, 1.11fr); min-height: 100svh; }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 520px; padding: clamp(2rem, 6vw, 6rem); border-right: 1px solid var(--line); background-color: #17171c; background-image: radial-gradient(ellipse at 70% 52%, #39251c, transparent 66%), linear-gradient(145deg, #1a1a1f, #121216 80%); }
.auth-brand::after { position: absolute; inset: 0; content: ''; pointer-events: none; background-image: linear-gradient(#ffb2680d 1px, transparent 1px), linear-gradient(90deg, #ffb2680d 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(115deg, transparent 4%, #000 54%, transparent 100%); }
.auth-brand .wordmark { position: absolute; z-index: 1; top: clamp(1.5rem, 4vw, 3rem); left: clamp(2rem, 6vw, 6rem); }
.auth-brand-content { position: relative; z-index: 1; }
.auth-display { font-size: clamp(4.5rem, 9vw, 9.3rem); line-height: .84; font-weight: 790; letter-spacing: -.09em; margin: .85rem 0 1.25rem; }
.auth-display span { color: var(--orange); }
.auth-content { display: grid; place-items: center; padding: 2.2rem clamp(1.35rem, 5vw, 5rem); }
.auth-card { width: min(100%, 410px); }
.auth-card > .support { margin: .65rem 0 1.55rem; }
.auth-card .auth-form { display: grid; gap: .95rem; }
.auth-form .button { justify-content: space-between; margin-top: .4rem; }
.auth-card .quiet { margin-top: .85rem; }
.totp-details { display: grid; justify-items: start; gap: .65rem; margin-bottom: 1rem; }
.totp-details img { display: block; background: #fff; border-radius: 7px; }
.totp-details details { color: var(--muted); }
.totp-details code { display: block; color: var(--text); overflow-wrap: anywhere; }
.otp { font-family: var(--mono); letter-spacing: .15em; }
.error-page { display: grid; place-items: center; min-height: 100svh; padding: 1rem; }
.error-card { padding: 2rem; }
.error-card .button { margin-top: 1.25rem; }

.app-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 2.2rem; padding: 1.7rem 1.25rem 1.2rem; border-right: 1px solid var(--line); background: #15151a; }
.sidebar .wordmark { padding-left: .35rem; }
.navigation { display: grid; gap: .38rem; }
.navigation a { display: flex; align-items: center; gap: .7rem; border: 1px solid transparent; border-radius: 8px; padding: .54rem .65rem; color: var(--muted); font-weight: 630; }
.navigation .nav-icon { display: inline-grid; place-items: center; min-width: 1.15rem; font-family: var(--mono); font-weight: 400; }
.navigation a[aria-current] { background: var(--orange-soft); border-color: #523925; color: var(--orange); }
.navigation a:not([aria-current]):hover { color: var(--text); background: var(--surface-raised); }
.sidebar-bottom { margin-top: auto; display: grid; gap: .28rem; border-top: 1px solid var(--line); padding: 1rem .35rem 0; }
.profile { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; min-width: 0; }
.avatar { flex: 0 0 34px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: #2c2531; color: #e4c4ff; font: 700 .78rem var(--mono); }
.profile div { min-width: 0; }
.profile strong { display: block; text-overflow: ellipsis; overflow: hidden; }
.profile small { display: block; color: var(--muted); font-size: .76rem; }
.workspace { width: 100%; max-width: 1450px; padding: clamp(1.25rem, 3.4vw, 3.55rem); margin: 0 auto; }
.workspace-header { display: flex; gap: 1rem; justify-content: space-between; align-items: end; margin-bottom: 1.55rem; }
.status-pill { flex: none; display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 999px; padding: .31rem .69rem; background: var(--surface); color: var(--muted); font-weight: 650; font-size: .82rem; }
.status-pill[data-state=active] { color: var(--good); background: #162921; border-color: #2e5846; }
.status-pill[data-state=failed], .status-pill[data-state=inactive] { color: var(--danger); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.card { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.server-card { overflow: hidden; background: radial-gradient(ellipse at 98% 10%, #302319 0%, transparent 54%), var(--surface); padding: clamp(1rem, 2.5vw, 1.65rem); }
.server-identity { display: flex; align-items: end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; }
.server-card h2 { font-size: clamp(1.45rem, 3vw, 2.2rem); }
.address { max-width: 100%; display: inline-flex; align-items: center; justify-content: space-between; gap: .7rem; border: 1px solid #403947; background: #18151a; border-radius: 8px; padding: .47rem .67rem; color: var(--text); margin-top: .42rem; text-align: left; }
.address code { overflow-wrap: anywhere; }
.address span { color: var(--orange); font-size: .75rem; font-weight: 700; }
.address:hover { border-color: var(--orange); }
.service-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin: .95rem 0; }
.metric { padding: .95rem 1.05rem; min-width: 0; }
.metric h2 { color: var(--muted); font-size: .87rem; letter-spacing: 0; }
.metric strong { display: block; font-size: clamp(1.12rem, 2.25vw, 1.85rem); margin: .3rem 0 .15rem; line-height: 1.15; overflow-wrap: anywhere; }
.metric small { color: var(--muted); font-size: .74rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.terminal { overflow: hidden; }
.terminal .section-header { padding: .85rem 1.05rem; }
.terminal pre { margin: 0; height: clamp(196px, 34vh, 412px); padding: .85rem 1.05rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--terminal); color: #d8d7e0; border-top: 1px solid var(--line); font-size: .81rem; line-height: 1.62; }
.terminal-full pre { height: clamp(240px, 56vh, 710px); }
.command-form { display: flex; align-items: center; gap: .55rem; border-top: 1px solid var(--line); padding: .7rem 1rem; }
.command-input { display: flex; align-items: center; flex: 1; min-width: 0; border: 1px solid #4a4350; border-radius: 8px; background: var(--terminal); gap: .45rem; padding-left: .65rem; }
.command-input span { color: var(--orange); font: 650 .95rem var(--mono); }
.command-input input { border: 0; min-width: 0; font-family: var(--mono); }
.op-feedback { margin-top: .7rem; color: var(--good); font-size: .87rem; }
.op-feedback[data-error=true] { color: var(--danger); }
.console-feedback { margin: 0; padding: 0 1rem .5rem; }
.content-card { margin-bottom: .95rem; padding: 1.1rem; }
.user-form { margin-top: 1.1rem; display: grid; grid-template-columns: minmax(120px, 1.1fr) minmax(120px, .78fr) max-content; align-items: end; gap: .65rem; }
.role-help { margin-top: 1rem; }
.setup-password p { margin-top: .25rem; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; margin-top: .75rem; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--line); padding: .68rem .55rem; white-space: nowrap; }
th { color: var(--muted); font-size: .76rem; font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.text-good { color: var(--good); }
.text-danger { color: var(--danger); }
dialog { width: min(calc(100% - 2rem), 440px); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; }
dialog::backdrop { background: #08080ac7; }
.dialog-buttons { display: flex; justify-content: end; gap: .5rem; margin-top: 1rem; }

@media (max-width: 850px) {
  .app-shell { grid-template-columns: 164px minmax(0, 1fr); }
  .sidebar { padding-inline: .7rem; }
  .auth-layout { grid-template-columns: minmax(235px, .75fr) minmax(290px, 1.25fr); }
  .auth-display { font-size: clamp(3.25rem, 10vw, 6rem); }
}

@media (max-width: 640px) {
  .auth-layout, .app-shell { display: block; }
  .auth-brand { display: block; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; }
  .auth-brand .wordmark { position: relative; left: auto; top: auto; }
  .auth-brand-content { display: none; }
  .auth-content { padding: 2.5rem 1.25rem; }
  .sidebar { position: static; height: auto; gap: .8rem; padding: .85rem 1rem .7rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .wordmark { padding: 0; }
  .navigation { display: flex; flex-wrap: wrap; gap: .32rem; }
  .navigation a { padding: .31rem .48rem; font-size: .82rem; gap: .32rem; }
  .sidebar-bottom { display: flex; gap: .65rem; align-items: center; padding: .55rem 0 0; flex-wrap: wrap; }
  .profile { margin: 0 auto 0 0; font-size: .83rem; }
  .avatar { display: none; }
  .workspace { padding: 1.15rem 1rem; }
  .workspace-header { gap: .55rem; }
  h1 { font-size: clamp(1.65rem, 7vw, 2.1rem); }
  .metrics { gap: .45rem; }
  .metric { padding: .65rem .55rem; }
  .metric small { line-height: 1.15; display: block; }
  .terminal .section-header .button { min-height: 36px; padding: .35rem .55rem; font-size: .8rem; }
  .user-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .user-form button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
