/* ==========================================================================
   RideCleaner app shell — sidebar + topbar chrome for authenticated pages.
   Tokens mirror auth.css / Marketing's site.css so this reads as the same
   product across Login, the marketing site, and the logged-in app.
   ========================================================================== */

:root {
  --brand-blue: #2f6fed;
  --brand-blue-dark: #1d54c4;
  --brand-blue-light: #eaf1ff;
  --ink: #0b0f19;
  --ink-soft: #4b5567;
  --ink-faint: #8891a3;
  --bg-soft: #f6f8fb;
  --border: #e7eaf2;
  --success: #16a34a;
  --success-bg: #e7f8ee;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fef3e2;
  --purple: #7c3aed;
  --purple-bg: #f2ebfe;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 2px 8px rgba(15, 23, 42, 0.05);
  --sidebar-width: 248px;
  --topbar-height: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

body.shell-body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}

.shell { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.shell-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 20px 16px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
.shell-brand svg { color: var(--ink); flex-shrink: 0; }
.shell-brand .dot { color: var(--brand-blue); }
.shell-brand-img { height: 42px; width: auto; display: block; }

.shell-role-badge {
  margin: 0 20px 16px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.shell-role-badge svg { width: 15px; height: 15px; color: var(--brand-blue); flex-shrink: 0; }

.shell-nav { list-style: none; margin: 4px 0; padding: 0 12px; flex: 1; }
.shell-nav li { margin-bottom: 2px; }
.shell-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.shell-nav a svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--ink-faint); transition: color 0.15s ease; }
.shell-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.shell-nav a:hover svg { color: var(--ink-soft); }
.shell-nav a.active { background: var(--brand-blue-light); color: var(--brand-blue-dark); }
.shell-nav a.active svg { color: var(--brand-blue); }

.shell-sidebar-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--ink-faint);
  flex-shrink: 0;
}

/* ===== Topbar ===== */
.shell-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.shell-topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.shell-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  margin-right: auto;
  color: var(--ink-soft);
  cursor: pointer;
}
.shell-sidebar-toggle svg { width: 22px; height: 22px; }

.shell-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.shell-bell:hover { background: var(--bg-soft); }
.shell-bell svg { width: 20px; height: 20px; }
.shell-bell .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shell-user-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.shell-user-toggle:hover { background: var(--bg-soft); }
.shell-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-blue-light);
  color: var(--brand-blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.shell-user-email {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shell-user-toggle svg.chevron { width: 14px; height: 14px; color: var(--ink-faint); flex-shrink: 0; }

.shell-main { flex: 1; padding: 28px; max-width: 1400px; width: 100%; }

/* ===== Stat cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1199.98px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-card); border-color: var(--brand-blue); transform: translateY(-2px); }

/* Pure-CTA variant (no metric to show — "Post a Job", "Reports") — a big
   action button replaces the stat-value/stat-link pair instead of leaving
   a blank number. */
.stat-card.action { justify-content: space-between; }
.stat-cta {
  margin-top: auto;
  background: var(--brand-blue);
  color: #fff;
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}
.stat-cta:hover { background: var(--brand-blue-dark); color: #fff; }
.stat-cta svg { width: 14px; height: 14px; }
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--brand-blue-light); color: var(--brand-blue); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }

.stat-label { font-size: 0.84rem; font-weight: 700; color: var(--ink-soft); }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-sub { font-size: 0.76rem; color: var(--ink-faint); margin-top: -6px; }
.stat-link {
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat-link:hover { text-decoration: underline; }
.stat-link svg { width: 13px; height: 13px; }

.shell-page-heading { font-size: 1.5rem; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.shell-page-sub { color: var(--ink-soft); margin: 0 0 24px; }

.shell-banner {
  background: var(--brand-blue-light);
  border: 1px solid #cfe0ff;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--brand-blue-dark);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ===== Mobile ===== */
@media (max-width: 991.98px) {
  .shell-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: var(--shadow-card);
  }
  .shell-sidebar.open { transform: translateX(0); }
  .shell-sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .shell-main { padding: 20px; }
  .shell-topbar { padding: 0 16px; }
  .shell-user-email { display: none; }
}

.shell-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.4);
  z-index: 25;
}
.shell-sidebar-backdrop.open { display: block; }

@media (prefers-reduced-motion: reduce) {
  .shell-sidebar { transition: none; }
}
