/* ===== Bento tokens (verbatim contract) ===== */
:root {
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-warm: #eaf1ff;
  --fg: #101828;
  --fg-2: #344054;
  --muted: #667085;
  --meta: #2563eb;
  --border: #d7e0ef;
  --border-soft: #edf2f8;
  --accent: #2563eb;
  --accent-on: #ffffff;
  --accent-hover: color-mix(in oklab, var(--accent), black 8%);
  --accent-active: color-mix(in oklab, var(--accent), black 14%);
  --success: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --font-display: Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, monospace;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 36px;
  --text-3xl: 54px;
  --text-4xl: 76px;
  --leading-body: 1.52;
  --leading-tight: 1.06;
  --tracking-display: -0.025em;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --section-y-desktop: 96px;
  --section-y-tablet: 68px;
  --section-y-phone: 48px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --elev-flat: none;
  --elev-ring: 0 0 0 1px var(--border);
  --elev-raised: 0 20px 52px rgba(16, 24, 40, 0.11);
  --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.22);
  --motion-fast: 150ms;
  --motion-base: 240ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --container-max: 1180px;
  --container-gutter-desktop: 36px;
  --container-gutter-tablet: 24px;
  --container-gutter-phone: 16px;
}

/* ===== Reset / base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: var(--tracking-display); line-height: var(--leading-tight); margin: 0; }
h1 { font-size: var(--text-3xl); font-weight: 700; }
h2 { font-size: var(--text-2xl); font-weight: 600; }
h3 { font-size: var(--text-xl); font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; }
code, .mono { font-family: var(--font-mono); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ===== Layout ===== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: var(--container-max); margin: 0 auto; padding-left: var(--container-gutter-desktop); padding-right: var(--container-gutter-desktop); }
@media (max-width: 1023px) { .container { padding-left: var(--container-gutter-tablet); padding-right: var(--container-gutter-tablet); } }
@media (max-width: 767px) { .container { padding-left: var(--container-gutter-phone); padding-right: var(--container-gutter-phone); } }

.main { flex: 1; padding-top: var(--space-8); padding-bottom: var(--space-12); }

/* ===== Top nav ===== */
.topnav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,0.85); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--border-soft); }
.topnav-inner { display: flex; align-items: center; gap: var(--space-6); height: 64px; }
.brand { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-display); font-weight: 700; color: var(--fg); font-size: var(--text-lg); letter-spacing: -0.015em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent), white 18%)); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 7px 9px 9px 7px; border: 2px solid var(--accent-on); border-radius: 50%; border-bottom-color: transparent; transform: rotate(-25deg); }
.brand-mark::before { content: ""; position: absolute; left: 13px; top: 16px; width: 6px; height: 6px; background: var(--accent-on); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: var(--space-3); }

.usage-pill { display: inline-flex; align-items: center; gap: var(--space-3); padding: 6px 12px 6px 14px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--fg-2); transition: background var(--motion-fast); }
.usage-pill:hover { background: color-mix(in oklab, var(--surface-warm), var(--accent) 8%); }
.usage-pill-item { display: inline-flex; align-items: center; gap: 6px; }
.usage-pill-sep { width: 1px; height: 14px; background: var(--border); }
.usage-bar { width: 56px; height: 4px; background: var(--border-soft); border-radius: var(--radius-pill); overflow: hidden; }
.usage-bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.usage-pill.is-warn .usage-bar > i { background: var(--warn); }
.usage-pill.is-danger .usage-bar > i { background: var(--danger); }
.usage-pill.is-warn { border-color: color-mix(in oklab, var(--warn), white 60%); }
.usage-pill.is-danger { border-color: color-mix(in oklab, var(--danger), white 60%); }

.plan-tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--fg-2); cursor: pointer; transition: border-color var(--motion-fast); }
.plan-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.plan-tag:hover { border-color: var(--accent); }

.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--fg-2); transition: background var(--motion-fast), color var(--motion-fast); padding: 0; }
.icon-btn:hover { background: var(--surface-warm); color: var(--fg); }
.icon-btn svg { width: 20px; height: 20px; }

.user-chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: 4px 12px 4px 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); cursor: pointer; transition: border-color var(--motion-fast); }
.user-chip:hover { border-color: var(--accent); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent), black 22%)); color: var(--accent-on); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); }
.user-chip .user-name { font-size: var(--text-sm); color: var(--fg-2); }

