/* ── Google Fonts ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Orbitron:wght@600;700;900&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────── */
:root {
  --gold:        #b3893b;
  --gold-light:  #cc9f52;
  --gold-dim:    #7a5c1e;
  --black:       #f5f5f5;
  --black-card:  #ffffff;
  --black-panel: #f0f0f0;
  --black-border:#d8d4ce;
  --text:        #111111;
  --text-muted:  #4a4a4a;
  --success:     #166b38;
  --warning:     #9a5e00;
  --danger:      #b02a1f;
  --info:        #1558a0;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,.08);
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  background: #efefef;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.main {
  background-image: none;
}
a { color: var(--gold-dim); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; }

/* ── Typography ───────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; font-family: 'Orbitron', monospace; letter-spacing: .03em; color: var(--text); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem 1.4rem;
  border-radius: 6px;
  border: none;
  font-size: .88rem;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter .2s, transform .15s, box-shadow .2s;
  text-decoration: none;
}
.btn:hover { filter: brightness(.93); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.btn:active { transform: translateY(0); }
.btn-gold    { background: var(--gold); color: #fff; box-shadow: 0 2px 8px rgba(179,137,59,.25); }
.btn-outline { background: transparent; border: 1px solid var(--gold); color: var(--gold-dim); }
.btn-outline:hover { background: rgba(179,137,59,.08); color: var(--gold); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .35rem .85rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--black-border);
  border-top: 2px solid var(--gold);
  border-radius: 8px;
  padding: 1.75rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
}
.card::before { display: none; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--black-border);
}
.card-header h3 { color: var(--gold-dim); font-size: .9rem; font-family: 'Orbitron', monospace; letter-spacing: .08em; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  margin-bottom: .4rem;
  font-size: .72rem;
  color: var(--gold-dim);
  font-weight: 700;
  font-family: 'Orbitron', monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.form-control {
  width: 100%;
  background: #fff;
  border: 1px solid #d0cdc8;
  border-radius: 6px;
  color: var(--text);
  padding: .7rem 1rem;
  font-size: .95rem;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(179,137,59,.12);
}
select.form-control { cursor: pointer; background: #fff; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.2rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .95rem;
  border-left: 4px solid;
}
.alert-success { background: #edf7f1; border-color: var(--success); color: var(--success); }
.alert-danger   { background: #fdf0ef; border-color: var(--danger);  color: var(--danger); }
.alert-warning  { background: #fef8ec; border-color: var(--warning); color: var(--warning); }
.alert-info     { background: #edf4fb; border-color: var(--info);    color: var(--info); }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.mob-only { display: none; } /* shown only inside @media mobile block */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
thead th {
  background: #faf7f2;
  color: var(--gold-dim);
  text-align: left;
  padding: .85rem 1rem;
  font-size: .68rem;
  font-family: 'Orbitron', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-bottom: 2px solid #e8dcc8;
}
tbody tr { border-bottom: 1px solid #f0ece6; transition: background .15s; }
tbody tr:hover { background: #faf7f2; }
tbody td { padding: .8rem 1rem; vertical-align: middle; font-family: 'Rajdhani', sans-serif; font-size: .95rem; font-weight: 500; color: var(--text); }

/* ── Status Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .18rem .7rem;
  border-radius: 4px;
  font-family: 'Orbitron', monospace;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.badge-pending   { background: #fef3dd; color: #a06b00; }
.badge-contacted { background: #deedf8; color: #1d5f8c; }
.badge-scheduled { background: #fdf3e0; color: #8a6828; }
.badge-completed { background: #e4f5ec; color: #1a7040; }
.badge-lost      { background: #fde8e6; color: #9e2a1f; }
.badge-active    { background: #e4f5ec; color: #1a7040; }
.badge-suspended { background: #fde8e6; color: #9e2a1f; }

/* ── Sidebar Layout ───────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e8ddd0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d0c8be transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #d0c8be; border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.sidebar-logo {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid #f0e8dc;
  text-align: center;
}
.sidebar-logo::after { display: none; }
.sidebar-logo img { height: 38px; object-fit: contain; filter: none; }
.sidebar-logo .brand {
  font-family: 'Orbitron', monospace;
  font-size: .6rem;
  color: var(--gold-dim);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-top: .6rem;
  opacity: .9;
}

.sidebar-nav { flex: 1; padding: .75rem 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.5rem;
  color: #3a3a3a;
  font-family: 'Rajdhani', sans-serif;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: all .18s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: var(--gold-dim);
  background: #faf5ee;
  border-left-color: #d4a84f;
}
.sidebar-nav a.active {
  color: var(--gold-dim);
  background: #fdf0de;
  border-left-color: var(--gold);
  font-weight: 700;
}
.sidebar-nav a.active::after { display: none; }
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .6; }
.sidebar-nav a.active svg, .sidebar-nav a:hover svg { opacity: 1; }

.sidebar-section {
  padding: 1rem 1.5rem .3rem;
  font-family: 'Orbitron', monospace;
  font-size: .55rem;
  color: #444;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 700;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #f0e8dc;
  font-size: .85rem;
  color: #555;
}
.sidebar-footer::before { display: none; }
.sidebar-footer .user-name {
  font-family: 'Orbitron', monospace;
  font-size: .72rem;
  color: var(--text);
  letter-spacing: .06em;
  font-weight: 700;
}

/* ── Main Content ─────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #efefef;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid #e8ddd0;
  padding: .9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.topbar::after { display: none; }
.topbar h1 {
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.content { padding: 2rem; flex: 1; }

/* ── Dashboard Hero ───────────────────────────────────────────────────── */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #ffffff 0%, #fdf7ee 60%, #faf0da 100%);
  border: 1px solid #e8dcc8;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(179,137,59,.08);
}
.dash-hero::before { display: none; }
.dash-hero::after {
  content: 'SDAS';
  position: absolute;
  right: 5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Orbitron', monospace;
  font-size: 6rem;
  font-weight: 900;
  color: rgba(179,137,59,.06);
  letter-spacing: .2em;
  pointer-events: none;
  user-select: none;
}
.dash-hero-left { position: relative; z-index: 1; }
.dash-greeting {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}
.dash-title {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: .06em;
  line-height: 1.1;
  margin-bottom: .6rem;
}
.dash-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  letter-spacing: .04em;
}
.dash-hero-right {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.dash-status-dot {
  width: 10px;
  height: 10px;
  background: #1a8a4a;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(26,138,74,.4);
  animation: dashBlink 2.5s ease-in-out infinite;
}
.dash-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(26,138,74,.3);
  animation: dashPulse 2.5s ease-out infinite;
}
.dash-status-label {
  font-family: 'Orbitron', monospace;
  font-size: .65rem;
  font-weight: 700;
  color: #1a8a4a;
  letter-spacing: .2em;
}
@keyframes dashBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}
@keyframes dashPulse {
  0%   { transform: translate(-50%, -60%) scale(1);   opacity: .5; }
  100% { transform: translate(-50%, -60%) scale(2.8); opacity: 0; }
}

