/* ─────────────────────────────────────────────
   Heritance Advisor Platform – Stylesheet
   ───────────────────────────────────────────── */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:        #0F1C2E;
  --navy-dark:   #090f18;
  --navy-mid:    #0d1826;
  --navy-light:  #162840;
  --navy-border: #1E3A5F;
  --navy-hover:  #1a3352;
  --gold:        #C9973A;
  --gold-light:  #e8b04a;
  --gold-dim:    rgba(201,151,58,0.15);
  --white:       #FFFFFF;
  --text:        #e8eef6;
  --text-muted:  #7a9bbf;
  --text-dim:    #4a6a8a;
  --red:         #e05252;
  --amber:       #E8A020;
  --green:       #3dbf7a;
  --sidebar-w:   260px;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.35);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.2);
  font-size: 15px;
}

html, body {
  height: 100%;
  background: var(--navy);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy-dark); }
::-webkit-scrollbar-thumb { background: var(--navy-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ─────────────────────────────────────────────
   LAYOUT
   ───────────────────────────────────────────── */

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy-dark);
  border-right: 1px solid var(--navy-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--navy-border);
}

.sidebar-logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--white);
}

.sidebar-logo span {
  color: var(--gold);
}

.sidebar-tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 24px 6px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-link:hover {
  background: var(--navy-hover);
  color: var(--text);
  border-left-color: var(--navy-border);
}

.nav-link.active {
  background: var(--gold-dim);
  color: var(--gold);
  border-left-color: var(--gold);
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
}

.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--navy-border);
}

.sidebar-advisor {
  margin-bottom: 14px;
}

.advisor-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.advisor-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background: rgba(224,82,82,0.1);
  border-color: var(--red);
  color: var(--red);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 36px 40px;
  max-width: 1200px;
  width: 100%;
}

/* ─────────────────────────────────────────────
   PAGE HEADER
   ───────────────────────────────────────────── */

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

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ─────────────────────────────────────────────
   FLASH MESSAGES
   ───────────────────────────────────────────── */

.flash-messages {
  padding: 0 40px;
  padding-top: 24px;
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 8px;
  background: rgba(201,151,58,0.12);
  border: 1px solid rgba(201,151,58,0.3);
  color: var(--gold-light);
}

.flash.error {
  background: rgba(224,82,82,0.1);
  border-color: rgba(224,82,82,0.3);
  color: #f08080;
}

/* ─────────────────────────────────────────────
   STAT CARDS  (summary bar)
   ───────────────────────────────────────────── */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: rgba(201,151,58,0.3); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ─────────────────────────────────────────────
   SECTION HEADERS  (Morning Briefing)
   ───────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 32px;
}

.section-header:first-of-type { margin-top: 0; }

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-badge.urgent {
  background: rgba(224,82,82,0.12);
  border: 1px solid rgba(224,82,82,0.3);
  color: #f08080;
}

.section-badge.this-month {
  background: rgba(232,160,32,0.12);
  border: 1px solid rgba(232,160,32,0.3);
  color: var(--amber);
}

.section-badge.wins {
  background: rgba(61,191,122,0.1);
  border: 1px solid rgba(61,191,122,0.25);
  color: var(--green);
}

.section-count {
  font-size: 13px;
  color: var(--text-dim);
}

/* ─────────────────────────────────────────────
   BRIEFING CARDS
   ───────────────────────────────────────────── */

.briefing-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.briefing-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.briefing-card:hover {
  border-color: rgba(201,151,58,0.35);
  box-shadow: var(--shadow-sm);
}

.briefing-card.urgent-card {
  border-left: 3px solid var(--red);
}

.briefing-card.month-card {
  border-left: 3px solid var(--amber);
}

.briefing-card.win-card {
  border-left: 3px solid var(--green);
}

.briefing-household {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
}

.briefing-client {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.briefing-reason {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.briefing-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-dim);
  padding: 6px 12px;
  border-radius: 6px;
}

.briefing-action.win-action {
  color: var(--green);
  background: rgba(61,191,122,0.08);
}

.briefing-meta {
  text-align: right;
  flex-shrink: 0;
}

.risk-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.risk-HIGH  { background: rgba(224,82,82,0.15);  color: #f08080;  border: 1px solid rgba(224,82,82,0.25); }
.risk-MEDIUM{ background: rgba(232,160,32,0.12); color: var(--amber); border: 1px solid rgba(232,160,32,0.25); }
.risk-LOW   { background: rgba(61,191,122,0.1);  color: var(--green); border: 1px solid rgba(61,191,122,0.2); }

.briefing-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  margin-top: 8px;
  line-height: 1;
}

.briefing-score-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─────────────────────────────────────────────
   HOUSEHOLDS TABLE
   ───────────────────────────────────────────── */

