/* ═══════════════════════════════════════════════════════════════════
   Waterwood Investor Portal — stylesheet. Moved out of index.html on
   2026-09-12 (audit PR 5); the navy/gold design language is Clayton's
   brand and a logged deviation from the bedrock (CLAUDE.md §13).
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --navy: #0B1D3A;
  --navy-light: #132B52;
  --navy-mid: #1A3A6B;
  --gold: #C8A961;
  --gold-light: #E0C97D;
  --gold-dark: #A8893D;
  --bg: #F5F6FA;
  --card-bg: #FFFFFF;
  --text: #1A1A2E;
  --text-light: #6B7280;
  --success: #10B981;
  --info: #3B82F6;
  --warning: #F59E0B;
  --danger: #EF4444;
  --border: #E5E7EB;
  --shadow: 0 1px 3px rgba(11,29,58,0.08), 0 4px 12px rgba(11,29,58,0.04);
  --shadow-lg: 0 4px 16px rgba(11,29,58,0.12), 0 8px 32px rgba(11,29,58,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, var(--navy-mid) 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(200,169,97,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(200,169,97,0.05) 0%, transparent 50%);
  animation: loginGlow 15s ease-in-out infinite alternate;
}

@keyframes loginGlow {
  0% { transform: translate(0,0) rotate(0deg); }
  100% { transform: translate(-2%,2%) rotate(3deg); }
}

/* Respect a stated preference for less motion — the login glow runs
   infinitely and the entry animations fire on every section change, which
   is a real problem for vestibular sensitivity (audit ux-7). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 420px;
  max-width: 90vw;
}

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

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.login-logo .tagline {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.login-card {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(200,169,97,0.15);
  border-radius: 16px;
  padding: 40px;
}

.login-card h2 {
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-card .subtitle {
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  margin-bottom: 32px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--gold);
  background: rgba(200,169,97,0.06);
  box-shadow: 0 0 0 3px rgba(200,169,97,0.1);
}

/* Placeholder was rgba(…,0.25) ≈ 1.9:1 on the navy card — effectively
   invisible, and this audience skews older. WCAG 1.4.3 wants 4.5:1 for small
   text; 0.55 clears it without looking like filled-in content. (audit ux-5) */
.form-group input::placeholder { color: rgba(255,255,255,0.55); }

/* Visible keyboard focus. The app had no focus style at all, so a keyboard
   user could not tell where they were (audit ux-1). :focus-visible keeps
   mouse clicks clean. */
.btn:focus-visible,
.nav-item:focus-visible,
.faq-question:focus-visible,
.doc-category:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy);
  width: 100%;
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200,169,97,0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
}

.btn-outline:hover {
  background: var(--bg);
  border-color: var(--gold);
  color: var(--text);
}

.btn-navy {
  background: var(--navy);
  color: #fff;
}

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

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-xs { padding: 6px 12px; font-size: 12px; }

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #FCA5A5;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}

/* ── PASSWORD RESET ── */
#resetSection { display: none; }
#resetSection .form-group input[type="password"] { margin-bottom: 4px; }

.password-strength {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  margin-top: 8px;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: var(--transition);
}

/* ── MAIN LAYOUT ── */
.app { display: none; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--navy);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

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

.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.sidebar-logo .tagline {
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 2px;
}

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

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.62);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

.nav-item.active {
  background: rgba(200,169,97,0.12);
  color: var(--gold);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

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

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
}

.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  color: rgba(255,255,255,0.65);
  font-size: 11px;
}

.logout-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #FCA5A5;
}

.main-content {
  margin-left: 260px;
  min-height: 100vh;
}

.page-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

