/* ============== Musadid Platform - Theme ============== */
:root {
  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --white: #ffffff;
  --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;
  --gray-900: #111827;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
}

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

/* ============== Top Navigation ============== */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}
.topbar .brand .logo {
  width: 40px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  flex-shrink: 0;
}
.topbar .brand .logo svg { width: 100%; height: 100%; display: block; }
/* Generic .logo (used in modal headers, footers, PDF, etc.) */
.logo { display: inline-flex; align-items: center; justify-content: center; }
.logo svg { width: 100%; height: 100%; display: block; }
.topbar nav { display: flex; gap: 6px; }
.topbar nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 0.95rem;
}
.topbar nav a:hover { background: var(--primary-50); color: var(--primary); }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-50); }
.btn-ghost {
  background: transparent;
  color: var(--gray-700);
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #059669; color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #d97706; color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============== Layout: app shell with sidebar ============== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 67px);
}
.sidebar {
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  padding: 18px 14px;
}
.sidebar .user-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.sidebar .user-card .name { font-weight: 700; font-size: 1rem; }
.sidebar .user-card .role { font-size: 0.8rem; opacity: .9; margin-top: 4px; }
.sidebar h6 {
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gray-400);
  margin: 14px 8px 6px;
  letter-spacing: 1px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--gray-700);
  font-weight: 500;
  margin-bottom: 2px;
  font-size: 0.95rem;
}
.side-link:hover { background: var(--primary-50); color: var(--primary); }
.side-link.active {
  background: var(--primary);
  color: var(--white);
}
.side-link.active:hover { color: var(--white); }
.side-link .icon { width: 18px; text-align: center; }

.main { padding: 28px; }
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}
.page-sub { color: var(--gray-500); margin-bottom: 22px; }

/* ============== Cards & Stats ============== */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label { color: var(--gray-500); font-size: 0.9rem; }
.stat-card .stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-top: 6px;
}
.stat-card .stat-icon {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--primary-50);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-card.success .stat-icon { background: #d1fae5; color: var(--success); }
.stat-card.warning .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-card.danger  .stat-icon { background: #fee2e2; color: var(--danger); }

/* ============== Tables ============== */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data thead th {
  background: var(--gray-50);
  color: var(--gray-700);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--gray-200);
}
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.93rem;
  color: var(--gray-700);
}
table.data tbody tr:hover { background: var(--primary-50); }
table.data tbody tr:last-child td { border-bottom: none; }

/* ============== Forms ============== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  font-size: 0.92rem;
}
.form-group .req { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--white);
  transition: border .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}
textarea.form-control { min-height: 90px; resize: vertical; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-help { color: var(--gray-500); font-size: 0.82rem; margin-top: 4px; }

/* ============== Badges ============== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-incomplete { background: #fed7aa; color: #9a3412; }
.badge-info { background: var(--primary-100); color: var(--primary-dark); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ============== Auth pages ============== */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-side {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-side h2 { font-size: 2.4rem; margin-bottom: 12px; }
.auth-side p { font-size: 1.05rem; opacity: .92; line-height: 1.9; }
.auth-side .feat { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 0.98rem; }
.auth-side .feat .check {
  width: 26px; height: 26px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.auth-form {
  background: var(--white);
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form .auth-inner { max-width: 420px; width: 100%; margin: auto; }
.auth-form h3 { font-size: 1.6rem; color: var(--gray-900); margin-bottom: 6px; }
.auth-form .auth-sub { color: var(--gray-500); margin-bottom: 24px; }

/* ============== Modal ============== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h4 { font-size: 1.15rem; color: var(--gray-900); }
.modal-close {
  background: transparent; border: none; font-size: 1.4rem;
  cursor: pointer; color: var(--gray-500); width: 32px; height: 32px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--gray-100); }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ============== Chat ============== */
.chat-window {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  display: flex;
  flex-direction: column;
  height: 460px;
}
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: var(--gray-50);
}
.chat-msg {
  max-width: 78%;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.93rem;
}
.chat-msg.me {
  background: var(--primary);
  color: var(--white);
  margin-right: auto;
  border-bottom-right-radius: 4px;
}
.chat-msg.them {
  background: var(--white);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  margin-left: auto;
  border-bottom-left-radius: 4px;
}
.chat-meta {
  font-size: 0.72rem;
  opacity: .75;
  margin-top: 4px;
  display: block;
}
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--gray-200);
}
.chat-input input { flex: 1; }

