:root {
  --navy: #002b5c;
  --navy-dark: #001a3a;
  --navy-light: #274b78;
  --orange: #cc5500;
  --orange-dark: #a64400;
  --orange-light: #e8f0f7;
  --gray-50: #f7f8fa;
  --gray-100: #eef1f5;
  --gray-200: #dde3ea;
  --gray-400: #97a2b0;
  --gray-600: #5b6675;
  --gray-800: #2b3340;
  --white: #ffffff;
  --danger: #b3261e;
  --success: #1e7a3a;
  --warning: #9a6a00;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 43, 92, 0.08), 0 1px 2px rgba(0, 43, 92, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 43, 92, 0.10);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--gray-50);
  color: var(--gray-800);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

img, svg { max-width: 100%; }

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

/* Header */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--white);
}

.brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--white);
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.header-nav a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.header-nav a:hover { color: var(--white); }
.header-nav a.active { color: var(--white); font-weight: 700; border-bottom: 2px solid var(--orange); padding-bottom: 2px; }

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.row-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  margin-left: 8px;
  vertical-align: middle;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.role-badge {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--orange-dark); }

.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--gray-200); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-100); }

.btn-ghost { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.4); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.1); }

/* .btn-ghost is white-on-transparent, meant for dark surfaces (like the header) --
   invisible on a plain white card, which is what made the User Management
   Deactivate button look like empty clickable space. This is the light-surface
   equivalent for a button that should still read as a caution/destructive action. */
.btn-outline-danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover:not(:disabled) { background: #fbeceb; }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }

/* Layout containers */
.page-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.narrow { max-width: 460px; }

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card + .card { margin-top: 18px; }

h1, h2, h3, h4 { color: var(--navy); margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { line-height: 1.55; margin: 0 0 12px; color: var(--gray-800); }
.muted { color: var(--gray-600); }
.small { font-size: 0.85rem; }

/* Auth page */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy) 220px, var(--gray-50) 220px);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
}

.tab-switch {
  display: flex;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
}
.tab-switch button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-600);
  cursor: pointer;
}
.tab-switch button.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow);
}

/* Forms */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.field .hint { font-size: 0.78rem; color: var(--gray-600); margin-top: 4px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 43, 92, 0.12);
}
textarea { min-height: 110px; resize: vertical; }
.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 10px; }
.req { color: var(--danger); font-weight: 700; }
.success-text { color: var(--success); font-size: 0.85rem; margin-top: 10px; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 12px;
}
.checkbox-row input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; }
.checkbox-row label { font-size: 0.88rem; color: var(--gray-800); font-weight: 400; margin: 0; }