.table-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 4px;
}

.sort-btn {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--navy-border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}

.sort-btn:hover {
  background: var(--navy-hover);
  color: var(--text);
}

.sort-btn.active {
  background: var(--gold-dim);
  border-color: rgba(201,151,58,0.4);
  color: var(--gold);
}

.table-wrap {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 14px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--navy-mid);
  text-align: left;
  border-bottom: 1px solid var(--navy-border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(30,58,95,0.5);
  cursor: pointer;
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--navy-hover); }

tbody td {
  padding: 14px 18px;
  font-size: 14px;
  vertical-align: middle;
}

.td-household {
  font-weight: 600;
  color: var(--white);
}

.td-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.td-aum {
  font-weight: 600;
  color: var(--gold);
  font-size: 15px;
}

.td-score {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ─────────────────────────────────────────────
   HOUSEHOLD DETAIL
   ───────────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.detail-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--navy-border);
}

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.field-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.field-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.field-value.gold { color: var(--gold); font-weight: 700; }

/* ── Risk Breakdown ── */
.risk-detail-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.risk-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.score-item {
  text-align: center;
}

.score-number {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.score-number.good { color: var(--green); }
.score-number.warn { color: var(--amber); }
.score-number.danger { color: var(--red); }
.score-number.gold { color: var(--gold); }

.score-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.score-bar-wrap {
  margin-top: 8px;
}

.score-bar {
  height: 4px;
  background: var(--navy-border);
  border-radius: 2px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.fill-good   { background: var(--green); }
.fill-warn   { background: var(--amber); }
.fill-danger { background: var(--red); }
.fill-gold   { background: var(--gold); }

.risk-explanation {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  padding-top: 16px;
  border-top: 1px solid var(--navy-border);
}

/* ── Recommended Action ── */
.action-card {
  background: rgba(201,151,58,0.06);
  border: 1px solid rgba(201,151,58,0.25);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.action-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 10px;
}

.action-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

/* ── Engagement Timeline ── */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--navy-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy-border);
  border: 2px solid var(--navy-light);
}

.timeline-item.heir-present::before {
  background: var(--green);
  border-color: var(--navy-light);
}

.timeline-date {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.timeline-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.timeline-heir-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--green);
  background: rgba(61,191,122,0.08);
  border: 1px solid rgba(61,191,122,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
}

/* ── Notes ── */
.notes-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.notes-form {
  margin-bottom: 20px;
}

.notes-textarea {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 16px;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
  outline: none;
}

.notes-textarea:focus {
  border-color: var(--gold);
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--gold);
  color: var(--navy-dark);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--gold-light); }

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.note-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.note-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.notes-empty {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  padding: 8px 0;
}

/* ─────────────────────────────────────────────
   PRIORITY ACTIONS
   ───────────────────────────────────────────── */

.priority-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.priority-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 20px;
  align-items: center;
  transition: border-color 0.2s;
  text-decoration: none;
  color: inherit;
}

.priority-card:hover { border-color: rgba(201,151,58,0.3); }

.priority-card.rank-1 { border-left: 3px solid var(--red); }
.priority-card.rank-2 { border-left: 3px solid var(--red); }
.priority-card.rank-3 { border-left: 3px solid var(--amber); }

.priority-rank {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
  line-height: 1;
}

.priority-household {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 3px;
}

.priority-heir {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.priority-action-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.priority-right {
  text-align: right;
  flex-shrink: 0;
  min-width: 110px;
}

.priority-revenue {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.priority-revenue-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* ─────────────────────────────────────────────
   SETTINGS
   ───────────────────────────────────────────── */

.settings-section {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  max-width: 560px;
}

.settings-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--navy-border);
}

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

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus { border-color: var(--gold); }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────── */

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

.login-card {
  width: 100%;
  max-width: 420px;
}

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

.login-logo {
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
}

.login-logo span { color: var(--gold); }

.login-tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-form-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 24px;
}

.login-error {
  background: rgba(224,82,82,0.1);
  border: 1px solid rgba(224,82,82,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #f08080;
  margin-bottom: 16px;
}

.login-input {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}

.login-input:focus { border-color: var(--gold); }
.login-input::placeholder { color: var(--text-dim); }

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: var(--navy-dark);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s;
  margin-top: 4px;
}

.login-btn:hover { background: var(--gold-light); }

.login-hint {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--navy-border);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}

.login-hint strong { color: var(--text-muted); }

