:root {
  color-scheme: dark;
  --bg: #080d14;
  --panel: #101925;
  --panel-alt: #162231;
  --line: #253342;
  --ink: #edf3f5;
  --muted: #8f9eae;
  --accent: #9de9ba;
  --danger: #ff9b9b;
  --font: Inter, 'Segoe UI', system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: var(--accent);
}
button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 17px;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 15px;
}
p {
  color: var(--muted);
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #0a121c;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 16px;
}
input[type='checkbox'] {
  width: auto;
}
textarea {
  resize: vertical;
}
select {
  cursor: pointer;
}
.topbar {
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px max(24px, calc((100vw - 1240px) / 2));
  gap: 16px;
}
.wordmark {
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark span {
  color: var(--accent);
}
.wordmark small {
  display: block;
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.workspace {
  max-width: 1240px;
  margin: auto;
  padding: 36px 24px 64px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.page-heading p {
  margin-top: 10px;
}
.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
  margin-bottom: 10px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.panel > h2 {
  margin-bottom: 16px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  white-space: normal;
}
.button:hover {
  border-color: var(--accent);
}
.button.primary {
  background: var(--accent);
  color: #0b1c14;
  border-color: var(--accent);
}
.button.quiet {
  background: transparent;
}
.button.danger {
  color: var(--danger);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: end;
}
.full {
  grid-column: 1/-1;
}
.help {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
}
.notice {
  padding: 13px 16px;
  border: 1px solid #47664f;
  background: #14291d;
  border-radius: 9px;
  margin-bottom: 20px;
}
.notice.error {
  border-color: #724545;
  background: #321b1d;
  color: #ffcdcd;
}
.status,
.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.status[data-status='connected'] {
  color: var(--accent);
  border-color: #365444;
}
.status[data-status='offline'],
.status[data-status='locked'] {
  color: var(--danger);
  border-color: #724545;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.segments {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.segments button {
  background: transparent;
  border: 0;
  padding: 10px 14px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-height: 42px;
}
.segments button[aria-pressed='true'] {
  background: var(--accent);
  color: #0b1c14;
}
.inline-label {
  flex-direction: row;
  align-items: center;
  white-space: nowrap;
}
.inline-label select {
  width: auto;
  font-size: 13px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  padding: 20px;
  border-left: 2px solid var(--line);
  background: linear-gradient(100deg, #111c28, transparent);
}
.kpi span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}
.kpi strong {
  font-size: clamp(18px, 2.2vw, 27px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 22px;
}
.footer-tools {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.footer-tools .help {
  margin-top: 5px;
}
dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  padding: 26px;
}
dialog::backdrop {
  background: #000b;
  backdrop-filter: blur(4px);
}
dialog > p {
  margin-bottom: 20px;
}
code {
  color: var(--accent);
}
.empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.fine-print {
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 800px) {
  .topbar {
    padding: 16px 20px;
  }
  .workspace {
    padding: 24px 16px 48px;
  }
  .work-grid {
    grid-template-columns: 1fr;
  }
  .page-heading {
    align-items: flex-start;
  }
  .toolbar,
  .footer-tools {
    flex-direction: column;
    align-items: stretch;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .panel {
    padding: 18px;
  }
  .inline-label {
    justify-content: space-between;
  }
  .button {
    min-height: 44px;
  }
}
@media (max-width: 400px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .segments button {
    padding: 8px 10px;
  }
  .page-heading {
    flex-direction: column;
  }
}
