/* ============================================================================
   216 AI Business Co-Pilot — Design System
   Brand: Navy #003052 | Orange #FCA63D | Beige #EDE8E3
   Fonts: Rozha One (headings) | Raleway (body)
   ============================================================================ */

:root {
  --bg: #EDE8E3;
  --surface: #F5F1EC;
  --surface2: #FFFFFF;
  --border: #D5CEC6;
  --border-subtle: #E2DBD4;

  --navy: #003052;
  --navy-light: #0A4A7A;
  --navy-muted: #1A5580;
  --text: #003052;
  --text-secondary: #2D5070;
  --subtext: #5A7A94;
  --muted: #8AA0B0;

  --orange: #FCA63D;
  --orange-hover: #E8912A;
  --orange-light: rgba(252, 166, 61, 0.15);
  --orange-subtle: rgba(252, 166, 61, 0.08);

  --green: #2E7D32;
  --green-bg: rgba(46, 125, 50, 0.10);
  --amber: #B45309;
  --amber-bg: rgba(180, 83, 9, 0.10);
  --red: #C0392B;
  --red-bg: rgba(192, 57, 43, 0.10);

  --font: 'Raleway', sans-serif;
  --font-heading: 'Rozha One', serif;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --shadow: 0 1px 4px rgba(0, 48, 82, 0.08);
  --shadow-md: 0 2px 12px rgba(0, 48, 82, 0.10);
  --shadow-lg: 0 4px 24px rgba(0, 48, 82, 0.12);

  --sidebar-width: 240px;
  --transition: 0.18s ease;
}

/* ── Base ────────────────────────────────────────────────────────────────── */

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

h1, h2, h3 { font-family: var(--font-heading); font-weight: 400; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--orange); }

/* ── Layout ──────────────────────────────────────────────────────────────── */

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .wordmark {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: white;
  display: block;
  line-height: 1.1;
}

.sidebar-logo .tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
  font-family: var(--font);
  font-weight: 600;
}

.sidebar-member {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}

.member-info .name {
  font-size: 13px;
  font-weight: 600;
  color: white;
  line-height: 1.2;
}

.member-info .phase {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  text-transform: capitalize;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.30);
  padding: 16px 20px 6px;
  font-family: var(--font);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-family: var(--font);
}

.nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  color: white;
  background: rgba(252, 166, 61, 0.12);
  border-left-color: var(--orange);
}

.nav-item .icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 12px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.logout-btn {
  font-size: 12px;
  color: rgba(255,255,255,0.40);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  padding: 4px 0;
  transition: color var(--transition);
}
.logout-btn:hover { color: rgba(255,255,255,0.70); }

/* Main content area */
.main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 32px;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--subtext);
}

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

.card {
  background: var(--surface2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--subtext);
  margin-bottom: 16px;
  font-family: var(--font);
}

.card-heading {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 16px;
}

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

.form-group {
  margin-bottom: 16px;
}

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

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 48, 82, 0.08);
}

input::placeholder, textarea::placeholder { color: var(--muted); }

textarea { resize: vertical; min-height: 80px; }

/* Checkbox row */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 8px;
  user-select: none;
}

.check-row:hover { border-color: var(--navy); background: var(--surface); }
.check-row.checked { border-color: var(--green); background: var(--green-bg); }

.check-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--green);
  flex-shrink: 0;
}

.check-row span { font-size: 14px; font-weight: 500; }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--orange);
  color: var(--navy);
}
.btn-primary:hover { background: var(--orange-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-navy {
  background: var(--navy);
  color: white;
}
.btn-navy:hover { background: var(--navy-light); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); background: var(--surface); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Metrics grid ────────────────────────────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-input-group {
  display: flex;
  flex-direction: column;
}

.metric-input-group label {
  font-size: 12px;
  color: var(--subtext);
  margin-bottom: 4px;
}

/* Section divider */
.section-divider {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtext);
  padding: 20px 0 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  font-family: var(--font);
}

/* ── 4-week summary table ────────────────────────────────────────────────── */

.weeks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.weeks-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--subtext);
  border-bottom: 2px solid var(--border);
  background: var(--surface);
}