/* ─────────────────────────────────────────────
   BACK LINK
   ───────────────────────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--gold); }

/* ─────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────── */

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ─────────────────────────────────────────────
   MOBILE MENU TOGGLE
   ───────────────────────────────────────────── */

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--navy-dark);
  border-bottom: 1px solid var(--navy-border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.mobile-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.mobile-logo span { color: var(--gold); }

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.25s;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */

@media (max-width: 1024px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .risk-scores { grid-template-columns: repeat(3, 1fr); }
  .page-content { padding: 28px 28px; }
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100%;
    transition: left 0.3s ease;
    z-index: 200;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    width: 100%;
  }

  .page-content {
    padding: 20px 16px;
  }

  .stats-bar {
    grid-template-columns: 1fr 1fr;
  }

  .stats-bar .stat-card:last-child {
    grid-column: 1 / -1;
  }

  .risk-scores {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .briefing-card {
    grid-template-columns: 1fr;
  }

  .briefing-meta {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .priority-card {
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
  }

  .priority-right {
    grid-column: 2;
    text-align: left;
  }

  .page-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table { min-width: 650px; }
}

/* ─────────────────────────────────────────────
   AGE GAP SCORING  (new in v2)
   ───────────────────────────────────────────── */

/* Tag shown next to heir age in the profile card */
.age-gap-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.age-gap-tag.large {
  background: rgba(232,160,32,0.12);
  border: 1px solid rgba(232,160,32,0.3);
  color: var(--amber);
}

.age-gap-tag.extreme {
  background: rgba(224,82,82,0.12);
  border: 1px solid rgba(224,82,82,0.3);
  color: #f08080;
}

/* Action row inside the recommended action card */
.age-gap-action-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(201,151,58,0.2);
  font-size: 13px;
  color: var(--amber);
  line-height: 1.5;
}

.age-gap-action-row svg { flex-shrink: 0; margin-top: 2px; }

/* Age gap flag on morning briefing cards */
.briefing-age-gap-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--amber);
  background: rgba(232,160,32,0.08);
  border: 1px solid rgba(232,160,32,0.2);
  padding: 5px 10px;
  border-radius: 6px;
  margin-top: 8px;
  line-height: 1.4;
}

/* Age gap flag on priority actions */
.priority-age-gap-flag {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--amber);
  background: rgba(232,160,32,0.07);
  border: 1px solid rgba(232,160,32,0.18);
  padding: 7px 12px;
  border-radius: 6px;
  margin-top: 10px;
  line-height: 1.5;
}

.priority-age-gap-flag svg { flex-shrink: 0; margin-top: 2px; }

/* 4-column risk scores grid (now includes age gap row) */
.risk-scores {
  grid-template-columns: repeat(4, 1fr) !important;
}

@media (max-width: 1024px) {
  .risk-scores { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
  .risk-scores { grid-template-columns: 1fr !important; }
}

/* ─────────────────────────────────────────────
   HEIR INVESTMENT PREFERENCES
   ───────────────────────────────────────────── */

.invest-prefs-card {
  margin-bottom: 24px;
}

.prefs-source-tag {
  display: inline-block;
  margin-left: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--green);
  background: rgba(61,191,122,0.08);
  border: 1px solid rgba(61,191,122,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
}

.prefs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.pref-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-item-full {
  grid-column: 1 / -1;
}

.pref-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}

.pref-value {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
}

.pref-high    { background: rgba(224,82,82,0.1);   color: #f08080;       border: 1px solid rgba(224,82,82,0.2); }
.pref-medium  { background: rgba(232,160,32,0.1);  color: var(--amber);  border: 1px solid rgba(232,160,32,0.2); }
.pref-low     { background: rgba(61,191,122,0.08); color: var(--green);  border: 1px solid rgba(61,191,122,0.18); }
.pref-unknown { background: rgba(122,155,191,0.1); color: var(--text-muted); border: 1px solid var(--navy-border); }

.pref-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pref-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 5px;
}

.esg-tag {
  background: rgba(61,191,122,0.08);
  border: 1px solid rgba(61,191,122,0.22);
  color: var(--green);
}

.sector-tag {
  background: rgba(201,151,58,0.08);
  border: 1px solid rgba(201,151,58,0.22);
  color: var(--gold);
}

.exclude-tag {
  background: rgba(224,82,82,0.07);
  border: 1px solid rgba(224,82,82,0.2);
  color: #f08080;
}

.pref-none {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}

.pref-notes {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

@media (max-width: 768px) {
  .prefs-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   FAMILY BRIEFINGS PAGE
   ───────────────────────────────────────────── */

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--navy-hover);
  color: var(--text);
  border-color: var(--text-dim);
}

/* Briefing rows */
.briefings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.briefing-row {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 20px;
  align-items: start;
  transition: border-color 0.2s;
}

.briefing-row:hover { border-color: rgba(201,151,58,0.3); }

