/* ============ CUREMED PORTAL - WEBSITE THEME ============ */
:root {
  --blue: #0B5FA5;
  --blue-dark: #084A82;
  --blue-light: #2E7DD1;
  --blue-bg: #EAF2FA;
  --grad-blue: linear-gradient(135deg, #0B5FA5 0%, #2E7DD1 100%);

  --green: #10B981;
  --green-dark: #059669;
  --green-bg: #ECFDF5;
  --amber: #F59E0B;
  --amber-dark: #D97706;
  --amber-bg: #FFFBEB;
  --red: #EF4444;
  --red-dark: #DC2626;
  --red-bg: #FEF2F2;
  --purple: #8B5CF6;
  --purple-bg: #F5F3FF;

  --ink: #0F172A;
  --ink-soft: #64748B;
  --ink-mid: #475569;
  --line: #E5EAF0;
  --line-soft: #F5F8FA;
  --line-strong: #CBD5E1;
  --bg: #F8FAFD;
  --white: #FFFFFF;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Monaco, monospace;

  --shadow-sm: 0 1px 2px rgba(11, 95, 165, 0.06);
  --shadow-md: 0 4px 12px rgba(11, 95, 165, 0.08);
  --shadow-lg: 0 8px 24px rgba(11, 95, 165, 0.10);
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

/* ============ AUTH PAGE (LOGIN) ============ */
.auth-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } }

.auth-brand {
  background: linear-gradient(135deg, #084A82 0%, #0B5FA5 45%, #2E7DD1 100%);
  color: #fff;
  padding: 60px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 70%);
  border-radius: 50%;
}
.auth-brand::after {
  content: "";
  position: absolute;
  bottom: -80px;
  left: -60px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}
@media (max-width: 900px) { .auth-brand { padding: 40px 30px; min-height: 280px; } }

.auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  margin-bottom: 60px;
}
/* The square icon was 42px with a white plate behind it. The .co logo is a
   full lockup — mark and wordmark together — so it needs a width rather than
   a box, and no plate. */
.brand-logo img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.brand-logo-svg {
  width: 160px;
  height: auto;
  /* The auth panel is dark and the logo is drawn for light backgrounds.
     Inverting keeps the wordmark legible; the hue-rotate brings the blue mark
     back round from the warm tone invert leaves it at. */
  filter: invert(1) hue-rotate(180deg) saturate(0.8) brightness(1.4);
  /* Overrides the square rules above, which still apply by tag. */
  border-radius: 0;
  background: none;
  padding: 0;
}
.brand-logo-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
/* .co sets the Med half of its footer wordmark in a light blue rather than
   a dimmer white. On the dark auth panel that reads as the brand colour
   rather than as the same word losing contrast halfway through. */
.brand-accent { color: #6bb6e8; }

.brand-content { flex: 1; }
.brand-content h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  font-weight: 700;
}
@media (max-width: 900px) { .brand-content h1 { font-size: 1.8rem; } }

.brand-tagline {
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
  margin-bottom: 48px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
@media (max-width: 900px) { .brand-features { display: none; } }

.feature-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.feature-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.20);
}
.feature-icon svg { width: 20px; height: 20px; stroke: #fff; }
.feature-item h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #fff;
  margin-bottom: 4px;
  font-weight: 600;
}
.feature-item p {
  font-size: 0.87rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.72);
}

.brand-footer {
  padding-top: 32px;
  margin-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}
.brand-footer a { color: #fff; text-decoration: underline; }

.auth-form-wrap {
  background: #fff;
  padding: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 900px) { .auth-form-wrap { padding: 40px 24px; } }

.auth-form-inner { width: 100%; max-width: 400px; }

.form-header { margin-bottom: 36px; }
.form-header h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.form-header p {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  transition: all 0.15s ease;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-bg);
}
.form-input::placeholder { color: #94A3B8; }

.form-error {
  display: block;
  font-size: 0.82rem;
  color: var(--red);
  margin-top: 6px;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  font-size: 0.87rem;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-mid);
  cursor: pointer;
}
.checkbox-label input { accent-color: var(--blue); width: 16px; height: 16px; }
.forgot-link { color: var(--blue); font-weight: 500; }

.btn-submit {
  position: relative;
  width: 100%;
  padding: 13px 20px;
  background: var(--grad-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(11, 95, 165, 0.25);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.20) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.btn-submit:hover {
  box-shadow: 0 6px 16px rgba(11, 95, 165, 0.28);
}
.btn-submit:hover::before { transform: translateX(100%); }
.btn-submit svg { transition: transform 0.2s ease; position: relative; z-index: 1; }
.btn-submit:hover svg { transform: translateX(3px); }
.btn-submit span { position: relative; z-index: 1; }

.form-footer {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.87rem;
  color: var(--ink-soft);
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 20px;
  border-left: 3px solid;
}
.alert-error { background: var(--red-bg); border-color: var(--red); color: var(--red-dark); }
.alert-success { background: var(--green-bg); border-color: var(--green); color: var(--green-dark); }
.alert-info { background: var(--blue-bg); border-color: var(--blue); color: var(--blue-dark); }

/* ============ APP SHELL WITH LIGHT SIDEBAR ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) { .app-shell { grid-template-columns: 1fr; } }

.sidebar {
  background: #fff;
  color: var(--ink);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}
@media (max-width: 900px) { .sidebar { position: static; height: auto; } }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 32px;
  color: var(--ink);
  text-decoration: none;
}
.sidebar-brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* The lockup in the expanded sidebar, beside the role line. */
.sidebar-brand-svg {
  width: 130px;
  height: auto;
  border-radius: 0;
  flex-shrink: 0;
}

/* And in the collapsed header row on mobile, where there is less width. */
.sidebar-logo-svg {
  width: 118px;
  height: auto;
  border-radius: 0;
}
.sidebar-brand-info { min-width: 0; }
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.sidebar-brand-accent { color: var(--blue); }
.sidebar-brand-role {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 14px 12px 6px;
  margin-top: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ink-mid);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
}
.sidebar-link:hover {
  background: var(--line-soft);
  color: var(--ink);
}
.sidebar-link.active {
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
}
.sidebar-link.active svg { stroke: var(--blue); }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--grad-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.sidebar-logout:hover {
  background: var(--red-bg);
  color: var(--red-dark);
}
.sidebar-logout svg { width: 16px; height: 16px; }

/* Main Content */
.app-main {
  padding: 32px 40px 60px;
  overflow-x: auto;
}
@media (max-width: 900px) { .app-main { padding: 24px 20px; } }

