@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

/* === Theme tokens === */
:root {
  /* Surfaces */
  --bg:      #F7F9FC;
  --col-bg:  #FFFFFF;
  --card:    #FFFFFF;
  --border:  #E5E9F0;

  /* Text */
  --text:    #0A2540;
  --muted:   #5A6573;
  --meta:    #8B95A3;

  /* Shadows */
  --shadow:        0 1px 3px rgba(10,37,64,0.08);
  --shadow-hover:  0 4px 12px rgba(10,37,64,0.12);

  /* Brand */
  --link:    #1E88E5;
  --accent:  #F26B1F;
  --money:   #10B981;

  /* Header (light) */
  --header-bg:     #FFFFFF;
  --header-border: #1E88E5;
  --header-text:   #0A2540;
  --header-kicker: #1E88E5;
  --header-nav-text: #5A6573;
}

html[data-theme="dark"] {
  /* Surfaces */
  --bg:      #0F1419;
  --col-bg:  #1A1F26;
  --card:    #232A33;
  --border:  #2F3845;

  /* Text */
  --text:    #F5F7FA;
  --muted:   #A8B2BD;
  --meta:    #6B7684;

  /* Shadows */
  --shadow:        0 2px 8px rgba(0,0,0,0.4);
  --shadow-hover:  0 4px 18px rgba(0,0,0,0.55);

  /* Brand (same in dark) */
  --link:    #60A5FA;
  --accent:  #F26B1F;
  --money:   #10B981;

  /* Header (dark) */
  --header-bg:     #0A2540;
  --header-border: #1E88E5;
  --header-text:   #F5F7FA;
  --header-kicker: #60A5FA;
  --header-nav-text: #A8B2BD;
}

/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.link-plain {
  color: inherit;
  text-decoration: none;
}
.link-plain:hover {
  text-decoration: none;
}

.kanban-card--production {
  cursor: pointer;
}
.kanban-card--production .production-checklist {
  cursor: default;
}

.crew-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}
@media (max-width: 560px) {
  .crew-calc-grid { grid-template-columns: 1fr; }
}
.crew-calc-total {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.crew-calc-extra-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.crew-calc-extras-head {
  grid-column: 1 / -1;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* === Layout === */
.header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 3px solid var(--header-border);
}

.header-dark {
  background: var(--header-bg);
  border-bottom: 3px solid var(--header-border);
  color: var(--header-text);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
  min-width: 260px;
}

.header-brand:hover { text-decoration: none; }

.header-brand-text { display: flex; flex-direction: column; gap: 0.1rem; }
.header-kicker { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--header-kicker); }
.header-dark .header-title { color: var(--header-text); }

.header-logo {
  height: 40px;
  width: auto;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--header-text);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.nav-link {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: var(--header-nav-text);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(148, 163, 184, 0.12); text-decoration: none; }
.nav-link.active { background: rgba(14, 165, 233, 0.18); color: #e2e8f0; }

.nav-link-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  user-select: none;
}
.nav-link-disabled:hover { background: transparent; }

.nav-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.10);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.10);
  color: inherit;
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
}
.icon-btn:hover {
  text-decoration: none;
  background: rgba(148, 163, 184, 0.16);
}

.segmented {
  display: inline-flex;
  gap: 0.25rem;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 0.25rem;
  border-radius: 12px;
}