.weeks-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.weeks-table tr:last-child td { border-bottom: none; }
.weeks-table tr:hover td { background: var(--surface); }

.weeks-table .week-label {
  font-weight: 600;
  color: var(--navy);
}

.weeks-table .current-week td { background: var(--orange-subtle); }

/* Target indicator */
.target-cell { display: flex; align-items: center; gap: 6px; }
.target-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.target-dot.green { background: var(--green); }
.target-dot.amber { background: #F59E0B; }
.target-dot.red { background: var(--red); }

/* ── RAG badge ───────────────────────────────────────────────────────────── */

.rag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.rag.green { background: var(--green-bg); color: var(--green); }
.rag.amber { background: var(--amber-bg); color: var(--amber); }
.rag.red { background: var(--red-bg); color: var(--red); }

/* ── Stat cards ──────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--subtext);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  color: var(--navy);
  line-height: 1;
}

.stat-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Week selector ───────────────────────────────────────────────────────── */

.week-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.week-selector label {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.week-selector input[type="date"] {
  width: auto;
}

/* ── Login screen ────────────────────────────────────────────────────────── */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 20px;
}

.login-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand .title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--navy);
  display: block;
}

.login-brand .sub {
  font-size: 13px;
  color: var(--subtext);
  margin-top: 4px;
  font-weight: 500;
}

.login-divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 20px 0;
  position: relative;
}

.login-divider::before, .login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

/* ── Coming soon ─────────────────────────────────────────────────────────── */

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--subtext);
}

.coming-soon .icon { font-size: 48px; margin-bottom: 16px; }
.coming-soon h3 { font-family: var(--font-heading); color: var(--navy); margin-bottom: 8px; }
.coming-soon p { font-size: 14px; max-width: 320px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; z-index: 100; height: 100vh; }
  .page { padding: 20px 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .weeks-table { font-size: 12px; }
  .weeks-table th, .weeks-table td { padding: 7px 8px; }
}

/* ── Animations ──────────────────────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.22s ease forwards; }

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

@keyframes celebrate {
  0%   { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(46, 125, 50, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

.celebrate { animation: celebrate 0.6s ease; }

/* ── Toasts ──────────────────────────────────────────────────────────────── */

#toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  animation: fadeIn 0.2s ease;
}

.toast.error { background: var(--red); }

/* ── Phase progress (sidebar) ────────────────────────────────────────────── */

.phase-progress {
  padding: 10px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.phase-progress-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  margin-bottom: 8px;
  font-family: var(--font);
}

.phase-progress-track {
  display: flex;
  gap: 3px;
  margin-bottom: 5px;
}

.phase-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.10);
  transition: background var(--transition);
}

.phase-segment.done   { background: rgba(252, 166, 61, 0.45); }
.phase-segment.active { background: var(--orange); }

.phase-progress-name {
  font-size: 11px;
  color: var(--orange);
  font-weight: 700;
  text-transform: capitalize;
  font-family: var(--font);
  letter-spacing: 0.03em;
}

/* ── Week command card (dashboard) ───────────────────────────────────────── */

.week-command-card {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.week-command-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.week-label-small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  font-family: var(--font);
}

.streak-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  background: rgba(252, 166, 61, 0.15);
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font);
}

.week-command-card .page-title { color: white; }
.week-command-card .page-subtitle { color: rgba(255,255,255,0.55); }

/* ── Hero stat row (dashboard) ───────────────────────────────────────────── */

.hero-stat-row {
  display: flex;
  align-items: stretch;
  background: var(--surface2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px 0;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hero-stat {
  flex: 1;
  text-align: center;
  padding: 0 16px;
}

.hero-stat-number {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--navy);
  line-height: 1;
}

.hero-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 7px;
  font-family: var(--font);
}

.hero-stat-divider {
  width: 1px;
  background: var(--border-subtle);
  flex-shrink: 0;
  margin: 4px 0;
}

/* ── Chat ────────────────────────────────────────────────────────────────── */