.page-header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.page-header p {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  border-color: var(--line-strong);
}
.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.green { background: var(--green-bg); color: var(--green-dark); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber-dark); }
.stat-icon.red { background: var(--red-bg); color: var(--red-dark); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }

.stat-lbl {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 6px;
}
.stat-val {
  font-family: var(--font-display);
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-dark);
}
.stat-trend.negative { color: var(--red-dark); }
.stat-trend svg { width: 12px; height: 12px; }

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
@media (max-width: 1100px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.chart-card-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 600;
}
.chart-card-header .badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chart-container {
  position: relative;
  height: 260px;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) { .content-grid { grid-template-columns: 1fr; } }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-header-action {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.panel-body { padding: 8px 0; }

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: var(--line-soft);
}
.data-table td {
  padding: 14px 24px;
  font-size: 0.88rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--line-soft); }
.data-table code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-mid);
  background: var(--line-soft);
  padding: 3px 7px;
  border-radius: 5px;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}
.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-active, .status-sent, .status-paid {
  background: var(--green-bg);
  color: var(--green-dark);
}
.status-pending, .status-accrued {
  background: var(--amber-bg);
  color: var(--amber-dark);
}
.status-canceled, .status-failed, .status-overdue {
  background: var(--red-bg);
  color: var(--red-dark);
}
.status-inactive, .status-on_hold {
  background: var(--line-soft);
  color: var(--ink-soft);
}

/* List Item */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--line-soft); }
.list-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 3px;
  font-weight: 600;
}
.list-item small {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* Top Partners Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--line-soft);
  color: var(--ink-mid);
  flex-shrink: 0;
}
.leaderboard-rank.gold { background: linear-gradient(135deg, #FCD34D, #F59E0B); color: #78350F; }
.leaderboard-rank.silver { background: linear-gradient(135deg, #E5E7EB, #9CA3AF); color: #1F2937; }
.leaderboard-rank.bronze { background: linear-gradient(135deg, #FDBA74, #EA580C); color: #7C2D12; }
.leaderboard-info { flex: 1; min-width: 0; }
.leaderboard-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}
.leaderboard-clients {
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.leaderboard-amount {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue);
}


/* ============ ADMIN CRUD PAGES ============ */

/* Page Header with Actions */
.page-header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}
.page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--grad-blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(11,95,165,0.20);
}
.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(11,95,165,0.28);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
}
.btn-secondary:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-danger {
  background: #fff;
  color: var(--red-dark);
  border: 1.5px solid var(--red-bg);
}
.btn-danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
}

.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-icon-only { padding: 8px; }

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.filter-search {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--line-soft);
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.filter-search:focus-within {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}
.filter-search svg { width: 16px; height: 16px; color: var(--ink-soft); flex-shrink: 0; }
.filter-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.filter-search input::placeholder { color: var(--ink-soft); }

.filter-select {
  padding: 8px 30px 8px 12px;
  background: var(--line-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  outline: none;
}
.filter-select:focus { background-color: #fff; border-color: var(--blue); }

/* Data Table Enhancements */
.data-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.data-table .table-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  margin-right: 10px;
  vertical-align: middle;
}
.data-table .cell-name {
  display: flex;
  align-items: center;
  gap: 12px;
}
.data-table .cell-name-info { min-width: 0; }
.data-table .cell-name-primary {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.data-table .cell-name-secondary {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.data-table .cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: var(--line-soft);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
}
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 600;
}
.empty-state p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Form Layout */
.form-container {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  max-width: 800px;
}
.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.form-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 4px;
  font-weight: 600;
}
.form-section-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .full-width { grid-column: 1 / -1; }

.form-group textarea.form-input {
  resize: vertical;
  min-height: 90px;
  font-family: var(--font-body);
}
.form-group select.form-input {
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%230B5FA5' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}

/* Detail Page */
.detail-header {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  flex-shrink: 0;
}
.detail-info { flex: 1; min-width: 250px; }
.detail-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 4px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.detail-subline {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--ink-mid);
}
.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.detail-meta-item svg { width: 14px; height: 14px; color: var(--ink-soft); }
.detail-meta-item a { color: var(--blue); }
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}


/* ============ DATE RANGE FILTER ============ */
.date-filter {
  position: relative;
  display: inline-block;
}

.date-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.date-filter-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.date-filter-btn.active {
  background: var(--blue-bg);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}
.date-filter-btn svg {
  width: 16px;
  height: 16px;
}
.date-filter-btn .filter-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  font-weight: 500;
}
.date-filter-btn.active .filter-label {
  color: var(--blue);
}
.date-filter-btn .chevron {
  transition: transform 0.2s ease;
}
.date-filter.open .chevron {
  transform: rotate(180deg);
}

.date-filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(11, 95, 165, 0.14);
  z-index: 100;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}
.date-filter.open .date-filter-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.date-preset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-mid);
  transition: all 0.12s ease;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.date-preset-item:hover {
  background: var(--line-soft);
  color: var(--ink);
}
.date-preset-item.active {
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
}
.date-preset-item .preset-range {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 400;
}
.date-preset-item.active .preset-range {
  color: var(--blue);
}

.date-preset-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.date-custom-section {
  padding: 12px 14px;
}
.date-custom-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 10px;
}
.date-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.date-custom-grid input {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  transition: all 0.15s ease;
}
.date-custom-grid input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}
.date-custom-grid label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-weight: 600;
}
.date-custom-apply {
  width: 100%;
  padding: 9px 14px;
  background: var(--grad-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.date-custom-apply:hover {
  box-shadow: 0 4px 12px rgba(11, 95, 165, 0.24);
}


/* ============ RESPONSIVE TABLES ============ */
.data-table-wrap { overflow-x: auto; }
.data-table { min-width: 700px; }

/* Compact table variant for many columns */
.data-table.data-table-compact th,
.data-table.data-table-compact td {
  padding: 10px 14px;
  font-size: 0.82rem;
}
.data-table.data-table-compact code {
  font-size: 0.72rem;
  padding: 2px 5px;
}
.data-table.data-table-compact .status-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
}
.data-table.data-table-compact .btn-sm {
  padding: 5px 9px;
  font-size: 0.75rem;
}
.data-table.data-table-compact .cell-name-primary {
  font-size: 0.85rem;
}
.data-table.data-table-compact .cell-name-secondary {
  font-size: 0.72rem;
}


/* ============ INVOICE FORM ENHANCEMENTS ============ */
.invoice-context-card {
  background: linear-gradient(135deg, #EAF2FA 0%, #F8FAFD 100%);
  border: 1px solid var(--blue-bg);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}
@media (max-width: 700px) {
  .invoice-context-card { grid-template-columns: 1fr; text-align: center; }
}

.invoice-context-icon {
  width: 56px;
  height: 56px;
  background: var(--grad-blue);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(11, 95, 165, 0.25);
}
.invoice-context-info { min-width: 0; }
.invoice-context-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 4px;
}
.invoice-context-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.invoice-context-sub {
  font-size: 0.88rem;
  color: var(--ink-mid);
}
.invoice-context-sub code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(11, 95, 165, 0.08);
  color: var(--blue-dark);
}
.invoice-context-badges {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
@media (max-width: 700px) {
  .invoice-context-badges { align-items: center; }
}

/* Payout Preview Card */
.payout-preview {
  background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 100%);
  border: 1px solid #A7F3D0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.payout-preview-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #059669, #10B981);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}
.payout-preview-icon svg { width: 20px; height: 20px; }
.payout-preview-content { flex: 1; min-width: 0; }
.payout-preview-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-dark);
  font-weight: 600;
  margin-bottom: 2px;
}
.payout-preview-amount {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.payout-preview-desc {
  font-size: 0.82rem;
  color: var(--ink-mid);
}
.payout-preview-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--green-dark);
  background: rgba(16, 185, 129, 0.12);
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 600;
}