.banner {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.banner-error { background: #fbeceb; color: var(--danger); border: 1px solid #f2c9c6; }
.banner-success { background: #e9f6ed; color: var(--success); border: 1px solid #bfe3c9; }
.banner-info { background: var(--orange-light); color: var(--navy); border: 1px solid #cddaea; }

/* Grid / stat cards */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  font-weight: 600;
}
.stat-card .stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 6px;
}
.stat-card .stat-sub { font-size: 0.8rem; color: var(--gray-600); margin-top: 4px; }

.nav-link-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.nav-link-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.nav-link-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.nav-link-card h3 { color: var(--navy); margin-bottom: 4px; }
.nav-link-card p { margin: 0; color: var(--gray-600); font-size: 0.88rem; }

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-received { background: #eef1f5; color: var(--gray-600); }
.status-under_review { background: #fdf3e0; color: var(--warning); }
.status-approved { background: #e9f6ed; color: var(--success); }
.status-declined { background: #fbeceb; color: var(--danger); }
.status-funded { background: var(--orange-light); color: var(--navy); }
.status-withdrawn { background: #eceff3; color: var(--gray-600); }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
}
th { color: var(--gray-600); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }

/* Apply form stepper */
.stepper {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.step-dot {
  flex: 1;
  min-width: 40px;
  text-align: center;
}
.step-dot .circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 0 auto 6px;
}
.step-dot.active .circle { background: var(--navy); color: var(--white); }
.step-dot.done .circle { background: var(--success); color: var(--white); }
.step-dot .label { font-size: 0.7rem; color: var(--gray-600); }
.step-dot.active .label { color: var(--navy); font-weight: 600; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.step-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  gap: 10px;
}

.review-section {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.review-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.review-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.9rem; }
.review-row .k { color: var(--gray-600); }
.review-row .v { color: var(--gray-800); font-weight: 500; text-align: right; }

.file-drop {
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  padding: 26px;
  text-align: center;
  background: var(--gray-50);
}
.file-drop.has-file { border-color: var(--success); background: #f2faf4; }

.footer-note {
  text-align: center;
  color: var(--gray-600);
  font-size: 0.8rem;
  padding: 20px;
}

.center-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--gray-600);
}

/* Case detail: notes + decision panel */
.case-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.back-link:hover { color: var(--navy); }

.note-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.note-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
}
.note-item .note-meta { font-size: 0.75rem; color: var(--gray-600); margin-bottom: 4px; }
.note-item .note-body { font-size: 0.9rem; white-space: pre-wrap; }
.empty-note { color: var(--gray-600); font-size: 0.88rem; }

.decision-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #8f1f19; }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover:not(:disabled) { background: #155e2c; }

.decision-summary { display: flex; flex-direction: column; gap: 4px; }

/* Funding agreement */
.agreement-doc {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--gray-800);
  max-height: 480px;
  overflow-y: auto;
}
.signature-block {
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  padding: 18px;
  margin-top: 18px;
  background: var(--gray-50);
}

[hidden] { display: none !important; }

/* ===== Public landing page ===== */

.btn-lg { padding: 14px 28px; font-size: 1.02rem; }

.landing { min-height: 100vh; background: var(--white); }

.landing-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-dark { color: var(--navy); }
.brand-light { color: var(--white); }

.landing-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.landing-nav a {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.landing-nav a:hover { color: var(--navy); }

.landing-header-actions { display: flex; align-items: center; gap: 10px; }

.hero {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--white);
  padding: 64px 24px;
  text-align: center;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero h1 {
  color: var(--white);
  font-size: 2.3rem;
  line-height: 1.2;
  margin-bottom: 18px;
}
.hero h1 span { color: #ffb27a; }
.hero-sub {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.08rem;
  max-width: 620px;
  margin: 0 auto 28px;
}
.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-note {
  margin: 20px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.trust-bar {
  background: var(--orange-light);
  border-bottom: 1px solid var(--gray-200);
  padding: 22px 24px;
}
.trust-bar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  text-align: center;
}
.trust-item { display: flex; flex-direction: column; gap: 4px; }
.trust-item strong { color: var(--navy); font-size: 0.95rem; }
.trust-item span { color: var(--gray-600); font-size: 0.82rem; }

.landing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 24px;
}
.landing-section.alt {
  max-width: none;
  background: var(--gray-50);
}
.landing-section.alt > * { max-width: 1080px; margin-left: auto; margin-right: auto; }

.section-title { text-align: center; font-size: 1.6rem; }
.section-sub {
  text-align: center;
  color: var(--gray-600);
  max-width: 560px;
  margin: 0 auto 36px;
}
.section-footnote {
  text-align: center;
  color: var(--gray-600);
  font-size: 0.88rem;
  margin: 28px auto 0;
  max-width: 560px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.step-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.step-card p { font-size: 0.9rem; margin-bottom: 0; }

.qualify-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}
.qualify-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--navy);
  text-align: center;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.why-item h3 { margin-bottom: 6px; }
.why-item p { font-size: 0.92rem; margin-bottom: 0; }

.attorney-block {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.attorney-block p { margin-bottom: 0; max-width: 560px; }

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.faq-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 18px 20px;
}
.faq-item h3 { margin-bottom: 6px; font-size: 1rem; }
.faq-item p { font-size: 0.9rem; margin-bottom: 0; color: var(--gray-600); }

.cta-band {
  background: var(--navy);
  color: var(--white);
  text-align: center;
  padding: 56px 24px;
}
.cta-band h2 { color: var(--white); }
.cta-band p { color: rgba(255, 255, 255, 0.85); margin-bottom: 24px; }

.landing-footer {
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.75);
  padding: 40px 24px;
}
.landing-footer-inner { max-width: 1080px; margin: 0 auto; }
.footer-nav { display: flex; gap: 20px; margin: 16px 0 4px; flex-wrap: wrap; }
.footer-nav a { color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }
.footer-legal { font-size: 0.8rem; margin: 16px 0; max-width: 760px; }
.footer-copy { font-size: 0.8rem; margin: 0; }

/* Contact band (public landing page) */
.contact-band {
  background: var(--gray-50, #f7f8fa);
  text-align: center;
  padding: 56px 24px;
}
.contact-band h2 { margin-bottom: 8px; }
.contact-lines { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin: 16px 0; font-weight: 600; }
.contact-band .small { font-size: 0.85rem; color: var(--gray-600, #5b6675); max-width: 720px; margin: 0 auto; }

/* Legal document pages (Terms, Privacy) */
.legal-doc {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.legal-doc h1 { margin-bottom: 8px; }
.legal-updated { color: var(--gray-600, #5b6675); font-size: 0.85rem; margin-bottom: 24px; }
.legal-doc h2 { margin-top: 32px; font-size: 1.15rem; }
.legal-doc p, .legal-doc li { line-height: 1.65; }
.legal-doc ul { padding-left: 24px; }
.legal-doc ul li { margin-bottom: 6px; }

/* Auth page footer */
.auth-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
  color: var(--gray-600, #5b6675);
}
.auth-footer a { color: inherit; text-decoration: none; margin: 0 6px; }
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .qualify-grid { grid-template-columns: repeat(2, 1fr); }
  .why-grid { grid-template-columns: 1fr; }
  .trust-bar-inner { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .landing-nav { display: none; }
  .hero h1 { font-size: 1.7rem; }
  .steps-grid { grid-template-columns: 1fr; }
  .qualify-grid { grid-template-columns: 1fr; }
  .trust-bar-inner { grid-template-columns: repeat(2, 1fr); }
  .attorney-block { flex-direction: column; align-items: flex-start; }
}

/* Honeypot field: invisible to real visitors, left unset. Automated form
   fillers that populate every input tend to fill it anyway, which is how
   we tell them apart from a person. Kept off-screen (not display:none) so
   it still occupies a real, fillable input in the DOM. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