.page-title p {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.page-body {
  padding: 28px 32px;
}

/* ── DASHBOARD ── */
.phase-banner {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.phase-banner::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: radial-gradient(ellipse at 100% 50%, rgba(200,169,97,0.1) 0%, transparent 70%);
}

.phase-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(200,169,97,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.phase-icon svg { color: var(--gold); }

.phase-info h3 {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

.phase-info p {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  margin-top: 2px;
}

.phase-timeline {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.phase-step {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.phase-step.active {
  background: var(--gold);
  color: var(--navy);
}

.phase-step.completed {
  background: rgba(16,185,129,0.2);
  color: #6EE7B7;
}

.phase-step.upcoming {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.62);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-card.gold::before { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.kpi-card.green::before { background: linear-gradient(90deg, #10B981, #34D399); }
.kpi-card.blue::before { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.kpi-card.purple::before { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.kpi-change.up { background: rgba(16,185,129,0.1); color: #059669; }

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.charts-grid-2col { grid-template-columns: 1fr 1fr; }
.charts-grid > .card { min-width: 0; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.card-body { padding: 24px; }

.chart-container {
  position: relative;
  height: 280px;
}

/* ── CASH FLOWS TABLE ── */
.table-container {
  overflow-x: auto;
  /* Scroll shadow (CSS-only, audit primaryUser-6). On a phone the table is
     wider than the screen, so Amount and Running Balance sit off the right
     edge — the two numbers the investor opened the portal to see — with
     nothing indicating the table scrolls. The right-hand shadow appears only
     while there is more to scroll to and fades at the end, using
     background-attachment: local for the cover layers. */
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(11,29,58,0.16), rgba(11,29,58,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(11,29,58,0.16), rgba(11,29,58,0)) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

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

table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

table tr:hover td { background: rgba(200,169,97,0.03); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-interest { background: rgba(59,130,246,0.1); color: #2563EB; }
.badge-principal { background: rgba(16,185,129,0.1); color: #059669; }
.badge-distribution { background: rgba(200,169,97,0.15); color: var(--gold-dark); }
.badge-investment { background: rgba(200,169,97,0.15); color: var(--gold-dark); }

.amount-positive { color: #059669; font-weight: 600; }
/* Projected money must never look like received money (audit psych-5). Same
   figures rendered in the same bold green taught the eye they were the same
   thing; projections are muted, lighter and italic so "will get" reads
   differently from "have got" at a glance. */
.amount-projected { color: var(--text-light); font-weight: 500; font-style: italic; }
.amount-negative { color: var(--text); font-weight: 600; }

/* ── DOCUMENTS ── */
.doc-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.doc-category {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.doc-category:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.doc-category.active {
  border-color: var(--gold);
  background: rgba(200,169,97,0.04);
}

.doc-cat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.doc-cat-icon.gold { background: rgba(200,169,97,0.12); color: var(--gold-dark); }
.doc-cat-icon.blue { background: rgba(59,130,246,0.1); color: #2563EB; }
.doc-cat-icon.green { background: rgba(16,185,129,0.1); color: #059669; }
.doc-cat-icon.purple { background: rgba(200,169,97,0.12); color: var(--gold-dark); }
.doc-cat-icon.red { background: rgba(239,68,68,0.1); color: #DC2626; }
.doc-cat-icon.amber { background: rgba(245,158,11,0.1); color: #D97706; }

.doc-category h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.doc-category p {
  font-size: 12px;
  color: var(--text-light);
}

.doc-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.doc-item:last-child { border-bottom: none; }
.doc-item:hover { background: rgba(200,169,97,0.03); }

.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(239,68,68,0.08);
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}

.doc-info { flex: 1; }

.doc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.doc-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.doc-actions {
  display: flex;
  gap: 8px;
}

/* ── UPDATES ── */
.timeline {
  position: relative;
  padding-left: 32px;
}

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

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

.timeline-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-dot svg { width: 12px; height: 12px; color: var(--gold); }

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

.timeline-date {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.timeline-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.timeline-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}

/* ── ADMIN ── */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.admin-tab {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
}

.admin-tab.active {
  background: #fff;
  color: var(--navy);
  box-shadow: var(--shadow);
}

.admin-tab:hover:not(.active) { color: var(--text); }

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

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

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

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: var(--transition);
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,169,97,0.1);
}

.admin-form textarea { min-height: 100px; resize: vertical; }

/* ── SECTIONS ── */
.section { display: none; }
.section.active { display: block; }

/* ── MOBILE HEADER ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--navy);
  z-index: 99;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.hamburger-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.hamburger-btn:hover { background: rgba(255,255,255,0.14); }

.mobile-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,29,58,0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
}

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

/* ── RESPONSIVE ── */

/* Tablet */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .doc-categories { grid-template-columns: repeat(2, 1fr); }
}

/* Phone & small tablet */
@media (max-width: 768px) {
  /* Mobile header visible */
  .mobile-header { display: flex; }

  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content full width with top padding for mobile header */
  .main-content {
    margin-left: 0;
    padding-top: 56px;
  }

  /* Page header stacks */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
  }

  .page-title h2 { font-size: 18px; }

  /* Page body reduced padding */
  .page-body { padding: 16px; }

  /* Phase banner stacks */
  .phase-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .phase-timeline { flex-wrap: wrap; }

  /* KPI single column */
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 24px; }

  /* Charts smaller */
  .chart-container { height: 220px; }

  /* Document categories single column */
  .doc-categories { grid-template-columns: 1fr; }

  /* Document items stack */
  .doc-item {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
  }

  .doc-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Form rows single column */
  .form-row { grid-template-columns: 1fr; }

  /* Admin tabs scroll horizontally */
  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .admin-tab { flex-shrink: 0; }

  /* Tables: ensure horizontal scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }

  table { min-width: 600px; }

  /* Timeline more compact */
  .timeline { padding-left: 28px; }

  /* Modal full screen on mobile */
  .modal {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }

  .modal-overlay { align-items: flex-end; }

  /* Login card compact */
  .login-card { padding: 28px 20px; }
  .login-logo h1 { font-size: 22px; letter-spacing: 4px; }
  .login-logo .tagline { font-size: 10px; letter-spacing: 3px; }

  /* Card header/body compact */
  .card-header { padding: 16px; }
  .card-body { padding: 16px; }

  /* Buttons touch-friendly */
  .btn { padding: 12px 20px; min-height: 44px; }
  .btn-sm { padding: 10px 16px; min-height: 40px; }

  /* Drop zone compact */
  .drop-zone-content { padding: 28px 16px; }
}

/* Small phone (iPhone SE, etc.) */
@media (max-width: 375px) {
  .page-body { padding: 12px; }
  .table-container { margin: 0 -12px; padding: 0 12px; }
  .kpi-card { padding: 18px; }
  .kpi-value { font-size: 22px; }
  .phase-banner { padding: 16px; }
  .phase-info h3 { font-size: 16px; }
  .phase-step { padding: 3px 8px; font-size: 10px; }
  .login-container { max-width: 95vw; }
  .login-card { padding: 24px 16px; }
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.0s; }
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,29,58,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: #fff;
  border-radius: 16px;
  width: 500px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { background: rgba(239,68,68,0.1); color: #DC2626; }

.modal-body { padding: 24px; }

/* ── EMPTY STATE ── */
/* ── DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--gold);
  background: rgba(200,169,97,0.04);
}

.drop-zone.drag-over {
  box-shadow: 0 0 0 4px rgba(200,169,97,0.1);
}

.drop-zone-content {
  padding: 40px 20px;
  text-align: center;
}

.drop-zone-file {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state p { font-size: 13px; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── IRR HIGHLIGHT ── */
.irr-display {
  text-align: center;
  padding: 20px;
}

.irr-value {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.irr-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.irr-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 8px;
}

.ownership-company {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.ownership-company h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.ownership-company .pct {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold-dark);
}

.ownership-company .label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ── LOGO ── */
.logo-img {
  height: auto;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
.logo-img.login-logo-img { width: 320px; max-width: 80vw; margin: 0 auto; }
.logo-img.sidebar-logo-img { width: 210px; }

/* ── ADMIN INVESTOR LIST ── */
.investor-summary-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.investor-summary-bar .stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
}
.investor-summary-bar .stat-pill .num { color: var(--navy); }
.investor-search-box {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 13px; width: 220px; outline: none;
}
.investor-search-box:focus { border-color: var(--gold); }
.investor-sort-btns button.active { background: var(--navy); color: white; border-color: var(--navy); }

.investor-table { width: 100%; border-collapse: collapse; }
.investor-table th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light);
  border-bottom: 2px solid var(--border); background: var(--bg); white-space: nowrap;
  cursor: pointer; user-select: none;
}
.investor-table th:hover { color: var(--navy); }
.investor-table th .sort-arrow { font-size: 10px; margin-left: 4px; opacity: 0.4; }
.investor-table th.sorted .sort-arrow { opacity: 1; color: var(--gold-dark); }
.investor-table td {
  padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.investor-table tr:hover { background: rgba(200,169,97,0.04); }
.investor-table tr.expanded { background: rgba(26,58,92,0.03); }
.investor-table .inv-name-cell {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.investor-table .inv-name-cell .user-avatar {
  width: 32px; height: 32px; font-size: 11px; flex-shrink: 0;
}
.investor-table .inv-name-cell .inv-name { font-weight: 600; font-size: 13px; }
.investor-table .entity-badge {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: var(--bg); color: var(--text-light);
}
.investor-table .amt-cell { font-weight: 600; color: var(--navy); white-space: nowrap; }
.investor-table .status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
}
.investor-table .status-dot.complete { background: var(--success); }
.investor-table .status-dot.incomplete { background: var(--gold); }
.investor-table .status-dot.missing { background: var(--danger); }

.incomplete-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  padding: 20px;
}
.incomplete-modal {
  background: white; border-radius: 12px; max-width: 640px; width: 100%;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden;
}
.incomplete-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.incomplete-modal-header h3 { margin: 0; font-size: 16px; color: var(--navy); }
.incomplete-modal-close {
  background: none; border: none; font-size: 28px; line-height: 1;
  cursor: pointer; color: var(--text-light); padding: 0 4px;
}
.incomplete-modal-close:hover { color: var(--navy); }
.incomplete-modal-body { padding: 20px 24px; overflow-y: auto; }
.incomplete-item {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px; background: var(--bg);
}
.incomplete-name {
  font-size: 14px; font-weight: 600; color: var(--navy);
  cursor: pointer; margin-bottom: 6px;
}
.incomplete-name:hover { color: var(--gold-dark); }
.incomplete-missing { font-size: 12px; color: var(--text-light); }
.missing-chip {
  display: inline-block; background: rgba(220,53,69,0.1); color: var(--danger);
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  margin: 2px 4px 2px 0;
}

.investor-detail-row td { padding: 0 !important; border-bottom: 2px solid var(--border); }
.investor-detail-panel {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px;
  padding: 16px 20px 16px 56px; font-size: 12px; color: var(--text-light);
  background: var(--bg); border-top: 1px solid var(--border);
}
.investor-detail-panel .detail-label { font-weight: 600; color: var(--text); }
.investor-detail-panel .detail-section {
  grid-column: 1 / -1; border-top: 1px solid var(--border);
  padding-top: 8px; margin-top: 4px;
}
.investor-detail-panel .detail-section-title {
  font-weight: 700; color: var(--navy); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}
.investor-detail-actions {
  grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px;
}

.investor-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

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

/* ── WELCOME OVERLAY ── */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,29,58,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.welcome-card {
  background: #fff;
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}

.welcome-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.welcome-card .welcome-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 28px;
}

.welcome-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: left;
  margin-bottom: 28px;
}

.welcome-section-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.welcome-section-item svg {
  flex-shrink: 0;
  color: var(--gold-dark);
  margin-top: 2px;
}

.welcome-section-item h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.welcome-section-item p {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.4;
}

/* ── NOTIFICATION DOTS ── */
.nav-item { position: relative; }
.nav-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--navy);
}

/* ── FAQ ACCORDION ── */
.faq-item {
  border-bottom: 1px solid var(--border);
}

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

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  transition: var(--transition);
  gap: 12px;
}

.faq-question:hover { background: var(--bg); }

.faq-chevron {
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--text-light);
}

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

.faq-answer {
  display: none;
  padding: 0 20px 18px 20px;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.7;
}

.faq-item.open .faq-answer { display: block; }

/* ── SUPPORT CONTACT ── */
.contact-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.contact-row svg { flex-shrink: 0; color: var(--gold-dark); margin-top: 2px; }

.contact-row .contact-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-row .contact-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ── MESSAGE STATUS BADGES ── */
.badge-pending { background: rgba(245,158,11,0.1); color: #D97706; }
.badge-replied { background: rgba(16,185,129,0.1); color: #059669; }

/* ── PRINT HEADER ── */
.print-header { display: none; }

/* ── PRINT STYLES ── */
@media print {
  .sidebar, .mobile-header, .sidebar-overlay, .toast-container,
  .welcome-overlay, .nav-dot, .btn, button, #demoBanner,
  .phase-banner, #adminNavSection, #settingsNavSection { display: none !important; }

  .main-content { margin-left: 0 !important; padding-top: 0 !important; }
  .app { display: block !important; }
  .section { display: none !important; }
  #section-dashboard { display: block !important; }

  .print-header {
    display: block !important;
    text-align: center;
    padding: 20px 0 16px;
    border-bottom: 2px solid var(--navy);
    margin-bottom: 20px;
  }

  .print-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 4px;
    text-transform: uppercase;
  }

  .print-header p {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
  }

  .card { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
  .page-header { display: none !important; }
  .kpi-card { box-shadow: none !important; border: 1px solid #ddd; }
  .chart-container { height: 200px !important; }
}

/* ── RESPONSIVE: WELCOME ── */
@media (max-width: 768px) {
  .welcome-card { padding: 28px 20px; }
  .welcome-sections { grid-template-columns: 1fr; }
}

/* ══════ PHASE 2 STYLES ══════ */

/* ── ENTITY SWITCHER ── */
.entity-switcher-bar {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--gold);
}
.entity-switcher-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}
.entity-switcher-bar select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(200,169,97,0.3);
  border-radius: 6px;
  color: #fff;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  max-width: 400px;
}
.entity-switcher-bar select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(200,169,97,0.2);
}
.entity-switcher-bar select option { color: var(--text); background: #fff; }
.bulk-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.bulk-preview-table th, .bulk-preview-table td {
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.bulk-preview-table th {
  background: var(--bg);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}
.bulk-preview-table input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
}

/* ── DRAFT BANNER ── */
.draft-banner {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}
.draft-banner .draft-count { font-weight: 700; color: #D97706; }
.badge-draft { background: rgba(245,158,11,0.1); color: #D97706; }

/* ── ENGAGEMENT INDICATORS ── */
.engagement-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.engagement-indicator.green { background: #10B981; }
.engagement-indicator.yellow { background: #F59E0B; }
.engagement-indicator.red { background: #EF4444; }

/* ── EMAIL TEMPLATE BUILDER ── */
.template-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 16px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  max-height: 400px;
  overflow-y: auto;
}
.merge-field-ref {
  display: inline-block;
  background: rgba(200,169,97,0.1);
  border: 1px solid rgba(200,169,97,0.3);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: monospace;
  color: var(--gold-dark);
  cursor: pointer;
  margin: 2px;
}
.merge-field-ref:hover { background: rgba(200,169,97,0.2); }

/* ── TAX CENTER ── */
.tax-year-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tax-year-tab {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  background: #fff;
}
.tax-year-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.tax-year-tab:hover:not(.active) { border-color: var(--gold); color: var(--text); }
.pdf-intake-zone:hover, .pdf-intake-zone.drag-over {
  background: rgba(200,169,97,0.08);
  box-shadow: 0 0 0 4px rgba(200,169,97,0.1);
}

/* ── RESPONSIVE ADDITIONS ── */
@media (max-width: 768px) {
  .entity-switcher-bar { padding: 8px 16px; }
  .entity-switcher-bar select { max-width: 100%; flex: 1; min-width: 0; }
  .notify-contact-row { grid-template-columns: 1fr; }
  .bulk-preview-table { min-width: 500px; }
  .admin-overview .admin-quick-actions { flex-direction: column; }
}