/* Input with prefix */
.input-with-prefix {
  position: relative;
}
.input-with-prefix .prefix-symbol {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-weight: 500;
  pointer-events: none;
  font-size: 0.95rem;
}
.input-with-prefix input {
  padding-left: 30px !important;
}

/* Calculate button */
.calc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--blue-bg);
  color: var(--blue);
  border: none;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
  text-transform: uppercase;
  margin-left: 8px;
}
.calc-btn:hover {
  background: var(--blue);
  color: #fff;
}
.calc-btn svg { width: 12px; height: 12px; }

/* Status Logic Preview */
.status-logic-card {
  background: #fff;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  padding: 18px 22px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.status-logic-arrow {
  font-family: var(--font-mono);
  color: var(--blue);
  font-weight: 700;
  font-size: 1.2rem;
}
.status-logic-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-logic-item-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Sticky form actions */
.form-actions-sticky {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 2px solid var(--line);
  padding: 16px 32px;
  margin: 32px -32px -32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 14px 14px;
}
.form-actions-sticky .actions-group {
  display: flex;
  gap: 12px;
}
.form-actions-sticky .save-status {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}


/* ============ TIMELINE COMPONENT ============ */
.timeline {
  display: flex;
  align-items: flex-start;
  padding: 32px 20px 24px;
  background: linear-gradient(135deg, #F8FAFD 0%, #FFFFFF 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  gap: 0;
}

.timeline-step {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 8px;
}

/* Base connecting line (grey dashed for future steps) */
.timeline-step::after {
  content: "";
  position: absolute;
  top: 22px;
  left: calc(50% + 26px);
  right: calc(-50% + 26px);
  height: 3px;
  background-color: var(--line-strong);
  background-image: linear-gradient(90deg,
    transparent 0%,
    transparent 40%,
    rgba(11, 95, 165, 0.35) 50%,
    transparent 60%,
    transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  z-index: 0;
  animation: flowRight 2s linear infinite;
  border-radius: 2px;
}

@keyframes flowRight {
  0% { background-position: 200% 0; }
  100% { background-position: -100% 0; }
}

.timeline-step:last-child::after { display: none; }

/* Completed connecting line — solid green with subtle shine */
.timeline-step.completed::after {
  background-color: var(--green);
  background-image: linear-gradient(90deg,
    transparent 0%,
    transparent 40%,
    rgba(255,255,255,0.5) 50%,
    transparent 60%,
    transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shineRight 3s linear infinite;
}

@keyframes shineRight {
  0% { background-position: 200% 0; }
  100% { background-position: -100% 0; }
}

/* Active step — animated flowing line towards next step */
.timeline-step.active::after {
  background-color: var(--line-soft);
  background-image: linear-gradient(90deg,
    transparent 0%,
    var(--blue) 30%,
    var(--blue-light) 50%,
    var(--blue) 70%,
    transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: flowRight 1.5s linear infinite;
}

.timeline-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}

/* Completed dot — solid green with checkmark bounce */
.timeline-step.completed .timeline-dot {
  background: linear-gradient(135deg, #10B981, #059669);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.32);
  animation: dotPop 0.5s ease-out;
}

@keyframes dotPop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Active dot — pulsing rings + rotating gradient border */
.timeline-step.active .timeline-dot {
  background: #fff;
  border-color: transparent;
  color: var(--blue);
  position: relative;
  z-index: 2;
  box-shadow:
    0 0 0 4px var(--blue-bg),
    0 8px 20px rgba(11, 95, 165, 0.25);
  animation: activePulse 2s ease-in-out infinite;
}

.timeline-step.active .timeline-dot::before {
  content: "";
  position: absolute;
  inset: -2.5px;
  border-radius: 50%;
  padding: 2.5px;
  background: conic-gradient(from 0deg, var(--blue), #6BAEF0, var(--blue));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: rotate 3s linear infinite;
}

/* Outer ripple effect */
.timeline-step.active .timeline-dot::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  opacity: 0;
  animation: ripple 2s ease-out infinite;
}

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

@keyframes activePulse {
  0%, 100% {
    box-shadow: 0 0 0 4px var(--blue-bg), 0 8px 20px rgba(11, 95, 165, 0.25);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(11, 95, 165, 0.10), 0 8px 20px rgba(11, 95, 165, 0.35);
  }
}

@keyframes ripple {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

/* Failed dot — red with warning bounce */
.timeline-step.failed .timeline-dot {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.32);
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--blue-bg), 0 4px 12px rgba(11, 95, 165, 0.20); }
  50% { box-shadow: 0 0 0 8px rgba(11, 95, 165, 0.08), 0 4px 12px rgba(11, 95, 165, 0.20); }
}

.timeline-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.3;
}
.timeline-step.completed .timeline-label { color: var(--green-dark); }
.timeline-step.active .timeline-label { color: var(--blue); }

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.4;
}

/* ============ TOOLTIP ============ */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tooltip-icon {
  width: 14px;
  height: 14px;
  color: var(--ink-soft);
  cursor: help;
}
.tooltip-wrap:hover .tooltip-text {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0F172A;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
  pointer-events: none;
  max-width: 260px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
  min-width: 180px;
}
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #0F172A;
}

/* ============ CLICKABLE ROWS ============ */

