/* ═══════════════════════════════════════════════════════════════════════
   BookFlow ASP — Main Stylesheet
   Mobile-first, pure CSS, no external frameworks
   ═══════════════════════════════════════════════════════════════════════ */

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

:root {
  --navy:      #1a1a2e;
  --navy-dark: #12122b;
  --navy-mid:  #16213e;
  --accent:    #0f3460;
  --blue:      #2563eb;
  --blue-lt:   #3b82f6;
  --green:     #16a34a;
  --green-lt:  #dcfce7;
  --red:       #dc2626;
  --red-lt:    #fee2e2;
  --amber:     #d97706;
  --amber-lt:  #fef3c7;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-800:  #1f2937;
  --white:     #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
  --radius:    10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ──────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-800); }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--gray-800); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--gray-700); }
h4 { font-size: 1rem; font-weight: 600; color: var(--gray-700); }
p  { color: var(--gray-600); }
a  { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 1rem; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ── Navbar ──────────────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--white);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  white-space: nowrap;
}

.navbar-brand .brand-icon {
  width: 30px;
  height: 30px;
  background: var(--blue);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.navbar-brand span { color: var(--white); }

.navbar-links {
  display: none;
  align-items: center;
  gap: .25rem;
}

.navbar-links a {
  color: rgba(255,255,255,.8);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.navbar-links a:hover,
.navbar-links a.active { color: var(--white); background: rgba(255,255,255,.12); }

.navbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.navbar-user {
  display: none;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: rgba(255,255,255,.75);
}

.role-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.role-badge.admin { background: #fbbf24; color: #1a1a2e; }
.role-badge.client { background: var(--blue); color: var(--white); }

.impersonate-bar {
  background: #f59e0b;
  color: #1a1a2e;
  text-align: center;
  padding: .4rem 1rem;
  font-size: .8rem;
  font-weight: 600;
}

.impersonate-bar a { color: #1a1a2e; font-weight: 700; text-decoration: underline; }

/* Hamburger */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
  display: none;
  background: var(--navy-dark);
  border-top: 1px solid rgba(255,255,255,.1);
  padding: .5rem;
}

.mobile-menu.open { display: block; }

.mobile-menu a {
  display: block;
  color: rgba(255,255,255,.85);
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
}

.mobile-menu a:hover { background: rgba(255,255,255,.1); color: var(--white); }
.mobile-menu .menu-divider { height: 1px; background: rgba(255,255,255,.1); margin: .5rem 0; }

/* Desktop nav */
@media (min-width: 768px) {
  .navbar-links { display: flex; }
  .navbar-user  { display: flex; }
  .hamburger    { display: none; }
}

/* ── Breadcrumb ──────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  font-size: .8rem;
  color: var(--gray-500);
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--gray-400); }
.breadcrumb .current { color: var(--gray-700); font-weight: 500; }

/* ── Toast Notifications ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 360px;
  width: calc(100% - 2rem);
}

.toast {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  border-left: 4px solid var(--blue);
  animation: slideIn .3s ease;
}

.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: .875rem; color: var(--gray-800); margin-bottom: .15rem; }
.toast-msg   { font-size: .8rem; color: var(--gray-600); }
.toast-close { background: none; border: none; color: var(--gray-400); cursor: pointer; padding: .1rem; font-size: 1rem; line-height: 1; }

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

/* ── Page Header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.page-header-left h1 { margin-bottom: .25rem; }
.page-header-left p  { font-size: .875rem; color: var(--gray-500); }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.last-updated {
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: .25rem;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .875rem 1.25rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  font-size: .8rem;
  color: var(--gray-500);
}

/* ── Stat Cards ──────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}

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

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  margin-bottom: .35rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.1;
}

.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.amber  { color: var(--amber); }

.stat-sub {
  font-size: .75rem;
  color: var(--gray-500);
  margin-top: .25rem;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .4rem;
  border-radius: 12px;
  margin-top: .3rem;
}

.stat-change.up   { background: var(--green-lt); color: var(--green); }
.stat-change.down { background: var(--red-lt); color: var(--red); }

@media (min-width: 640px)  { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .625rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
  min-height: 44px;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-primary   { background: var(--blue); color: var(--white); border-color: var(--blue); }
.btn-primary:hover  { background: #1d4ed8; text-decoration: none; }

.btn-secondary { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); text-decoration: none; }

.btn-success   { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-success:hover { background: #15803d; text-decoration: none; }

.btn-danger    { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

.btn-warning   { background: var(--amber); color: var(--white); border-color: var(--amber); }
.btn-warning:hover { background: #b45309; text-decoration: none; }

.btn-ghost     { background: transparent; color: var(--blue); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); text-decoration: none; }

.btn-sm { padding: .4rem .75rem; font-size: .8rem; min-height: 36px; }
.btn-lg { padding: .875rem 1.5rem; font-size: 1rem; min-height: 52px; }
.btn-xl { padding: 1rem 2rem; font-size: 1.1rem; min-height: 56px; border-radius: var(--radius); }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--gray-700); margin-bottom: .375rem; }
.form-label.required::after { content: ' *'; color: var(--red); }

.form-control {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue-lt);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-control::placeholder { color: var(--gray-400); }
.form-hint { font-size: .8rem; color: var(--gray-500); margin-top: .25rem; }
.form-error { font-size: .8rem; color: var(--red); margin-top: .25rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Input with icon */
.input-group { position: relative; }
.input-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; font-size: .9rem; }
.input-group .form-control { padding-left: 2.25rem; }
.input-btn { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--gray-500); cursor: pointer; padding: .25rem; min-height: 32px; }

/* Checkbox/radio */
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--blue); }
.form-check-label { font-size: .875rem; color: var(--gray-700); }

