:root {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171b22;
  --surface-2: #202633;
  --line: #303848;
  --text: #f3f5f7;
  --muted: #a6b0bf;
  --red: #e05861;
  --amber: #d8a641;
  --green: #68b779;
  --blue: #77aee6;
  --cyan: #70c9c3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(224, 88, 97, 0.12), transparent 36%),
    linear-gradient(300deg, rgba(112, 201, 195, 0.10), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 108px;
  border-bottom: 1px solid var(--line);
}

.menu-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0d11;
  cursor: pointer;
  flex: 0 0 auto;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.menu-toggle:hover { border-color: rgba(119, 174, 230, 0.8); }

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.46);
}

.menu-scrim[hidden] { display: none; }

.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 21;
  width: min(340px, calc(100vw - 28px));
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(23, 27, 34, 0.98);
  box-shadow: 24px 0 80px rgba(0, 0, 0, 0.42);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}

.menu-drawer.open { transform: translateX(0); }

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.menu-close,
.panel-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #60758c;
  border-radius: 6px;
  background: #2f4052;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.menu-close:hover,
.panel-button:hover:not(:disabled) {
  border-color: #8ca3bc;
  background: #3b5065;
}

.panel-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.menu-nav {
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.menu-nav a,
.menu-nav button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-nav a:hover,
.menu-nav button:hover {
  border-color: rgba(48, 56, 72, 0.9);
  background: var(--surface-2);
}

.identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.hal-eye {
  width: 70px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff0e8 0 8%, #ff725e 9% 23%, #a91f2d 24% 42%, #28090d 43% 62%, #08090a 63%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 42px rgba(224, 88, 97, 0.46);
  flex: 0 0 auto;
}

.hal-eye span {
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff2e8;
  box-shadow: 0 0 18px rgba(255, 236, 222, 0.92);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 7vw, 4.6rem); line-height: 0.95; }
h2 { font-size: 1.05rem; }

.timeblock { text-align: right; flex: 0 0 auto; }
.signout-form { margin: 0; }

.signout,
.signin-link {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #60758c;
  border-radius: 6px;
  background: #2f4052;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.signout:hover,
.signin-link:hover {
  border-color: #8ca3bc;
  background: #3b5065;
}

.signout:active,
.signin-link:active { background: #263747; }

.signin-link {
  display: inline-flex;
  align-items: center;
}

.signed-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(104, 183, 121, 0.55);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.94);
}

.signed-out[hidden] { display: none; }
.signed-out h2 { font-size: 1.25rem; }
.signed-out p:last-child { margin: 8px 0 0; color: var(--muted); }

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: start center;
}

.login-shell {
  width: min(430px, calc(100% - 32px));
  padding: clamp(42px, 10vh, 92px) 0 24px;
}

.login-card {
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

.login-brand {
  display: grid;
  justify-items: center;
  text-align: center;
}

.login-brand .hal-eye {
  width: 76px;
  margin-bottom: 14px;
}

.login-brand h1 {
  font-size: 2.15rem;
  line-height: 1;
}

.login-message {
  margin: 10px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0d11;
  color: var(--text);
  font: inherit;
}

.login-form input:focus {
  outline: 2px solid rgba(119, 174, 230, 0.55);
  outline-offset: 2px;
}

.login-form button {
  min-height: 44px;
  border: 1px solid #60758c;
  border-radius: 6px;
  background: #2f4052;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.login-form button:hover {
  border-color: #8ca3bc;
  background: #3b5065;
}

.clock {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
}
.date-line { margin-top: 8px; color: var(--muted); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.status-card,
.metric-card,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.94);
}

.status-card,
.metric-card { padding: 16px; }

.label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-card strong,
.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.status-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.35;
}

.status-card.ok { border-color: rgba(104, 183, 121, 0.55); }
.status-card.warn { border-color: rgba(216, 166, 65, 0.7); }
.status-card.crit { border-color: rgba(224, 88, 97, 0.82); }

.meter {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0d11;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.meter span.warn { background: var(--amber); }
.meter span.crit { background: var(--red); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  min-height: 250px;
  padding: 16px;
}

.panel.wide { grid-column: span 2; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  margin-bottom: 14px;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: minmax(100px, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(48, 56, 72, 0.7);
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.findings {
  display: grid;
  gap: 10px;
}

.finding {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: var(--surface-2);
}

.finding.crit { border-left-color: var(--red); }
.finding.warn { border-left-color: var(--amber); }
.finding.ok { border-left-color: var(--green); }
.finding strong { font-size: 0.96rem; }
.finding span { color: var(--muted); line-height: 1.35; }

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(48, 56, 72, 0.75);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid rgba(48, 56, 72, 0.75);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td { overflow-wrap: anywhere; }

.logs {
  min-height: 260px;
  max-height: 420px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid rgba(48, 56, 72, 0.75);
  border-radius: 6px;
  background: #0b0d11;
  color: #dce3ea;
  font: 0.86rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.settings-panel[hidden] { display: none; }

.settings-content {
  display: grid;
  gap: 12px;
}

.setting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.setting-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(48, 56, 72, 0.75);
  border-radius: 6px;
  background: var(--surface-2);
}

.setting-card span {
  color: var(--muted);
  line-height: 1.35;
}

.account-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.account-form input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0d11;
  color: var(--text);
  font: inherit;
}

.setting-message {
  min-height: 20px;
  color: var(--muted);
}

.setting-message.success { color: var(--green); }
.setting-message.error { color: var(--red); }

@media (max-width: 980px) {
  .hero-grid,
  .grid { grid-template-columns: 1fr 1fr; }
  .status-card,
  .panel.wide { grid-column: span 2; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1280px); padding-top: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .timeblock { text-align: left; }
  .signout-form { width: 100%; }
  .signout { width: 100%; }
  .menu-toggle { order: -1; }
  .signed-out { align-items: stretch; flex-direction: column; }
  .signin-link { justify-content: center; }
  .hero-grid,
  .grid { grid-template-columns: 1fr; }
  .status-card,
  .panel.wide { grid-column: auto; }
  .setting-grid { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 1fr; gap: 4px; }
}