/* ============== Tabs ============== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============== Toast / Alert ============== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.93rem;
}
.alert-info { background: var(--primary-50); color: var(--primary-dark); border: 1px solid var(--primary-100); }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: var(--white);
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); pointer-events: auto; }

/* ============== Landing page ============== */
.hero {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--white) 60%);
  padding: 90px 28px 70px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -120px; left: -120px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, var(--primary-100), transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -160px; right: -160px;
  width: 460px; height: 460px;
  background: radial-gradient(circle, var(--primary-100), transparent 70%);
  border-radius: 50%;
}
.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
.hero h1 {
  font-size: 3rem;
  line-height: 1.25;
  color: var(--gray-900);
  margin-bottom: 18px;
  font-weight: 800;
}
.hero h1 .accent { color: var(--primary); }
.hero p.lead {
  font-size: 1.15rem;
  color: var(--gray-600);
  margin-bottom: 24px;
  line-height: 1.9;
}
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .badge-strip {
  display: inline-block;
  background: var(--primary-100);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.hero-illu {
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 30px;
  border: 1px solid var(--gray-100);
}

.section { padding: 70px 28px; }
.section .container { max-width: 1180px; margin: 0 auto; }
.section h2 {
  text-align: center;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 12px;
}
.section .section-sub {
  text-align: center;
  color: var(--gray-500);
  font-size: 1.05rem;
  margin-bottom: 40px;
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
}

.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.feat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}
.feat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feat-card .feat-icon {
  width: 60px; height: 60px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.5rem;
}
.feat-card h4 {
  font-size: 1.1rem;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.feat-card p { color: var(--gray-500); font-size: 0.95rem; }

.stats-strip {
  background: var(--primary);
  color: var(--white);
  padding: 50px 28px;
}
.stats-strip .container {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  text-align: center;
}
.stats-strip .v { font-size: 2.4rem; font-weight: 800; }
.stats-strip .l { opacity: .9; margin-top: 4px; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  counter-reset: stepc;
}
.step-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  counter-increment: stepc;
}
.step-card::before {
  content: counter(stepc);
  position: absolute;
  top: -16px;
  right: 24px;
  width: 38px; height: 38px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
}
.step-card h5 {
  margin-top: 14px;
  font-size: 1.05rem;
  color: var(--gray-900);
}
.step-card p { color: var(--gray-500); font-size: 0.93rem; margin-top: 6px; }

.cta-band {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  padding: 60px 28px;
  text-align: center;
}
.cta-band h3 { font-size: 1.9rem; margin-bottom: 8px; }
.cta-band p { opacity: .92; margin-bottom: 22px; }
.cta-band .btn { background: var(--white); color: var(--primary); }
.cta-band .btn:hover { background: var(--gray-100); color: var(--primary-dark); }

footer.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 36px 28px;
  text-align: center;
  font-size: 0.92rem;
}

/* ============== Helpers ============== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-bold { font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hidden { display: none !important; }

/* ============== Mobile menu (hamburger + drawer) ============== */
.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--primary);
  line-height: 1;
}
.menu-btn:hover { background: var(--primary-50); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 80;
}
.sidebar-overlay.show { display: block; }

/* ============== Tablets and small laptops ============== */
@media (max-width: 1024px) {
  .topbar { padding: 12px 18px; }
  .main { padding: 22px; }
  .hero { padding: 60px 22px 50px; }
  .hero h1 { font-size: 2.4rem; }
  .section { padding: 56px 22px; }
}

/* ============== Tablets / large phones ============== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-form { padding: 40px 26px; }

  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero h1 { font-size: 2rem; line-height: 1.3; }
  .hero p.lead { font-size: 1rem; }

  /* Sidebar becomes a drawer that slides from the right (RTL) */
  .sidebar {
    position: fixed;
    top: 0;
    right: -290px;
    width: 280px;
    height: 100vh;
    z-index: 90;
    transition: right .25s ease-out;
    box-shadow: -4px 0 16px rgba(0,0,0,.12);
    overflow-y: auto;
  }
  .sidebar.open { right: 0; }
  .menu-btn { display: inline-flex; }

  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Tables become horizontally scrollable */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 640px; }
}

