@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
  --primary: #0B5CFF;
  --primary-dark: #0948cc;
  --secondary: #00B2FF;
  --text: #07111F;
  --muted: #64748B;
  --border: #E6ECF5;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(7,17,31,0.06), 0 4px 16px rgba(7,17,31,0.04);
  --shadow-lg: 0 8px 32px rgba(7,17,31,0.08);
  --sidebar-w: 260px;
  --header-h: 64px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: 'Tajawal', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

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

img { max-width: 100%; display: block; }

/* Typography */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 700; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; font-family: inherit; font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition); white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 0.8125rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; font-family: inherit; font-size: 0.875rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white);
  color: var(--text); transition: border-color var(--transition), box-shadow var(--transition);
}
.form-select {
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: menulist;
  min-height: 42px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,92,255,0.1);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-error { color: var(--danger); font-size: 0.8125rem; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; }
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Searchable select (customer picker) */
.searchable-select { position: relative; }
.searchable-select-field { display: flex; gap: 6px; align-items: center; }
.searchable-select-field .form-input { flex: 1; }
.searchable-select-clear { flex-shrink: 0; padding: 6px 10px; min-width: auto; }
.searchable-select-dropdown {
  position: fixed; z-index: 2500;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 220px; overflow-y: auto;
}
.searchable-select-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 10px 14px; border: none; background: none; cursor: pointer;
  text-align: right; font-family: inherit; font-size: 0.875rem; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.searchable-select-option:last-child { border-bottom: none; }
.searchable-select-option:hover, .searchable-select-option:focus {
  background: rgba(11, 92, 255, 0.06); outline: none;
}
.searchable-select-option-label { font-weight: 600; }
.searchable-select-option-sub { font-size: 0.75rem; color: var(--muted); }
.searchable-select-empty { padding: 12px 14px; color: var(--muted); font-size: 0.875rem; text-align: center; }
.searchable-select-hint { margin-top: 4px; margin-bottom: 0; }
.searchable-select-input[readonly] { background: var(--bg); cursor: default; }

/* Cards */
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  max-width: 100%; min-width: 0;
}
.card.card-form { overflow: visible; }
.card.card-form .card-body { overflow: visible; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 16px; }
.stat-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; word-break: break-word; }
.stat-card .stat-label { font-size: 0.8125rem; color: var(--muted); margin-top: 4px; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 1.25rem; margin-bottom: 12px;
}
.stat-icon.blue { background: rgba(11,92,255,0.1); color: var(--primary); }
.stat-icon.cyan { background: rgba(0,178,255,0.1); color: var(--secondary); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--danger); }