.user-menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-raised); padding: 8px; z-index: 60; display: none; }
.menu-pop[data-open="true"] { display: block; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: var(--space-3); padding: 10px 12px; border: 0; background: transparent; color: var(--fg); border-radius: var(--radius-sm); text-align: left; font-size: var(--text-sm); }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-warm); }
.menu-pop .menu-header { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-warm); margin-bottom: 6px; }
.menu-pop .menu-header .name { font-weight: 600; font-size: var(--text-sm); color: var(--fg); }
.menu-pop .menu-header .email { font-size: var(--text-xs); color: var(--muted); font-family: var(--font-mono); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border-soft); margin: 6px 0; }

/* Hide secondary nav text on small screens */
@media (max-width: 900px) {
  .user-chip .user-name, .plan-tag .plan-label, .usage-pill-sep, .usage-pill-item.usage-members { display: none; }
}

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: var(--text-sm); font-weight: 500; line-height: 1; cursor: pointer; transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast); white-space: nowrap; font-family: inherit; color: var(--fg); background: transparent; }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn-primary { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); border-color: var(--accent-active); }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--surface-warm); color: var(--fg); }
.btn-danger { background: var(--danger); color: var(--accent-on); border-color: var(--danger); }
.btn-danger:hover { background: color-mix(in oklab, var(--danger), black 10%); border-color: color-mix(in oklab, var(--danger), black 10%); }
.btn-warn { background: var(--warn); color: var(--accent-on); border-color: var(--warn); }
.btn-warn:hover { background: color-mix(in oklab, var(--warn), black 10%); border-color: color-mix(in oklab, var(--warn), black 10%); }
.btn[disabled], .btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 14px 24px; font-size: var(--text-base); }
.btn svg { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Page header (in-page hero) ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-8); flex-wrap: wrap; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--meta); margin-bottom: var(--space-3); }
.page-head .eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--meta); }
.page-head h1 { font-size: 40px; }
.page-head .lead { color: var(--fg-2); font-size: var(--text-base); max-width: 56ch; margin-top: var(--space-3); }
.page-head .actions { display: flex; gap: var(--space-3); }

/* ===== Stats grid (overview) ===== */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-bottom: var(--space-8); }
@media (max-width: 768px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); transition: border-color var(--motion-fast), transform var(--motion-fast); }
.stat:hover { border-color: var(--accent); }
.stat .stat-label { font-size: var(--text-sm); color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.stat .stat-label svg { width: 16px; height: 16px; color: var(--meta); }
.stat .stat-value { font-family: var(--font-display); font-size: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--fg); line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.stat .stat-value .denom { font-size: 18px; color: var(--muted); font-weight: 500; }
.stat .stat-foot { font-size: var(--text-xs); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); }
.stat .stat-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }
.stat-bar { height: 4px; background: var(--border-soft); border-radius: var(--radius-pill); overflow: hidden; margin-top: 2px; }
.stat-bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ===== Toolbar (search + filters + primary action) ===== */
.toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-6); }
.search { position: relative; flex: 1; min-width: 240px; }
.search input { width: 100%; padding: 12px 16px 12px 44px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--fg); transition: border-color var(--motion-fast), box-shadow var(--motion-fast); font-family: inherit; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 0; border-color: var(--accent); box-shadow: var(--focus-ring); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.filter-tabs { display: inline-flex; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); gap: 2px; }
.filter-tabs button { padding: 6px 14px; border: 0; background: transparent; font-size: var(--text-sm); color: var(--fg-2); border-radius: var(--radius-pill); transition: background var(--motion-fast), color var(--motion-fast); font-family: inherit; }
.filter-tabs button.is-active { background: var(--accent); color: var(--accent-on); }
.filter-tabs button:hover:not(.is-active) { background: var(--surface-warm); color: var(--fg); }

/* ===== Room card grid ===== */
.room-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
@media (max-width: 1023px) { .room-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .room-grid { grid-template-columns: 1fr; } }

.room-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); transition: border-color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast); cursor: pointer; min-height: 240px; }
.room-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--elev-raised); }
.room-card:focus-visible { outline: 0; border-color: var(--accent); box-shadow: var(--focus-ring); }
.room-card.is-disabled { opacity: 0.62; }
.room-card.is-disabled::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in oklab, var(--muted), white 88%) 10px 20px); border-radius: inherit; pointer-events: none; }
.room-card.is-readonly .room-badge { background: color-mix(in oklab, var(--warn), white 78%); color: color-mix(in oklab, var(--warn), black 18%); border: 1px solid color-mix(in oklab, var(--warn), white 50%); }

