:root {
  color-scheme: dark;
  --background: #0a0e1a;
  --panel: #0f1628;
  --line: #26385c;
  --gold: #e1bc63;
  --text: #e8eaf0;
  --muted: #a5aec6;
  --bad: #ffa1a1;
  font: 15px system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--background); }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font: 2rem Georgia, serif; }
h2 { font: 1.45rem Georgia, serif; }
button, input, select, textarea { font: inherit; }
button {
  color: var(--text); border: 1px solid var(--line); background: var(--panel);
  border-radius: 4px; cursor: pointer; padding: .6rem .95rem;
}
button:hover { border-color: var(--gold); }
button:disabled { opacity: .65; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.primary { background: var(--gold); color: var(--background); border-color: var(--gold); font-weight: 700; }
.sign-in { display: grid; min-height: 100dvh; place-items: center; padding: 1.25rem; }
.login-box, dialog {
  width: min(100%, 29rem); padding: 2rem; background: var(--panel);
  border: 1px solid var(--line); border-top: 2px solid var(--gold); color: var(--text);
}
.login-box h1 { color: var(--gold); margin-bottom: 1.5rem; text-align: center; }
label { display: grid; gap: .35rem; margin: 1rem 0; color: var(--muted); }
input, select, textarea {
  color: var(--text); background: var(--background); border: 1px solid var(--line);
  border-radius: 4px; padding: .65rem; width: 100%;
}
textarea { resize: vertical; min-height: 6rem; }
.app-header, .account, .view-heading, footer { display: flex; align-items: center; gap: .75rem; }
.app-header, .view-heading { justify-content: space-between; }
.app-header { min-height: 4rem; padding: .65rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.app-header strong { color: var(--gold); font: 1.25rem Georgia, serif; letter-spacing: .06em; }
.account { font-size: .85rem; flex-wrap: wrap; justify-content: end; overflow-wrap: anywhere; }
.app-body { display: grid; grid-template-columns: 13rem minmax(0, 1fr); min-height: calc(100dvh - 4rem); }
nav { border-right: 1px solid var(--line); padding: 1rem .75rem; }
nav button { display: block; text-align: left; width: 100%; margin-bottom: .35rem; border-color: transparent; }
nav [aria-current="page"] { border-color: var(--line); color: var(--gold); }
#content { padding: 1.5rem; }
.view-heading { margin-bottom: 1rem; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; }
.card { padding: 1rem; background: var(--panel); border: 1px solid var(--line); }
.card strong { color: var(--gold); display: block; font: 1.8rem Georgia, serif; margin-top: .4rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); background: var(--panel); }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .7rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); font-size: .85rem; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 1rem; }
dialog { max-height: 90dvh; overflow: auto; }
dialog::backdrop { background: #060911ba; }
dialog p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .75rem; }
footer { justify-content: end; flex-wrap: wrap; margin-top: 1rem; }
[role="status"]:empty { display: none; }
[role="status"] { margin: .6rem 0; color: var(--gold); }
[role="status"][data-error] { color: var(--bad); }
@media (max-width: 650px) {
  .app-body { display: block; }
  nav { display: flex; gap: .4rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav button { width: auto; white-space: nowrap; margin: 0; }
  .app-header, #content { padding: .9rem; }
  dialog { padding: 1rem; }
}
.setup-key { font-family: ui-monospace, monospace; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--gold); }

[data-mode="demo"] #sign-in,
[data-mode="demo"] #security,
[data-mode="demo"] #logout { display: none; }