.chat-sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 16px 12px;
  overflow-y: auto; display: flex; flex-direction: column;
}
.chat-convo-list { flex: 1; overflow-y: auto; }
.chat-convo-item {
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  margin-bottom: 2px; position: relative; font-size: 13px;
}
.chat-convo-item:hover { background: var(--border-subtle); }
.chat-convo-item.active { background: rgba(10,74,122,0.08); }
.chat-convo-title { font-weight: 600; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 20px; }
.chat-convo-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.chat-convo-delete { position: absolute; top: 8px; right: 6px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; opacity: 0; }
.chat-convo-item:hover .chat-convo-delete { opacity: 1; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 20px 10px; display: flex;
  flex-direction: column; gap: 16px;
}
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 40px;
}
.chat-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 80%; }
.chat-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-assistant { align-self: flex-start; }
.chat-msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: white; display: flex;
  align-items: center; justify-content: center; font-size: 13px;
  font-weight: 700; flex-shrink: 0;
}
.chat-msg-avatar-user { background: var(--orange); color: var(--navy); }
.chat-msg-bubble {
  padding: 10px 14px; border-radius: 12px; font-size: 14px;
  line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.chat-msg-assistant .chat-msg-bubble { background: var(--surface); color: var(--text); border: 1px solid var(--border-subtle); }
.chat-msg-user .chat-msg-bubble { background: var(--navy); color: white; }
.chat-msg-error { background: rgba(220,38,38,0.06) !important; border-color: var(--red) !important; color: var(--red) !important; }
.chat-msg-thinking {
  display: flex; align-items: center; gap: 8px;
  color: var(--subtext); font-size: 13px; font-style: italic;
}

.chat-input-area {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.chat-input {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 14px; font-family: var(--font);
  line-height: 1.5; max-height: 120px; overflow-y: auto;
}
.chat-input:focus { border-color: var(--navy-light); outline: none; }
.chat-send-btn { padding: 10px 16px; font-size: 16px; border-radius: 8px; }

/* ── Lessons ─────────────────────────────────────────────────────────────── */

.lesson-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; margin-bottom: 2px;
  transition: background 0.15s;
}
.lesson-item:hover { background: var(--border-subtle); }
.lesson-selected { background: rgba(10,74,122,0.08) !important; }
.lesson-next { border-left: 3px solid var(--navy-light); }
.lesson-done { opacity: 0.6; }
.lesson-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--green); flex-shrink: 0;
}
.lesson-done .lesson-check { background: var(--green); color: white; border-color: var(--green); }
.lesson-next .lesson-check { border-color: var(--navy-light); color: var(--navy-light); }
.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-size: 13px; font-weight: 600; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }

.lesson-content { font-size: 14px; line-height: 1.8; color: var(--text); }
.lesson-content h1 { font-size: 20px; font-weight: 700; color: var(--navy); margin: 20px 0 10px; }
.lesson-content h2 { font-size: 17px; font-weight: 700; color: var(--navy); margin: 18px 0 8px; }
.lesson-content h3 { font-size: 15px; font-weight: 700; color: var(--navy); margin: 14px 0 6px; }
.lesson-content ul { padding-left: 20px; margin: 8px 0; }
.lesson-content li { margin-bottom: 4px; }
.lesson-content a { color: var(--navy-light); }
.lesson-content strong { color: var(--navy); }

/* ── Admin analytics ─────────────────────────────────────────────────────── */

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

.admin-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: var(--font);
  margin-bottom: 12px;
}

.member-card {
  background: var(--surface2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}

.member-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.member-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.member-key-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.member-stat { text-align: center; }

.member-stat-value {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--navy);
  line-height: 1;
}

.member-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
  font-family: var(--font);
}

.member-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .hero-stat-row { flex-wrap: wrap; }
  .hero-stat { min-width: 50%; padding: 12px 16px; }
  .hero-stat-divider { display: none; }
  .admin-grid { grid-template-columns: 1fr; }
  .member-key-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Framework Audit ─────────────────────────────────────────────────────── */

.month-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.month-display {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  min-width: 160px;
  text-align: center;
  font-family: var(--font);
}