.room-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.room-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.room-title h3 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; position: relative; }
.online-dot.is-online { box-shadow: 0 0 0 4px color-mix(in oklab, var(--success), white 80%); }
.online-dot.is-offline { background: var(--muted); box-shadow: none; }
.room-id { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.room-badge { position: absolute; top: 16px; right: 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 3px 8px; border-radius: var(--radius-pill); background: color-mix(in oklab, var(--warn), white 78%); color: color-mix(in oklab, var(--warn), black 22%); }

.toggle { width: 36px; height: 20px; background: var(--border); border-radius: var(--radius-pill); position: relative; cursor: pointer; transition: background var(--motion-fast); flex: none; border: 0; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--accent-on); border-radius: 50%; transition: transform var(--motion-fast) var(--ease-standard); box-shadow: 0 1px 3px rgba(16,24,40,0.2); }
.toggle.is-on { background: var(--accent); }
.toggle.is-on::after { transform: translateX(16px); }
.toggle[disabled] { opacity: 0.45; cursor: not-allowed; }

.room-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-5); font-size: var(--text-sm); color: var(--fg-2); }
.room-meta dt { color: var(--muted); font-size: var(--text-xs); margin-bottom: 2px; }
.room-meta dd { margin: 0; font-family: var(--font-mono); font-size: 13px; color: var(--fg); }
.room-actions { display: flex; gap: var(--space-2); margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--border-soft); }
.room-actions .btn { flex: 1; }

/* "+" New room card */
.room-card.is-new { align-items: center; justify-content: center; text-align: center; background: var(--surface-warm); border-style: dashed; gap: var(--space-3); }
.room-card.is-new:hover { background: color-mix(in oklab, var(--surface-warm), var(--accent) 10%); border-color: var(--accent); }
.room-card.is-new .plus { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-on); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 300; }
.room-card.is-new h3 { font-size: var(--text-base); font-weight: 600; }
.room-card.is-new p { font-size: var(--text-xs); color: var(--muted); }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--text-sm); font-weight: 500; color: var(--fg); }
.field .hint { font-size: var(--text-xs); color: var(--muted); }
.field input, .field textarea, .field select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--fg); font-family: inherit; transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--accent); box-shadow: var(--focus-ring); }
.field-row { display: flex; justify-content: space-between; align-items: center; }
.field .counter { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45); backdrop-filter: blur(4px); display: none; z-index: 80; align-items: center; justify-content: center; padding: var(--space-6); }
.modal-backdrop[data-open="true"] { display: flex; animation: fadeIn var(--motion-base) var(--ease-standard); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 480px; box-shadow: var(--elev-raised); animation: popIn 250ms var(--ease-standard); overflow: hidden; }
.modal.is-lg { max-width: 640px; }
.modal.is-xl { max-width: 880px; }
@keyframes popIn { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { padding: var(--space-6) var(--space-6) var(--space-4); display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.modal-head h3 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; }
.modal-head .sub { font-size: var(--text-sm); color: var(--muted); margin-top: 4px; }
.modal-body { padding: 0 var(--space-6) var(--space-4); }
.modal-foot { padding: var(--space-4) var(--space-6) var(--space-6); display: flex; justify-content: flex-end; gap: var(--space-3); border-top: 1px solid var(--border-soft); margin-top: var(--space-4); }

/* ===== Drawer ===== */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.35); display: none; z-index: 80; }
.drawer-backdrop[data-open="true"] { display: block; animation: fadeIn var(--motion-base); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 90vw); background: var(--surface); box-shadow: var(--elev-raised); z-index: 81; transform: translateX(100%); transition: transform 250ms var(--ease-standard); display: flex; flex-direction: column; }
.drawer[data-open="true"] { transform: translateX(0); }
.drawer-head { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-5) var(--space-6); }