.briefing-row.status-scheduled { border-left: 3px solid var(--amber); }
.briefing-row.status-completed  { border-left: 3px solid var(--green); }
.briefing-row.status-cancelled  { border-left: 3px solid var(--text-dim); opacity: 0.75; }

.briefing-row-date {
  padding-right: 16px;
  border-right: 1px solid var(--navy-border);
}

.bdate-month {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.3;
}

.bdate-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.briefing-row-household {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 6px;
}

.briefing-row-location,
.briefing-row-attendees {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

.briefing-row-location svg,
.briefing-row-attendees svg { flex-shrink: 0; margin-top: 1px; }

.briefing-row-notes {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 6px;
  line-height: 1.5;
}

.briefing-row-status { flex-shrink: 0; }

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 10px;
  border-radius: 5px;
  white-space: nowrap;
}

.status-pill.scheduled  { background: rgba(232,160,32,0.12); color: var(--amber);  border: 1px solid rgba(232,160,32,0.25); }
.status-pill.completed  { background: rgba(61,191,122,0.1);  color: var(--green);  border: 1px solid rgba(61,191,122,0.22); }
.status-pill.cancelled  { background: rgba(122,155,191,0.08); color: var(--text-muted); border: 1px solid var(--navy-border); }

/* Audit table */
.audit-table-wrap {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 8px;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
}

.audit-table thead th {
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--navy-mid);
  text-align: left;
  border-bottom: 1px solid var(--navy-border);
  white-space: nowrap;
}

.audit-table tbody tr {
  border-bottom: 1px solid rgba(30,58,95,0.5);
  transition: background 0.12s;
}

.audit-table tbody tr:last-child { border-bottom: none; }
.audit-table tbody tr:hover { background: var(--navy-hover); }

.audit-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  vertical-align: top;
}

.audit-ts {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}

.audit-household {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.audit-details {
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 440px;
}

.audit-action-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.audit-scheduled { background: rgba(232,160,32,0.12); color: var(--amber);  border: 1px solid rgba(232,160,32,0.25); }
.audit-completed { background: rgba(61,191,122,0.1);  color: var(--green);  border: 1px solid rgba(61,191,122,0.22); }
.audit-cancelled { background: rgba(122,155,191,0.08); color: var(--text-muted); border: 1px solid var(--navy-border); }

/* ─── Schedule Briefing Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--navy-border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
  display: flex;
}

.modal-close:hover { color: var(--text); }

.modal-form {
  padding: 24px 28px;
}

.modal-form .form-row {
  margin-bottom: 18px;
}

.modal-form .form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.form-hint {
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
}

.required { color: var(--red); }

.modal-form .form-input,
.modal-form .form-textarea {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.modal-form .form-input:focus,
.modal-form .form-textarea:focus { border-color: var(--gold); }

.modal-form .form-input::placeholder,
.modal-form .form-textarea::placeholder { color: var(--text-dim); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

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

/* date/time input calendar icon color */
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--navy-border);
  margin-top: 8px;
}

@media (max-width: 768px) {
  .briefing-row {
    grid-template-columns: 1fr;
  }
  .briefing-row-date {
    border-right: none;
    border-bottom: 1px solid var(--navy-border);
    padding-bottom: 12px;
    padding-right: 0;
  }
  .form-row-2col { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr; }
  .stats-bar .stat-card:last-child { grid-column: auto; }
  .login-form-card { padding: 24px 20px; }
}

/* ─────────────────────────────────────────────
   AUDIT TRAIL PAGE
   ───────────────────────────────────────────── */

.audit-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
}

.audit-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.audit-filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.audit-filter-select,
.audit-filter-input {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.audit-filter-select:focus,
.audit-filter-input:focus { border-color: var(--gold); }

.audit-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 0;
  flex-shrink: 0;
}

.audit-result-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Timeline */
.audit-timeline {
  position: relative;
  padding-left: 28px;
}

.audit-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--navy-border);
}

.audit-date-divider {
  position: relative;
  margin: 24px 0 14px -28px;
  padding-left: 28px;
}

.audit-date-divider span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  background: var(--navy);
  padding: 2px 10px 2px 0;
  position: relative;
  z-index: 1;
}

.audit-entry {
  position: relative;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.audit-entry-dot {
  position: absolute;
  left: -24px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--navy);
  flex-shrink: 0;
  z-index: 1;
}