/* ── Stat Cards ───────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card {
  background: #fff;
  border: 1px solid #e8ddd0;
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  padding: 1.4rem 1.6rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.stat-card:hover {
  box-shadow: 0 4px 18px rgba(179,137,59,.12);
  transform: translateY(-2px);
}
.stat-card::before { display: none; }
.stat-card::after  { display: none; }
.stat-card .label {
  font-family: 'Orbitron', monospace;
  font-size: .58rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: .6rem;
}
.stat-card .value {
  font-family: 'Orbitron', monospace;
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--gold-dim);
  letter-spacing: .04em;
}
.stat-card .sub   { font-size: .82rem; color: #555; margin-top: .3rem; font-family: 'Rajdhani', sans-serif; }
.stat-card .icon  { position: absolute; bottom: .75rem; right: 1rem; font-size: 2.5rem; opacity: .08; }

/* ── Landing Page ─────────────────────────────────────────────────────── */
.lp-hero {
  background: linear-gradient(160deg, #fff 60%, #fdf5e8 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 4vw;
  border-bottom: 1px solid #e8dcc8;
}
.lp-nav .logo-wrap img { height: 38px; }
.lp-nav .logo-wrap .tagline { font-size: .7rem; color: var(--gold-dim); letter-spacing: .15em; text-transform: uppercase; }

.hero-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 4vw 3rem;
  gap: 1.5rem;
}
.hero-eyebrow { font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); background: rgba(201,168,76,.1); border: 1px solid rgba(201,168,76,.25); padding: .35rem 1rem; border-radius: 30px; display: inline-block; }
.hero-title { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.1; max-width: 760px; }
.hero-title span { color: var(--gold); }
.hero-subtitle { font-size: 1.1rem; color: #444; max-width: 560px; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: .5rem; }

.benefits { padding: 5rem 4vw; background: #faf7f2; }
.section-label { text-align: center; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin-bottom: .75rem; }
.section-title { text-align: center; font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 3rem; }
.benefits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.5rem; max-width: 1100px; margin: 0 auto; }
.benefit-card {
  background: #fff;
  border: 1px solid #e8dcc8;
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color .2s, transform .2s;
}
.benefit-card:hover { border-color: var(--gold); transform: translateY(-4px); }
.benefit-icon { font-size: 2.2rem; margin-bottom: 1rem; }
.benefit-card h3 { color: var(--gold-dim); font-size: 1.05rem; margin-bottom: .5rem; }
.benefit-card p  { color: #444; font-size: .92rem; }

.earnings { padding: 4rem 4vw; text-align: center; background: linear-gradient(135deg, #fdf5e8, #fff); border-top: 1px solid #e8dcc8; border-bottom: 1px solid #e8dcc8; }
.earnings .big { font-size: clamp(3rem, 10vw, 6rem); font-weight: 900; color: var(--gold); }
.earnings p { color: #444; font-size: 1.1rem; margin-top: .5rem; }

.signup-section { padding: 5rem 4vw; display: flex; justify-content: center; }
.signup-card { background: #fff; border: 1px solid #e8dcc8; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 520px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.signup-card h2 { color: var(--gold-dim); margin-bottom: .5rem; }
.signup-card .sub { color: #444; margin-bottom: 1.5rem; font-size: .92rem; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f5f0e8 0%, #efefef 100%); padding: 2rem; }
.login-card { background: #fff; border: 1px solid #e8dcc8; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { height: 45px; }
.login-logo h2 { color: var(--gold-dim); font-size: 1.1rem; margin-top: .75rem; }
.login-logo p { color: #444; font-size: .85rem; }

.lp-footer { padding: 2rem 4vw; text-align: center; color: #555; font-size: .85rem; border-top: 1px solid #e8dcc8; }

/* ── Mobile hamburger ─────────────────────────────────────────────────── */
.mob-topbar {
  display: none;
  position: sticky; top: 0; z-index: 400;
  background: #1a1a1a;
  padding: calc(.7rem + env(safe-area-inset-top, 0px)) 1rem .7rem;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid #2a2a2a;
}
.mob-hamburger {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: 4px;
}
.mob-hamburger span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.mob-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mob-hamburger.open span:nth-child(2) { opacity: 0; }
.mob-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mob-brand { font-family: 'Orbitron', monospace; font-size: .75rem; letter-spacing: .1em; color: var(--gold); }
.mob-topbar-right { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 500; backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Show mobile topbar, hide desktop topbar */
  .mob-topbar { display: flex; }
  .main > .topbar { display: none; }

  /* Sidebar slides in from left */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 600;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.4);
  }

  /* Main fills full width */
  .main { width: 100%; }
  .content { padding: .85rem; }

  /* ── Page header rows (title + button) ───── */
  .page-header-row,
  [style*="display:flex"][style*="justify-content:space-between"] {
    flex-wrap: wrap;
    gap: .6rem;
  }

  /* ── Stat cards: 2 cols on tablet, 1 col on phone ── */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-card { padding: 1rem 1.1rem; }
  .stat-card .value { font-size: 1.35rem; }

  /* ── Tables: horizontal scroll + don't break layout ── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid var(--black-border);
  }
  table { min-width: 360px; font-size: .85rem; }
  thead th { padding: .65rem .75rem; font-size: .6rem; }
  tbody td { padding: .65rem .75rem; font-size: .88rem; }

  /* Hide less-critical table columns on small screens */
  .col-hide-mobile { display: none; }

  /* Show elements only on mobile */
  .mob-only { display: block; }

  /* ── Cards ── */
  .card { padding: 1.1rem; }

  /* ── Search / filter bar ── */
  .search-bar,
  form[style*="display:flex"] {
    flex-direction: column;
    gap: .6rem;
  }
  .search-bar input,
  .search-bar select,
  .search-bar .form-control { width: 100% !important; }

  /* ── Dash hero: compact one-block card on phones (no stacked date pile) ── */
  .dash-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 1.1rem 1.25rem;
    gap: .4rem;
  }
  .dash-hero::after { display: none; }
  .dash-hero-right { display: none !important; }
  .dash-greeting { font-size: .78rem; margin-bottom: .05rem; }
  .dash-title { font-size: 1.3rem; margin-bottom: .3rem; }
  .dash-sub { font-size: .88rem; }

  /* ── Landing page ── */
  .lp-nav { padding: 1rem; }

  /* ── Any 2-column page layout → single column ── */
  .layout-2col { grid-template-columns: 1fr !important; }

  /* ── Invoice layout ── (form first, status/balance summary after) */
  .inv-layout { grid-template-columns: 1fr !important; }
  .inv-right { position: static !important; order: 1; width: 100%; }
  .inv-left  { order: 0; }

  /* Invoice top bar */
  .inv-topbar-actions { flex-wrap: wrap; gap: .4rem; }

  /* Item rows — name full width on top, then qty/rate/unit/delete below */
  .item-row-top {
    display: flex !important; flex-wrap: wrap; gap: .5rem; align-items: center;
  }
  .item-row-top .autocomplete-wrap {
    flex: 0 0 100% !important; width: 100% !important; order: 1;
  }
  .item-row-top .autocomplete-wrap input {
    width: 100% !important; font-size: 1rem !important; padding: .65rem .75rem !important;
  }
  .item-row-top .item-delete { order: 2; margin-left: auto; flex-shrink: 0; }
  .item-row-top .item-qty    { order: 3; width: 64px !important; flex-shrink: 0; }
  .item-row-top .item-rate-wrap { order: 4; flex: 1 1 105px; }
  .item-row-top .item-unit   { order: 5; flex: 1 1 80px; font-size: .85rem !important; }
  .item-row { padding: .9rem !important; border-radius: 8px !important; }
  .item-amount { font-size: .92rem !important; }

  /* Two-col grids → single col */
  .grid-2 { grid-template-columns: 1fr; }

  /* Dashboard main grid */
  .dash-main-grid { grid-template-columns: 1fr !important; }

  /* Year/Make/Model row */
  .vehicle-ymm-grid { grid-template-columns: 70px 1fr 1fr !important; }

  /* Invoice tabs: scrollable row */
  .inv-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .inv-tab { padding: .6rem .9rem; font-size: .82rem; white-space: nowrap; }

  /* Preview tab — stack, and fit the invoice document to the screen */
  #tabPreview > div { grid-template-columns: 1fr !important; }
  #livePreviewContainer { padding: .5rem !important; }
  .ipv-doc { max-width: 100% !important; }
  .ipv-doc .ipv-head { padding: 18px 16px !important; }
  .ipv-doc .ipv-headrow { flex-wrap: wrap; gap: 12px; }
  .ipv-doc .ipv-body { padding: 18px 16px !important; }

  /* Summary rows — prevent number clipping */
  .summary-row { flex-wrap: nowrap; gap: .5rem; }
  .summary-row .val { white-space: nowrap; flex-shrink: 0; }
  .inv-meta-card, .inv-summary-card { min-width: 0; width: 100%; box-sizing: border-box; }

  /* Paid input in summary card — full width */
  .inv-summary-card input[type=number] { width: 100% !important; }
  .summary-row input[type=number] { max-width: none !important; flex: 1; }

  /* Modals */
  .modal { padding: 1.25rem; border-radius: 10px; }
  .modal-overlay { padding: .75rem; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 12px 12px 0 0; }
  #serviceWizard .modal { max-width: 100% !important; width: 100% !important; border-radius: 12px 12px 0 0; }

  /* Wizard */
  #swStep1 > div { grid-template-columns: 1fr 1fr; }
  #ppfMaterialPicker { grid-template-columns: 1fr !important; }
  #ppfPanelGrid { grid-template-columns: 1fr 1fr !important; }

  /* Tint area rows */
  .tint-area-row { flex-direction: column; align-items: flex-start; gap: .35rem; }
  .tint-area-check { min-width: unset !important; }
  .tint-shade-wrap { flex-wrap: wrap; }

  /* Saved vehicles */
  #savedVehiclesList { flex-direction: row; flex-wrap: wrap; }
  .saved-vehicle-btn { flex: 1; min-width: 120px; }

  /* Buttons — bigger tap targets */
  .btn { padding: .6rem 1.1rem; font-size: .83rem; }
  .btn-sm { padding: .4rem .75rem; font-size: .76rem; }
}

/* Extra-small phones (≤ 420px) */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .mob-brand { font-size: .65rem; }
  .content { padding: .65rem; }
  table { min-width: 300px; }
}

/* ── Divider ──────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--black-border); margin: 1.5rem 0; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid #d8cfc4;
  border-top: 4px solid var(--gold);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.1);
  position: relative;
  overflow-y: auto;
  max-height: 92vh;
}
.modal::before { display: none; }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: #777; cursor: pointer; font-size: 1.4rem; font-family: 'Rajdhani', sans-serif; }
.modal-close:hover { color: var(--gold); }
.modal h3 { color: var(--gold-dim); margin-bottom: 1.25rem; font-family: 'Orbitron', monospace; font-size: .9rem; letter-spacing: .1em; }

/* ── Grid Utilities ───────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: .75rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-center { text-align: center; }

/* ── Invoice Pages ────────────────────────────────────────────────────── */
.inv-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e8dcc8;
  margin-bottom: 2rem;
}
.inv-tab {
  padding: .7rem 1.75rem;
  font-size: .92rem;
  font-weight: 600;
  color: #555;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.inv-tab:hover { color: var(--gold); }
.inv-tab.active { color: var(--gold-dim); border-bottom-color: var(--gold); }
.inv-tab.disabled { opacity: .35; pointer-events: none; }

.inv-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
.inv-left { display: flex; flex-direction: column; gap: 1.25rem; }
.inv-right { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }

.inv-section {
  background: #fff;
  border: 1px solid #e8dcc8;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.inv-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #f0e8dc;
  background: #faf7f2;
}
.inv-section-header h3 { font-size: 1rem; color: var(--text); }
.inv-section-header .toggle-icon { color: #444; transition: transform .2s; font-size: 1.1rem; }
.inv-section-header.collapsed .toggle-icon { transform: rotate(-90deg); }
.inv-section-body { padding: 1.25rem; }
.inv-section-body.collapsed { display: none; }

.inv-section-summary {
  padding: .6rem 1.25rem;
  font-size: .85rem;
  color: #555;
  background: #faf7f2;
  display: none;
}
.inv-section-summary.show { display: block; }

/* Line Items */
.item-row {
  background: #faf7f2;
  border: 1px solid #e8dcc8;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: .75rem;
  position: relative;
}
.item-row-top { display: grid; grid-template-columns: 1fr 80px 110px 90px auto; gap: .6rem; align-items: start; }
.item-row-bottom { margin-top: .6rem; display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; }
.item-extras { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.item-amount { font-size: 1rem; font-weight: 700; color: var(--gold-dim); text-align: right; min-width: 80px; padding-top: .5rem; }
.item-delete { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.2rem; padding: .25rem; line-height: 1; }
.item-delete:hover { opacity: .75; }

.add-item-btn { border: 2px dashed #d0ccc6; background: transparent; color: #444; border-radius: 8px; padding: .75rem; width: 100%; cursor: pointer; font-size: .9rem; transition: border-color .2s, color .2s; }
.add-item-btn:hover { border-color: var(--gold); color: var(--gold-dim); }

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gold);
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;   /* momentum scrolling on iOS */
  overscroll-behavior: contain;        /* don't fight the page scroll */
  touch-action: pan-y;
  display: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
@media (max-width: 768px) {
  .autocomplete-dropdown { max-height: 46vh; }
  .autocomplete-item { padding: .8rem .9rem; }
}
.autocomplete-dropdown.open { display: block; }
.autocomplete-item {
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .9rem;
  border-bottom: 1px solid #f0e8dc;
  transition: background .1s;
  color: var(--text);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted { background: #fdf5e8; color: var(--gold-dim); }
.autocomplete-item .sub { font-size: .78rem; color: #555; margin-top: .1rem; }

/* Right panel summary */
.inv-meta-card, .inv-summary-card, .inv-deposit-card {
  background: #fff;
  border: 1px solid #e8dcc8;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.inv-meta-card .inv-num { font-size: 1.4rem; font-weight: 900; color: var(--gold-dim); }
.inv-meta-card .inv-status { margin-top: .4rem; }

.summary-row { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; font-size: .92rem; }
.summary-row.total { font-size: 1.05rem; font-weight: 800; border-top: 1px solid #e8dcc8; margin-top: .4rem; padding-top: .75rem; color: var(--gold-dim); }
.summary-row.balance { font-size: 1.1rem; font-weight: 900; color: var(--gold-dim); }
.summary-row label { color: #555; }
.summary-row .val { font-weight: 600; }
.summary-row .val.negative { color: var(--danger); }

/* Deposit modal */
.deposit-info { background: #fdf5e8; border: 1px solid #e8dcc8; border-radius: 8px; padding: .85rem; font-size: .87rem; color: #444; }
.deposit-info strong { color: var(--gold-dim); }

/* PDF Page */
.pdf-page {
  background: #fff;
  color: #111;
  max-width: 800px;
  margin: 0 auto;
  padding: 50px 60px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
.pdf-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }
.pdf-logo { text-align: center; }
.pdf-logo img { height: 60px; object-fit: contain; }
.pdf-logo .company-name { font-size: 18px; font-weight: 800; color: #b3893b; margin-top: 6px; }
.pdf-logo .company-info { font-size: 11px; color: #444; margin-top: 4px; line-height: 1.6; }
.pdf-invoice-meta { text-align: right; }
.pdf-invoice-meta .big-label { font-size: 28px; font-weight: 900; color: #b3893b; letter-spacing: .05em; }
.pdf-invoice-meta table { margin-top: 8px; margin-left: auto; font-size: 12px; }
.pdf-invoice-meta td { padding: 2px 6px; }
.pdf-invoice-meta td:first-child { color: #444; text-align: right; }
.pdf-invoice-meta td:last-child { font-weight: 600; }

.pdf-bill-to { margin-bottom: 30px; }
.pdf-bill-to h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #444; margin-bottom: 8px; border-bottom: 1px solid #e0d0b0; padding-bottom: 4px; }
.pdf-bill-to .client-name { font-size: 15px; font-weight: 700; }

.pdf-vehicle { background: #faf7f2; border: 1px solid #e8dcc8; border-radius: 6px; padding: 12px 16px; margin-bottom: 28px; font-size: 12px; }
.pdf-vehicle h4 { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: #444; margin-bottom: 6px; }

.pdf-items { width: 100%; border-collapse: collapse; margin-bottom: 28px; }
.pdf-items thead th { background: #b3893b; color: #fff; padding: 10px 12px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.pdf-items thead th:last-child { text-align: right; }
.pdf-items tbody tr { border-bottom: 1px solid #eee; }
.pdf-items tbody tr:nth-child(even) { background: #faf7f2; }
.pdf-items tbody td { padding: 10px 12px; vertical-align: top; }
.pdf-items tbody td:last-child { text-align: right; font-weight: 600; }
.pdf-items .item-desc { font-size: 11px; color: #444; margin-top: 3px; }

.pdf-totals { display: flex; justify-content: flex-end; margin-bottom: 40px; }
.pdf-totals table { min-width: 260px; }
.pdf-totals td { padding: 5px 8px; font-size: 13px; }
.pdf-totals td:first-child { color: #444; }
.pdf-totals td:last-child { text-align: right; font-weight: 600; }
.pdf-totals .total-row td { font-size: 15px; font-weight: 800; border-top: 2px solid #b3893b; color: #b3893b; padding-top: 10px; }
.pdf-totals .balance-row td { font-size: 16px; font-weight: 900; color: #b3893b; }

.pdf-footer { border-top: 1px solid #e0d0b0; padding-top: 16px; text-align: center; font-size: 11px; color: #444; }

.pdf-deposit-notice { background: #fff9ee; border: 1px solid #e8dcc8; border-radius: 6px; padding: 14px 18px; margin-bottom: 28px; font-size: 12px; }
.pdf-deposit-notice strong { color: #b3893b; }

@media print {
  body { background: #fff !important; }
  .no-print { display: none !important; }
  .pdf-page { padding: 30px; }
}

/* Customer View */
.cv-wrap { min-height: 100vh; background: #f4f4f4; }
.cv-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; gap: 1rem; }
.cv-header { background: #111; padding: 1.5rem 2rem; display: flex; align-items: center; gap: 1rem; }
.cv-header img { height: 40px; }
.cv-header span { color: #b3893b; font-weight: 700; font-size: 1.1rem; }
.cv-body { max-width: 720px; margin: 2rem auto; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.cv-banner { background: #b3893b; color: #fff; padding: 1.5rem 2rem; }
.cv-banner h2 { font-size: 1.3rem; }
.cv-banner p { font-size: .9rem; opacity: .85; margin-top: .25rem; }
.cv-content { padding: 2rem; }

/* ── Dropdown / Action Menus ──────────────────────────────────────────── */
.action-btn {
  background: none;
  border: 1px solid #e0ddd8;
  border-radius: 5px;
  color: #555;
  cursor: pointer;
  padding: .3rem .6rem;
  font-size: .9rem;
  line-height: 1;
  transition: border-color .15s, color .15s;
}
.action-btn:hover { border-color: var(--gold); color: var(--gold-dim); }
.action-menu {
  background: #fff;
  border: 1px solid #e0ddd8;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  overflow: hidden;
}
.menu-item {
  padding: .65rem 1.1rem;
  cursor: pointer;
  font-size: .92rem;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  color: var(--text);
  transition: background .1s;
}
.menu-item:hover { background: #faf5ee; color: var(--gold-dim); }
.menu-danger { color: var(--danger) !important; }
.menu-danger:hover { background: #fdf0ef !important; }
.menu-divider { height: 1px; background: #f0ece6; margin: .2rem 0; }

/* ── Quick Add Wizard ─────────────────────────────────────────────────── */
.sw-cat-btn {
  display:flex;flex-direction:column;align-items:flex-start;gap:.3rem;
  background: #fff;
  border: 2px solid #d8cfc4;
  border-radius: 10px;
  padding: .9rem 1rem;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sw-cat-btn:hover { background: #fdf5e8; border-color: var(--gold); box-shadow: 0 2px 10px rgba(179,137,59,.15); }
.sw-cat-icon { font-size: 1.6rem; line-height: 1; }
.sw-cat-label { font-family:'Orbitron',monospace; font-size:.75rem; letter-spacing:.06em; color:#111; font-weight:700; }
.sw-cat-sub { font-size:.78rem; color:#555; font-family:'Rajdhani',sans-serif; }

.sw-field-label { display:block; font-family:'Orbitron',monospace; font-size:.68rem; letter-spacing:.12em; color:var(--gold-dim); margin-bottom:.5rem; font-weight:700; }

.sw-pill {
  font-family:'Rajdhani',sans-serif; font-size:.9rem; font-weight:700;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 20px;
  padding: .4rem 1rem;
  cursor: pointer;
  color: #333;
  transition: all .15s;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.sw-pill:hover { background: #fdf5e8; border-color: var(--gold); color: var(--gold-dim); }
.sw-pill.active { background: var(--gold); border-color: var(--gold); color: #fff; box-shadow: 0 2px 8px rgba(179,137,59,.3); }

.sw-check {
  display:flex; align-items:center; gap:.55rem; font-size:.9rem; font-weight:600;
  cursor:pointer; padding:.35rem .6rem; border-radius:6px; transition:background .1s; color:#111;
}
.sw-check:hover { background: #fdf5e8; }
.sw-check input[type=checkbox] { accent-color:var(--gold); width:15px; height:15px; }

.tint-area-row { display:flex; align-items:center; flex-wrap:wrap; gap:.4rem; padding:.35rem .5rem; border-radius:6px; transition:background .1s; border-bottom:1px solid #f0ece6; }
.tint-area-row:last-child { border-bottom:none; }
.tint-area-row:hover { background: #fdf5e8; }

.sw-other-btn {
  font-family:'Rajdhani',sans-serif; font-size:.9rem; font-weight:700;
  background: #fff;
  border: 2px solid #d8d0c8;
  border-radius: 8px;
  padding: .6rem .85rem;
  cursor: pointer;
  color: #222;
  text-align: left;
  transition: all .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sw-other-btn:hover { background: #fdf5e8; border-color: var(--gold); color: var(--gold-dim); }

/* ── Shared iOS-style mobile list (invoices / estimates / clients / bookings) ── */
.m-list { display: none; }
@media (max-width: 768px) {
  .d-only { display: none !important; }
  .m-list { display: block; }
}
.im-row { display: block; padding: 15px 2px; border-bottom: 1px solid var(--black-border); text-decoration: none; color: inherit; }
.im-row:active { background: var(--black-panel); }
.im-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.im-title { font-weight: 700; font-size: 1.04rem; color: var(--text); line-height: 1.25; }
.im-amt { font-weight: 700; font-size: 1.04rem; color: var(--text); white-space: nowrap; }
.im-sub { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 5px; }
.im-date { font-size: .92rem; color: var(--text-muted); }
.im-overdue { color: #e0245e; font-weight: 600; }
.im-status { font-size: .92rem; color: var(--text-muted); white-space: nowrap; }
.im-instamp { font-size: .66rem; font-family: 'Orbitron', monospace; letter-spacing: .08em; color: var(--gold); }
/* expandable per-customer rows (portals / boost schedule) */
.m-acc { border-bottom: 1px solid var(--black-border); }
.m-acc > summary { list-style: none; cursor: pointer; padding: 14px 2px; }
.m-acc > summary::-webkit-details-marker { display: none; }
.m-acc > summary::after { content: '⌄'; float: right; color: var(--text-muted); font-size: 1.1rem; line-height: 1.2; }
.m-acc[open] > summary::after { content: '⌃'; }
.m-acc-body { padding: 2px 2px 14px; }