/* Company subscription summary (admin-managed dates) */
.subscription-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 20px;
}
.subscription-metric { display: flex; flex-direction: column; gap: 4px; }
.subscription-metric-label { font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
.subscription-metric-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1.2; word-break: break-word; }
.subscription-metric-hint { margin-top: 2px; }
.subscription-card--ok { border-color: rgba(16,185,129,0.35); }
.subscription-card--warning { border-color: rgba(245,158,11,0.45); }
.subscription-card--danger { border-color: rgba(239,68,68,0.45); }
.subscription-card--warning .subscription-remaining,
.subscription-card--danger .subscription-remaining { color: var(--danger); }
.subscription-card--ok .subscription-remaining { color: var(--success); }
.subscription-note { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); color: var(--muted); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; font-size: 0.75rem;
  font-weight: 500; border-radius: 999px; line-height: 1.4;
}
.badge-active, .badge-confirmed, .badge-paid, .badge-available { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-pending, .badge-trial, .badge-partial { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-expired, .badge-cancelled, .badge-overdue, .badge-inactive { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-suspended, .badge-maintenance { background: rgba(100,116,139,0.1); color: var(--muted); }
.badge-rented, .badge-active-booking { background: rgba(11,92,255,0.1); color: var(--primary); }
.badge-completed { background: rgba(59,130,246,0.1); color: var(--info); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}
.card .table-wrap { overflow-x: auto; overflow-y: visible; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  text-align: right; padding: 10px 16px; font-weight: 600; color: var(--muted);
  background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: rgba(248,250,252,0.8); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.company-name-cell {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px;
}
.company-catalog-link {
  font-size: 0.8125rem; font-weight: 600; color: var(--primary);
  white-space: nowrap;
}
.company-catalog-link:hover { color: var(--primary-dark); text-decoration: underline; }

.car-image-upload { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.car-image-preview {
  flex-shrink: 0; width: 120px; height: 90px; border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0); background: var(--bg-muted, #f4f7fb);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.car-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-image-field .form-input[type="file"] { max-width: 280px; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination button {
  min-width: 36px; height: 36px; border: 1px solid var(--border); background: var(--white);
  border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-size: 0.875rem;
  transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(7,17,31,0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; visibility: hidden; transition: all var(--transition); padding: 20px;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 8px; justify-content: flex-start; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; left: auto; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm); color: white; font-size: 0.875rem;
  box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; min-width: 280px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading */
.spinner {
  width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.7); display: flex;
  align-items: center; justify-content: center; z-index: 3000;
}
.page-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px; color: var(--muted); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* Dashboard Layout — grid on desktop, off-canvas sidebar on mobile */
.dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
.sidebar {
  grid-column: 1;
  grid-row: 1;
  width: var(--sidebar-w);
  background: var(--white);
  border-left: 1px solid var(--border);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 100;
  -webkit-overflow-scrolling: touch;
}
.sidebar-brand {
  padding: 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.125rem;
}
.sidebar-brand img { width: 32px; height: 32px; }
.sidebar-nav { padding: 12px; }
.nav-section { font-size: 0.6875rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 0.875rem; font-weight: 500; transition: all var(--transition);
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: rgba(11,92,255,0.08); color: var(--primary); font-weight: 600; }
.nav-link svg, .nav-link .icon { width: 18px; height: 18px; flex-shrink: 0; }
.main-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
}
.topbar {
  height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  min-width: 0; max-width: 100%;
}
.topbar-start, .topbar-end {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.topbar-start { flex: 1; }
.topbar-end { flex-shrink: 0; }
.topbar-title {
  font-size: 1rem; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.topbar-user {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px;
}
.page-content { padding: 24px; min-width: 0; max-width: 100%; }
body.sidebar-open { overflow: hidden; touch-action: none; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Filters bar */
.filters-bar {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: center;
}
.filters-bar .form-input, .filters-bar .form-select { width: auto; min-width: 160px; }

.filter-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.filter-chip {
  border: 1px solid var(--border);
  background: var(--bg, #fff);
  color: var(--text-muted, #536078);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.filter-chip:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.filter-chip.is-active {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
}
.filter-chip .chip-count {
  display: inline-block;
  margin-inline-start: 6px;
  opacity: 0.85;
  font-weight: 700;
}

.date-when {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}
.date-when.today { background: #fff6e9; color: #b8730a; }
.date-when.tomorrow { background: #eef6ff; color: #1d4ed8; }
.date-when.soon { background: #eefbf3; color: #15803d; }
.date-when.past { background: #f3f4f6; color: #6b7280; }

.sort-btns { display: inline-flex; flex-direction: column; gap: 2px; margin-inline-end: 6px; vertical-align: middle; }
.sort-btns .btn { padding: 0 6px; min-width: 28px; line-height: 1.2; font-size: 0.75rem; }

/* Public site */
.navbar {
  position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand { font-weight: 800; font-size: 1.25rem; color: var(--text); display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.navbar-logo-img { height: 48px; width: auto; max-width: 64px; object-fit: contain; display: block; }
.navbar-nav { display: flex; align-items: center; gap: 8px; list-style: none; }
.navbar-nav a { padding: 8px 14px; font-size: 0.875rem; font-weight: 500; color: var(--muted); border-radius: var(--radius-sm); }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--primary); background: rgba(11,92,255,0.06); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.hero {
  padding: 100px 0 80px; text-align: center;
  background: linear-gradient(180deg, var(--white) 0%, var(--bg) 100%);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 16px; }
.hero p { font-size: 1.125rem; color: var(--muted); max-width: 600px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card { padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); transition: box-shadow var(--transition); }
.feature-card:hover { box-shadow: var(--shadow-lg); }
.feature-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(11,92,255,0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 16px; }
.footer { background: var(--text); color: rgba(255,255,255,0.7); padding: 60px 0 24px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; margin-bottom: 40px; }
.footer h4 { color: white; margin-bottom: 16px; font-size: 0.875rem; }
.footer a { color: rgba(255,255,255,0.6); font-size: 0.875rem; display: block; margin-bottom: 8px; }
.footer a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px; text-align: center; font-size: 0.8125rem; }

/* Auth pages */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg) 0%, rgba(11,92,255,0.05) 100%); padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 40px 32px;
}
.auth-logo { text-align: center; margin-bottom: 32px; font-weight: 800; font-size: 1.5rem; color: var(--primary); }
.auth-title { text-align: center; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--muted); }

/* Mobile menu */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; font-size: 1.25rem; line-height: 1; color: var(--text); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.sidebar-overlay.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Responsive — dashboards, auth, legacy public pages */
@media (max-width: 1024px) {
  .settings-grid { grid-template-columns: 1fr; }
  .page-content { padding: 20px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .dashboard {
    display: block;
    grid-template-columns: none;
  }

  .sidebar-overlay { display: block; }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(85vw, 280px);
    height: 100%;
    height: 100dvh;
    align-self: auto;
    grid-column: auto;
    grid-row: auto;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transition: transform 0.25s ease;
    transform: translate3d(100%, 0, 0);
    pointer-events: none;
  }
  .sidebar.open {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }

  .main-content {
    grid-column: auto;
    grid-row: auto;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0;
  }
  .menu-toggle { display: flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; flex-shrink: 0; }

  .topbar {
    height: auto;
    min-height: var(--header-h);
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0));
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }
  .topbar-title {
    font-size: 0.9rem;
    max-width: none;
  }
  .topbar-user { display: none; }
  .topbar-end .btn { padding: 6px 10px; font-size: 0.8125rem; }

  .page-content { padding: 14px 12px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0)); }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 16px;
    gap: 10px;
  }
  .page-header-actions {
    width: 100%;
    justify-content: stretch;
  }
  .page-header-actions .btn { flex: 1; min-width: 0; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.35rem; }
  .subscription-metrics { grid-template-columns: 1fr 1fr; gap: 12px; }

  .form-row { grid-template-columns: 1fr; gap: 12px; }
  .settings-grid { grid-template-columns: 1fr; gap: 16px; }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }
  .card-body { padding: 16px; min-width: 0; }
  .card { overflow: visible; }
  .card-footer { padding: 12px 16px; }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
  }
  .filters-bar .form-input,
  .filters-bar .form-select,
  .filters-bar .btn {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .table { font-size: 0.8125rem; }
  .table th, .table td { padding: 10px 10px; }
  .table-wrap {
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card-body.table-wrap { padding: 12px; }
  .card-header h3 { font-size: 0.95rem; line-height: 1.35; }
  .card-header .btn { flex-shrink: 0; }
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .table-actions .btn { width: 100%; justify-content: center; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    margin: 0;
  }
  .modal-header { padding: 16px 16px 0; }
  .modal-body { padding: 16px; }
  .modal-footer {
    padding: 0 16px 16px;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn { width: 100%; justify-content: center; }

  .btn { white-space: normal; text-align: center; }
  .btn-sm { min-height: 36px; }

  .navbar-inner { padding: 0 12px; height: 56px; position: relative; }
  .navbar-nav { display: none; }
  .navbar-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    right: 0;
    left: 0;
    background: white;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }
  .navbar-nav a { width: 100%; padding: 12px 14px; }
  .menu-toggle#nav-toggle { display: flex; }

  .container { padding: 0 16px; }
  .section { padding: 48px 0; }
  .hero { padding: 56px 0 40px; }
  .hero h1 { font-size: clamp(1.75rem, 6vw, 2.25rem); }
  .hero p { font-size: 1rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .features-grid,
  .pricing-grid,
  .blog-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .cta-banner { padding: 32px 20px; }
  .wizard-steps { flex-direction: column; }
  .wizard-step { min-width: 0; }

  .form-input,
  .form-textarea,
  .form-select { font-size: 16px; min-height: 44px; }

  .auth-page { padding: 16px; }
  .auth-card { padding: 28px 20px; }

  .toast-container { top: 12px; right: 12px; left: 12px; max-width: none; }
  .toast { min-width: 0; width: 100%; }

  .pagination { flex-wrap: wrap; gap: 6px; }
  .pagination button { min-width: 40px; height: 40px; }

  .empty-state { padding: 40px 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .subscription-metrics { grid-template-columns: 1fr; }
  .topbar-title { font-size: 0.85rem; }
  .navbar-brand { font-size: 1rem; }
  .navbar-logo-img { max-width: 140px; height: 36px; }
  .stat-card .stat-icon { width: 36px; height: 36px; font-size: 1.1rem; }
}

@media (max-width: 360px) {
  .page-content { padding: 10px 8px; }
  .btn-lg { padding: 10px 16px; font-size: 0.9375rem; }
}

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; align-items: stretch; }
.pricing-card { padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); display: flex; flex-direction: column; }
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg); }
.pricing-card .price { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin: 16px 0; }
.pricing-card ul { list-style: none; margin: 20px 0; flex: 1; }
.pricing-card li { padding: 8px 0; font-size: 0.875rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.pricing-card li::before { content: '✓ '; color: var(--success); font-weight: 700; }

/* FAQ accordion */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--white); overflow: hidden; }
.faq-question {
  width: 100%; text-align: right; padding: 16px 20px; background: none; border: none;
  font-family: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-question:hover { background: var(--bg); }
.faq-answer { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; color: var(--muted); font-size: 0.9375rem; }
.faq-item.open .faq-answer { max-height: 500px; padding: 0 20px 16px; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-chevron { transition: transform var(--transition); color: var(--muted); }

/* Blog */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.blog-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow var(--transition);
}
.blog-card:hover { box-shadow: var(--shadow-lg); }
.blog-card-cover { height: 180px; background: linear-gradient(135deg, rgba(11,92,255,0.15), rgba(0,178,255,0.1)); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.blog-card-body { padding: 20px; }
.blog-card h3 { margin-bottom: 8px; font-size: 1.125rem; }
.blog-post-content { max-width: 720px; margin: 0 auto; }
.blog-post-content img { border-radius: var(--radius); margin: 24px 0; }
.blog-meta { color: var(--muted); font-size: 0.875rem; margin-bottom: 24px; }

/* Legal prose */
.legal-content { max-width: 800px; margin: 0 auto; }
.legal-content h2 { margin: 32px 0 12px; font-size: 1.25rem; }
.legal-content p, .legal-content li { margin-bottom: 12px; color: var(--muted); line-height: 1.8; }
.legal-content ul { padding-right: 24px; }

/* Wizard / onboarding */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 32px; flex-wrap: wrap; }
.wizard-step {
  flex: 1; min-width: 100px; padding: 12px; text-align: center; border-radius: var(--radius-sm);
  background: var(--bg); font-size: 0.8125rem; font-weight: 600; color: var(--muted);
}
.wizard-step.active { background: rgba(11,92,255,0.1); color: var(--primary); }
.wizard-step.done { background: rgba(16,185,129,0.1); color: var(--success); }

/* Error / maintenance pages */
.standalone-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; background: var(--bg);
}
.standalone-page .code { font-size: 5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.hero-badge {
  display: inline-block; padding: 6px 14px; background: rgba(11,92,255,0.1);
  color: var(--primary); border-radius: 999px; font-size: 0.8125rem; font-weight: 600; margin-bottom: 16px;
}
.section-title { text-align: center; margin-bottom: 48px; }
.section-title h2 { margin-bottom: 8px; }
.cta-banner {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border-radius: var(--radius); padding: 48px 32px; text-align: center;
}
.cta-banner h2 { color: white; margin-bottom: 12px; }
.cta-banner p { opacity: 0.9; margin-bottom: 24px; }
.cta-banner .btn-primary { background: white; color: var(--primary); }
.cta-banner .btn-primary:hover { background: var(--bg); }