/* Dot colours by action type */
.at-login               .audit-entry-dot { background: var(--text-muted); }
.at-household-viewed    .audit-entry-dot { background: var(--gold); }
.at-heir-profile-viewed .audit-entry-dot { background: #a78bfa; }
.at-note-added          .audit-entry-dot { background: var(--green); }
.at-briefing-scheduled  .audit-entry-dot { background: var(--amber); }
.at-briefing-completed  .audit-entry-dot { background: var(--green); }
.at-priority-action-viewed .audit-entry-dot { background: #f08080; }
.at-message-sent        .audit-entry-dot { background: #38bdf8; }
.at-audit-trail-viewed  .audit-entry-dot { background: var(--text-dim); }

.audit-entry-body {
  flex: 1;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: border-color 0.15s;
}

.audit-entry-body:hover { border-color: rgba(201,151,58,0.25); }

.audit-entry-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.audit-type-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 9px;
  border-radius: 4px;
}

/* Pill colours */
.at-pill-login                { background: rgba(122,155,191,0.12); color: var(--text-muted); border: 1px solid rgba(122,155,191,0.2); }
.at-pill-household-viewed     { background: rgba(201,151,58,0.1);   color: var(--gold);       border: 1px solid rgba(201,151,58,0.2); }
.at-pill-heir-profile-viewed  { background: rgba(167,139,250,0.1);  color: #a78bfa;           border: 1px solid rgba(167,139,250,0.2); }
.at-pill-note-added           { background: rgba(61,191,122,0.1);   color: var(--green);      border: 1px solid rgba(61,191,122,0.2); }
.at-pill-briefing-scheduled   { background: rgba(232,160,32,0.1);   color: var(--amber);      border: 1px solid rgba(232,160,32,0.2); }
.at-pill-briefing-completed   { background: rgba(61,191,122,0.1);   color: var(--green);      border: 1px solid rgba(61,191,122,0.2); }
.at-pill-priority-action-viewed { background: rgba(224,82,82,0.1);  color: #f08080;           border: 1px solid rgba(224,82,82,0.2); }
.at-pill-message-sent         { background: rgba(56,189,248,0.1);   color: #38bdf8;           border: 1px solid rgba(56,189,248,0.2); }
.at-pill-audit-trail-viewed   { background: rgba(122,155,191,0.08); color: var(--text-dim);   border: 1px solid var(--navy-border); }

.audit-entry-advisor {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.audit-entry-sep { color: var(--text-dim); }

.audit-entry-household {
  font-size: 13px;
  color: var(--gold);
  font-weight: 500;
}

.audit-entry-ts {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
}

.audit-entry-detail {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .audit-filter-bar { flex-direction: column; align-items: stretch; }
  .audit-filter-group { min-width: 100%; }
  .audit-entry-ts { display: none; }
}

/* ─────────────────────────────────────────────
   SECURE MESSAGES PAGE
   ───────────────────────────────────────────── */

/* Two-panel shell — fills remaining viewport height */
.msg-shell {
  display: flex;
  height: calc(100vh - 56px); /* subtract mobile header height */
  overflow: hidden;
}

@media (min-width: 769px) {
  .msg-shell { height: 100vh; }
}

/* ── Left panel: conversation list ── */
.msg-sidebar {
  width: 300px;
  min-width: 300px;
  border-right: 1px solid var(--navy-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--navy-mid);
}

.msg-sidebar-header {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--navy-border);
  flex-shrink: 0;
}

.msg-sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}

.msg-sidebar-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
}

.msg-conv-list {
  flex: 1;
  overflow-y: auto;
}

.msg-conv-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(30,58,95,0.4);
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.msg-conv-item:hover { background: var(--navy-hover); }
.msg-conv-item.active { background: var(--gold-dim); border-left: 3px solid var(--gold); }

.msg-conv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy-border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.msg-conv-item.active .msg-conv-avatar {
  background: rgba(201,151,58,0.25);
  color: var(--gold);
}

.msg-conv-body { flex: 1; min-width: 0; }

.msg-conv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.msg-conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-conv-time {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  margin-left: 8px;
}

.msg-conv-household {
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 4px;
}

.msg-conv-preview {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.msg-conv-preview.unread {
  color: var(--text);
  font-weight: 500;
}

.msg-unread-badge {
  background: var(--gold);
  color: var(--navy-dark);
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  margin-top: 2px;
}

.msg-no-convs {
  padding: 32px 20px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Right panel: message thread ── */
.msg-thread-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.msg-thread-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--navy-border);
  background: var(--navy-mid);
  flex-shrink: 0;
}

.msg-thread-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(201,151,58,0.15);
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.msg-thread-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.msg-thread-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.msg-thread-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 6px 12px;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg-thread-link:hover { color: var(--gold); border-color: rgba(201,151,58,0.35); }

/* Messages scroll area */
.msg-thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-date-divider {
  text-align: center;
  margin: 16px 0 8px;
  position: relative;
}

.msg-date-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--navy-border);
}

.msg-date-divider span {
  position: relative;
  z-index: 1;
  background: var(--navy);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Bubble rows */
.msg-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 6px;
}

.msg-bubble-row.outbound {
  flex-direction: row-reverse;
}

.msg-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.msg-bubble-wrap {
  max-width: 68%;
  display: flex;
  flex-direction: column;
}

.msg-bubble-row.outbound .msg-bubble-wrap {
  align-items: flex-end;
}

.msg-bubble {
  padding: 11px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.bubble-in {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.bubble-out {
  background: rgba(201,151,58,0.15);
  border: 1px solid rgba(201,151,58,0.28);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.msg-bubble-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.msg-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 48px 0;
}

/* Compose bar */
.msg-compose {
  border-top: 1px solid var(--navy-border);
  background: var(--navy-mid);
  padding: 16px 20px 12px;
  flex-shrink: 0;
}

.msg-compose-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: 12px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.15s;
}

.msg-compose-inner:focus-within { border-color: var(--gold); }

.msg-compose-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  font-family: inherit;
  padding: 4px 0;
}

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

.msg-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gold);
  border: none;
  color: var(--navy-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.msg-send-btn:hover { background: var(--gold-light); }

.msg-compose-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 7px;
  padding-left: 4px;
}