/* ===== Toast ===== */
.toast-stack { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; box-shadow: var(--elev-raised); display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--fg); min-width: 260px; max-width: 420px; pointer-events: auto; animation: toastIn 200ms var(--ease-standard); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.is-success { border-left: 3px solid var(--success); }
.toast.is-info    { border-left: 3px solid var(--meta); }
.toast.is-warn    { border-left: 3px solid var(--warn); }
.toast.is-error   { border-left: 3px solid var(--danger); }
.toast .icon { width: 18px; height: 18px; flex: none; }
.toast.is-success .icon { color: var(--success); }
.toast.is-info .icon    { color: var(--meta); }
.toast.is-warn .icon    { color: var(--warn); }
.toast.is-error .icon   { color: var(--danger); }

/* ===== Banner ===== */
.banner { display: flex; gap: var(--space-3); align-items: center; padding: 12px var(--space-6); border-radius: var(--radius-md); background: color-mix(in oklab, var(--warn), white 86%); color: color-mix(in oklab, var(--warn), black 26%); font-size: var(--text-sm); border: 1px solid color-mix(in oklab, var(--warn), white 60%); margin-bottom: var(--space-6); }
.banner.is-info { background: var(--surface-warm); color: var(--fg-2); border-color: var(--border); }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner .banner-actions { margin-left: auto; display: flex; gap: 8px; }

/* ===== Empty state ===== */
.empty { text-align: center; padding: var(--space-12) var(--space-6); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.empty .empty-art { margin: 0 auto var(--space-5); width: 96px; height: 96px; display: grid; place-items: center; background: var(--surface-warm); border-radius: var(--radius-lg); color: var(--meta); }
.empty .empty-art svg { width: 48px; height: 48px; }
.empty h3 { margin-bottom: var(--space-2); }
.empty p { color: var(--muted); margin-bottom: var(--space-5); }

/* ===== Skeleton shimmer ===== */
.skeleton { position: relative; overflow: hidden; background: var(--border-soft); border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ===== Map (SVG placeholder) ===== */
.map-shell { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; height: 100%; min-height: 540px; }
.map-svg { display: block; width: 100%; height: 100%; background: linear-gradient(180deg, #e8efff 0%, #f4f7ff 100%); }
.map-grid line { stroke: rgba(37, 99, 235, 0.06); stroke-width: 1; }
.map-grid line.major { stroke: rgba(37, 99, 235, 0.12); }
.map-land { fill: rgba(37, 99, 235, 0.05); stroke: rgba(37, 99, 235, 0.18); stroke-width: 1.2; stroke-linejoin: round; }
.map-river { fill: none; stroke: rgba(37, 99, 235, 0.28); stroke-width: 1.5; }
.map-road  { fill: none; stroke: rgba(37, 99, 235, 0.18); stroke-width: 1; stroke-dasharray: 4 6; }
.map-label { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.map-pin { cursor: pointer; transform-origin: center; transition: transform 200ms var(--ease-standard); }
.map-pin:hover, .map-pin.is-active { transform: scale(1.08); }
.map-pin .pin-shadow { fill: rgba(16,24,40,0.18); }
.map-pin .pin-ring { fill: none; stroke-width: 2; opacity: 0.6; transform-origin: center; }
.map-pin.is-online .pin-ring { animation: pulse 2s ease-out infinite; }
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}
.map-pin .pin-body { stroke: white; stroke-width: 2; }
.map-pin .pin-label { font-family: var(--font-display); font-size: 11px; font-weight: 600; fill: white; }

.map-pop { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; min-width: 200px; box-shadow: var(--elev-raised); font-size: var(--text-xs); pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); display: none; }
.map-pop[data-open="true"] { display: block; }
.map-pop::after { content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); width: 12px; height: 12px; background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); rotate: 45deg; }
.map-pop h4 { font-size: var(--text-sm); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.map-pop .coord { font-family: var(--font-mono); color: var(--fg-2); line-height: 1.5; }
.map-pop .ts { color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }

.map-overlay { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.map-chip { pointer-events: auto; background: rgba(255,255,255,0.92); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 12px; font-size: var(--text-xs); color: var(--fg-2); display: inline-flex; align-items: center; gap: 6px; backdrop-filter: blur(8px); font-family: var(--font-mono); }
.map-chip .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: liveBlink 1.4s ease-in-out infinite; }
@keyframes liveBlink { 50% { opacity: 0.3; } }
.map-zoom { position: absolute; bottom: 18px; right: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; box-shadow: var(--elev-ring); }
.map-zoom button { width: 36px; height: 36px; border: 0; background: transparent; color: var(--fg-2); font-size: 18px; cursor: pointer; }
.map-zoom button:hover { background: var(--surface-warm); color: var(--fg); }
.map-zoom button + button { border-top: 1px solid var(--border); }
.map-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--border); padding: var(--space-5) var(--space-6); border-radius: var(--radius-md); text-align: center; color: var(--muted); }

