/* ============================================================================
   Discovery Platform — Dashboard
   Light-theme client portal. Brand colors are injected at runtime as
   --brand / --brand-hover / --brand-accent from /brands/{brand}.json.
   ============================================================================ */

/* ── Design tokens ── */
:root {
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-accent: #0ea5e9;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-soft-border: color-mix(in srgb, var(--brand) 22%, white);

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e4e9f1;
  --border-strong: #d3dae5;

  --text: #16233a;
  --text-muted: #5a6779;
  --text-dim: #93a0b4;

  --success: #16a34a;
  --success-bg: #e9f9ef;
  --warning: #b45309;
  --warning-bg: #fdf3e3;
  --danger: #dc2626;
  --danger-bg: #fdeaea;
  --info-bg: #eaf2fd;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(22, 35, 58, 0.05);
  --shadow: 0 2px 10px rgba(22, 35, 58, 0.07);
  --shadow-lg: 0 16px 44px rgba(22, 35, 58, 0.16);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --sidebar-w: 236px;
  --topbar-h: 62px;
  --bottomnav-h: 62px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

[hidden] { display: none !important; }

img { max-width: 100%; }

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--brand); }

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Splash / loading overlay ── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-width: 2px;
  vertical-align: -3px;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.splash-text { color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--text-dim); background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-lg { min-height: 52px; padding: 14px 26px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

.btn svg { flex: none; }

/* ── Forms ── */
.field { display: block; margin-bottom: 16px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.field-hint {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.input::placeholder { color: var(--text-dim); }

textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235a6779' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ── Auth ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.auth-brand { text-align: center; margin-bottom: 26px; }

.auth-brand .logo-mark { width: 46px; height: 46px; font-size: 20px; margin: 0 auto 12px; }

.auth-brand h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }

.auth-brand p { margin-top: 6px; color: var(--text-muted); font-size: 14px; }

.auth-note {
  margin-top: 18px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-note button {
  background: none;
  border: none;
  padding: 4px;
  color: var(--brand);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.auth-error {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13.5px;
  line-height: 1.5;
}

.auth-success {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  color: var(--success);
  font-size: 13.5px;
  line-height: 1.5;
}

/* ── App shell ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16.5px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.logo-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-spacer { flex: 1; }

.biz-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.biz-switcher select.input {
  min-height: 40px;
  max-width: 240px;
  font-size: 14px;
  font-weight: 600;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 4px;
  border-radius: 999px;
  cursor: pointer;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  flex: none;
}

.user-menu {
  position: absolute;
  top: calc(var(--topbar-h) - 6px);
  right: 16px;
  z-index: 60;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  animation: pop-in 0.14s ease;
}

.user-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu-head strong { display: block; font-size: 14.5px; }
.user-menu-head span { font-size: 12.5px; color: var(--text-muted); word-break: break-all; }

.user-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.user-menu button:hover { background: var(--surface-2); }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 30;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px 24px;
  overflow-y: auto;
}

.nav-label {
  padding: 16px 12px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg { flex: none; }

.nav-item:hover { background: var(--surface-2); color: var(--text); }

.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* Main content */
.main {
  padding: calc(var(--topbar-h) + 26px) 28px 60px;
  margin-left: var(--sidebar-w);
  max-width: calc(1120px + var(--sidebar-w));
}

.view { animation: view-in 0.18s ease; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page-head { margin-bottom: 22px; }

.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }

.page-sub { margin-top: 6px; color: var(--text-muted); font-size: 14.5px; max-width: 620px; }

.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.toolbar-row .input { width: auto; flex: 1 1 220px; max-width: 340px; }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar { display: none; }

.bottom-nav-inner { display: flex; min-width: 100%; }

.bottom-nav-item {
  flex: 1 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 6px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.bottom-nav-item.is-active { color: var(--brand); background: var(--brand-soft); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }

.card-sub { margin-top: 3px; font-size: 13.5px; color: var(--text-muted); }

/* ── Badges & chips ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-info { background: var(--info-bg); color: var(--brand); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

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

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ── Toasts ── */
.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
}

.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.toast.is-leaving { opacity: 0; transition: opacity 0.3s; }

/* ── Skeletons & empty states ── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--border);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.skeleton-line { height: 14px; margin-bottom: 12px; }
.skeleton-tile { height: 96px; border-radius: var(--radius-lg); }
.skeleton-card { height: 150px; border-radius: var(--radius-lg); margin-bottom: 18px; }

.empty {
  text-align: center;
  padding: 44px 24px;
  color: var(--text-muted);
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

/* ── Home ── */
.greeting { margin-bottom: 24px; }
.greeting h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; }
.greeting p { margin-top: 6px; color: var(--text-muted); font-size: 15px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.stat-value {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-label { margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--text-muted); }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.action-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.action-tile:hover { border-color: var(--brand-soft-border); box-shadow: var(--shadow); }
.action-tile:active { transform: scale(0.99); }

.action-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
}

.action-tile strong { display: block; font-size: 15.5px; font-weight: 700; }
.action-tile span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); }

.lead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
}