/* No conversation selected */
.msg-no-selection {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.msg-no-sel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.msg-no-sel-sub {
  font-size: 13px;
  color: var(--text-dim);
}

/* Responsive: stack panels on mobile */
@media (max-width: 768px) {
  .msg-shell { flex-direction: column; height: auto; }
  .msg-sidebar { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid var(--navy-border); max-height: 260px; }
  .msg-thread-panel { min-height: 400px; }
  .msg-bubble-wrap { max-width: 85%; }
  .msg-thread-link span { display: none; }
}

/* ─────────────────────────────────────────────
   ADMIN BADGE + SIDEBAR
   ───────────────────────────────────────────── */

.admin-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: rgba(201,151,58,0.2);
  color: var(--gold);
  border: 1px solid rgba(201,151,58,0.4);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 7px;
  vertical-align: middle;
}

.briefing-advisor-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
}

/* ─────────────────────────────────────────────
   ADVISOR OVERVIEW PAGE (admin)
   ───────────────────────────────────────────── */

.ov-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.ov-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ov-advisor-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(201,151,58,0.15);
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.ov-advisor-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}

.ov-advisor-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.ov-header-stats {
  display: flex;
  gap: 24px;
  margin-left: auto;
  flex-wrap: wrap;
}

.ov-stat {
  text-align: right;
}

.ov-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.ov-stat-val.danger { color: #f08080; }
.ov-stat-val.warn   { color: var(--amber); }
.ov-stat-val.ok     { color: var(--green); }

.ov-stat-lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.ov-risk-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.ov-risk-bar {
  flex: 1;
  height: 8px;
  background: var(--navy-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  margin-left: 8px;
}

.ov-bar-seg { height: 100%; }
.ov-bar-seg.high   { background: var(--red); }
.ov-bar-seg.medium { background: var(--amber); }
.ov-bar-seg.low    { background: var(--green); }

.ov-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.ov-table thead th {
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  background: var(--navy-mid);
  text-align: left;
  border-bottom: 1px solid var(--navy-border);
  white-space: nowrap;
}

.ov-table tbody tr {
  border-bottom: 1px solid rgba(30,58,95,0.4);
  cursor: pointer;
  transition: background 0.12s;
}

.ov-table tbody tr:last-child { border-bottom: none; }
.ov-table tbody tr:hover { background: var(--navy-hover); }
.ov-table tbody td { padding: 11px 12px; font-size: 13px; vertical-align: middle; }

.ov-eng-bar {
  display: inline-block;
  width: 60px;
  height: 4px;
  background: var(--navy-border);
  border-radius: 2px;
  overflow: hidden;
  margin-right: 6px;
  vertical-align: middle;
}

.ov-eng-fill {
  height: 100%;
  border-radius: 2px;
}

.ov-eng-fill.fill-good   { background: var(--green); }
.ov-eng-fill.fill-warn   { background: var(--amber); }
.ov-eng-fill.fill-danger { background: var(--red); }

@media (max-width: 768px) {
  .ov-header-stats { margin-left: 0; justify-content: flex-start; }
  .ov-card { padding: 16px; }
  .ov-table { overflow-x: auto; display: block; }
}

/* ─────────────────────────────────────────────
   HEIR INVITATION FLOW
   ───────────────────────────────────────────── */

.btn-invite {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--gold);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-invite:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

.btn-invite-resend {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}

.btn-invite-resend:hover {
  background: rgba(201,151,58,0.08);
  transform: translateY(-1px);
}

.invite-sent-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(72,199,142,0.12);
  color: var(--green);
  border: 1px solid rgba(72,199,142,0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.invite-modal-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-style: italic;
}

.invite-msg-preview {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.invite-msg-preview strong {
  color: var(--text);
}

.invite-no-email-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(240,128,128,0.08);
  border: 1px solid rgba(240,128,128,0.3);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: #f08080;
  margin-bottom: 20px;
  line-height: 1.5;
}

.invite-no-email-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Toast notification */
.invite-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-light);
  border: 1px solid var(--gold);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.invite-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────────
   HOUSEHOLDS — SEARCH, FILTER & EXPORT
   ───────────────────────────────────────────── */

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-export:hover {
  background: rgba(201,151,58,0.08);
  transform: translateY(-1px);
}

.hh-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.hh-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.hh-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.hh-search-input {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 14px 9px 36px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.hh-search-input:focus { border-color: var(--gold); }
.hh-search-input::placeholder { color: var(--text-dim); }

.hh-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hh-filter-select {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7a99' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.hh-filter-select:focus { border-color: var(--gold); }

.hh-clear-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: rgba(240,128,128,0.1);
  border: 1px solid rgba(240,128,128,0.3);
  border-radius: var(--radius);
  color: #f08080;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.hh-clear-btn:hover { background: rgba(240,128,128,0.18); }

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--gold); }
.sort-arrow { color: var(--gold); font-size: 11px; }

.hh-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 768px) {
  .hh-filter-bar { flex-direction: column; align-items: stretch; }
  .hh-search-wrap { min-width: 0; }
  .hh-filters { flex-direction: column; }
  .hh-filter-select { width: 100%; }
}