/* ============ DETAIL PAGE ENHANCEMENTS ============ */
.detail-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.detail-section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.detail-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 32px;
}
@media (max-width: 700px) {
  .info-grid { grid-template-columns: 1fr; gap: 16px; }
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}
.info-value {
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 500;
}
.info-value.large {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.info-value a {
  color: var(--blue);
}

/* ============ INVOICE STATUS PILL ============ */
.invoice-mini {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: all 0.15s ease;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 10px;
}
.invoice-mini:hover {
  border-color: var(--blue);
  color: var(--ink);
}
.invoice-mini-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.invoice-mini-icon.paid { background: linear-gradient(135deg, #059669, #10B981); }
.invoice-mini-icon.pending { background: linear-gradient(135deg, #D97706, #F59E0B); }
.invoice-mini-icon.overdue { background: linear-gradient(135deg, #DC2626, #EF4444); }
.invoice-mini-icon svg { width: 18px; height: 18px; }
.invoice-mini-info { min-width: 0; }
.invoice-mini-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.invoice-mini-sub {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.invoice-mini-sub code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--line-soft);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink-mid);
}
.invoice-mini-amount {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ============ TIMELINE MINI (Compact for cards) ============ */
.timeline-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--line-soft);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
}
.timeline-mini-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
  position: relative;
  flex-shrink: 0;
}
.timeline-mini-dot.done {
  background: linear-gradient(135deg, #10B981, #059669);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}
.timeline-mini-dot.active {
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
  animation: activePulse 2s ease-in-out infinite;
}
.timeline-mini-line {
  width: 24px;
  height: 3px;
  background-color: var(--line-strong);
  background-image: linear-gradient(90deg,
    transparent 0%,
    rgba(11, 95, 165, 0.4) 50%,
    transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: flowRight 2s linear infinite;
  flex-shrink: 0;
  border-radius: 2px;
}
.timeline-mini-line.done {
  background: var(--green);
  animation: none;
}

/* ============ MILESTONE CARD ============ */
.milestone-card {
  background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 100%);
  border: 1px solid #A7F3D0;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.milestone-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #059669, #10B981);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}
.milestone-icon svg { width: 22px; height: 22px; }
.milestone-content { flex: 1; }
.milestone-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--green-dark);
  font-weight: 700;
  margin-bottom: 2px;
}
.milestone-sub {
  font-size: 0.85rem;
  color: var(--ink-mid);
}


/* ============ CLICKABLE ROW AFFORDANCE ============ */





/* Clickable list-item affordance */
a.list-item {
  position: relative;
  padding-right: 42px !important;
}
a.list-item::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  opacity: 0.5;
  transition: all 0.2s ease;
}
a.list-item:hover {
  background: var(--blue-bg);
}
a.list-item:hover::after {
  opacity: 1;
  right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230B5FA5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
}

/* "Click to view" hint on hover */

/* Info banner at top of clickable tables */
.clickable-table-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--blue-bg);
  color: var(--blue-dark);
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}
.clickable-table-hint svg {
  width: 16px;
  height: 16px;
}



/* Row hover indicator (no chevron, just background + accent) */

/* ============ CLICKABLE ROWS (Clean) ============ */
.data-table tr.clickable-row {
  cursor: pointer;
}
.data-table tr.clickable-row td {
  transition: background-color 0.15s ease;
}
.data-table tr.clickable-row:hover td {
  background: var(--blue-bg) !important;
}
.data-table tr.clickable-row:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--blue);
}
.data-table tr.clickable-row:hover .cell-name-primary {
  color: var(--blue-dark);
}


/* ============ VIEW BUTTON ON ROW HOVER ============ */
/* Add empty "view" cell to end of clickable rows via ::after on <tr> */
.data-table tr.clickable-row td:last-child {
  position: relative;
}

.data-table tr.clickable-row td:last-child .row-view-btn {
  display: none;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 12px;
  background: var(--blue);
  color: #fff;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(11, 95, 165, 0.25);
}

.data-table tr.clickable-row td:last-child .row-view-btn svg {
  width: 12px;
  height: 12px;
}

.data-table tr.clickable-row:hover td:last-child .row-view-btn {
  display: inline-flex;
}


/* ============ CELEBRATION EFFECT (Last Step Complete) ============ */

/* Special glow on the last completed step's dot */
.timeline-step.completed.final .timeline-dot {
  background: linear-gradient(135deg, #10B981, #059669);
  animation: victoryPulse 2.5s ease-in-out infinite, dotPop 0.6s ease-out;
  position: relative;
  overflow: visible;
}

@keyframes victoryPulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(16, 185, 129, 0.6),
      0 0 0 4px rgba(16, 185, 129, 0.15),
      0 8px 24px rgba(16, 185, 129, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 14px rgba(16, 185, 129, 0),
      0 0 0 4px rgba(16, 185, 129, 0.25),
      0 8px 30px rgba(16, 185, 129, 0.6);
  }
}

/* Rotating star sparkle around final dot */
.timeline-step.completed.final .timeline-dot::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0deg,
    rgba(16, 185, 129, 0.5) 60deg,
    transparent 120deg,
    rgba(52, 211, 153, 0.5) 180deg,
    transparent 240deg,
    rgba(16, 185, 129, 0.5) 300deg,
    transparent 360deg);
  animation: rotateSparkle 4s linear infinite;
  z-index: -1;
  filter: blur(6px);
}