.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--surface-2); }

.lead-row-main { min-width: 0; }
.lead-row-main strong { display: block; font-size: 14.5px; }
.lead-row-main span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lead-row-side { flex: none; display: flex; align-items: center; gap: 10px; }
.lead-row time { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ── CRM board ── */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(256px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  align-items: start;
}

.board-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  scroll-snap-align: start;
  min-height: 180px;
}

.board-col.drag-over { border-color: var(--brand); background: var(--brand-soft); }

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 12px;
}

.col-title { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); }

.col-title .col-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
}

.col-count {
  min-width: 24px;
  text-align: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.col-empty {
  padding: 20px 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 13px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.lead-card:hover { border-color: var(--brand-soft-border); box-shadow: var(--shadow); }
.lead-card.is-dragging { opacity: 0.5; }

.lead-card h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }

.lead-card .lead-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-card time { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-dim); }

.lead-card select.stage-select {
  margin-top: 10px;
  width: 100%;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 30px 6px 10px;
  background-position: right 9px center;
}

/* ── Drawer ── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(22, 35, 58, 0.42);
  animation: fade-in 0.18s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  width: min(440px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  padding: 24px 24px 40px;
  animation: drawer-in 0.22s ease;
}

@keyframes drawer-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.drawer h2 { font-size: 20px; font-weight: 700; padding-right: 44px; }

.drawer-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }

.drawer-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
}

.contact-line svg { color: var(--brand); flex: none; }
.contact-line[href]:hover { color: var(--brand); }

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline-item {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
}

.timeline-item:last-child { padding-bottom: 2px; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
}

.timeline-item p { font-size: 13.5px; }
.timeline-item time { font-size: 12px; color: var(--text-dim); }

/* ── Analytics ── */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 180px;
  padding-top: 8px;
}

.bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  gap: 6px;
}

.bar-fill {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: var(--brand);
  opacity: 0.85;
  transition: opacity 0.15s;
}

.bar-col:hover .bar-fill { opacity: 1; }

.bar-label {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.list-row:last-child { border-bottom: none; }

.list-row-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.list-row-value { font-weight: 700; font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.split-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 12px;
  background: var(--surface-2);
}

.split-seg { height: 100%; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}

/* ── Website editor ── */
.page-group { margin-bottom: 28px; }

.page-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  text-transform: capitalize;
}

.block-row { padding: 16px 0; border-bottom: 1px solid var(--border); }
.block-row:last-child { border-bottom: none; padding-bottom: 4px; }
.block-row:first-child { padding-top: 4px; }

.block-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.block-label { font-size: 14px; font-weight: 600; }

.block-help { font-size: 12.5px; color: var(--text-dim); margin-top: -4px; margin-bottom: 8px; }

.locked-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.locked-value {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 14.5px;
  color: var(--text-muted);
  overflow-wrap: break-word;
}

.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.2s;
}

.save-pill.is-saved { color: var(--success); }
.save-pill.is-saving { color: var(--text-muted); }
.save-pill.is-error { color: var(--danger); }

