:root {
  color-scheme: dark;
  --asphalt: #0b1115;
  --slate: #111d25;
  --raised: #172731;
  --line: #30414b;
  --concrete: #f1eee5;
  --muted: #91a0a9;
  --amber: #f4a000;
  --blue: #1687d9;
  --green: #46d39a;
  --red: #f06464;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--asphalt); color: var(--concrete); }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.grid {
  position: fixed; inset: 0; pointer-events: none; opacity: .22;
  background-image: linear-gradient(rgba(66,91,105,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(66,91,105,.16) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }
.login-card { width: min(100%, 440px); background: #101a21; border: 1px solid var(--line); border-top: 4px solid var(--amber); padding: 36px; box-shadow: 10px 10px 0 #071014; }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-lockup img { border: 1px solid #43545e; }
.brand-lockup div { display: grid; }
.brand-lockup strong { letter-spacing: .08em; font-size: 18px; }
.brand-lockup span { color: var(--amber); letter-spacing: .22em; font-size: 10px; font-weight: 800; margin-top: 4px; }
.eyebrow { color: #61b9ef; text-transform: uppercase; letter-spacing: .2em; font-weight: 800; font-size: 11px; }
.login-card > .eyebrow { margin-top: 44px; }
h1, h2, p { margin-top: 0; }
.login-card h1 { font-size: clamp(30px, 6vw, 42px); letter-spacing: -.04em; margin: 10px 0 10px; }
.login-card > p { color: var(--muted); line-height: 1.6; margin-bottom: 28px; }
form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #b4c0c7; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
input { width: 100%; border: 1px solid #50616b; background: #0b141a; color: white; padding: 14px 15px; outline: none; }
select { width: 100%; border: 1px solid #50616b; border-radius: 0; background: #0b141a; color: white; padding: 14px 15px; outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,135,217,.18); }
select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,135,217,.18); }
button { border: 1px solid var(--line); background: transparent; cursor: pointer; }
button:focus-visible { outline: 3px solid rgba(22,135,217,.5); outline-offset: 2px; }
.primary { background: var(--amber); border-color: #ffc14a; color: #16120a; padding: 15px 18px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; display: flex; justify-content: space-between; }
.primary:hover { background: #ffb41f; }
.form-error { min-height: 18px; color: #ff8a8a; font-size: 13px; margin: -6px 0 -4px; }
.login-card small { display: block; text-align: center; color: #70818b; margin-top: 22px; }

.app-shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 60px; position: relative; }
header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.section-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.section-nav button { border: 0; border-bottom: 3px solid transparent; padding: 15px 18px 12px; color: var(--muted); font-size: 13px; font-weight: 800; }
.section-nav button:hover { color: var(--concrete); }
.section-nav button.active { color: var(--concrete); border-bottom-color: var(--amber); }
.page { display: none; }
.page.active { display: block; }
.account { display: flex; align-items: center; gap: 18px; font-size: 13px; font-weight: 800; }
.quiet { border-color: #3a4c56; padding: 9px 13px; color: #bdc7cc; }
.quiet:hover { border-color: #71818a; color: white; }
.command-strip { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 52px 0 28px; }
.command-strip h1 { font-size: clamp(34px, 5vw, 58px); letter-spacing: -.05em; margin: 8px 0 8px; }
.command-strip p { color: var(--muted); margin: 0; }
.command-strip.compact { padding-top: 42px; }
.command-strip.compact h1 { font-size: clamp(32px, 4vw, 48px); }
.status { min-width: 150px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line); padding: 12px 18px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: #7a858b; }
.status.online i { background: var(--green); box-shadow: 0 0 14px var(--green); }
.status.offline i { background: var(--red); }
.status.updating i { background: var(--amber); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .35; } }

.control-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.control-grid button { min-height: 126px; border: 0; border-right: 1px solid var(--line); padding: 20px; text-align: left; display: grid; align-content: space-between; background: rgba(17,29,37,.88); transition: background .15s, transform .15s; }
.control-grid button:last-child { border-right: 0; }
.control-grid button:hover { background: var(--raised); transform: translateY(-2px); }
.control-grid button:disabled { cursor: wait; opacity: .55; transform: none; }
.control-grid strong { font-size: 22px; }
.control-grid small { color: var(--muted); }
.control-index { color: var(--amber); font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.control-grid .danger:hover { background: #311b1d; }

.telemetry-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); margin-top: 22px; border: 1px solid var(--line); }
.telemetry-grid article { background: #0f1a21; padding: 20px; display: grid; gap: 8px; }
.telemetry-grid span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.telemetry-grid strong { font-size: 23px; }

.core-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
.pressure-card, .core-metrics, .notice-panel { border: 1px solid var(--line); background: #0f1a21; }
.pressure-card { padding: 28px; }
.pressure-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 22px 0 18px; }
.pressure-heading strong { font-size: clamp(36px, 6vw, 62px); letter-spacing: -.05em; }
.pressure-heading span { color: var(--muted); font-size: 20px; font-weight: 800; padding-bottom: 8px; }
.pressure-track { height: 9px; background: #263842; overflow: hidden; }
.pressure-track i { display: block; width: 0; height: 100%; background: var(--green); transition: width .35s ease, background .35s ease; }
.pressure-card p { color: var(--muted); line-height: 1.6; margin: 22px 0 0; max-width: 720px; }
.core-metrics { display: grid; }
.core-metrics article { display: grid; gap: 8px; align-content: center; padding: 22px; border-bottom: 1px solid var(--line); }
.core-metrics article:last-child { border-bottom: 0; }
.core-metrics span { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.core-metrics strong { font-size: 24px; }
.notice-panel { margin-top: 22px; border-left: 4px solid var(--blue); padding: 22px; display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.notice-panel h2 { margin: 5px 0 0; font-size: 21px; }
.notice-panel p { color: var(--muted); max-width: 620px; line-height: 1.55; margin: 0; }

.config-form { gap: 22px; }
.settings-panel { border: 1px solid var(--line); background: #0f1a21; }
.settings-heading { padding: 22px; border-bottom: 1px solid var(--line); display: flex; align-items: start; gap: 18px; }
.settings-heading > span { color: var(--amber); font-size: 11px; font-weight: 900; letter-spacing: .14em; padding-top: 5px; }
.settings-heading h2 { margin: 0 0 5px; font-size: 21px; }
.settings-heading p { margin: 0; color: var(--muted); }
.field-grid { padding: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field-grid .wide { grid-column: 1 / -1; }
.check-row { display: flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.check-row input { appearance: none; width: 18px; height: 18px; padding: 0; flex: 0 0 auto; }
.check-row input:checked { background: var(--amber); box-shadow: inset 0 0 0 4px #0b141a; }
.access-warning { margin: 0 22px 22px; padding: 15px 17px; border-left: 4px solid var(--amber); background: #2a2110; display: grid; gap: 5px; }
.access-warning span { color: #cabd9f; line-height: 1.5; }
.save-bar { position: sticky; bottom: 16px; z-index: 2; padding: 17px 18px; border: 1px solid var(--line); border-left: 4px solid var(--amber); background: rgba(11,17,21,.96); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: space-between; gap: 24px; box-shadow: 0 12px 35px rgba(0,0,0,.35); }
.save-bar > div { display: grid; gap: 5px; }
.save-bar > div span { color: var(--muted); font-size: 12px; }
.save-bar .primary { min-width: 230px; }

.console-panel { margin-top: 22px; border: 1px solid var(--line); background: #0f1a21; }
.panel-heading { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 5px 0 0; font-size: 20px; }
pre { min-height: 300px; max-height: 430px; overflow: auto; margin: 0; padding: 22px; color: #b8c8d0; background: #081015; font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.console-full { margin-top: 0; }
.console-full pre { min-height: 520px; max-height: calc(100vh - 330px); }
#toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px; color: #16120a; background: var(--amber); font-weight: 800; transform: translateY(150%); transition: transform .2s; }
#toast.visible { transform: translateY(0); }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 1440px); }
  header { padding: 12px 0; }
  .account #account-name { display: none; }
  .command-strip { align-items: start; flex-direction: column; padding-top: 34px; }
  .control-grid, .telemetry-grid { grid-template-columns: repeat(2, 1fr); }
  .core-layout { grid-template-columns: 1fr; }
  .notice-panel { align-items: start; flex-direction: column; gap: 12px; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .save-bar .primary { width: 100%; }
  .control-grid button:nth-child(2) { border-right: 0; }
  .control-grid button:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 430px) {
  .login-card { padding: 28px 22px; }
  .section-nav { overflow-x: auto; }
  .section-nav button { white-space: nowrap; }
  .control-grid, .telemetry-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
  .control-grid button { border-right: 0; border-bottom: 1px solid var(--line); }
  .control-grid button:last-child { border-bottom: 0; }
}
