/* ULTRATOUR Agent Portal — shared styles
   Design language matches the main marketing site,
   sized up for working-app readability. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-rail: #fafbfc;
  --bg-hover: #f0f3f7;

  --text: #0a0a0a;
  --text-2: #3f4855;
  --text-3: #7a8290;

  --border: #e5e7eb;
  --border-strong: #cfd4db;

  --accent: #1a5fb4;
  --accent-hover: #144d92;
  --accent-soft: #e6f1fb;
  --accent-deep: #0c447c;

  --live: #2d6a1f;
  --live-bg: #d4edcb;
  --proc: #0c447c;
  --proc-bg: #d6e7f8;
  --draft: #5a6470;
  --draft-bg: #ebedef;
  --sold: #4c2a99;
  --sold-bg: #e6dffe;

  --warn: #a8804a;
  --warn-bg: #f5ede0;

  --header-h: 60px;
  --rail-w: 220px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

img { max-width: 100%; display: block; }

/* ── App shell (header + rail + main) ─────────────────── */

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
}

.app-logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.app-logo span { color: var(--accent); }
.app-logo:hover { text-decoration: none; }

.demo-pill {
  display: inline-block;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-left: 12px;
}

.demo-note {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.demo-note strong { font-weight: 700; }

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-2);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a5fb4, #0c447c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.app-rail {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  width: var(--rail-w);
  background: var(--bg-rail);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 18px;
  z-index: 40;
}

.rail-profile {
  text-align: center;
  margin-bottom: 18px;
}
.rail-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, #d6dde6, #b8c1cc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.rail-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.rail-brokerage {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.rail-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.rail-stats { display: flex; flex-direction: column; gap: 12px; }
.rail-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 2px;
}
.rail-stat-val {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
}
.rail-nav a:hover { background: var(--bg-hover); text-decoration: none; }
.rail-nav a.active { background: var(--accent-soft); color: var(--accent-deep); }
.rail-nav a .nav-icon { width: 18px; text-align: center; font-size: 14px; }

.rail-footer {
  margin-top: 16px;
}
.rail-footer a {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-main {
  padding-top: var(--header-h);
  padding-left: var(--rail-w);
  min-height: 100vh;
  background: var(--bg-soft);
}

.app-main-inner {
  padding: 28px 32px 48px;
  max-width: 1240px;
}

/* ── Typography ───────────────────────────────────────── */

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 22px;
}

h2 { font-size: 18px; font-weight: 600; color: var(--text); }
h3 { font-size: 15px; font-weight: 600; color: var(--text); }

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 8px;
}

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-large {
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
}

.btn-block { width: 100%; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-hover); }

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Forms ────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}
.form-grid .full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.field input, .field select, .field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,95,180,0.12);
}
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.field-hint {
  font-size: 12px;
  color: var(--text-3);
}
.char-counter {
  font-size: 12px;
  color: var(--text-3);
  text-align: right;
}

/* Toggle (yes/no) */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle input { display: none; }
.toggle-track {
  width: 38px; height: 22px;
  border-radius: 100px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.16s;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-label { font-size: 13px; color: var(--text-2); font-weight: 500; }

/* ── Cards ────────────────────────────────────────────── */

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

/* Listing card */
.listing-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
}
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.listing-thumb {
  position: relative;
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, #1e3a5f, #2a5298);
}