/* ===== Member list (room detail) ===== */
.room-layout { display: grid; grid-template-columns: 1fr 380px; gap: var(--space-5); align-items: stretch; }
@media (max-width: 1023px) { .room-layout { grid-template-columns: 1fr 340px; } }
@media (max-width: 900px)  { .room-layout { grid-template-columns: 1fr; } .map-shell { min-height: 360px; } }

.member-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; min-height: 540px; }
.member-head { padding: var(--space-5) var(--space-5) var(--space-4); border-bottom: 1px solid var(--border-soft); }
.member-head .row1 { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.member-head h3 { font-size: var(--text-base); font-weight: 600; }
.member-head .count { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }
.member-tabs { display: inline-flex; padding: 3px; background: var(--surface-warm); border-radius: var(--radius-pill); margin-top: var(--space-3); }
.member-tabs button { padding: 4px 12px; font-size: var(--text-xs); border: 0; background: transparent; border-radius: var(--radius-pill); color: var(--fg-2); cursor: pointer; font-family: inherit; font-weight: 500; }
.member-tabs button.is-active { background: var(--surface); color: var(--fg); box-shadow: var(--elev-ring); }

.member-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.member-list li { padding: 14px var(--space-5); border-bottom: 1px solid var(--border-soft); cursor: pointer; display: flex; align-items: flex-start; gap: var(--space-3); transition: background var(--motion-fast); }
.member-list li:last-child { border-bottom: 0; }
.member-list li:hover, .member-list li.is-focused { background: var(--surface-warm); }
.member-list li .avatar { width: 32px; height: 32px; font-size: 13px; flex: none; }
.member-list .m-main { flex: 1; min-width: 0; }
.member-list .m-name { font-size: var(--text-sm); font-weight: 500; color: var(--fg); display: inline-flex; align-items: center; gap: 8px; }
.member-list .m-coord { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); margin-top: 4px; line-height: 1.5; }
.member-list .m-ts { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.member-list .status { width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: 7px; }
.member-list .status.is-online  { background: var(--success); box-shadow: 0 0 0 3px color-mix(in oklab, var(--success), white 80%); }
.member-list .status.is-offline { background: var(--muted); }

.section-divider { padding: var(--space-3) var(--space-5); background: var(--surface-warm); font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.room-foot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-top: var(--space-5); padding: var(--space-5) var(--space-6); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.room-foot .foot-stat { display: flex; align-items: center; gap: var(--space-5); }
.room-foot .foot-stat .pair { display: flex; flex-direction: column; }
.room-foot .foot-stat .pair-label { font-size: var(--text-xs); color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.room-foot .foot-stat .pair-value { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--fg); letter-spacing: -0.02em; }

/* ===== Pricing ===== */
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
@media (max-width: 1023px) { .plan-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .plan-grid { grid-template-columns: 1fr; } }
.plan { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); transition: transform var(--motion-fast), border-color var(--motion-fast); }
.plan:hover { border-color: var(--accent); transform: translateY(-2px); }
.plan.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: linear-gradient(180deg, color-mix(in oklab, var(--accent), white 92%), var(--surface) 60%); }
.plan.is-featured::before { content: "推荐"; position: absolute; top: -10px; right: 18px; padding: 4px 10px; background: var(--accent); color: var(--accent-on); font-size: var(--text-xs); font-weight: 600; border-radius: var(--radius-pill); letter-spacing: 0.04em; }
.plan-name { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price .currency { font-size: var(--text-base); color: var(--fg-2); }
.plan-price .amount { font-family: var(--font-display); font-size: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--fg); line-height: 1; }
.plan-price .period { font-size: var(--text-sm); color: var(--muted); }
.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: var(--text-sm); color: var(--fg-2); flex: 1; }
.plan-list li { display: flex; align-items: flex-start; gap: 10px; }
.plan-list li svg { width: 16px; height: 16px; color: var(--accent); flex: none; margin-top: 3px; }
.plan-list li.is-mute { color: var(--muted); }
.plan-list li.is-mute svg { color: var(--muted); }
.plan-list li b { color: var(--fg); font-weight: 600; }
.plan .current-tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--accent); font-family: var(--font-mono); }
.plan .current-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ===== Help / FAQ ===== */
.help-grid { display: grid; grid-template-columns: 240px 1fr; gap: var(--space-8); }
@media (max-width: 900px) { .help-grid { grid-template-columns: 1fr; } }
.help-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 88px; align-self: flex-start; }
.help-nav a { display: block; padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--fg-2); border: 1px solid transparent; }
.help-nav a:hover { background: var(--surface-warm); color: var(--fg); }
.help-nav a.is-active { background: var(--surface); border-color: var(--border); color: var(--accent); }