/* Select */
select.form-control { cursor: pointer; }

/* ── Tables ──────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--white);
}

thead { background: var(--gray-50); }
thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--gray-100); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: .75rem 1rem; color: var(--gray-700); vertical-align: middle; }

tfoot td {
  padding: .75rem 1rem;
  font-weight: 700;
  background: var(--gray-50);
  border-top: 2px solid var(--gray-200);
  color: var(--gray-800);
}

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.badge-blue     { background: #dbeafe; color: #1d4ed8; }
.badge-green    { background: var(--green-lt); color: #15803d; }
.badge-red      { background: var(--red-lt); color: #b91c1c; }
.badge-amber    { background: var(--amber-lt); color: #92400e; }
.badge-gray     { background: var(--gray-100); color: var(--gray-600); }
.badge-navy     { background: var(--navy); color: var(--white); }
.badge-purple   { background: #ede9fe; color: #6d28d9; }

/* Status-specific */
.badge-auto_approved, .badge-approved { background: var(--green-lt); color: #15803d; }
.badge-needs_review   { background: var(--amber-lt); color: #92400e; }
.badge-flagged        { background: var(--red-lt); color: #b91c1c; }
.badge-pending        { background: #dbeafe; color: #1d4ed8; }

/* Business type badges */
.badge-corporation   { background: #dbeafe; color: #1d4ed8; }
.badge-sole_prop     { background: #f3e8ff; color: #7e22ce; }
.badge-partnership   { background: var(--amber-lt); color: #92400e; }

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  margin-bottom: 1rem;
}

.alert-icon { flex-shrink: 0; font-size: 1rem; margin-top: .1rem; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: .15rem; }

.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ── Flag Cards ──────────────────────────────────────────────────────── */
.flag-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--amber);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
}

.flag-card.high  { border-left-color: var(--red); }
.flag-card.low   { border-left-color: var(--blue); }

.flag-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.flag-type   { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--amber); letter-spacing: .04em; }
.flag-type.high { color: var(--red); }
.flag-date   { font-size: .75rem; color: var(--gray-400); white-space: nowrap; }
.flag-desc   { font-size: .9rem; color: var(--gray-700); margin-bottom: .75rem; }
.flag-meta   { font-size: .8rem; color: var(--gray-500); }

/* ── Deadline/Urgency Items ──────────────────────────────────────────── */
.deadline-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.deadline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gray-300);
  flex-shrink: 0;
}

.deadline-dot.urgent  { background: var(--red); }
.deadline-dot.warning { background: var(--amber); }
.deadline-dot.ok      { background: var(--green); }

.deadline-info { flex: 1; }
.deadline-name { font-size: .875rem; font-weight: 500; color: var(--gray-800); }
.deadline-client { font-size: .75rem; color: var(--gray-500); }
.deadline-date { font-size: .8rem; color: var(--gray-600); white-space: nowrap; font-weight: 500; }

/* ── AR Aging ────────────────────────────────────────────────────────── */
.aging-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin-top: .5rem;
}

.aging-bucket {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  text-align: center;
  border: 1px solid var(--gray-200);
}

.aging-label { font-size: .7rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; }
.aging-value { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); }
.aging-bucket.overdue .aging-value { color: var(--red); }
.aging-bucket.warning .aging-value { color: var(--amber); }

