:root {
  --bg0: #0c1118;
  --panel: rgba(22, 30, 42, 0.88);
  --stroke: rgba(214, 228, 240, 0.12);
  --text: #e8eef6;
  --muted: #93a4b8;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --ok: #4ade80;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font: "Instrument Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

/* Author display rules must not override the hidden attribute. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(45, 212, 191, 0.18), transparent 60%),
    radial-gradient(700px 420px at 90% 0%, rgba(56, 189, 248, 0.14), transparent 55%),
    linear-gradient(180deg, #0c1118 0%, #0a0e14 100%);
  z-index: -1;
  pointer-events: none;
}

.shell {
  width: min(1080px, calc(100% - 2rem));
  min-height: 100vh;
  margin-inline: auto;
  padding: 1.5rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Login-only: center the card in the remaining viewport. */
.shell:has(#loginView:not([hidden])) {
  justify-content: flex-start;
}

.shell:has(#loginView:not([hidden])) .login {
  margin-block: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  width: 100%;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  min-width: 0;
}

.mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 30px rgba(45,212,191,0.25);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

h1, h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 { font-size: clamp(1.25rem, 2.5vw, 1.55rem); font-weight: 700; }
h2 { font-size: 1.2rem; }

.lede, .section-head p {
  color: var(--muted);
  margin: 0.45rem 0 0;
}

.top-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-shrink: 0;
}

.pill {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  white-space: nowrap;
}

.card, .status-panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login {
  width: min(420px, 100%);
  margin-inline: auto;
  padding: 1.6rem;
}

.login form {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--muted);
}

input:not([type="checkbox"]), select {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(8, 12, 18, 0.7);
  color: var(--text);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  font: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:not([type="checkbox"]):focus, select:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0.78rem 1.1rem;
  transition: transform .15s ease, background .2s, border-color .2s;
}

button:active { transform: translateY(1px); }

.primary {
  background: linear-gradient(135deg, #2dd4bf, #22c1b0 45%, #38bdf8);
  color: #041016;
  font-weight: 700;
}

.ghost {
  background: transparent;
  border-color: var(--stroke);
  color: var(--text);
}

.ghost:hover { border-color: rgba(45,212,191,0.45); }

.full { width: 100%; }

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 1rem;
  width: 100%;
  align-items: start;
}

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; }
}

.status-panel { padding: 1.2rem; }

.status-panel h2 { margin-bottom: 0.9rem; }

.status-panel dl {
  margin: 0 0 1rem;
  display: grid;
  gap: 0.7rem;
}

.status-panel dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status-panel dd {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--text);
  word-break: break-all;
}

.settings { padding: 1.35rem; min-width: 0; }

.section-head { margin-bottom: 1.1rem; }

fieldset {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem 1rem 1.05rem;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

legend {
  padding: 0 0.4rem;
  color: var(--text);
  font-weight: 600;
}

.toggle {
  display: grid;
  grid-template-columns: 1.15rem 1fr;
  align-items: center;
  column-gap: 0.75rem;
  color: var(--text);
}

.toggle input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
  justify-self: center;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.toast {
  margin: 0;
  color: var(--ok);
  font-size: 0.92rem;
}

.error { color: var(--danger); margin: 0; }