.status-pill {
  position: absolute;
  top: 12px; right: 12px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-pill.live { background: var(--live-bg); color: var(--live); }
.status-pill.processing { background: var(--proc-bg); color: var(--proc); display: inline-flex; align-items: center; gap: 6px; }
.status-pill.draft { background: var(--draft-bg); color: var(--draft); }
.status-pill.sold { background: var(--sold-bg); color: var(--sold); }

.spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid rgba(12,68,124,0.25);
  border-top-color: var(--proc);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.listing-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.listing-addr {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.listing-meta {
  font-size: 13px;
  color: var(--text-2);
}
.listing-mls {
  font-size: 12px;
  color: var(--text-3);
}
.listing-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  flex-wrap: wrap;
}
.listing-stats span { display: inline-flex; align-items: center; gap: 4px; }
.listing-actions {
  display: flex;
  gap: 6px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.listing-actions .btn { padding: 6px 10px; font-size: 12px; flex: 1; }

/* ── Sort/filter bar ──────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.sort-group select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
}
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.12s;
}
.filter-pill:hover { background: var(--bg-hover); }
.filter-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Wizard progress bar ──────────────────────────────── */

.wizard-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.wiz-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
}
.wiz-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.wiz-step.active .wiz-num { background: var(--accent); color: #fff; }
.wiz-step.active { color: var(--text); font-weight: 500; }
.wiz-step.done .wiz-num { background: var(--live); color: #fff; }
.wiz-step.done { color: var(--text-2); }
.wiz-bar {
  flex: 1;
  min-width: 16px;
  height: 1px;
  background: var(--border);
}

.wiz-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}
.wiz-panel h2 { margin-bottom: 6px; font-size: 20px; }
.wiz-sub { font-size: 14px; color: var(--text-3); margin-bottom: 24px; }
.wiz-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Drag-drop zone ───────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  background: var(--bg-soft);
  cursor: pointer;
  transition: all 0.12s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone-icon {
  font-size: 36px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.dropzone h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.dropzone p { font-size: 13px; color: var(--text-3); }
.dropzone .browse-link { color: var(--accent); cursor: pointer; }

.upload-result {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 16px;
}
.upload-result .filename {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.upload-result .filemeta {
  font-size: 12px;
  color: var(--text-3);
}
.upload-result .verified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--live-bg);
  color: var(--live);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
}

.progress-bar {
  margin-top: 12px;
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s;
  border-radius: 100px;
}

/* Sidecar parse results */
.reveal-list {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reveal-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.reveal-list .check { color: var(--live); font-weight: 600; }
.reveal-list .warn { color: var(--warn); font-weight: 600; }

.note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 12px;
}

/* Document upload list */
.doc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.doc-item .doc-status { font-size: 12px; color: var(--text-3); }
.doc-item .doc-status.done { color: var(--live); font-weight: 500; }

/* ── Processing screen ────────────────────────────────── */

.processing {
  text-align: center;
  padding: 48px 32px;
}
.processing-ring {
  width: 80px; height: 80px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 1.2s linear infinite;
}
.processing h2 { font-size: 22px; margin-bottom: 6px; }
.processing .eta { font-size: 14px; color: var(--text-3); margin-bottom: 28px; }

.process-steps {
  list-style: none;
  max-width: 360px;
  margin: 0 auto 28px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.process-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-3);
  transition: color 0.3s;
}
.process-steps li.done { color: var(--text); }
.process-steps li.active { color: var(--text); font-weight: 500; }
.process-steps .step-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--bg-hover);
  color: var(--text-3);
  flex-shrink: 0;
}
.process-steps li.done .step-icon { background: var(--live); color: #fff; }
.process-steps li.active .step-icon {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.6; } }

/* ── Tour preview placeholder ─────────────────────────── */