.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.faq-section + .faq-section { border-top: 1px solid var(--border-soft); }
.faq-section h3 { padding: var(--space-5) var(--space-6) 0; font-size: var(--text-base); font-weight: 600; }
.faq-item { border-top: 1px solid var(--border-soft); }
.faq-item:first-of-type { margin-top: var(--space-4); }
.faq-item button { all: unset; display: flex; width: 100%; padding: var(--space-4) var(--space-6); justify-content: space-between; align-items: center; cursor: pointer; box-sizing: border-box; font-size: var(--text-sm); color: var(--fg); font-weight: 500; }
.faq-item button:hover { background: var(--surface-warm); }
.faq-item .caret { transition: transform var(--motion-fast); color: var(--muted); }
.faq-item[data-open="true"] .caret { transform: rotate(90deg); color: var(--accent); }
.faq-item .a { display: none; padding: 0 var(--space-6) var(--space-5); color: var(--fg-2); font-size: var(--text-sm); line-height: 1.6; }
.faq-item[data-open="true"] .a { display: block; }
.faq-item .a code { background: var(--surface-warm); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ===== Login ===== */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .login-page { grid-template-columns: 1fr; } .login-aside { display: none; } }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: var(--space-12) var(--space-8); }
.login-card { width: 100%; max-width: 420px; }
.login-card .brand { font-size: 22px; margin-bottom: var(--space-8); }
.login-card h1 { font-size: 36px; margin-bottom: var(--space-3); }
.login-card .sub { color: var(--fg-2); margin-bottom: var(--space-8); }
.login-card .form { display: flex; flex-direction: column; gap: var(--space-4); }
.divider { display: flex; align-items: center; gap: 12px; margin: var(--space-5) 0; color: var(--muted); font-size: var(--text-xs); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.oauth-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.oauth-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--fg); font-size: var(--text-sm); cursor: pointer; font-family: inherit; transition: border-color var(--motion-fast); }
.oauth-btn:hover { border-color: var(--accent); }
.oauth-btn svg { width: 18px; height: 18px; }
.login-foot { margin-top: var(--space-6); font-size: var(--text-xs); color: var(--muted); text-align: center; }
.login-aside { background: linear-gradient(160deg, color-mix(in oklab, var(--accent), white 86%) 0%, color-mix(in oklab, var(--accent), white 70%) 100%); position: relative; overflow: hidden; padding: var(--space-12); display: flex; flex-direction: column; justify-content: space-between; }
.login-aside .aside-eyebrow { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.login-aside h2 { font-size: 40px; max-width: 12ch; margin-top: var(--space-4); color: color-mix(in oklab, var(--accent), black 30%); }
.login-aside .aside-quote { color: var(--fg-2); font-size: var(--text-sm); max-width: 36ch; }

/* Decorative ortho map illustration for aside */
.aside-map { position: absolute; right: -60px; bottom: -40px; width: 560px; height: 460px; opacity: 0.65; }

/* ===== Helpers ===== */
.flex { display: flex; gap: var(--space-3); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--space-3); }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.section { margin-top: var(--space-12); }
.section + .section { margin-top: var(--space-12); }
.hr { height: 1px; background: var(--border-soft); border: 0; margin: var(--space-5) 0; }

/* Share panel */
.share-grid { display: grid; grid-template-columns: 200px 1fr; gap: var(--space-5); padding-top: var(--space-4); }
@media (max-width: 600px) { .share-grid { grid-template-columns: 1fr; } }
.qr-box { background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; display: grid; place-items: center; aspect-ratio: 1; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.share-key { font-family: var(--font-mono); font-size: 13px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all; line-height: 1.5; user-select: all; }
.share-key .key-cover { cursor: pointer; color: var(--meta); margin-left: 4px; }

/* Code-look chip */
.kbd { display: inline-block; padding: 2px 6px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); }