.segmented-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.header-dark .segmented-btn { color: #cbd5e1; }
.segmented-btn:hover { background: rgba(148, 163, 184, 0.18); }
.segmented-btn.active { background: rgba(14, 165, 233, 0.22); color: #0b1220; }
.header-dark .segmented-btn.active { background: rgba(14, 165, 233, 0.28); color: #e2e8f0; }

.header-who {
  font-size: 0.85rem;
  color: #94a3b8;
  white-space: nowrap;
}

.page-title { margin-bottom: 1rem; }
.page-title h2 { font-size: 1.2rem; margin-bottom: 0.25rem; }

.sla-banner {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  font-weight: 900;
  color: #dc2626;
}
.muted { color: var(--muted); }

.section-title { margin-top: 0.25rem; margin-bottom: 0.75rem; }
.section-title h3 { font-size: 1rem; margin-bottom: 0.15rem; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.module-group-title {
  margin-top: 0.25rem;
  font-weight: 950;
  color: var(--text);
  letter-spacing: 0.02em;
}

.module-tile {
  display: block;
  background: var(--card);
  border-radius: 12px;
  padding: 1rem 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}

.module-tile:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  border-color: #cbd5e1;
}

.module-tile .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.module-tile .name { font-weight: 800; color: var(--text); }
.module-tile .metric { font-weight: 900; color: #0ea5e9; white-space: nowrap; }
.module-tile .metric.metric-alert { color: #dc2626; }
.module-tile .desc { margin-top: 0.35rem; color: var(--muted); font-size: 0.85rem; }

.module-tile-under-construction {
  opacity: 0.88;
  cursor: default;
  pointer-events: none;
  border-style: dashed;
  border-color: var(--border);
}
.module-tile-under-construction .name { color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 0.75rem;
}

.stats-grid-4 {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.kpi-section {
  margin-bottom: 1rem;
}

.kpi-section-title {
  font-weight: 900;
  color: var(--text);
  margin: 0.25rem 0 0.5rem;
}

.sales-rev-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.stat-tile {
  background: var(--card);
  border-radius: 12px;
  padding: 1rem 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-tile .value { font-size: 1.5rem; font-weight: 800; }
.stat-tile .label { margin-top: 0.25rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.stat-tile .hint { margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted); }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
  .module-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 760px) {
  .header { padding: 0.75rem 1rem; }
  .header-logo { height: 32px; }
  .header-brand { min-width: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .stats-grid-4 { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .module-grid { grid-template-columns: repeat(1, minmax(140px, 1fr)); }
  .header-who { display: none; }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* Signed-out (login) screen */
.signed-out {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Full-bleed hero background for login */
.signed-out-home-hero {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: url('/images/login-bg.png') center center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}

/* Dark overlay so text/logo stays readable */
.signed-out-home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.30) 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
  z-index: 0;
}

.signed-out-home-hero .signed-out-home-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.15rem;
  padding: 1rem 1.25rem 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.signed-out-home-hero-inner .google-btn {
  margin-top: 1.25rem;
}

.signed-out-home-title {
  margin: 0;
  font-size: clamp(1.85rem, 5.5vw, 2.75rem);
  font-weight: 950;
  letter-spacing: -0.04em;
  color: #ffffff;
  line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

/* All-caps, blocky display title (landing + home brand rows) */
.signed-out-home-title.bf-brand-headline {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: inherit;
  font-weight: 950;
  margin: 0 0 0.55rem;
  line-height: 1.05;
}

/* Bigfoot wilderness font on login hero */
.signed-out-home-hero .signed-out-home-title.bf-brand-headline {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  letter-spacing: 0.12em;
  color: #ffffff;
  text-shadow: 0 2px 20px rgba(0,0,0,0.8), 0 0 40px rgba(0,0,0,0.5);
  margin: 0 0 0.25rem;
}

.signed-out-home-hero .signed-out-home-hero-inner {
  gap: 0.25rem;
}

.landing-page-stack .signed-out-home-title.bf-brand-headline {
  margin-bottom: 0.85rem;
}

.home-dashboard-brand-title.bf-brand-headline {
  letter-spacing: 0.07em;
  margin-bottom: 0.55rem;
}

.signed-out-home-logo {
  width: min(360px, 78vw);
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

/* Remove white box on login hero — blends logo into dark background */
.signed-out-home-hero .signed-out-home-logo {
  mix-blend-mode: screen;
  filter: drop-shadow(0 2px 16px rgba(0,0,0,0.6));
}

.home-dashboard-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.25rem 0 0.5rem;
}

.home-dashboard-brand-title {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

.home-dashboard-brand .signed-out-home-logo {
  width: min(280px, 70vw);
}

.signed-out-card {
  width: min(520px, 92vw);
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  padding: 1.25rem 1.25rem;
  text-align: center;
}

.signed-out-title {
  font-weight: 1000;
  font-size: 1.1rem;
  color: var(--text);
}

.google-btn {
  margin: 1rem auto 0;
  width: min(320px, 92%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: var(--card);
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.google-btn:hover {
  text-decoration: none;
  border-color: #d1d5db;
  box-shadow: 0 6px 18px rgba(0,0,0,0.10);
}
.google-btn-icon {
  display: inline-flex;
}
.google-btn-text {
  font-size: 0.95rem;
}

/* Root URL: minimal sign-in landing — uses the forest hero bg from home.html */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: url('/images/login-bg.png') center center / cover no-repeat;
  position: relative;
  color: #fff;
}
/* Dark overlay so text/logo stays readable on the forest bg */
.landing-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.30) 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
  pointer-events: none;
  z-index: 0;
}
.landing-page > * { position: relative; z-index: 1; }
.landing-page .signed-out-home-title { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.landing-page-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 1.5rem;
}

.landing-page-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: min(420px, 100%);
  box-sizing: border-box;
}

.landing-page-stack .google-btn {
  margin-top: 1.25rem;
}

/* Dashboard header hiding when signed out */
body.signed-out-mode .header-actions {
  display: none !important;
}
body.signed-out-mode .header-title {
  display: none !important;
}
/* Hide header entirely on login screen */
body.signed-out-mode .header {
  display: none !important;
}
/* Remove container constraints so hero fills viewport */
body.signed-out-mode .container {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

/* === Tab Bar === */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.tab {
  padding: 0.7rem 1.5rem;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: #1a6fbf; }
.tab.active { color: #1a6fbf; border-bottom-color: #1a6fbf; }

/* === Stage Badges === */
.stage-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.stage-docs_needed        { background: #fee2e2; color: #991b1b; }
.stage-awaiting_signature  { background: #fef3c7; color: #92400e; }
.stage-applied             { background: #dbeafe; color: #1e40af; }
.stage-permit_approved     { background: #d1fae5; color: #065f46; }
.stage-inspection_scheduled { background: #ede9fe; color: #5b21b6; }
.stage-final_inspection    { background: #ccfbf1; color: #115e59; }
.stage-closed              { background: #e5e7eb; color: #374151; }

.stage-not_started              { background: #f1f5f9; color: var(--muted); }
.stage-in_progress_inspection   { background: #fef3c7; color: #92400e; }
.stage-final_inspection         { background: #dbeafe; color: #1e40af; }
.stage-dumpster_picked_up       { background: #d1fae5; color: #065f46; }

.stage-clickable { cursor: pointer; }
.stage-clickable:hover { filter: brightness(0.9); }

/* === Stats Row === */
.stats-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  flex: 1;
  min-width: 120px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .count {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-card { cursor: pointer; transition: box-shadow 0.15s, transform 0.1s; }
.stat-card:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.12); transform: translateY(-1px); }

.stat-card .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === Toolbar === */
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  user-select: none;
  white-space: nowrap;
}

.toolbar-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.sales-tracker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: -0.25rem 0 1rem 0;
}

.sales-metric {
  background: rgba(148, 163, 184, 0.10);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #0f172a;
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  display: inline-flex;
  gap: 0.45rem;
  align-items: baseline;
}
.sales-metric .label {
  color: #475569;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.sales-metric .value {
  font-weight: 900;
}

.toolbar select,
.toolbar input {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.toolbar input { flex: 1; min-width: 200px; }

.toolbar select:focus,
.toolbar input:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.6);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.btn {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary { background: #1a6fbf; color: #fff; }
.btn-primary:hover { background: #155a9c; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }

/* === Table === */
.table-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

th {
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-weight: 600;
}

tr:hover td { background: #f8fafc; }
tr:last-child td { border-bottom: none; }

.clickable-row { cursor: pointer; }

/* === Permit Detail === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.back-link:hover { color: #2563eb; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: #1e293b;
}

.kv { display: flex; flex-direction: column; gap: 0.5rem; }
.kv-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid #f1f5f9; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { font-weight: 800; color: var(--muted); font-size: 0.85rem; }
.kv-row .v { color: var(--text); font-weight: 700; text-align: right; }

.field-group {
  margin-bottom: 1rem;
}

.field-group label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field-group .value {
  font-size: 1rem;
}

textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

/* === Stage Stepper === */
.stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  position: relative;
}

.step::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.step:first-child::before { top: 50%; }
.step:last-child::before { bottom: 50%; }

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  z-index: 1;
  flex-shrink: 0;
}

.step.completed .step-dot { background: #22c55e; color: #fff; }
.step.current .step-dot { background: #2563eb; color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,0.2); }

.step-label {
  font-size: 0.9rem;
  color: #94a3b8;
}

.step.completed .step-label { color: #1e293b; }
.step.current .step-label { color: #1e293b; font-weight: 600; }

/* === Timeline === */
.timeline {
  padding: 0;
  list-style: none;
}

.timeline-item {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
  border-left: 2px solid #e2e8f0;
}

.timeline-item::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #2563eb;
  border-radius: 50%;
  position: absolute;
  left: -5px;
  top: 0.75rem;
}

.timeline-date {
  font-size: 0.75rem;
  color: #94a3b8;
}

.timeline-text {
  font-size: 0.9rem;
}

/* === Documents === */
.doc-list {
  list-style: none;
  padding: 0;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.doc-item:last-child { border-bottom: none; }

.doc-name { font-size: 0.9rem; }

.doc-size {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: 0.5rem;
}

.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  color: #94a3b8;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 0.75rem;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.upload-zone input { display: none; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #22c55e; }
.toast.error { background: #ef4444; }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}

.empty-state h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--muted); }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal.modal-wide {
  max-width: 980px;
  max-height: 80vh;
  overflow: auto;
}

.modal h3 { margin-bottom: 1rem; }

.modal .form-group { margin-bottom: 1rem; }

.modal .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.modal .form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
}

.modal .form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* === Refresh Indicator === */
.refresh-indicator {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: auto;
}

/* === Pills (small badges) === */
.pill {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e5e7eb;
  color: #374151;
  margin-left: 0.4rem;
  white-space: nowrap;
}
.pill-yellow { background: #fef3c7; color: #92400e; }
.pill-red { background: #fee2e2; color: #991b1b; }

/* === Warning Indicator (>5 days in stage) === */
.days-warning {
  color: #dc2626;
  font-weight: 700;
}

.days-warning::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #dc2626;
  border-radius: 50%;
  margin-right: 0.4rem;
  animation: pulse-warning 1.5s ease-in-out infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

tr.row-warning { border-left: 3px solid #dc2626; }

/* === Kanban View === */
.kanban {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-column {
  min-width: 220px;
  flex: 1;
  background: var(--col-bg);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  overflow: hidden;
}

/* === Board column colors (pastel) === */
.kanban-column.col-not_contacted_yet { background: #dbeafe; }     /* darkest (pastel) blue */
.kanban-column.col-met_last_72_hours { background: #e0f2fe; }     /* medium (pastel) blue */
.kanban-column.col-met_last_2_weeks { background: #eff6ff; }      /* lightest (pastel) blue */
.kanban-column.col-warm_still_in_play { background: #ffedd5; }    /* warm fire/orange */
.kanban-column.col-high_priority_close { background: #dcfce7; }   /* lighter green */
.kanban-column.col-recently_sold { background: #bbf7d0; }         /* darker pastel green */

/* === Inbound leads column colors (pastel) === */
.kanban-column.col-new { background: #dcfce7; }              /* pastel green */
.kanban-column.col-appointment_set { background: #bbf7d0; }  /* darker pastel green */
.kanban-column.col-dead { background: #fee2e2; }             /* pastel red */

.kanban-column.col-not_contacted_yet .kanban-column-header { color: #1e3a8a; }
.kanban-column.col-met_last_72_hours .kanban-column-header { color: #1d4ed8; }
.kanban-column.col-met_last_2_weeks .kanban-column-header { color: #1e40af; }
.kanban-column.col-recently_sold .kanban-column-header { color: #065f46; }
.kanban-column.col-high_priority_close .kanban-column-header { color: #166534; }
.kanban-column.col-warm_still_in_play .kanban-column-header { color: #9a3412; }

.kanban-column.col-new .kanban-column-header { color: #166534; }
.kanban-column.col-appointment_set .kanban-column-header { color: #065f46; }
.kanban-column.col-dead .kanban-column-header { color: #991b1b; }

/* === Collections / AR aging buckets (pastel) === */
.kanban-column.col-ar-d0_14 { background: #bbf7d0; }   /* brightest pastel green */
.kanban-column.col-ar-d14_30 { background: #dcfce7; }  /* lighter pastel green */
.kanban-column.col-ar-d30_60 { background: #fef9c3; }  /* pastel yellow */
.kanban-column.col-ar-d60_plus { background: #fee2e2; } /* pastel red */

.kanban-column.col-ar-d0_14 .kanban-column-header { color: #065f46; }
.kanban-column.col-ar-d14_30 .kanban-column-header { color: #166534; }
.kanban-column.col-ar-d30_60 .kanban-column-header { color: #92400e; }
.kanban-column.col-ar-d60_plus .kanban-column-header { color: #991b1b; }

.kanban-column-footer {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.kanban-column-footer .total {
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.kanban-column-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-header .col-count {
  background: #e2e8f0;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
}

.kanban-card {
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  border: 1px solid transparent;
  transition: box-shadow 0.15s, transform 0.1s, background 0.15s, border-color 0.15s;
}

/* Production board cards stack vertically (never row flex from other kanban variants). */
.kanban-card.kanban-card--production {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Sales desk (board.html) only: drag handle + stacked body; do not apply to production / other kanbans */
.kanban-card.kanban-card--sales-desk {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.kanban-card--sales-desk .kanban-card-stack {
  flex: 1;
  min-width: 0;
}

.kanban-card--sales-desk .kanban-card-drag {
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  color: #cbd5e1;
  font-size: 0.65rem;
  line-height: 1.2;
  letter-spacing: -0.08em;
  padding: 0.15rem 0.1rem 0 0;
}

.kanban-card--sales-desk .kanban-card-drag:active {
  cursor: grabbing;
}

.kanban-card:hover {
  background: rgba(14, 165, 233, 0.06);
  border-color: rgba(14, 165, 233, 0.18);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.kanban-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #1e293b;
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  margin-left: -0.35rem;
  margin-right: -0.35rem;
  transition: color 0.15s, font-weight 0.15s;
}

.kanban-card:hover .kanban-card-title {
  color: #0f172a;
  font-weight: 700;
}

.kanban-card-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.kanban-card-sub.ar-amount {
  font-size: 1.05rem;
  font-weight: 900;
  color: #0f172a;
  margin-top: 0.1rem;
}

.kanban-card-sub.checklist label {
  display: block;
  margin: 0.25rem 0;
  color: #334155;
}
.kanban-card-sub.checklist input[type="checkbox"] {
  margin-right: 0.45rem;
}

.kanban-card-warning {
  border-left: 4px solid #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.06);
}

.kanban-card-warning .kanban-card-title {
  color: #7f1d1d;
}

.kanban-card-warning .kanban-card-sub {
  color: rgba(127, 29, 29, 0.72);
}

.kanban-card-warning .kanban-card-sub.kanban-card-sla {
  color: #dc2626;
  font-weight: 800;
}

/* New Lead contact overdue (6h) */
/* (Now uses the standard left red line via .kanban-card-warning) */

.kanban-card.dragging {
  opacity: 0.4;
}

.kanban-column.column-drag-over {
  background: #e0edfa;
  border: 2px dashed #1a6fbf;
}

/* === Bulk Action Bar === */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
  background: #1a6fbf;
  color: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.bulk-bar.visible { display: flex; }

.bulk-bar select {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.85rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.bulk-bar select option { color: #1a1a2e; }

.bulk-bar .btn-sm { padding: 0.35rem 1rem; }

#bulk-count { margin-right: auto; }

td .row-checkbox { cursor: pointer; width: 16px; height: 16px; }

tr.selected td { background: #eff6ff; }

/* === View Toggle === */
#view-toggle.active {
  background: #1a6fbf;
  color: #fff;
}

