/* Humble dashboard — mint theme (planning.md §7.1) */
:root {
  --mint-500: #3eb489;
  --mint-600: #2e9a73;
  --mint-700: #237a5b;
  --mint-100: #ddf5ea;
  --mint-50: #f3fbf7;
  --forest-900: #17332a;
  --forest-800: #1f4238;
  --forest-700: #2a5447;
  --ink-900: #1b2622;
  --ink-700: #34433e;
  --ink-500: #62736c;
  --line: #d8e8e0;
  --surface: #ffffff;
  --bg: var(--mint-50);
  --danger: #d9534f;
  --warn: #e0a526;
  --offline: #a8b5b0;
  --shadow: 0 1px 2px rgba(23, 51, 42, .06), 0 4px 16px rgba(23, 51, 42, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mint-100: #1d3a30;
    --mint-50: #12211c;
    --ink-900: #e7f3ee;
    --ink-700: #c7d8d1;
    --ink-500: #8fa59c;
    --line: #294238;
    --surface: #182b24;
    --bg: #12211c;
    --forest-900: #0d1a15;
    --forest-800: #15271f;
    --forest-700: #1d352b;
    --offline: #5d6f68;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --mint-100: #1d3a30; --mint-50: #12211c; --ink-900: #e7f3ee; --ink-700: #c7d8d1; --ink-500: #8fa59c;
  --line: #294238; --surface: #182b24; --bg: #12211c; --forest-900: #0d1a15; --forest-800: #15271f;
  --forest-700: #1d352b; --offline: #5d6f68; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink-900);
  background: var(--bg);
}
a { color: var(--mint-600); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--forest-900);
  color: #cfe7dd;
  display: flex; flex-direction: column;
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; }
.brand img { width: 34px; height: 34px; }
.brand b { font-size: 19px; letter-spacing: .2px; }
.brand small { display: block; color: #8fc9b0; font-size: 11px; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  color: #cfe7dd; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--forest-800); color: #fff; }
.nav a.active { background: var(--mint-500); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .section { margin: 14px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7ea596; }
.sidebar .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--forest-700); font-size: 12.5px; }
.status { display: flex; align-items: center; gap: 8px; color: #a9d9c4; }
.foot .user { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: #fff; }

.main { padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; }
.page-head p { margin: 2px 0 0; color: var(--ink-500); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.muted { color: var(--ink-500); }
.small { font-size: 12.5px; }

/* the TeamViewer-style "connect" hero */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; }
.hero .big-id { font-size: 26px; letter-spacing: 2px; font-weight: 600; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-900);
  border-radius: 8px; padding: 7px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--mint-500); }
button.primary, .btn.primary { background: var(--mint-500); border-color: var(--mint-500); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--mint-600); border-color: var(--mint-600); }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; padding: 5px 8px; }
button.ghost:hover { background: var(--mint-100); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--mint-500); outline-offset: 2px; }

input, select {
  font: inherit; color: var(--ink-900); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus { border-color: var(--mint-500); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint-500) 25%, transparent); }
label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12.5px; color: var(--ink-700); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-row > * { flex: 1 1 160px; }
.form-row > button { flex: 0 0 auto; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: color-mix(in srgb, var(--mint-100) 50%, transparent); }
td.right, th.right { text-align: right; }

/* device groups */
.group { margin-bottom: 18px; }
.group-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 10px 16px; background: var(--mint-100); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0; font-weight: 650;
}
.group-head .count { color: var(--ink-500); font-weight: 500; }
.group-head .chev { transition: transform .15s; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }
.group.collapsed .group-head { border-radius: var(--radius); }
.group-body { background: var(--surface); border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--offline); flex: none; }
.dot.on { background: var(--mint-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint-500) 25%, transparent); }
.dev-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.kind { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink-700) 12%, transparent); color: var(--ink-700); cursor: help; }
.kind svg { width: 13px; height: 13px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--mint-100); color: var(--mint-700); }
.badge.gray { background: color-mix(in srgb, var(--offline) 25%, transparent); color: var(--ink-700); }
.badge.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: #8a6100; }

/* ---------- login ---------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1000px 500px at 20% 0%, color-mix(in srgb, var(--mint-500) 22%, transparent), transparent), var(--bg); }
.login { width: 100%; max-width: 380px; }
.login .brand { color: var(--ink-900); justify-content: center; padding-bottom: 8px; }
.login .brand small { color: var(--ink-500); }
.login form { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--danger); font-weight: 600; min-height: 1em; }
.oauth { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.site-links { display: flex; gap: 14px; margin-bottom: 12px; font-size: 13px; }
.site-links a { color: #a9d9c4; text-decoration: none; }
.site-links a:hover { color: #fff; text-decoration: underline; }
.login-links { display: flex; justify-content: center; gap: 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.login-links a { color: var(--ink-500); text-decoration: none; }
.login-links a:hover { color: var(--mint-600); text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; }
.icon-btn svg { width: 18px; height: 18px; }
.has-service { display: inline-flex; color: var(--ink-500); margin-left: 4px; }
.has-service svg { width: 15px; height: 15px; }
.oauth .btn { text-align: center; text-decoration: none; color: var(--ink-900); font-weight: 600; padding: 10px 12px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-500); font-size: 13px; margin: 10px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- drawer & toast ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(10, 25, 20, .35); z-index: 10; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 11;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12);
  padding: 22px; overflow-y: auto;
}
.drawer h2 { margin-top: 0; }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--ink-500); }
dl.kv dd { margin: 0; word-break: break-word; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--forest-900); color: #fff; padding: 10px 18px; border-radius: 8px;
  opacity: 0; transition: all .2s; pointer-events: none; z-index: 20; font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
.copy-line { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.copy-line code { flex: 1; background: var(--mint-50); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; overflow-x: auto; white-space: nowrap; }
.empty { text-align: center; padding: 34px 10px; color: var(--ink-500); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .brand { padding: 0 10px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .section, .sidebar .foot { display: none; }
  .main { padding: 18px 16px 40px; }
  .hero { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* Account kind choice (signup) and switches (device and account settings) */
.choices { display: grid; gap: 10px; margin: 6px 0 14px; }
label.choice, label.switch { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
label.choice { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
label.choice:has(input:checked) { border-color: var(--mint-500); background: color-mix(in srgb, var(--mint-100) 50%, transparent); }
label.choice > span, label.switch > span { display: flex; flex-direction: column; gap: 2px; }
label.choice input, label.switch input { margin-top: 3px; width: auto; }
label.switch { margin-top: 12px; }
