/* LMSAdvisorCRM — app design system (Phase 3)
   Light/gray base with a richer indigo/violet accent, per the
   reference screenshot. See PROJECT_HANDOFF.md Phase 3 for the full
   design notes this implements. */

:root {
  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --border: #E4E6EC;
  --text: #1A1D29;
  --muted: #6B7280;
  --accent: #4F46E5;
  --accent-dark: #4338CA;
  --accent-soft: #EEF2FF;
  --success: #059669;
  --success-bg: #ECFDF5;
  --danger: #D6403F;
  --danger-bg: #FDECEC;
  --warning: #D97706;
  --info: #2563EB;
  --info-bg: #EFF6FF;
  --radius: 12px;
  --radius-sm: 8px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;

  /* Quick-action pastel tints — one hue per card, icon uses the darker shade */
  --tint-a-bg: #EEF2FF; --tint-a-fg: #4F46E5; /* lavender/indigo */
  --tint-b-bg: #EFF6FF; --tint-b-fg: #2563EB; /* blue */
  --tint-c-bg: #F5F3FF; --tint-c-fg: #7C3AED; /* violet */
  --tint-d-bg: #ECFDF5; --tint-d-fg: #059669; /* teal */
}

[data-theme="dark"] {
  --bg: #14161F;
  --surface: #1C1F2B;
  --border: #2B2F40;
  --text: #E8E9EE;
  --muted: #9298AC;
  --accent: #6366F1;
  --accent-dark: #818CF8;
  --accent-soft: #232646;
  --success: #34D399;
  --success-bg: #0F2A22;
  --danger: #F87171;
  --danger-bg: #2C1818;
  --warning: #FBBF24;
  --info: #60A5FA;
  --info-bg: #16243D;

  --tint-a-bg: #232646; --tint-a-fg: #818CF8;
  --tint-b-bg: #16243D; --tint-b-fg: #60A5FA;
  --tint-c-bg: #271F46; --tint-c-fg: #A78BFA;
  --tint-d-bg: #0F2A22; --tint-d-fg: #34D399;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn, .icon-btn { font-family: var(--sans); }

svg { display: block; }

/* ===== App shell: sidebar + topbar + content ===== */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.15s ease;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .brand-name { display: none; }
body.sidebar-collapsed .sidebar-header { justify-content: center; }
body.sidebar-collapsed .nav-item { justify-content: center; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4338CA, #7C3AED);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.brand-name {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }
body.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }

.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }

.nav-group { margin-bottom: 18px; }

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .nav-icon { flex-shrink: 0; color: var(--muted); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-item .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Main column ===== */

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 17px; font-weight: 700; }

.topbar-search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 360px; margin: 0 16px; padding: 7px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); }
.topbar-search input { border: none; background: none; outline: none; font-size: 13.5px; color: var(--text); width: 100%; padding: 0; }
.topbar-search input::placeholder { color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

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

.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
  padding: 8px;
  display: none;
  z-index: 20;
}
.dropdown.open .dropdown-menu { display: block; }

.dropdown-header { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-name { font-weight: 600; font-size: 13.5px; }
.dropdown-email { font-size: 12.5px; color: var(--muted); }

.dropdown-empty { padding: 16px 10px; text-align: center; color: var(--muted); font-size: 13px; }

.dropdown-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
}
.dropdown-item:hover { background: var(--bg); text-decoration: none; }

.page-content { padding: 24px; max-width: 100%; }
.page-inner { max-width: 920px; margin: 0 auto; }

/* ===== Top KPI stat tiles (the 8 metrics from the spec) ===== */

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

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-tile .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-tile .stat-value { font-size: 22px; font-weight: 700; }

/* ===== Hero + overview row ===== */

.dash-top-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .dash-top-row { grid-template-columns: 1fr; }
}