/* ─────────────────────────────────────────────
   HEIR ENGAGEMENT TIMELINE
   ───────────────────────────────────────────── */

.engagement-timeline-card {
  margin-bottom: 20px;
}

.eng-timeline {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
}

.eng-event {
  display: flex;
  gap: 0;
  position: relative;
}

.eng-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 32px;
  flex-shrink: 0;
}

.eng-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.eng-line {
  width: 2px;
  flex: 1;
  min-height: 16px;
  background: var(--navy-border);
  margin: 2px 0;
}

.eng-event:last-child .eng-line { display: none; }

/* category colours */
.eng-milestone .eng-dot  { background: rgba(72,199,142,0.15); color: var(--green); border: 1.5px solid rgba(72,199,142,0.4); }
.eng-positive  .eng-dot  { background: rgba(201,151,58,0.12); color: var(--gold);  border: 1.5px solid rgba(201,151,58,0.35); }
.eng-pending   .eng-dot  { background: rgba(255,185,0,0.1);   color: var(--amber); border: 1.5px solid rgba(255,185,0,0.3); }
.eng-none      .eng-dot  { background: rgba(240,128,128,0.1); color: #f08080;      border: 1.5px solid rgba(240,128,128,0.25); }

.eng-body {
  flex: 1;
  padding: 0 0 20px 14px;
}

.eng-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
  margin-top: 3px;
}

.eng-date {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.eng-type-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 10px;
}
.eng-pill-milestone { background: rgba(72,199,142,0.12);  color: var(--green); }
.eng-pill-positive  { background: rgba(201,151,58,0.12);  color: var(--gold); }
.eng-pill-pending   { background: rgba(255,185,0,0.1);    color: var(--amber); }
.eng-pill-none      { background: rgba(240,128,128,0.1);  color: #f08080; }

.eng-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────
   RISK SCORE HISTORY CHART
   ───────────────────────────────────────────── */

.risk-history-card {
  margin-bottom: 20px;
}

.risk-chart-caption {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

/* ─────────────────────────────────────────────
   ADMIN FIRM-WIDE STATS BANNER
   ───────────────────────────────────────────── */

.firm-stats-banner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.firm-stat-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.firm-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(201,151,58,0.1);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.firm-stat-icon-green { background: rgba(72,199,142,0.1);  color: var(--green); }
.firm-stat-icon-gold  { background: rgba(201,151,58,0.1);  color: var(--gold); }
.firm-stat-icon-red   { background: rgba(240,128,128,0.1); color: #f08080; }
.firm-stat-icon-amber { background: rgba(255,185,0,0.1);   color: var(--amber); }

.firm-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  line-height: 1.1;
}

.firm-stat-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

.text-red   { color: #f08080 !important; }
.text-amber { color: var(--amber) !important; }
.text-green { color: var(--green) !important; }

@media (max-width: 1100px) {
  .firm-stats-banner { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .firm-stats-banner { grid-template-columns: repeat(2, 1fr); }
  .firm-stat-value { font-size: 18px; }
}

/* ─────────────────────────────────────────────
   SETTINGS PAGE
   ───────────────────────────────────────────── */

.settings-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--navy-border);
}

.settings-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(201,151,58,0.1);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.settings-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.settings-profile-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px 0;
}

.settings-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.settings-avatar-info { flex: 1; }

.settings-avatar-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.settings-avatar-role {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.settings-avatar-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  font-style: italic;
}

.settings-fields {
  padding: 20px 24px 24px;
}

.settings-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.settings-input {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  font-family: inherit;
}

.settings-input:focus { border-color: var(--gold); }
.settings-input::placeholder { color: var(--text-dim); }

.settings-hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.settings-error {
  background: rgba(240,128,128,0.08);
  border: 1px solid rgba(240,128,128,0.3);
  border-radius: var(--radius);
  color: #f08080;
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.settings-actions {
  padding-top: 4px;
}

.settings-logo-placeholder {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--navy);
  border: 1px dashed var(--navy-border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text-dim);
  font-size: 13px;
}

/* CRM integration */
.crm-integration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px 0;
}