@keyframes rotateSparkle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Confetti particles bursting from final step */
.timeline-step.completed.final .timeline-dot::after {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background:
    radial-gradient(circle 3px at 20% 30%, #F59E0B 100%, transparent),
    radial-gradient(circle 2px at 80% 20%, #EF4444 100%, transparent),
    radial-gradient(circle 2px at 30% 80%, #8B5CF6 100%, transparent),
    radial-gradient(circle 3px at 70% 70%, #10B981 100%, transparent),
    radial-gradient(circle 2px at 90% 50%, #F59E0B 100%, transparent),
    radial-gradient(circle 2px at 10% 60%, #06B6D4 100%, transparent);
  animation: confettiBurst 2s ease-out infinite;
  pointer-events: none;
}

@keyframes confettiBurst {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Emoji badge floating above final step */
.timeline-step.completed.final .timeline-label::before {
  content: "🎉";
  display: inline-block;
  margin-right: 4px;
  animation: bounce 1.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Green victory glow around entire label */
.timeline-step.completed.final .timeline-label {
  color: var(--green-dark);
  font-weight: 700;
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.timeline-step.completed.final .timeline-date {
  color: var(--green-dark);
  font-weight: 600;
}

/* ============ CELEBRATION BANNER ============ */
.celebration-banner {
  background: linear-gradient(135deg,
    #ECFDF5 0%,
    #D1FAE5 25%,
    #A7F3D0 50%,
    #D1FAE5 75%,
    #ECFDF5 100%);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  border: 1.5px solid #6EE7B7;
  border-radius: 14px;
  padding: 20px 28px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Confetti particles floating in banner */
.celebration-banner::before,
.celebration-banner::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle 3px at 15% 30%, #F59E0B 100%, transparent),
    radial-gradient(circle 2px at 85% 20%, #EF4444 100%, transparent),
    radial-gradient(circle 3px at 25% 70%, #8B5CF6 100%, transparent),
    radial-gradient(circle 2px at 75% 80%, #06B6D4 100%, transparent),
    radial-gradient(circle 3px at 45% 40%, #F59E0B 100%, transparent),
    radial-gradient(circle 2px at 60% 60%, #EC4899 100%, transparent),
    radial-gradient(circle 2px at 90% 50%, #10B981 100%, transparent);
  opacity: 0.6;
  animation: confettiFloat 6s ease-in-out infinite;
}

.celebration-banner::after {
  animation-delay: -3s;
  opacity: 0.4;
}

@keyframes confettiFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(180deg); }
}

.celebration-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #10B981, #059669);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  font-size: 1.6rem;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
  position: relative;
  z-index: 1;
  animation: iconBounce 1.5s ease-in-out infinite;
}

@keyframes iconBounce {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.08) rotate(5deg); }
}

.celebration-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.celebration-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--green-dark);
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.celebration-sub {
  font-size: 0.88rem;
  color: var(--ink-mid);
  font-weight: 500;
}


/* ============ BULK IMPORT UI ============ */
.import-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #F8FAFD 0%, #FFFFFF 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 20px;
}

.import-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.import-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.import-step.active .import-step-num {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 4px var(--blue-bg);
}

.import-step.completed .import-step-num {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.import-step.completed .import-step-num svg { width: 14px; height: 14px; }

.import-step-label {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9rem;
}
.import-step:not(.active):not(.completed) .import-step-label {
  color: var(--ink-soft);
}

.import-step-line {
  flex: 1;
  height: 2px;
  background: var(--line);
  min-width: 40px;
}
.import-step-line.completed {
  background: var(--green);
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--line-soft);
}
.upload-zone:hover {
  border-color: var(--blue);
  background: var(--blue-bg);
}
.upload-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-bg);
  transform: scale(1.01);
}
.upload-zone.has-file {
  border-color: var(--green);
  border-style: solid;
  background: rgba(16, 185, 129, 0.04);
}

.upload-zone-icon {
  width: 56px;
  height: 56px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(11, 95, 165, 0.1);
}
.upload-zone-icon svg { width: 28px; height: 28px; }

.upload-zone-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 4px;
}
.upload-zone-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* CSV Column Info Cards */
.csv-col-info {
  padding: 10px 14px;
  background: var(--line-soft);
  border-radius: 8px;
  border-left: 3px solid var(--blue);
}
.csv-col-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.csv-col-name .required {
  background: var(--red-bg);
  color: var(--red-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
}
.csv-col-name .optional {
  background: var(--line);
  color: var(--ink-mid);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
}
.csv-col-desc {
  font-size: 0.78rem;
  color: var(--ink-soft);
}


/* ============ AUTH COMPACT LAYOUT (no scroll) ============ */
.auth-page {
  max-height: 100vh;
  overflow: hidden;
}

.brand-content-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 20px 0;
}

/* Floating Lottie animation */
.auth-lottie-float {
  width: 100%;
  max-width: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatUpDown 4s ease-in-out infinite;
  filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.2));
}

.auth-lottie-float lottie-player {
  width: 100%;
  height: auto;
}

@keyframes floatUpDown {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

/* Heading below animation */
.auth-heading {
  text-align: center;
  max-width: 400px;
}

.auth-heading h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  line-height: 1.2;
}

.auth-heading .brand-tagline {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 900px) {
  .auth-page {
    max-height: none;
    overflow: auto;
  }
  .auth-lottie-float {
    max-width: 300px;
    padding: 32px;
  }
  .auth-heading h1 {
    font-size: 1.4rem;
  }
}




/* ============ AUTH BRAND ENHANCED (blue theme) ============ */
.auth-brand {
  background:
    radial-gradient(circle at 25% 25%, rgba(16, 185, 129, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 75% 75%, rgba(56, 189, 248, 0.12) 0%, transparent 45%),
    linear-gradient(135deg, #084A82 0%, #0B5FA5 45%, #2E7DD1 100%) !important;
  position: relative;
  overflow: hidden;
}

/* Subtle animated glow orbs */
.auth-brand::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.22) 0%, transparent 70%);
  border-radius: 50%;
  animation: authOrb1 18s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.auth-brand::after {
  content: "";
  position: absolute;
  bottom: -100px;
  left: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  animation: authOrb2 22s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes authOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 40px) scale(1.1); }
}

@keyframes authOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

.auth-brand-inner {
  position: relative;
  z-index: 2;
}

/* Lottie animation with deep shadow (as requested) */
.auth-lottie-float {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.10) 40%, rgba(255, 255, 255, 0.05) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 48px;
  animation: floatUpDown 4s ease-in-out infinite, bubbleGlow 6s ease-in-out infinite;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.35),
    0 15px 30px rgba(16, 185, 129, 0.20),
    inset 0 2px 4px rgba(255, 255, 255, 0.30),
    inset 0 -2px 4px rgba(0, 0, 0, 0.10);
  position: relative;
  overflow: hidden;
}

/* Bubble highlight shine */
.auth-lottie-float::before {
  content: "";
  position: absolute;
  top: 8%;
  left: 15%;
  width: 40%;
  height: 25%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  filter: blur(6px);
  pointer-events: none;
  animation: shineMove 8s ease-in-out infinite;
}

/* Second small highlight */
.auth-lottie-float::after {
  content: "";
  position: absolute;
  bottom: 15%;
  right: 20%;
  width: 15%;
  height: 15%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  filter: blur(4px);
  pointer-events: none;
}

@keyframes bubbleGlow {
  0%, 100% {
    box-shadow:
      0 30px 60px rgba(0, 0, 0, 0.35),
      0 15px 30px rgba(16, 185, 129, 0.20),
      inset 0 2px 4px rgba(255, 255, 255, 0.30),
      inset 0 -2px 4px rgba(0, 0, 0, 0.10);
  }
  50% {
    box-shadow:
      0 30px 60px rgba(0, 0, 0, 0.35),
      0 20px 40px rgba(56, 189, 248, 0.30),
      inset 0 2px 4px rgba(255, 255, 255, 0.35),
      inset 0 -2px 4px rgba(0, 0, 0, 0.10);
  }
}

