:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --ink: #17202a;
  --muted: #657386;
  --line: #dfe5ec;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b45309;
  --danger: #b91c1c;
  --soft: #edf7f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  cursor: pointer;
}
button:hover { border-color: var(--brand); }
button[type="submit"], .top-actions button:last-child, .danger {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.danger { background: var(--danger); border-color: var(--danger); }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
h1, h2, h3, p { margin-top: 0; }
.hidden { display: none !important; }
.eyebrow { margin-bottom: 6px; color: var(--brand-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.error, .warning { color: var(--danger); }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
}
.brand-panel {
  padding: 8vw;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #1f2937 74%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.brand-panel h1 { font-size: 52px; max-width: 680px; line-height: 1; }
.brand-panel p:last-child { max-width: 520px; color: #d7fff8; font-size: 18px; line-height: 1.6; }
.auth-card {
  align-self: center;
  width: min(420px, calc(100% - 40px));
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 70px rgba(23, 32, 42, .12);
  display: grid;
  gap: 16px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: #17202a;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar div { margin-bottom: 18px; display: grid; gap: 2px; }
.sidebar span { color: #b6c2cf; font-size: 13px; }
.sidebar button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #d7dee8;
  border-color: transparent;
}
.sidebar button.active, .sidebar button:hover { background: rgba(255,255,255,.09); color: #fff; }
#logoutBtn { margin-top: auto; }
.content { min-width: 0; padding: 24px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}
.topbar h2 { margin-bottom: 0; font-size: 28px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notice {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric-grid div, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric-grid div { padding: 18px; display: grid; gap: 7px; }
.metric-grid span { color: var(--muted); font-size: 13px; }
.metric-grid strong { font-size: 30px; }
.panel { padding: 18px; margin-bottom: 16px; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-head h3 { margin-bottom: 0; }
.panel-head span { color: var(--muted); font-size: 13px; }
.stack { display: grid; gap: 10px; }
.row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
  display: grid;
  gap: 8px;
}
.row-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.row h4 { margin: 0; }
.row p { margin-bottom: 0; color: var(--muted); line-height: 1.45; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}
.badge.warn { background: #fff7ed; color: var(--accent); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
}
.tab { display: none; }
.tab.active { display: block; }
dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 90px rgba(0, 0, 0, .24);
}
.dialog-card { width: min(520px, calc(100vw - 34px)); padding: 22px; display: grid; gap: 14px; }
.download-link {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}
.download-link:hover { text-decoration: underline; }
.pair-code {
  border: 1px dashed var(--brand);
  background: var(--soft);
  border-radius: 8px;
  padding: 18px;
  font-size: 34px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .14em;
  text-align: center;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 820px) {
  .auth-shell, .app-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 34vh; padding: 34px 24px; }
  .brand-panel h1 { font-size: 38px; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar div { min-width: 180px; margin-bottom: 0; }
  .sidebar button { min-width: max-content; }
  .metric-grid, .inline-form { grid-template-columns: 1fr; }
  .topbar, .panel-head, .row-head { align-items: stretch; flex-direction: column; }
}