.tour-placeholder {
  background: linear-gradient(135deg, #1e3a5f 0%, #2a5298 50%, #0d2644 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  text-align: center;
  min-height: 240px;
  position: relative;
  overflow: hidden;
}
.tour-placeholder .tour-label {
  display: inline-block;
  background: rgba(26,95,180,0.85);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.tour-placeholder p { margin-top: 6px; opacity: 0.7; }

/* ── Embed code block ────────────────────────────────── */

.code-block {
  background: #0e1623;
  color: #cfd8dc;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: "SF Mono", Monaco, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* ── Editor page ──────────────────────────────────────── */

.editor-shell {
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.editor-preview {
  flex: 0 0 60%;
  background: linear-gradient(135deg, #1e3a5f 0%, #2a5298 50%, #0d2644 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.editor-preview-label {
  position: absolute;
  top: 16px;
  left: 18px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.editor-preview-toolbar {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  gap: 6px;
}
.editor-preview-toolbar .btn {
  background: rgba(255,255,255,0.95);
  font-size: 12px;
  padding: 6px 12px;
}

.editor-timeline {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.editor-timeline-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  margin-right: 4px;
  flex-shrink: 0;
}
.room-chip {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s;
}
.room-chip:hover { background: var(--bg-hover); }
.room-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.editor-details {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  background: #fff;
}
.editor-details h2 { margin-bottom: 4px; font-size: 18px; }
.editor-details .room-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 18px;
}
.editor-divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}
.editor-details .label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.hotspot-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.hotspot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.hotspot-item .h-actions { display: flex; gap: 4px; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.reveal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-2);
}
.reveal-row .both {
  color: var(--live);
  font-size: 12px;
  font-weight: 500;
}

/* ── Analytics page ───────────────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 14px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.stat-box .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.stat-box .stat-val {
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.chart-card h2 { margin-bottom: 18px; }

/* Vertical bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  margin-bottom: 8px;
  padding-left: 36px;
  position: relative;
}
.bar-chart::before, .bar-chart::after {
  content: "";
  position: absolute;
  left: 36px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.bar-chart::before { top: 0; }
.bar-chart::after { top: 50%; }
.bar {
  flex: 1;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 4px;
  transition: opacity 0.16s;
}
.bar:hover { opacity: 0.85; }
.bar-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}
.bar-y-axis {
  position: absolute;
  left: 0; top: 0; bottom: 24px;
  width: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  padding-right: 6px;
}
.bar-labels {
  display: flex;
  gap: 8px;
  padding-left: 36px;
  font-size: 11px;
  color: var(--text-3);
}
.bar-labels span {
  flex: 1;
  text-align: center;
}

/* Horizontal bar chart */
.hbar-chart { display: flex; flex-direction: column; gap: 12px; }
.hbar {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.hbar-label { color: var(--text); font-weight: 500; }
.hbar-track {
  height: 10px;
  background: var(--bg-soft);
  border-radius: 100px;
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
}
.hbar-val { text-align: right; color: var(--text-3); font-size: 12px; font-weight: 500; }

/* Question list */
.qlist { list-style: none; counter-reset: q; }
.qlist li {
  counter-increment: q;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.qlist li::before {
  content: counter(q) ".";
  color: var(--text-3);
  font-weight: 600;
  font-size: 13px;
}
.qlist li:last-child { border-bottom: none; }
.qlist .q-text { color: var(--text); }
.qlist .q-count { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ── Login page ───────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  padding: 24px;
}
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}
.login-logo span { color: var(--accent); }
.login-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 28px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  margin-bottom: 22px;
}
.login-footer {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ── Companion page (mobile scan) ─────────────────────── */

.companion-page {
  min-height: 100vh;
  background: var(--bg-soft);
  display: flex;
  justify-content: center;
}
.companion-frame {
  width: 100%;
  max-width: 420px;
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.companion-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.companion-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.companion-logo {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.companion-logo span { color: var(--accent); }
.companion-sub {
  font-size: 12px;
  color: var(--text-3);
}
.companion-timer {
  font-family: "SF Mono", Monaco, monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.companion-body {
  padding: 22px 20px;
  flex: 1;
}
.companion-body h2 { margin-bottom: 14px; font-size: 16px; }

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-3);
  font-size: 14px;
}

.reveal-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reveal-checklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}
.reveal-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.reveal-dot.complete { background: var(--live); }
.reveal-dot.partial { background: var(--warn); }
.reveal-checklist .room {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.state-badges { display: flex; gap: 4px; }
.state-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 100px;
  background: var(--bg-hover);
  color: var(--text-3);
}
.state-badge.set { background: var(--accent-soft); color: var(--accent-deep); }

.companion-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}
.btn-mark {
  width: 100%;
  height: 60px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.btn-mark:hover { background: var(--accent-hover); }
.btn-finish {
  width: 100%;
  height: 44px;
  background: var(--bg-hover);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: not-allowed;
}
.btn-finish.ready {
  background: #fff;
  color: var(--text);
  cursor: pointer;
  border-color: var(--border-strong);
}
.btn-finish.ready:hover { background: var(--bg-hover); }

/* Bottom sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 28px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
  z-index: 101;
  transition: transform 0.25s ease-out;
  max-height: 80vh;
  overflow-y: auto;
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 100px;
  margin: 0 auto 16px;
}
.sheet h3 { text-align: center; margin-bottom: 16px; font-size: 15px; }
.room-options { display: flex; flex-direction: column; gap: 8px; }
.room-options button {
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
}
.room-options button:hover { background: var(--bg-hover); }

.state-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.state-buttons button {
  padding: 22px;
  border: 2px solid var(--border-strong);
  background: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.state-buttons button:hover { border-color: var(--accent); color: var(--accent); }

.toast {
  position: fixed;
  top: calc(var(--header-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--live);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast .toast-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  margin-left: 8px;
  cursor: pointer;
}

/* ── Mobile responsive ────────────────────────────────── */

@media (max-width: 900px) {
  :root { --rail-w: 0px; }
  .app-rail {
    transform: translateX(-100%);
    transition: transform 0.25s;
    width: 240px;
    box-shadow: 4px 0 12px rgba(0,0,0,0.12);
  }
  .app-rail.open { transform: translateX(0); }
  .app-main { padding-left: 0; }
  .menu-toggle { display: inline-flex; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .editor-preview { flex-basis: 50%; }
  .hbar { grid-template-columns: 100px 1fr 40px; gap: 10px; font-size: 12px; }
  .app-main-inner { padding: 20px 18px 36px; }
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-2);
  margin-right: 12px;
}