/* Rich text editor */
.rt-toolbar {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2);
}

.rt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.rt-btn:hover { background: var(--surface); color: var(--text); }

.rt-editor {
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.rt-editor:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.rt-editor:empty::before { content: attr(data-placeholder); color: var(--text-dim); }

.rt-editor img { border-radius: var(--radius-sm); }
.rt-editor blockquote {
  margin: 12px 0;
  padding: 4px 16px;
  border-left: 3px solid var(--brand);
  color: var(--text-muted);
}

.rt-editor-lg { min-height: 320px; }

/* Image block */
.img-block { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

.img-preview {
  width: 148px;
  height: 100px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface-2);
}

.img-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.img-block-fields { flex: 1 1 200px; min-width: 0; }

/* Publish bar */
.publish-bar {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(22, 35, 58, 0.08);
  animation: publish-in 0.25s ease;
}

@keyframes publish-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.publish-bar-msg { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }

.publish-bar-msg .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  flex: none;
}

.publish-bar-actions { display: flex; gap: 10px; }

.main.has-publish-bar { padding-bottom: 140px; }

/* ── Blog ── */
.post-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
}

.post-row:hover { background: var(--surface-2); }
.post-row:last-child { border-bottom: none; }

.post-cover {
  width: 78px;
  height: 54px;
  flex: none;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.post-row-main { flex: 1; min-width: 0; }
.post-row-main strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row-main span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.composer-title {
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 6px 0;
}

.composer-title:focus { outline: none; }
.composer-title::placeholder { color: var(--text-dim); }

.cover-uploader {
  position: relative;
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.cover-uploader img { display: block; width: 100%; max-height: 240px; object-fit: cover; }

.composer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ── Requests ── */
.request-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.request-item:last-child { border-bottom: none; }

.request-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.request-item-head strong { font-size: 14.5px; }

.request-desc { font-size: 14px; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: break-word; }

.request-meta { margin-top: 8px; font-size: 12.5px; color: var(--text-dim); display: flex; gap: 14px; flex-wrap: wrap; }

.request-admin-note {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  font-size: 13.5px;
}

.op-request-controls {
  display: grid;
  grid-template-columns: 160px 140px 1fr auto;
  gap: 10px;
  align-items: start;
  margin-top: 12px;
}

.screenshot-thumb {
  max-width: 200px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.data-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 35, 58, 0.45);
  animation: fade-in 0.16s ease;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  animation: pop-in 0.18s ease;
}

.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 16px; padding-right: 30px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── Settings / admin ── */
.settings-list { list-style: none; margin: 0; padding: 0; }

.settings-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.settings-list li:last-child { border-bottom: none; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  word-break: break-all;
}

.biz-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .op-request-controls { grid-template-columns: 1fr 1fr; }
  .op-request-controls textarea { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .bottom-nav { display: block; }

  .main {
    margin-left: 0;
    padding: calc(var(--topbar-h) + 18px) 16px calc(var(--bottomnav-h) + 40px);
  }

  .publish-bar {
    left: 0;
    bottom: var(--bottomnav-h);
    padding: 12px 16px;
  }

  .main.has-publish-bar { padding-bottom: calc(var(--bottomnav-h) + 150px); }

  .topbar { padding: 0 14px; gap: 10px; }
  .biz-switcher select.input { max-width: 150px; }
  .logo-name { max-width: 130px; }

  .quick-actions { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .drawer {
    top: auto;
    left: 0;
    width: 100vw;
    max-height: 88vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: sheet-in 0.24s ease;
  }

  @keyframes sheet-in {
    from { transform: translateY(60px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }

  .board { grid-auto-columns: 82vw; }

  .page-title { font-size: 21px; }
  .greeting h1 { font-size: 23px; }

  .bars { height: 140px; gap: 3px; }
  .bar-label { font-size: 9px; }
}

@media (max-width: 480px) {
  .card { padding: 16px; }
  .toolbar-row .input { max-width: none; }
  .composer-title { font-size: 21px; }
  .img-preview { width: 110px; height: 76px; }
}

/* ── Print / reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