/* Overall score card */
.audit-score-card {
  background: var(--surface2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.audit-score-left { flex-shrink: 0; text-align: center; }

.audit-score-number {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  line-height: 1;
}

.audit-score-denom {
  font-family: var(--font);
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 500;
}

.audit-score-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
  font-family: var(--font);
}

.audit-score-bar-wrap {
  flex: 1;
}

.audit-score-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.audit-score-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.audit-score-breakdown {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-family: var(--font);
}

.audit-score-breakdown span { font-weight: 600; }

/* History strip */
.audit-history-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 24px;
  scrollbar-width: none;
}

.audit-history-strip::-webkit-scrollbar { display: none; }

.audit-month-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  min-width: 80px;
}

.audit-month-chip:hover { border-color: var(--navy); }
.audit-month-chip.active { border-color: var(--navy); background: var(--navy); }
.audit-month-chip.active .chip-month { color: rgba(255,255,255,0.7); }
.audit-month-chip.active .chip-score { color: white; }

.chip-month {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--subtext);
  margin-bottom: 3px;
  font-family: var(--font);
}

.chip-score {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--navy);
}

/* Section card */
.audit-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.audit-section-score {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font);
}

/* Item rows */
.audit-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.audit-item-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--subtext);
  flex-shrink: 0;
  font-family: var(--font);
}

.audit-item-text {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.4;
}

/* RAG toggle */
.rag-toggle {
  display: flex;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.rag-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  background: var(--bg);
  color: var(--muted);
  transition: all var(--transition);
  font-family: var(--font);
  letter-spacing: 0.02em;
}

.rag-btn:not(:last-child) { border-right: 1px solid var(--border); }
.rag-btn:hover { background: var(--surface); color: var(--text); }

.rag-btn-red.selected    { background: var(--red);    color: white; }
.rag-btn-amber.selected  { background: #F59E0B;        color: white; }
.rag-btn-green.selected  { background: var(--green);   color: white; }

@media (max-width: 768px) {
  .audit-score-card { flex-direction: column; gap: 16px; align-items: flex-start; }
  .audit-item-row { flex-wrap: wrap; gap: 10px; }
}

/* ============================================================================
   Monthly Plan (Tab 19)
   ============================================================================ */

.plan-hint {
  font-size: 12px;
  color: var(--subtext);
  margin-bottom: 16px;
  line-height: 1.5;
}

.plan-field {
  margin-bottom: 16px;
}
.plan-field:last-child { margin-bottom: 0; }

.plan-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Priority card — stands out from regular cards */
.plan-priority-card {
  border-left: 4px solid var(--red);
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.plan-priority-eyebrow {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
  margin-bottom: 6px;
}

.plan-priority-hint {
  font-size: 12px;
  color: var(--subtext);
  margin-bottom: 12px;
  line-height: 1.5;
}

.plan-priority-input {
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  border: 2px solid var(--red) !important;
  border-radius: 8px;
  padding: 12px 14px;
  background: white;
  resize: vertical;
  line-height: 1.5;
  box-sizing: border-box;
}
.plan-priority-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

/* Footer row — note + save button */
.plan-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 4px;
}

.plan-footer-note {
  font-size: 12px;
  color: var(--subtext);
  font-style: italic;
}

/* ============================================================================
   Revenue / P&L (Tab 21)
   ============================================================================ */

/* Year overview strip */
.rev-year-strip { padding: 16px 20px; }

.rev-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.rev-year-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtext);
}

.rev-year-totals { font-size: 13px; }

.rev-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 64px;
}

.rev-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.rev-bar-col.future { cursor: default; }
.rev-bar-col.active .rev-bar-label { color: var(--navy); font-weight: 700; }

.rev-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rev-bar-fill {
  width: 70%;
  min-height: 0;
  border-radius: 3px 3px 0 0;
  transition: height 0.2s ease;
}

.rev-bar-label {
  font-size: 9px;
  color: var(--subtext);
  text-transform: uppercase;
}

/* P&L summary equation row */
.rev-summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.rev-summary-item {
  flex: 1;
  min-width: 80px;
  text-align: center;
}