@media (min-width: 640px) { .aging-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Quick Actions ───────────────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
  margin-top: 1rem;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-800);
  font-weight: 600;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
  min-height: 56px;
}

.quick-action:hover { border-color: var(--blue-lt); box-shadow: var(--shadow); background: #f0f7ff; text-decoration: none; }

.quick-action-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: #dbeafe;
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

@media (min-width: 640px) { .quick-actions { grid-template-columns: repeat(3, 1fr); } }

/* ── Upload Zone ─────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--blue);
  background: #eff6ff;
}

.upload-icon { font-size: 2.5rem; margin-bottom: .75rem; color: var(--gray-400); }
.upload-title { font-size: 1rem; font-weight: 600; color: var(--gray-700); margin-bottom: .375rem; }
.upload-sub { font-size: .8rem; color: var(--gray-500); }
.upload-btn-text { color: var(--blue); font-weight: 600; }

.upload-progress {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  margin-top: 1rem;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width .3s ease;
  width: 0%;
}

.upload-file-list { margin-top: 1rem; }
.upload-file-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: .375rem;
  font-size: .85rem;
}

.upload-file-status { margin-left: auto; }

/* ── Onboarding Steps ────────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}

.step-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.step-item.active .step-circle    { background: var(--blue); color: var(--white); }
.step-item.completed .step-circle { background: var(--green); color: var(--white); }

.step-line {
  width: 40px; height: 2px;
  background: var(--gray-200);
  flex-shrink: 0;
}

.step-item.completed + .step-item .step-line,
.step-item.completed ~ .step-line { background: var(--green); }

.step-label {
  font-size: .65rem;
  color: var(--gray-500);
  text-align: center;
  margin-top: .25rem;
  white-space: nowrap;
}

.step-item.active .step-label    { color: var(--blue); font-weight: 600; }
.step-item.completed .step-label { color: var(--green); }

.step-wrapper { display: flex; flex-direction: column; align-items: center; }

/* ── Section Headers ─────────────────────────────────────────────────── */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--gray-200);
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.tab-btn {
  padding: .625rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover  { color: var(--gray-700); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Client List Row (admin) ─────────────────────────────────────────── */
.client-row-flagged { background: #fff5f5 !important; }
.client-row-flagged:hover { background: #fee2e2 !important; }

/* ── Disclaimer ──────────────────────────────────────────────────────── */
.disclaimer {
  margin-top: 2rem;
  padding: .875rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  color: var(--gray-500);
  text-align: center;
  font-style: italic;
}

/* ── Login Page ──────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--accent) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo .logo-mark {
  width: 56px; height: 56px;
  background: var(--blue);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--white);
  margin: 0 auto .75rem;
}

.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.login-logo p  { font-size: .8rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 1rem;
  font-size: .75rem;
  margin-top: auto;
}

.site-footer a { color: rgba(255,255,255,.7); text-decoration: none; }
.site-footer a:hover { color: var(--white); }

/* ── Utility ─────────────────────────────────────────────────────────── */
.text-green  { color: var(--green) !important; }
.text-red    { color: var(--red) !important; }
.text-amber  { color: var(--amber) !important; }
.text-blue   { color: var(--blue) !important; }
.text-gray   { color: var(--gray-500) !important; }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.fw-bold     { font-weight: 700; }
.fw-600      { font-weight: 600; }
.mt-1  { margin-top: .25rem; }
.mt-2  { margin-top: .5rem; }
.mt-3  { margin-top: .75rem; }
.mt-4  { margin-top: 1rem; }
.mb-1  { margin-bottom: .25rem; }
.mb-2  { margin-bottom: .5rem; }
.mb-3  { margin-bottom: .75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-5  { margin-bottom: 1.5rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.cad { font-variant-numeric: tabular-nums; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 1.25rem; }
}

@media (min-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .main-content { padding: 1.5rem; }
}

/* Reconciliation */
.recon-section { margin-bottom: 1.5rem; }
.recon-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.recon-matched   { background: #f0fdf4; border-left: 3px solid var(--green); }
.recon-unmatched { background: #fff7ed; border-left: 3px solid var(--amber); }

/* Portal specific */
.portal-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--accent) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.portal-hero h2 { color: var(--white); margin-bottom: .25rem; }
.portal-hero p  { color: rgba(255,255,255,.7); font-size: .875rem; }

.portal-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  margin: .5rem 0 .25rem;
}

.portal-stat-value.positive { color: #4ade80; }
.portal-stat-value.negative { color: #f87171; }

/* Print */
@media print {
  .navbar, .site-footer, .btn, .toast-container { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .main-content { padding: 0; }
}