/* ============== Phones (≤640px) ============== */
@media (max-width: 640px) {
  .topbar {
    padding: 10px 14px;
    gap: 8px;
  }
  .topbar nav { display: none; }
  .topbar .brand { font-size: 1.05rem; gap: 8px; }
  .topbar .brand .logo { width: 34px; height: 34px; }
  .topbar .actions { gap: 6px; }
  .topbar .actions .btn { padding: 7px 12px; font-size: 0.85rem; }
  .topbar .actions > span { display: none; }

  .main { padding: 16px; }
  .page-title { font-size: 1.3rem; }
  .page-sub { font-size: 0.92rem; margin-bottom: 16px; }

  .hero { padding: 36px 18px 30px; }
  .hero h1 { font-size: 1.7rem; line-height: 1.35; }
  .hero p.lead { font-size: 0.95rem; line-height: 1.85; }
  .hero .badge-strip { font-size: 0.78rem; padding: 5px 12px; }
  .hero .cta { flex-direction: column; }
  .hero .cta .btn { width: 100%; justify-content: center; }
  .hero-illu { padding: 18px; }

  .section { padding: 38px 18px; }
  .section h2 { font-size: 1.5rem; }
  .section .section-sub { font-size: 0.95rem; margin-bottom: 28px; }
  .stats-strip { padding: 32px 18px; }
  .stats-strip .v { font-size: 1.8rem; }
  .stats-strip .l { font-size: 0.88rem; }
  .cta-band { padding: 40px 18px; }
  .cta-band h3 { font-size: 1.4rem; }

  /* Cards/stats compact */
  .card { padding: 16px; }
  .card-title { font-size: 1rem; margin-bottom: 10px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.4rem; }
  .stat-card .stat-icon { width: 34px; height: 34px; font-size: 1rem; top: 12px; left: 12px; }
  .stat-card .stat-label { font-size: 0.82rem; }

  /* Forms */
  .form-control { font-size: 16px; } /* prevent iOS zoom */
  .auth-form { padding: 28px 18px; }
  .auth-form h3 { font-size: 1.3rem; }
  .auth-inner { max-width: 100%; }

  /* Tables */
  table.data thead th { font-size: 0.82rem; padding: 9px 10px; white-space: nowrap; }
  table.data tbody td { font-size: 0.86rem; padding: 9px 10px; white-space: nowrap; }
  table.data tbody td .btn { padding: 5px 9px; font-size: 0.78rem; }

  /* Tabs */
  .tabs { gap: 0; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { padding: 8px 12px; font-size: 0.86rem; flex-shrink: 0; }

  /* Modal — use !important to override inline max-width on .modal elements */
  .modal { max-width: calc(100vw - 16px) !important; margin: 8px; max-height: 95vh; border-radius: 12px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot { flex-wrap: wrap; gap: 8px; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-backdrop { padding: 0; }

  /* Chat compact */
  .chat-window { height: 380px; }
  .chat-msg { max-width: 88%; }

  /* Step cards & feature cards */
  .feat-grid { gap: 14px; }
  .feat-card { padding: 22px 18px; }
  .step-card { padding: 22px 18px; }

  /* Hero illustration card stays usable */
  .hero-illu .grid-2 { grid-template-columns: 1fr 1fr; }
  .hero-illu .stat-card .stat-value { font-size: 1.4rem; }
}

/* ============== Very small phones (≤380px) ============== */
@media (max-width: 380px) {
  .topbar .brand span { display: none; }
  .topbar .actions .btn-ghost { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .hero-illu .grid-2 { grid-template-columns: 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .stats-strip .container { grid-template-columns: 1fr 1fr; }
}

/* signature pad */
.sig-pad {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  cursor: crosshair;
  width: 100%;
  height: 160px;
  display: block;
}

/* file list */
.file-list { list-style: none; }
.file-list li {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
}
.file-list .ico { color: var(--primary); margin-left: 8px; }

/* timeline */
.timeline { position: relative; padding-right: 22px; }
.timeline::before {
  content: '';
  position: absolute;
  right: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--gray-200);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: '';
  position: absolute;
  right: -22px; top: 6px;
  width: 14px; height: 14px;
  background: var(--primary);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--primary);
  border-radius: 50%;
}
.tl-item .tl-time { color: var(--gray-500); font-size: 0.82rem; }
.tl-item .tl-text { color: var(--gray-800); font-size: 0.95rem; margin-top: 2px; }
