:root {
  /* Indigo/amber palette, matching jobpilot.autovibe.co.nz's brand language.
     Names kept from the original palette so every rule below (buttons,
     badges, cards) picks up the new colors without a rewrite; only the
     *values* changed, plus the handful of rules noted below that used
     these as full dark-page backgrounds and are now light instead. */
  --navy-950: #172554;
  --navy-900: #1e3a8a;
  --navy-800: #1e40af;
  --navy-700: #1d4ed8;
  --blue-500: #4f46e5;
  --blue-400: #6366f1;
  --cyan-400: #f59e0b;
  --green-500: #16a34a;
  --green-100: #dcfce7;
  --amber-500: #d97706;
  --amber-100: #fef3c7;
  --red-500: #dc2626;
  --red-100: #fee2e2;
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-300: #cbd5e1;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

/* Author rules that set `display` on a class (e.g. .field, .checkbox-row)
   otherwise beat the browser's default `[hidden] { display: none }` UA rule
   at equal specificity, silently un-hiding anything hidden via that class. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-muted);
  color: var(--ink-900);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

p { margin: 0; }

button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Brand mark ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand-accent { color: var(--blue-500); }
.brand .mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--blue-500);
  color: #fff;
  flex-shrink: 0;
}
.brand .mark svg { width: 16px; height: 16px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: #bfd2f0;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand { color: #fff; padding: 0 8px; }

.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7391c4;
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #bfd2f0;
}

.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }
.nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-link.active { background: var(--blue-500); color: #fff; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer { margin-top: auto; font-size: 12px; color: #7391c4; padding: 0 8px; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 14px; }
.sidebar-footer > div:first-child { color: #fff !important; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 { font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad { padding: 20px 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 980px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card .stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-500); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--ink-900); }
.stat-card .stat-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-icon.blue { background: #e7edff; color: var(--blue-500); }
.stat-icon.green { background: var(--green-100); color: var(--green-500); }
.stat-icon.amber { background: var(--amber-100); color: var(--amber-500); }
.stat-icon.red { background: var(--red-100); color: var(--red-500); }

.hero-banner {
  background: linear-gradient(120deg, var(--navy-900), var(--blue-500) 140%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.hero-banner .hero-label { font-size: 12px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.06em; }
.hero-banner .hero-value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.hero-banner.plan { background: linear-gradient(120deg, #0d6b4c, var(--green-500) 140%); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-900);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  line-height: 1.2;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-muted); }
.btn-primary { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }
.btn-primary:hover { background: #2559dd; }
.btn-danger { background: var(--red-500); border-color: var(--red-500); color: #fff; }
.btn-danger:hover { background: #c22e39; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.field .hint { font-size: 11.5px; color: var(--ink-500); font-weight: 400; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="password"], input[type="date"], input[type="datetime-local"], select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-900);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-400); outline-offset: 0; border-color: var(--blue-400); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.checkbox-row input { width: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-muted); }
.text-right { text-align: right; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-green { background: var(--green-100); color: var(--green-500); }
.badge-amber { background: var(--amber-100); color: var(--amber-500); }
.badge-red { background: var(--red-100); color: var(--red-500); }
.badge-blue { background: #e7edff; color: var(--blue-500); }
.badge-teal { background: #ccfbf1; color: #0d9488; }
.badge-gray { background: var(--surface-muted); color: var(--ink-500); }
.pill-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--navy-900);
  color: #cfe0ff;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Misc ---------- */
.muted { color: var(--ink-500); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { position: relative; flex: 1; min-width: 220px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-500); }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--navy-950);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(10, 16, 36, 0.28);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: var(--green-500); }
.toast.toast-error { background: var(--red-500); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 16, 36, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; z-index: 50; overflow-y: auto;
}
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(10,16,36,0.35); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink-500); }
.autocomplete { position: relative; }
.autocomplete-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; z-index: 10;
}
.autocomplete-item { padding: 9px 12px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--surface-muted); }
.autocomplete-item .sub { color: var(--ink-500); font-size: 12px; }

.error-text { color: var(--red-500); font-size: 13px; margin: 8px 0; }
.banner-note { background: var(--amber-100); color: #8a5314; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.banner-note.green { background: var(--green-100); color: #0d6b4c; }

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 40px 16px;
  background: radial-gradient(circle at top, #eef2ff, var(--surface-muted));
}
.auth-shell .brand { color: var(--ink-900); font-size: 22px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-card h2 { font-size: 19px; margin-bottom: 18px; }
.auth-card .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--ink-500); }
.auth-switch a { color: var(--blue-500); font-weight: 600; }

/* ---------- Marketing site ---------- */
.marketing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; max-width: 1180px; margin: 0 auto;
}
.marketing-nav .links { display: flex; gap: 26px; align-items: center; font-weight: 600; font-size: 14px; }
.marketing-hero {
  background: var(--surface-muted);
  color: var(--ink-900);
  padding: 70px 32px 90px;
}
.marketing-hero-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center; }
@media (max-width: 900px) { .marketing-hero-inner { grid-template-columns: 1fr; } }
.marketing-hero h1 { font-size: 42px; line-height: 1.15; margin-bottom: 18px; }
.marketing-hero p { font-size: 17px; color: var(--ink-500); line-height: 1.6; margin-bottom: 26px; }
.marketing-section { max-width: 1180px; margin: 0 auto; padding: 70px 32px; }
.marketing-section h2 { font-size: 28px; text-align: center; margin-bottom: 10px; }
.marketing-section .sub { text-align: center; color: var(--ink-500); margin-bottom: 40px; font-size: 15.5px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--surface); }
.feature-card .icon-wrap { width: 40px; height: 40px; border-radius: 10px; background: #e7edff; color: var(--blue-500); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { color: var(--ink-500); font-size: 14px; line-height: 1.55; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr; } }
.price-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; background: var(--surface); display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--blue-500); box-shadow: 0 12px 30px rgba(47,107,255,0.15); position: relative; }
.price-card .badge-blue { align-self: flex-start; margin-bottom: 10px; }
.price-card h3 { font-size: 18px; }
.price-card .price { font-size: 34px; font-weight: 800; margin: 10px 0 4px; }
.price-card .price span { font-size: 14px; font-weight: 500; color: var(--ink-500); }
.price-card ul { list-style: none; margin: 18px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--ink-700); }
.price-card ul li::before { content: "✓ "; color: var(--green-500); font-weight: 700; }
.price-card .btn { margin-top: auto; justify-content: center; }

.footer-cta { background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-900); text-align: center; padding: 70px 32px; }
.footer-cta h2 { font-size: 26px; margin-bottom: 12px; }
.footer-cta p { color: var(--ink-500); margin-bottom: 24px; }
.site-footer { padding: 30px 32px; text-align: center; color: var(--ink-500); font-size: 13px; border-top: 1px solid var(--line); }

/* ---------- Invoice print page (own layout, no sidebar) ---------- */
.invoice-print { max-width: 800px; margin: 30px auto; }
