:root {
  color-scheme: light;
  --ink: #192722;
  --muted: #576861;
  --line: #d6dfda;
  --surface: #fff;
  --background: #f3f6f4;
  --accent: #09684c;
  --accent-hover: #07523c;
  --error: #a33232;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
h1, h2, dl, dd, p { margin: 0; }
button, input { font: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: 28px; }
.header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, .brand, .page-heading, .toolbar, .section-heading { display: flex; align-items: center; }
.header-inner { justify-content: space-between; min-height: 64px; }
.brand { gap: 10px; font-weight: 670; }
.environment {
  color: var(--accent);
  background: #e6f2ed;
  border: 1px solid #c3dfd3;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .8rem;
  font-weight: 560;
}
main { padding-block: 32px; }
.page-heading { justify-content: space-between; gap: 12px; margin-bottom: 24px; }
h1 { font-size: 1.85rem; line-height: 1.2; }
h2 { font-size: 1.05rem; line-height: 1.3; flex-shrink: 0; }
.toolbar { gap: 12px; }

.login { max-width: 380px; }
.login form { display: grid; gap: 12px; margin-top: 24px; }
.login label { color: var(--muted); font-size: .88rem; }
.login input { min-height: 40px; width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.primary-button, .text-button { min-height: 36px; padding: 4px 12px; border-radius: 6px; cursor: pointer; }
.primary-button { justify-self: start; border: 1px solid var(--accent); background: var(--accent); color: var(--surface); }
.primary-button:hover { background: var(--accent-hover); }
.text-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.primary-button:disabled, .text-button:disabled { cursor: default; opacity: .55; }
.form-error { min-height: 1.3em; color: var(--error); font-size: .88rem; }

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.icon-button:hover { background: #e9f1ed; }
.icon-button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.state { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.state.online { color: var(--accent); }
.state.error { color: var(--error); }
.state.waiting { color: #78590e; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  padding-block: 18px;
  margin-bottom: 32px;
}
.metrics > div { padding-inline: 20px; }
.metrics > div:first-child { padding-left: 0; }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics dt { color: var(--muted); font-size: .84rem; }
.metrics dd { font-size: 1.85rem; font-weight: 660; margin-top: 6px; font-variant-numeric: tabular-nums; }
#online { color: var(--accent); }

.workspace { display: block; }
.section-heading { justify-content: space-between; gap: 12px; min-height: 38px; margin-bottom: 8px; }
.search { width: min(52%, 240px); }
.search input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 6px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: .88rem;
}
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; vertical-align: middle; padding: 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .82rem; font-weight: 650; background: #e9efeb; white-space: nowrap; }
.device-id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92rem; }
.device-meta { color: var(--muted); font-size: .78rem; margin-top: 3px; }
.session-count { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .84rem; color: var(--muted); }
.session-count.active { color: var(--accent); font-weight: 600; }
td:nth-child(4) { color: var(--muted); font-size: .83rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.terminal-button {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 560;
  white-space: nowrap;
}
.terminal-button:hover { background: var(--accent-hover); }
.terminal-button.offline { background: #e6ece9; color: var(--muted); }
.terminal-button.offline:hover { background: #dce5e0; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: .89rem; }
.updated { min-height: 1.3em; margin-top: 24px; color: var(--muted); font-size: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 860px) {
  .wrap { padding-inline: 16px; }
}