.crm-logo-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.crm-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #e84c2b;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
}

.crm-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.crm-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.crm-status-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(240,128,128,0.08);
  border: 1px solid rgba(240,128,128,0.2);
  color: #f08080;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
}

.crm-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f08080;
  flex-shrink: 0;
}

.crm-modal-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e84c2b;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
  flex-shrink: 0;
}

/* Notification toggles */
.notif-list {
  padding: 8px 24px;
}

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--navy-border);
}

.notif-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.notif-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--navy-border);
  border-radius: 12px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--gold); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Settings toast */
.settings-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-light);
  border: 1px solid var(--green);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

.settings-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.settings-toast-error {
  border-color: #f08080 !important;
}

@media (max-width: 768px) {
  .settings-field-row { grid-template-columns: 1fr; }
  .crm-integration-row { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────────
   HELP & RESOURCES PAGE
   ───────────────────────────────────────────── */

.help-section {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.help-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--navy-border);
}

.help-section-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(201,151,58,0.1);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.help-section-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Getting started guide cards */
.help-guides-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.help-guide-card {
  padding: 24px;
  border-right: 1px solid var(--navy-border);
  border-bottom: 1px solid var(--navy-border);
  transition: background 0.15s;
}

.help-guide-card:nth-child(even) { border-right: none; }
.help-guide-card:nth-child(3),
.help-guide-card:nth-child(4) { border-bottom: none; }
.help-guide-card:hover { background: rgba(201,151,58,0.03); }

.help-guide-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.help-guide-icon {
  color: var(--text-dim);
  margin-bottom: 10px;
}

.help-guide-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 10px;
  line-height: 1.4;
}

.help-guide-body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
}

.help-guide-body strong { color: var(--text); }

/* FAQ accordion */
.faq-list { padding: 4px 0; }

.faq-item {
  border-bottom: 1px solid var(--navy-border);
  overflow: hidden;
}

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s;
}

.faq-q:hover { color: var(--gold); }
.faq-item.open .faq-q { color: var(--gold); }

.faq-chevron {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.faq-item.open .faq-chevron { transform: rotate(180deg); color: var(--gold); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  padding: 0 24px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-a {
  max-height: 400px;
  padding: 0 24px 20px;
}

.faq-a strong { color: var(--text); }
.faq-a code {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--gold);
  font-family: monospace;
}

.faq-list-inner {
  margin: 10px 0 4px 18px;
  padding: 0;
}

.faq-list-inner li {
  margin-bottom: 6px;
}

/* Support section */
.support-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
}

.support-contact-card {
  border-right: 1px solid var(--navy-border);
  padding: 24px;
}

.support-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--navy-border);
}

.support-contact-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(201,151,58,0.1);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.support-contact-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.support-contact-value {
  font-size: 13px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.support-contact-value:hover { text-decoration: underline; }

.support-form-card { padding: 24px; }

.support-form-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 18px;
}

.support-form-fields {}

@media (max-width: 900px) {
  .help-guides-grid { grid-template-columns: 1fr; }
  .help-guide-card { border-right: none; }
  .help-guide-card:nth-child(3) { border-bottom: 1px solid var(--navy-border); }
  .support-grid { grid-template-columns: 1fr; }
  .support-contact-card { border-right: none; border-bottom: 1px solid var(--navy-border); }
}

/* ─────────────────────────────────────────────
   EMPTY STATES (page-level)
   ───────────────────────────────────────────── */

.page-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
}

.empty-state-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--gold);
  color: var(--navy);
  font-size: 32px;
  font-weight: 900;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.empty-state-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(201,151,58,0.1);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-state-heading {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 10px;
}

.empty-state-sub {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 380px;
  line-height: 1.6;
  margin-bottom: 4px;
}

.empty-state-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