@keyframes shineMove {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  50% { transform: translate(10px, 5px) scale(1.05); opacity: 0.8; }
}

.auth-lottie-float lottie-player {
  width: 100%;
  height: auto;
}

/* Heading — clean white with subtle glow */
.auth-heading h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  line-height: 1.2;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.auth-heading .brand-tagline {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.5;
  margin: 0;
}


/* ============ AUTH FOOTER TIGHTER (compact pages only) ============ */
.brand-content-compact + .brand-footer {
  margin-top: 16px !important;
  padding-top: 16px !important;
}


/* ============ SIDEBAR: Hamburger drawer on mobile ============ */
@media (max-width: 900px) {
  /* Hide sidebar by default on mobile */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Backdrop overlay when sidebar open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    animation: fadeIn 0.2s ease;
  }
  .sidebar-backdrop.active {
    display: block;
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* Mobile topbar with hamburger */
  .mobile-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #0B5FA5;
    text-decoration: none;
  }
  .mobile-topbar-brand img {
    height: 24px;
    width: auto;
  }
  .hamburger-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0F172A;
    border-radius: 8px;
  }
  .hamburger-btn:hover {
    background: #F1F5F9;
  }

  .app-main {
    padding: 16px !important;
  }
}

/* Hide mobile topbar on desktop */
.mobile-topbar {
  display: none;
}

/* ============ PAGE HEADER: Stack on mobile ============ */
@media (max-width: 700px) {
  .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px;
  }
  .page-header > div:last-child,
  .page-header .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
  }
  .page-header h1 {
    font-size: 1.4rem !important;
  }
}

/* ============ FILTER BAR: Vertical on mobile ============ */
@media (max-width: 700px) {
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px;
  }
  .filter-bar .search-input,
  .filter-bar input[type="search"],
  .filter-bar input[type="text"] {
    width: 100% !important;
    min-width: 0 !important;
  }
  .filter-select,
  .filter-bar select {
    width: 100% !important;
    min-width: 0 !important;
  }
  .filter-bar > * {
    flex: none !important;
    width: 100%;
  }
}

/* ============ DATA TABLES: Card view on mobile ============ */
@media (max-width: 700px) {
  /* Hide table headers */
  .data-table thead,
  .data-table-compact thead {
    display: none;
  }

  .data-table,
  .data-table-compact {
    border: none;
    background: transparent;
  }

  .data-table tbody,
  .data-table-compact tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .data-table tr,
  .data-table-compact tr {
    display: block;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }

  .data-table tr.clickable-row:hover,
  .data-table-compact tr.clickable-row:hover {
    background: #EAF2FA;
    box-shadow: 0 2px 8px rgba(11, 95, 165, 0.08);
  }

  .data-table td,
  .data-table-compact td {
    display: block;
    padding: 8px 0;
    border: none;
    font-size: 0.9rem;
    text-align: left;
  }

  /* Pseudo-label from data-label attribute (above value) */
  .data-table td::before,
  .data-table-compact td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748B;
    margin-bottom: 4px;
  }

  /* Hide the ::before if td has no data-label */
  .data-table td:not([data-label])::before,
  .data-table-compact td:not([data-label])::before {
    display: none;
  }

  /* First cell (usually # or ID) gets special treatment */
  .data-table td:first-child,
  .data-table-compact td:first-child {
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #E2E8F0;
    font-weight: 700;
  }

  /* Hide row number # column on mobile */
  .data-table td.row-num,
  .data-table-compact td.row-num {
    display: none;
  }

  /* View badge visible always on mobile */
  .row-view-btn {
    position: static !important;
    opacity: 1 !important;
  }
}

/* ============ STAT CARDS: Tighter on mobile ============ */
@media (max-width: 640px) {
  .stat-card {
    padding: 14px !important;
  }
  .stat-card .stat-value,
  .stat-value {
    font-size: 1.4rem !important;
  }
  .stat-card .stat-label,
  .stat-label {
    font-size: 0.72rem !important;
  }
  .stat-icon {
    width: 32px !important;
    height: 32px !important;
  }
}

/* ============ FORMS: Full width, comfortable mobile ============ */
@media (max-width: 700px) {
  .form-container {
    padding: 16px !important;
    border-radius: 12px !important;
  }
  .form-section {
    padding: 16px 0 !important;
  }
  .form-section-title,
  .section-title {
    font-size: 0.85rem !important;
  }
  .form-actions,
  .form-footer-actions {
    flex-direction: column-reverse !important;
    gap: 10px !important;
  }
  .form-actions .btn,
  .form-footer-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .form-input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important; /* Prevent iOS zoom */
  }
}

/* ============ BUTTONS: Better tap targets on mobile ============ */
@media (max-width: 700px) {
  .btn,
  button.btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  .btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.82rem;
  }
}

