:root {
  color-scheme: dark;
  --background: #080808;
  --panel: #161616;
  --text: #f5f5f5;
  --muted: #b4b4b4;
  --line: #373737;
  --accent: #ff007f;
  --link: #ff75b9;
  font: 100%/1.5 system-ui, sans-serif;
  color: var(--text);
  background: var(--background);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.65rem, 4vw, 2.2rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea {
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 2.65rem;
  padding: .5rem .75rem;
}
button { cursor: pointer; font-weight: 650; }
button:hover { border-color: var(--link); }
button:disabled { opacity: .65; cursor: wait; }
.primary { background: var(--accent); border-color: var(--accent); color: #080808; }
.danger { color: #ff9ba8; border-color: #95384a; }
.gate, .panel, dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.gate { max-width: 28rem; padding: 1.5rem; margin: clamp(1rem, 10vh, 6rem) auto; width: calc(100% - 2rem); }
.gate > * + * { margin-top: .9rem; }
.brand { color: var(--link); font-weight: 750; letter-spacing: .04em; }
.hq-title { font-size: 1.55rem; font-weight: 780; }
.workspace { min-height: 100vh; display: grid; grid-template-columns: 14rem minmax(0, 1fr); }
.sidebar {
  padding: 1.4rem 1rem;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
nav { display: grid; gap: .2rem; margin: 1.25rem 0; }
nav a {
  padding: .48rem .7rem;
  border-radius: 5px;
  border-left: 3px solid transparent;
  color: var(--text);
  text-decoration: none;
  font-size: .9375rem;
}
nav a:hover, nav a[aria-current="page"] { background: #252025; }
nav a[aria-current="page"] { border-left-color: var(--accent); font-weight: 700; }
.motto { color: var(--muted); font-size: .875rem; margin-top: 1rem; }
main { padding: clamp(1rem, 3vw, 2.5rem); min-width: 0; }
.page-header, .actions, .filters { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.page-header { justify-content: space-between; margin-bottom: 1.1rem; }
.actions { margin-top: 1rem; }
.filters { align-items: end; margin-bottom: 1rem; }
.filters label:first-child { flex: 1 1 15rem; }
label { display: grid; gap: .3rem; font-size: .9rem; }
input, select, textarea { width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 5.5rem; }
form { display: grid; gap: .8rem; }
.stack, .dashboard, .form-grid { display: grid; gap: 1rem; }
.dashboard { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.metrics { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); margin-bottom: 1rem; }
.panel { padding: 1rem; min-width: 0; }
.panel > * + * { margin-top: .65rem; }
.metric { font-size: 1.5rem; font-weight: 750; }
progress { display: block; width: 100%; accent-color: var(--accent); }
.muted { color: var(--muted); }
#notice, .error { color: #ffb3be; }
#notice { margin-bottom: 1rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; text-align: left; background: var(--panel); }
th, td { padding: .65rem .85rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { font-size: .875rem; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.link-button { border: 0; color: var(--link); background: transparent; padding: 0; min-height: 0; text-align: left; text-decoration: underline; overflow-wrap: anywhere; }
dialog { color: var(--text); width: min(calc(100% - 2rem), 44rem); max-height: 90dvh; padding: 1.25rem; overflow: auto; }
dialog::backdrop { background: #000b; }
dialog h2 { margin-bottom: .9rem; }
#delete-dialog { z-index: 1; width: min(calc(100% - 2rem), 28rem); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: .55rem 1rem; }
dt { color: var(--muted); }
dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
ul { padding-left: 1.2rem; }
li + li { margin-top: .35rem; }
@media (max-width: 700px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: .8rem 1rem; }
  nav { display: flex; flex-wrap: wrap; margin: .65rem 0; }
  nav a { padding: .35rem .5rem; }
  .motto { margin-top: .5rem; }
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}