.rev-summary-net { min-width: 100px; }

.rev-summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtext);
  margin-bottom: 4px;
}

.rev-summary-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.rev-summary-margin {
  font-size: 11px;
  font-weight: 600;
  margin-top: 3px;
}

.rev-summary-divider {
  font-size: 18px;
  color: var(--muted);
  font-weight: 300;
  flex-shrink: 0;
  align-self: center;
  padding-bottom: 8px;
}

/* Section cards */
.rev-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.rev-section-total {
  font-size: 18px;
  font-weight: 700;
}

.rev-fields { display: flex; flex-direction: column; gap: 10px; }

.rev-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rev-field-label {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.rev-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  width: 120px;
  flex-shrink: 0;
}
.rev-input-wrap:focus-within {
  border-color: var(--navy);
  background: white;
}

.rev-currency {
  font-size: 13px;
  color: var(--subtext);
  font-weight: 600;
  flex-shrink: 0;
}

.rev-input {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  width: 80px;
  text-align: right;
}
.rev-input:focus { outline: none; box-shadow: none !important; }
.rev-input::-webkit-inner-spin-button,
.rev-input::-webkit-outer-spin-button { -webkit-appearance: none; }

@media (max-width: 600px) {
  .rev-summary-row { gap: 6px; padding: 12px; }
  .rev-summary-value { font-size: 14px; }
  .rev-summary-divider { font-size: 14px; }
  .rev-bar-chart { height: 48px; }
}

/* ============================================================================
   Milestones (Tab 01)
   ============================================================================ */

/* Overall progress card */
.ms-progress-card { padding: 16px 20px; margin-bottom: 16px; }

.ms-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ms-progress-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtext);
}

.ms-progress-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.ms-progress-track {
  height: 8px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
}

.ms-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy) 0%, var(--green) 100%);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* Timeline */
.ms-timeline { display: flex; flex-direction: column; }

.ms-phase {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}

.ms-phase-future { opacity: 0.55; }
.ms-phase-current .ms-phase-label { color: var(--navy); }

/* Phase header row */
.ms-phase-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0 8px;
}

/* Dot + connecting line */
.ms-phase-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 32px;
}

.ms-phase-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--subtext);
  flex-shrink: 0;
  z-index: 1;
}

.ms-phase-dot.current {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.ms-phase-dot.done {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.ms-phase-line {
  width: 2px;
  flex: 1;
  min-height: 16px;
  background: var(--border);
  margin-top: 2px;
}

.ms-phase-meta { flex: 1; padding-top: 4px; }

.ms-phase-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 2px;
}

.ms-phase-subtitle {
  font-size: 11px;
  color: var(--subtext);
}

.ms-phase-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--subtext);
  flex-shrink: 0;
  padding-top: 6px;
}
.ms-phase-count.done { color: var(--green); }

/* Milestone items */
.ms-items {
  margin-left: 44px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
}

.ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  transition: background 0.15s;
}

.ms-item:hover { background: #f0f4ff; }
.ms-item-done { background: #f0fdf4; }
.ms-item-done:hover { background: #dcfce7; }

.ms-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.ms-checkbox:hover { border-color: var(--navy); }
.ms-checkbox.checked {
  background: var(--green);
  border-color: var(--green);
}

.ms-item-label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.ms-item-done .ms-item-label {
  color: var(--subtext);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.ms-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ms-item-link {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.ms-item-link:hover {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.ms-circle-link {
  color: var(--subtext);
  border-color: var(--border);
}
.ms-circle-link:hover {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
}

/* ============================================================================
   Quick Access toolbar
   ============================================================================ */

.qa-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.qa-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.qa-btn:hover {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(10,37,64,0.15);
}
.qa-btn:hover .qa-icon { filter: grayscale(0); }

.qa-icon { font-size: 14px; }

.qa-label { white-space: nowrap; }

@media (max-width: 600px) {
  .qa-bar { gap: 6px; }
  .qa-btn { padding: 6px 10px; font-size: 11px; }
  .ms-item-actions { flex-direction: column; gap: 4px; }
}