/* ============ TIMELINE: Vertical on mobile ============ */
@media (max-width: 700px) {
  .timeline,
  .timeline-container {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .timeline-step {
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    padding: 12px 0 !important;
    width: 100% !important;
    gap: 14px;
  }
  .timeline-step .timeline-dot {
    margin: 0 !important;
    flex-shrink: 0;
  }
  .timeline-step .timeline-content {
    text-align: left !important;
    flex: 1;
  }
  .timeline-line {
    display: none !important;
  }
  /* Vertical connector between steps */
  .timeline-step::after {
    content: "";
    position: absolute;
    left: 20px;
    top: 100%;
    width: 2px;
    height: 20px;
    background: #E2E8F0;
  }
  .timeline-step:last-child::after {
    display: none;
  }
  .timeline-step {
    position: relative;
  }
}

/* ============ CHART CARDS: Compact ============ */
@media (max-width: 700px) {
  .chart-card {
    padding: 16px !important;
  }
  .chart-card canvas {
    max-height: 220px !important;
  }
  .chart-card h3,
  .chart-title {
    font-size: 0.95rem !important;
  }
}

/* ============ MILESTONE + CELEBRATION CARDS ============ */
@media (max-width: 700px) {
  .milestone-card {
    padding: 16px !important;
    flex-direction: column !important;
    text-align: center !important;
    gap: 12px !important;
  }
  .celebration-banner {
    font-size: 0.9rem !important;
    padding: 14px 16px !important;
  }
  .celebration-banner .emoji {
    font-size: 1.5rem !important;
  }
}

/* ============ HERO CARDS (detail pages) ============ */
@media (max-width: 700px) {
  .hero-card,
  .payout-hero,
  .referral-hero {
    padding: 20px !important;
    text-align: center;
  }
  .hero-amount,
  .payout-hero-amount {
    font-size: 2rem !important;
  }
  .hero-card > div,
  .payout-hero > div {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: center !important;
  }
}

/* ============ INFO CARDS (partner/client) ============ */
@media (max-width: 700px) {
  .info-card,
  .detail-info-card {
    padding: 16px !important;
  }
  .info-card-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* ============ MODALS: Full screen on mobile ============ */
@media (max-width: 640px) {
  .modal-content,
  .modal-container {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    margin: 5vh auto !important;
    padding: 20px !important;
    border-radius: 16px !important;
  }
  .modal-actions {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  .modal-actions .btn {
    width: 100% !important;
    justify-content: center;
  }
}

/* ============ BULK ACTION BAR (sticky bottom) ============ */
@media (max-width: 700px) {
  .bulk-action-bar,
  .bulk-actions-sticky {
    padding: 12px 16px !important;
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
  }
  .bulk-action-bar .btn,
  .bulk-actions-sticky .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============ MINI CARDS (payout, invoice mini) ============ */
@media (max-width: 700px) {
  .mini-invoice-card,
  .mini-payout-card {
    padding: 12px !important;
  }
  .mini-invoice-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
}

/* ============ ADMIN ANALYTICS: Aging report + top partners ============ */
@media (max-width: 700px) {
  .aging-report,
  .partner-leaderboard {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .aging-report table,
  .partner-leaderboard table {
    min-width: 500px;
  }
}

/* ============ DATE FILTER: Mobile-friendly dropdown ============ */
@media (max-width: 700px) {
  .date-filter-dropdown {
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }
  .date-filter-btn {
    width: 100%;
    justify-content: space-between;
  }
}

/* ============ Export dropdown ============ */
@media (max-width: 700px) {
  .export-dropdown,
  .action-dropdown {
    right: 0 !important;
    left: auto;
    min-width: 200px;
  }
}


/* ============ MOBILE BATCH 1: Sidebar Drawer + Topbar ============ */

/* Mobile topbar hidden on desktop (base state) */
.mobile-topbar {
  display: none;
}
.sidebar-backdrop {
  display: none;
}

/* All mobile styles STRICTLY scoped */
@media (max-width: 900px) {
  /* Show mobile topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display, serif);
    font-weight: 700;
    font-size: 1.05rem;
    color: #083F6E;
    text-decoration: none;
  }
  .mobile-topbar-brand img {
    height: 26px;
    width: auto;
  }
  .hamburger-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0F172A;
    border-radius: 8px;
  }
  .hamburger-btn:hover {
    background: #F1F5F9;
  }

  /* Sidebar: slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    background: #fff;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Backdrop */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    animation: sbFadeIn 0.2s ease;
  }
  .sidebar-backdrop.active {
    display: block;
  }
  @keyframes sbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}


/* ============ TIMER PROGRESS CARD (referral detail) ============ */
.timer-progress-card {
  padding: 20px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  margin-bottom: 20px;
}
.timer-progress-card.status-expiring {
  border-color: #F59E0B;
  background: linear-gradient(to right, #FEF3C7 0%, #fff 100%);
}
.timer-progress-card.status-expired {
  border-color: #DC2626;
  background: linear-gradient(to right, #FEE2E2 0%, #fff 100%);
}
.timer-progress-card.status-active {
  border-color: #10B981;
  background: linear-gradient(to right, #ECFDF5 0%, #fff 100%);
}
.timer-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.timer-progress-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.timer-progress-label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #0F172A;
}
.timer-progress-card.status-expiring .timer-progress-label {
  color: #92400E;
}
.timer-progress-card.status-expired .timer-progress-label {
  color: #991B1B;
}
.timer-progress-bar {
  height: 12px;
  background: #F1F5F9;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.timer-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, #10B981, #059669);
}
.timer-progress-card.status-expiring .timer-progress-fill {
  background: linear-gradient(90deg, #F59E0B, #D97706);
}
.timer-progress-card.status-expired .timer-progress-fill {
  background: linear-gradient(90deg, #DC2626, #991B1B);
  width: 100% !important;
}
.timer-progress-dates {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #64748B;
  font-family: var(--font-mono);
}
.timer-progress-dates strong {
  color: #0F172A;
}

@media (max-width: 700px) {
  .timer-alert-banner {
    flex-direction: column;
    gap: 12px;
  }
  .timer-alert-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .timer-alert-item-timer {
    align-items: flex-start;
  }
}




/* ============ TIMER ALERT: UNIFIED BANNER ============ */
.timer-alert-banner {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 3px solid #F59E0B;
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.timer-alert-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.timer-alert-head:hover {
  background: #FEF3C7;
}

.timer-alert-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #F59E0B;
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-alert-icon svg {
  width: 16px;
  height: 16px;
}

.timer-alert-head-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.timer-alert-head-text strong {
  color: #78350F;
  font-weight: 600;
  font-size: 0.9rem;
}

.timer-alert-head-text span {
  color: #92400E;
  font-size: 0.75rem;
}

.timer-alert-toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #FDE68A;
  border-radius: 999px;
  color: #B45309;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timer-alert-toggle-btn:hover {
  background: #F59E0B;
  color: #fff;
  border-color: #F59E0B;
}

.toggle-btn-chevron {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn-chevron.rotated {
  transform: rotate(180deg);
}

/* Collapsible body */
.timer-alert-body {
  padding: 14px 16px;
  max-height: 1000px;
  opacity: 1;
  border-top: 1px solid #FDE68A;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease 0.05s,
    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-top-width 0.4s ease;
}

.timer-alert-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-width: 0;
  transition:
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease,
    padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-top-width 0.2s ease;
}

.timer-alert-note {
  color: #92400E;
  font-size: 0.82rem;
  margin: 0 0 10px;
  line-height: 1.5;
}

.timer-alert-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timer-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.timer-alert-item:hover {
  border-color: #F59E0B;
  background: #FFFBEB;
}

.timer-alert-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timer-alert-item-info strong {
  color: #0F172A;
  font-size: 0.85rem;
  font-weight: 600;
}

.timer-alert-item-info span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #78350F;
}

.timer-alert-item-timer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.timer-days {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #DC2626;
  line-height: 1;
}

.timer-days-label {
  font-size: 0.62rem;
  color: #78350F;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}


/* ============ BULK ACTION BAR ============ */
.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #EAF2FA 0%, #D6E7F5 100%);
  border: 1px solid #0B5FA5;
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bulk-action-info {
  color: #083F6E;
  font-size: 0.9rem;
  flex: 1;
  min-width: 150px;
}

.bulk-action-info strong {
  color: #0B5FA5;
  font-size: 1.1rem;
  margin-right: 4px;
}

.bulk-action-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.bulk-action-buttons .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.row-checkbox,
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #0B5FA5;
}


/* ============ DRAG & DROP UPLOAD ZONE ============ */
.drop-zone {
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #F8FAFC;
}

.drop-zone:hover {
  border-color: #0B5FA5;
  background: #EAF2FA;
}

.drop-zone.drag-over {
  border-color: #0B5FA5;
  background: #EAF2FA;
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(11, 95, 165, 0.15);
}

.drop-zone.has-file {
  border-color: #10B981;
  background: #ECFDF5;
  border-style: solid;
}

.drop-zone-icon {
  color: #64748B;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.drop-zone:hover .drop-zone-icon {
  color: #0B5FA5;
}

.drop-zone-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.drop-zone-text strong {
  color: #0F172A;
  font-size: 1rem;
  font-weight: 600;
}

.drop-zone-text span {
  color: #64748B;
  font-size: 0.85rem;
}

.drop-zone-hint {
  color: #94A3B8;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .app-main > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}


/* ============ CSV FIELD GUIDE ============ */
.field-guide-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.field-guide-item {
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.field-guide-item:hover {
  background: #EAF2FA;
  border-color: #0B5FA5;
}

.field-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.field-name code {
  background: #fff;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0B5FA5;
  border: 1px solid #CBD5E1;
}

.field-required {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  background: #FEE2E2;
  color: #DC2626;
  border-radius: 999px;
}

.field-optional {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  background: #F1F5F9;
  color: #64748B;
  border-radius: 999px;
}

.field-desc {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.5;
}

.field-desc code {
  background: #E2E8F0;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #0F172A;
}

.field-desc em {
  color: #0B5FA5;
  font-style: normal;
  font-weight: 500;
}

/* ==== Commission window ====
   The rolling clock across every client, and the one thing on the page that
   answers "am I still earning". The per-client timer alerts elsewhere say
   which referrals are near the end of their own term; this says whether the
   door is open at all. */
.wcard {
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, #072742 0%, #0B5FA5 55%, #2E7DD1 100%);
  border-radius: 18px;
  color: #fff;
  box-shadow: 0 14px 36px rgba(11,95,165,0.22);
}

.wcard::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -70px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(79,163,232,0.30) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.wcard > * { position: relative; z-index: 1; }

/* Amber inside sixty days, red once the cycle has broken. The colour is the
   only part of this anyone reads at a glance, so it takes the whole panel
   rather than one edge. */
.wcard--expiring {
  background: linear-gradient(135deg, #6B3600 0%, #B26A12 55%, #E8A33D 100%);
  box-shadow: 0 14px 36px rgba(232,163,61,0.24);
}
.wcard--broken {
  background: linear-gradient(135deg, #4F1414 0%, #99231F 55%, #DC2626 100%);
  box-shadow: 0 14px 36px rgba(220,38,38,0.22);
}

/* ---- Head ---- */
.wcard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.wcard-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.60);
  font-weight: 700;
  margin-bottom: 6px;
}
.wcard-headline {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.wcard-badge {
  flex-shrink: 0;
  padding: 6px 13px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---- Pips ---- */
.wcard-pips {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
}
.wcard-pip {
  width: 28px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.20);
}
/* Mint, so the signed part of the rail reads as a result rather than as
   fill. Amber panel gets a warm equivalent. */
.wcard-pip.is-on {
  background: #6BEDCA;
  box-shadow: 0 0 10px rgba(107,237,202,0.45);
}
.wcard--expiring .wcard-pip.is-on {
  background: #FFE9BF;
  box-shadow: 0 0 10px rgba(255,233,191,0.45);
}
.wcard-pips-note {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.70);
}

/* ---- The four numbers ---- */
.wcard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  overflow: hidden;
}
/* The gap is the divider: one pixel of the container showing through between
   cells, rather than borders that double up at the joins. */
.wcard-stat {
  padding: 14px 14px;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(6px);
}
.wcard-stat-lbl {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.60);
  margin-bottom: 5px;
}
.wcard-stat-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ---- Next milestone ---- */
.wcard-next {
  padding: 14px 16px;
  margin-bottom: 18px;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid #6BEDCA;
  border-radius: 8px;
}
.wcard--expiring .wcard-next { border-left-color: #FFE9BF; }
.wcard-next--closed { border-left-color: rgba(255,255,255,0.5); }

.wcard-next-lbl {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.60);
  margin-bottom: 6px;
}
.wcard-next p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.90);
}
.wcard-next strong { color: #fff; font-weight: 700; }

/* ---- The ladder ---- */
.wcard-ladder {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.wcard-rung {
  position: relative;
  flex: 1;
  padding-top: 18px;
  text-align: center;
}
/* The line between rungs runs behind the dots rather than between them, so
   it reads as one track with stops on it. */
.wcard-rung::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.18);
}
.wcard-rung:first-child::before { left: 50%; }
.wcard-rung:last-child::before { right: 50%; }

.wcard-rung.is-reached::before { background: rgba(107,237,202,0.55); }

.wcard-rung-dot {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  border: 2px solid transparent;
}
.wcard-rung.is-reached .wcard-rung-dot {
  background: #6BEDCA;
  box-shadow: 0 0 12px rgba(107,237,202,0.50);
}
.wcard--expiring .wcard-rung.is-reached .wcard-rung-dot {
  background: #FFE9BF;
  box-shadow: 0 0 12px rgba(255,233,191,0.50);
}
.wcard--expiring .wcard-rung.is-reached::before { background: rgba(255,233,191,0.55); }

.wcard-rung-years {
  display: block;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
}
.wcard-rung.is-reached .wcard-rung-years { color: #fff; }

.wcard-rung-clients {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
}

@media (max-width: 700px) {
  .wcard { padding: 20px 18px; }
  .wcard-head { flex-direction: column; gap: 12px; }
  .wcard-headline { font-size: 1.7rem; }
  /* Four columns of stats at phone width leave each too narrow for a date. */
  .wcard-stats { grid-template-columns: 1fr 1fr; }
  .wcard-pip { width: 20px; }
  .wcard-rung-clients { font-size: 0.58rem; }
}