.hero {
  border-radius: var(--radius);
  background: linear-gradient(135deg, #4338CA 0%, #6D28D9 100%);
  color: #fff;
  padding: 32px 36px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.hero-main { display: flex; flex-direction: column; justify-content: center; }

.hero-widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  min-width: 220px;
}
.hero-widget-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.hero-widget-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-widget-quote { font-size: 12.5px; opacity: 0.85; font-style: italic; line-height: 1.5; border-top: 1px solid rgba(255,255,255,0.16); padding-top: 10px; margin-top: 2px; }
.hero-widget-quote-author { opacity: 0.7; font-style: normal; }

.hero-eyebrow { font-size: 13.5px; opacity: 0.85; margin: 0 0 4px; }
.hero-title { font-size: 24px; font-weight: 700; margin: 0 0 10px; }
.hero-desc { font-size: 14px; opacity: 0.9; max-width: 480px; margin: 0 0 22px; line-height: 1.5; }
.hero-actions { display: flex; gap: 10px; }

.hero .btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.hero .btn.primary { background: #fff; color: #4338CA; }
.hero .btn.primary:hover { background: #F3F4F6; }
.hero .btn.secondary { background: rgba(255,255,255,0.16); color: #fff; border-color: rgba(255,255,255,0.3); }
.hero .btn.secondary:hover { background: rgba(255,255,255,0.24); }

.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.overview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.overview-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.overview-title { font-weight: 700; font-size: 14.5px; }

.overview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.overview-row:last-of-type { border-bottom: none; }
.overview-row .label { color: var(--muted); display: flex; align-items: center; gap: 7px; }
.overview-row .value { font-weight: 700; font-size: 15px; }
.value.c-purple { color: var(--accent); }
.value.c-green { color: var(--success); }
.value.c-blue { color: var(--info); }
.value.c-orange { color: var(--warning); }

.overview-link { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; }

/* ===== Section headers, quick actions, tool list ===== */

.section-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.qa-card {
  display: block;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid transparent;
  transition: transform 0.1s ease;
}
.qa-card:hover { text-decoration: none; transform: translateY(-2px); }
.qa-card.tint-a { background: var(--tint-a-bg); }
.qa-card.tint-b { background: var(--tint-b-bg); }
.qa-card.tint-c { background: var(--tint-c-bg); }
.qa-card.tint-d { background: var(--tint-d-bg); }

.qa-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.6);
}
[data-theme="dark"] .qa-icon { background: rgba(255,255,255,0.06); }
.tint-a .qa-icon { color: var(--tint-a-fg); }
.tint-b .qa-icon { color: var(--tint-b-fg); }
.tint-c .qa-icon { color: var(--tint-c-fg); }
.tint-d .qa-icon { color: var(--tint-d-fg); }

.qa-title { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 3px; }
.qa-desc { font-size: 12.5px; color: var(--muted); }

.tool-category { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.tool-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.tool-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
}

.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
@media (max-width: 1000px) { .tool-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tool-row { grid-template-columns: 1fr; } }

.tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tool-card:hover { text-decoration: none; border-color: var(--accent); }
.tool-card .tool-icon { color: var(--accent); flex-shrink: 0; }

/* ===== Charts + widgets ===== */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.panel-title { font-weight: 700; font-size: 14px; margin: 0 0 4px; }
.panel-subtitle { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }

.help-steps {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  background: var(--bg);
}
.help-steps summary {
  cursor: pointer;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-steps summary::-webkit-details-marker { display: none; }
.help-steps summary::before { content: "❔"; font-size: 12px; }
.help-steps[open] summary::before { content: "▾"; }
.help-steps .help-steps-body { padding: 2px 16px 14px 16px; font-size: 13px; line-height: 1.6; }
.help-steps .help-steps-body ol { margin: 0 0 10px 18px; padding: 0; }
.help-steps .help-steps-body li { margin-bottom: 8px; }
.help-steps .help-steps-body p { margin: 0 0 10px; }
.help-steps .help-steps-note {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  margin-top: 8px;
}

.chart-empty {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  flex-direction: column;
  gap: 8px;
}
.chart-empty svg { color: var(--border); }

.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.widget-row:last-child { border-bottom: none; }
.widget-empty { padding: 28px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ===== Generic placeholder page (features not built yet) ===== */

.placeholder-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.placeholder-wrap h1 { font-size: 18px; margin: 0 0 8px; }
.placeholder-wrap p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ===== Shared form/table primitives (carried over from Phase 1) ===== */

.center-wrap { min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  width: 100%;
  max-width: 440px;
  padding: 36px 40px;
}

h1 { font-size: 20px; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.01em; }
.subtitle { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  background: var(--surface);
}

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 18px; }
.alert.danger { background: var(--danger-bg); color: #8A2A29; }
[data-theme="dark"] .alert.danger { color: var(--danger); }

.actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 6px; }
.actions:has(.btn-link:first-child) { justify-content: space-between; }

button[type="submit"], .btn.primary:not(.hero .btn) { background: var(--accent); color: #fff; }
button[type="submit"], a.btn.primary {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
}
button[type="submit"]:hover, a.btn.primary:hover { background: var(--accent-dark); }

.btn.secondary:not(.hero .btn) {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  display: inline-block;
  cursor: pointer;
}
.btn.secondary:not(.hero .btn):hover { border-color: var(--accent); text-decoration: none; }

.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; font-family: var(--sans); padding: 0; }
.btn-link:hover { text-decoration: underline; }
.inline-form { display: inline; }

.check-list { list-style: none; margin: 0 0 24px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.check-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.check-list li:last-child { border-bottom: none; }

.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.pill.ok { background: var(--success-bg); color: var(--success); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* ===== Phase 4: leads ===== */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.filter-bar .field { margin-bottom: 0; min-width: 140px; }
.filter-bar .field label { font-size: 11px; margin-bottom: 4px; }
.filter-bar input, .filter-bar select { padding: 7px 10px; font-size: 13px; }

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  white-space: nowrap;
}
.status-new { background: var(--info-bg); color: var(--info); }
.status-contacted { background: var(--accent-soft); color: var(--accent); }
.status-qualified { background: #F5F3FF; color: #7C3AED; }
[data-theme="dark"] .status-qualified { background: #271F46; color: #A78BFA; }
.status-proposal_sent, .status-negotiation { background: #FEF3C7; color: var(--warning); }
[data-theme="dark"] .status-proposal_sent, [data-theme="dark"] .status-negotiation { background: #3A2E0F; }
.status-won { background: var(--success-bg); color: var(--success); }
.status-lost { background: var(--danger-bg); color: var(--danger); }

.tag-pill {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  margin: 0 4px 4px 0;
}

.pagination { display: flex; gap: 6px; margin-top: 16px; align-items: center; font-size: 13px; color: var(--muted); }
.pagination a, .pagination span.current {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 6px; border: 1px solid var(--border); color: var(--text);
}
.pagination span.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a:hover { border-color: var(--accent); text-decoration: none; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-section { margin-bottom: 22px; }
.detail-section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 10px; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; font-size: 13.5px; }
.kv-grid .kv-label { color: var(--muted); font-size: 12px; }
.kv-grid .kv-value { font-weight: 500; word-break: break-word; }

.timeline-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline-item:last-child { border-bottom: none; }
.timeline-item .timeline-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.note-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.note-item:last-child { border-bottom: none; }
.note-item .note-meta { color: var(--muted); font-size: 12px; margin-bottom: 3px; }

textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 70px;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); background: var(--surface); }

.inline-select-form { display: flex; gap: 8px; align-items: center; }
.inline-select-form select { width: auto; }

/* ===== Phase 5: form builder ===== */

.builder-layout { max-width: 760px; }

.builder-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.builder-field-list { min-height: 12px; margin-bottom: 14px; }

.field-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 8px;
  cursor: default;
}

.drag-handle { cursor: grab; color: var(--muted); letter-spacing: -2px; user-select: none; }
.drag-handle:active { cursor: grabbing; }

.field-type-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}

.field-card-label { flex: 1; font-size: 13.5px; font-weight: 500; }
.field-card .ff-required { color: var(--danger); }

.field-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.palette-btn {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.palette-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Phase 6: form tabs, embed, settings ===== */

.form-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.form-tab {
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.form-tab:hover { color: var(--text); text-decoration: none; }
.form-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.settings-section { margin-bottom: 24px; }
.settings-section-title { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.settings-section-desc { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }

.embed-block { margin-bottom: 22px; }
.embed-block-title { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.code-block {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.stats-inline { display: flex; gap: 24px; margin-bottom: 20px; }
.stats-inline .stat-tile { flex: 1; }

.rr-checklist { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.rr-checklist label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; }
.rr-checklist input { width: auto; }

/* ===== Phase 5: public-facing form rendering ===== */

.public-form-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.public-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  width: 100%;
  max-width: 560px;
  padding: 36px 40px;
}

.public-form-head { margin-bottom: 22px; }
.public-form-head h1 { font-size: 21px; }
.public-form-head p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.public-form-footer { margin-top: 18px; color: var(--muted); font-size: 12px; }

/* ===== Phase 12 follow-up: real calendar-grid booking widget ===== */

.booking-wrap { max-width: 760px; }
.booking-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  padding: 32px;
}
.booking-head { margin-bottom: 18px; }
.booking-head h1 { font-size: 22px; margin: 0; }
.booking-desc { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.booking-meta { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.booking-loading { padding: 32px 0; text-align: center; color: var(--muted); font-size: 13px; }

.booking-picker {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 640px) {
  .booking-picker { grid-template-columns: 1fr; }
}

.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-month-label { font-weight: 700; font-size: 15px; }
.cal-nav-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 32px; height: 32px; cursor: pointer; color: var(--text); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav-btn:hover { background: var(--bg); }
.cal-nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.calendar-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 6px;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1; border: none; background: none; border-radius: 8px;
  font-size: 13px; cursor: pointer; color: var(--text);
}
.cal-day-blank { visibility: hidden; }
.cal-day-unavailable { color: var(--border); cursor: default; }
.cal-day-available { font-weight: 600; }
.cal-day-available:hover { background: var(--accent-soft); }
.cal-day-available:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-day-selected, .cal-day-selected:hover { background: var(--accent); color: #fff; }

.cal-timezone { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.cal-timezone strong { color: var(--text); font-size: 13px; }

.booking-times-panel { border-left: 1px solid var(--border); padding-left: 24px; }
@media (max-width: 640px) {
  .booking-times-panel { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 18px; }
}
.times-heading { font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.times-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.time-slot-btn { width: 100%; text-align: center; }

.booking-details-form .form-step-actions { justify-content: flex-start; }

@media (prefers-reduced-motion: reduce) {
  .cal-day, .cal-nav-btn { transition: none; }
}

.progress-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.progress-bar-fill { height: 100%; background: var(--accent); transition: width 0.2s ease; }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

.form-step { display: none; border: none; padding: 0; margin: 0; }
.form-step.active { display: block; }
.form-step-title { font-size: 16px; margin: 0 0 16px; }
.form-step-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ===== Phase 11: Conversational/Typeform-style layout ===== */

.public-form-conversational { padding: 0; }
.public-form-conversational .public-form-card {
  max-width: 640px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  border: none;
  box-shadow: none;
  background: transparent;
}
.public-form-conversational .progress-bar { max-width: 640px; margin: 0 auto 8px; }
.public-form-conversational .progress-label { text-align: center; margin-bottom: 28px; }
.public-form-conversational .public-form-head { text-align: center; }
.public-form-conversational .public-form-head h1 { font-size: 26px; }

.conversational-page { animation: lac-page-in 0.35s ease; }
.conversational-page .ff-label { font-size: 24px; font-weight: 700; line-height: 1.3; margin-bottom: 16px; display: block; }
.conversational-page .ff-field { margin-bottom: 0; }
.conversational-page input[type="text"],
.conversational-page input[type="email"],
.conversational-page input[type="tel"],
.conversational-page input[type="url"],
.conversational-page input[type="number"],
.conversational-page textarea,
.conversational-page select {
  font-size: 19px;
  padding: 14px 4px;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.conversational-page input:focus,
.conversational-page textarea:focus,
.conversational-page select:focus {
  border-bottom-color: var(--accent);
  box-shadow: none;
  outline: none;
}
.conversational-page .form-step-actions { justify-content: flex-start; margin-top: 28px; }
.conversational-page .btn.primary { padding: 12px 28px; font-size: 15px; }

@keyframes lac-page-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.ff-field { margin-bottom: 18px; }
.ff-field.ff-width-half { display: inline-block; width: calc(50% - 8px); }
.ff-field.ff-width-third { display: inline-block; width: calc(33.333% - 8px); }
.ff-field.ff-width-half:nth-child(odd), .ff-field.ff-width-third { margin-right: 12px; }

.ff-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.ff-required { color: var(--danger); }
.ff-help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ff-heading { font-size: 16px; margin: 22px 0 12px; }
.ff-heading:first-child { margin-top: 0; }

.ff-field input[type="text"], .ff-field input[type="email"], .ff-field input[type="tel"],
.ff-field input[type="number"], .ff-field input[type="url"], .ff-field input[type="date"],
.ff-field input[type="time"], .ff-field input[type="file"], .ff-field select, .ff-field textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.ff-field input:focus, .ff-field select:focus, .ff-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); background: var(--surface);
}

.ff-choice-group { display: flex; flex-direction: column; gap: 8px; }
.ff-choice { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 400; cursor: pointer; }
.ff-choice input { width: auto; }
.ff-terms { font-size: 13px; }

.ff-rating { display: flex; gap: 6px; }
.ff-rating-item { cursor: pointer; }
.ff-rating-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.ff-rating-item span {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.ff-rating-item input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
