:root {
  --blue-primary: #2563EB;
  --blue-deep: #1E3A8A;
  --green: #10B981;
  --red: #EF4444;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 8px;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--blue-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Topbar ── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-shell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-height: 60px;
  position: relative;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 60px;
  width: 100%;
  min-width: 0;
}

.app-nav {
  width: 100%;
  border-top: 1px solid var(--border);
}

.app-nav-inner {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 0 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.app-nav-inner::-webkit-scrollbar {
  height: 4px;
}

.app-nav-inner::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.app-nav-inner a {
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-logout {
  display: none;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.topbar-logout:hover {
  color: var(--text);
  border-color: #CBD5E1;
  background: var(--card);
  text-decoration: none;
}

.nav-logout-mobile {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.brand-text {
  white-space: nowrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--blue-deep);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--blue-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  letter-spacing: -0.5px;
}

.brand-icon-lg {
  width: 48px;
  height: 48px;
  font-size: 16px;
  border-radius: 10px;
}

.tenant-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding-left: 14px;
  border-left: 1px solid var(--border);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-active {
  background: #D1FAE5;
  color: #047857;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.lang-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.lang-btn:hover,
.lang-btn.active {
  color: var(--blue-primary);
  text-decoration: none;
}

.lang-sep {
  color: var(--border);
  font-size: 12px;
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
}

.nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.nav a.active {
  background: #EFF6FF;
  color: var(--blue-primary);
}

.nav-logout {
  color: var(--text-muted) !important;
}

/* ── Main ── */
.main {
  padding: 28px 24px 48px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.link-muted {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.link-muted:hover {
  color: var(--blue-primary);
}

/* ── KPI cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.kpi-icon-blue { background: #EFF6FF; }
.kpi-icon-green { background: #D1FAE5; }
.kpi-icon-neutral { background: var(--bg); }
.kpi-icon-red { background: #FEE2E2; }

.kpi-label {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-value {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.kpi-value-green { color: var(--green); }
.kpi-value-red { color: var(--red); }

/* ── Dashboard grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

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

.dashboard-main h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

/* ── Lead cards ── */
.lead-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.lead-cards-full {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.lead-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.lead-card:hover {
  box-shadow: var(--shadow-md);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.lead-name {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.lead-phone {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.lead-issue {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.lead-address {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.lead-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.lead-time {
  font-size: 12px;
  color: var(--text-muted);
}

.lead-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Sidebar ── */
.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.sidebar-card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
}

.schedule-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.schedule-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.schedule-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-primary);
  min-width: 48px;
}

.schedule-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--blue-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-deep);
  color: #fff;
}

.btn-outline {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  flex: 1;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-new {
  background: #EFF6FF;
  color: var(--blue-primary);
}

.badge-booked,
.badge-scheduled,
.badge-confirmed {
  background: #D1FAE5;
  color: #047857;
}

.badge-lost,
.badge-cancelled {
  background: #FEE2E2;
  color: #B91C1C;
}

.badge-completed {
  background: #E2E8F0;
  color: #475569;
}

.badge-urgency-high {
  background: #FEE2E2;
  color: var(--red);
}

.badge-urgency-medium {
  background: #FEF3C7;
  color: #B45309;
}

.badge-urgency-low {
  background: var(--bg);
  color: var(--text-muted);
}

.badge-accepted {
  background: #D1FAE5;
  color: #065F46;
}

.badge-refused {
  background: #FEE2E2;
  color: #B91C1C;
}

.badge-pending {
  background: #FEF3C7;
  color: #B45309;
}

.badge-acceptance {
  text-transform: none;
  letter-spacing: 0.01em;
}

.lead-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Tables (appointments page) ── */
.section {
  margin-bottom: 36px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--bg);
}

/* ── Empty states ── */
.empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 24px 0;
}

.empty-sm {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

/* ── Login page ── */
.page-login .topbar {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}

/* ── Login page (legacy main.css) ── */
.page-login .topbar {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}

.page-login .main {
  padding: 0;
}

.login-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #EFF6FF 0%, var(--bg) 100%);
  padding: 40px 20px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  text-align: center;
  margin-bottom: 20px;
}

.login-box h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.login-subtitle {
  margin: 0 0 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

.login-tagline {
  margin: 0 0 24px;
  text-align: center;
  color: var(--blue-primary);
  font-size: 13px;
  font-weight: 500;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 12px;
}

.form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  color: var(--text);
  background: var(--card);
}

.form input:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form .btn-primary {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

/* ── Free-trial banner ── */
.trial-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  margin-bottom: 24px;
  border-radius: 14px;
  background: linear-gradient(120deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid #FDE68A;
  color: #78350F;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.12);
  overflow: hidden;
}

.trial-banner::before {
  content: "🎁";
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 20px;
  border-radius: 12px;
  background: #FDE68A;
  box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.15);
}

.trial-banner-expired {
  background: linear-gradient(120deg, #FEF2F2 0%, #FEE2E2 100%);
  border-color: #FECACA;
  color: #991B1B;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.12);
}

.trial-banner-expired::before {
  content: "⏰";
  background: #FECACA;
  box-shadow: inset 0 0 0 1px rgba(153, 27, 27, 0.15);
}

.trial-banner-text {
  flex: 1 1 220px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
}

.trial-banner-cta {
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ── Billing / plans ── */
.billing-page {
  max-width: 920px;
  margin: 0 auto;
}

.billing-hero {
  margin-bottom: 22px;
}

.billing-hero h1 {
  margin: 0 0 6px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.billing-hero-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* Current-subscription status card */
.plan-status {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 30px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.plan-status-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Trial-progress row under the status headline. */
.plan-status-trial {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.plan-status-trial-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.plan-status-trial-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
  transition: width 0.4s ease;
}

.plan-status-trial-note {
  display: block;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.plan-status-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 22px;
  border-radius: 13px;
  background: #EFF6FF;
}

.plan-status-body {
  flex: 1 1 auto;
  min-width: 0;
}

.plan-status-label {
  margin: 0 0 2px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.plan-status-value {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.plan-status-badge {
  flex: 0 0 auto;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: #D1FAE5;
  color: #047857;
}

.plan-status--paid {
  border-color: #A7F3D0;
}
.plan-status--paid .plan-status-icon {
  background: #D1FAE5;
}

.plan-status--trial {
  border-color: #FDE68A;
}
.plan-status--trial .plan-status-icon {
  background: #FEF3C7;
}

.plan-status--expired {
  border-color: #FECACA;
}
.plan-status--expired .plan-status-icon {
  background: #FEE2E2;
}
.plan-status--expired .plan-status-value {
  color: var(--red);
}

/* Section heading above the plan cards */
.plans-heading {
  margin-bottom: 18px;
}

.plans-heading h2 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.plans-heading p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}

/* Monthly call allowance shown under the price on each plan card. */
.plan-calls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px 0 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.plan-calls-dot {
  font-size: 14px;
}

/* Current-month usage against the subscribed plan's allowance. */
.plan-usage {
  margin: 0 0 26px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.plan-usage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.plan-usage-label {
  font-size: 13px;
  color: var(--text-muted);
}

.plan-usage-count {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.plan-usage-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.plan-usage-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue-primary), #60A5FA);
  transition: width 0.3s ease;
}

.plan-usage--over .plan-usage-bar > span {
  background: linear-gradient(90deg, #F59E0B, #EF4444);
}

.plan-usage-over-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #B45309;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 28px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.1);
  border-color: #CBD5E1;
}

.plan-card-featured {
  border-color: var(--blue-primary);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
}

.plan-card-featured:hover {
  border-color: var(--blue-primary);
}

/* Accent bar across the top of the featured plan. */
.plan-card-featured::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, var(--blue-primary), #60A5FA);
}

/* The plan the tenant is currently subscribed to */
.plan-card-current {
  border-color: var(--green);
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.15);
}
.plan-card-current:hover {
  border-color: var(--green);
}

.plan-badge {
  position: absolute;
  top: -12px;
  right: 22px;
  padding: 5px 14px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(90deg, var(--blue-primary), #4F46E5);
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.plan-card-head {
  margin-bottom: 18px;
}

.plan-name {
  margin: 0 0 3px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.plan-tag {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.plan-price {
  margin: 0 0 22px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.plan-price strong {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.plan-features {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
  flex: 1;
}

.plan-features li {
  position: relative;
  padding-left: 30px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.plan-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
  background: #D1FAE5;
  border-radius: 50%;
}

.plan-card-featured .plan-features li::before {
  color: var(--blue-primary);
  background: #DBEAFE;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  padding-top: 11px;
  padding-bottom: 11px;
  font-weight: 700;
}

.plan-cta {
  margin-top: auto;
  border-radius: 10px;
}

.plan-cta-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ECFDF5;
  color: #047857;
  border: 1.5px solid #A7F3D0;
  cursor: default;
  opacity: 1;
}

.plan-cta-current:hover {
  background: #ECFDF5;
}

.plan-cta-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
}

.billing-overage-note {
  margin: 24px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.billing-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.billing-note-lock {
  font-size: 14px;
}

@media (max-width: 980px) {
  .plan-grid {
    grid-template-columns: 1fr;
    max-width: 460px;
    margin: 0 auto;
  }
}

@media (max-width: 700px) {
  .plan-status-main {
    flex-wrap: wrap;
  }
}

/* ── Cards (generic) ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

/* ── Test call ── */
.test-call-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.test-scenarios {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.test-scenarios h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 10px;
}

.scenario-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.scenario-btn:hover {
  border-color: var(--blue-primary);
  background: #EFF6FF;
}

.scenario-btn.active {
  border-color: var(--blue-primary);
  background: #DBEAFE;
}

.scenario-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.scenario-expected {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .test-call-grid {
    grid-template-columns: 1fr;
  }
}

.form-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 14px 0 6px;
}

.form-card input,
.form-card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}

.form-card textarea {
  resize: vertical;
}

.result-card h2 {
  margin: 0 0 16px;
  font-size: 17px;
}

.result-summary {
  color: var(--text);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 6px;
  margin: 0 0 12px;
  font-size: 14px;
}

.result-json {
  background: var(--text);
  color: #E2E8F0;
  padding: 14px;
  border-radius: 6px;
  font-size: 13px;
  overflow-x: auto;
  margin: 0;
}

code {
  font-size: 13px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.booking-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

.booking-box h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.booking-row {
  margin-bottom: 10px;
}

.booking-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.result-reason {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.badge-score {
  background: var(--blue-deep);
  color: #fff;
  font-size: 14px;
}

.badge-action-BOOK_NOW {
  background: #FEE2E2;
  color: var(--red);
  font-size: 13px;
  padding: 4px 12px;
}

.badge-action-CALL_BACK {
  background: #FFEDD5;
  color: #C2410C;
  font-size: 13px;
  padding: 4px 12px;
}

.badge-action-SEND_QUOTE {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 12px;
}

/* ── Appointments: agenda + map ── */
.appointments-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .appointments-layout {
    grid-template-columns: 1fr;
  }
  .map-panel {
    order: -1;
  }
  .appointments-map {
    height: 320px !important;
  }
}

.panel-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.agenda-panel {
  min-width: 0;
}

.agenda-day {
  margin-bottom: 28px;
}

.agenda-day-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 2px solid var(--blue-primary);
  margin-bottom: 12px;
}

.agenda-day-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.agenda-day-date {
  font-size: 14px;
  color: var(--text-muted);
}

.agenda-day-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-primary);
  background: #EFF6FF;
  padding: 3px 10px;
  border-radius: 999px;
}

.agenda-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-slot {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue-primary);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.agenda-slot:hover {
  box-shadow: var(--shadow-md);
}

.agenda-slot-active {
  border-left-color: var(--green);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  background: #F0FDF4;
}

.agenda-slot-mapped {
  border-left-color: var(--blue-primary);
}

.agenda-time-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.agenda-time {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue-deep);
  line-height: 1;
}

.agenda-client {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.agenda-issue {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.agenda-address {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.agenda-address-missing {
  color: var(--red);
  font-style: italic;
}

.agenda-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-panel {
  position: sticky;
  top: 20px;
}

.appointments-map {
  width: 100%;
  height: calc(100vh - 180px);
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  z-index: 1;
}

.map-status {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.map-pin {
  background: transparent;
  border: none;
}

.map-pin-inner {
  background: var(--blue-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
  white-space: nowrap;
  position: relative;
}

.map-pin-inner::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--blue-primary);
}

/* ── Settings ── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

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

.settings-section h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.section-hint {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

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

.form-row-narrow {
  max-width: 140px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row-narrow {
    max-width: none;
  }
}

.settings-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.settings-actions .btn-primary {
  padding: 12px 28px;
}

.alert-success {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

/* ── Leads archive & tabs ── */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.view-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.view-tab {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.view-tab:hover {
  color: var(--text);
  text-decoration: none;
}

.view-tab.active {
  background: var(--card);
  color: var(--blue-primary);
  box-shadow: var(--shadow-sm);
}

.lead-action-form {
  flex: 1;
  margin: 0;
}

.lead-action-form button {
  width: 100%;
}

.btn-archive {
  color: var(--text-muted);
}

.btn-archive:hover {
  color: var(--red);
  border-color: #FECACA;
  background: #FEF2F2;
}

.badge-archived {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.lead-card-archived {
  opacity: 0.85;
}

/* ── Map routes ── */
.route-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.route-controls label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.route-day-select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
}

.route-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.route-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-legend-line {
  display: inline-block;
  width: 24px;
  height: 4px;
  border-radius: 2px;
}

.route-legend-car {
  background: #2563EB;
}

.route-legend-transit {
  background: repeating-linear-gradient(90deg, #F59E0B 0 6px, transparent 6px 10px);
}

.route-summary-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.route-summary-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.route-legs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: none;
  overflow: visible;
}

.route-leg-item {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.route-leg-item:hover,
.route-leg-item-active {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.route-leg-step {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.route-leg-body {
  flex: 1;
  min-width: 0;
}

.route-leg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
  gap: 8px;
}

.route-leg-km {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.route-leg-names {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
}

.route-leg-times-big {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.route-time-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 8px;
  min-width: 100px;
}

.route-time-chip-car {
  background: #DBEAFE;
  border: 1px solid #93C5FD;
}

.route-time-chip-transit {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
}

.route-time-chip-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.route-time-chip-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.route-time-chip-car .route-time-chip-value {
  color: #1D4ED8;
}

.route-time-chip-transit .route-time-chip-value {
  color: #B45309;
}

.route-legs-loading,
.route-legs-empty {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* Map time badges on route */
.route-time-icon-wrap {
  background: transparent !important;
  border: none !important;
}

.route-time-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #1D4ED8;
  border-radius: 10px;
  padding: 6px 10px 6px 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.route-time-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563EB;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.route-time-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-time-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1.2;
}

.route-time-mode {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.route-time-row-car .route-time-mode {
  color: #1D4ED8;
}

.route-time-row-transit .route-time-mode {
  color: #B45309;
}

.route-time-value {
  font-size: 15px;
  font-weight: 800;
}

.route-time-row-car .route-time-value {
  color: #1E3A8A;
}

.route-time-row-transit .route-time-value {
  color: #92400E;
  font-size: 13px;
}

.map-pin-depot-inner {
  background: #10B981;
  font-size: 10px;
}

.appointments-map {
  height: calc(100vh - 480px);
  min-height: 320px;
}

/* ══════════════════════════════════════════
   Dashboard — modern animated layout
   ══════════════════════════════════════════ */
.page-dashboard {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.08), transparent),
    var(--bg);
}

.page-dashboard .main {
  padding-top: 20px;
}

/* Hero */
.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 55%, #3B82F6 100%);
  border-radius: 16px;
  color: #fff;
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.25);
  position: relative;
  overflow: hidden;
}

.dash-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.dash-greeting {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.85;
  text-transform: capitalize;
}

.dash-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dash-subtitle {
  margin: 0;
  font-size: 14px;
  opacity: 0.8;
}

.dash-subtitle strong {
  color: #FDE68A;
  font-weight: 700;
}

.dash-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.dash-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.dash-action:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: #fff;
}

.dash-action-primary {
  background: rgba(255, 255, 255, 0.95);
  color: var(--blue-deep);
  border-color: transparent;
}

.dash-action-primary:hover {
  background: #fff;
  color: var(--blue-deep);
}

.dash-action-icon {
  font-size: 16px;
  line-height: 1;
}

.dash-action-badge {
  background: var(--blue-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.dash-action-primary .dash-action-badge {
  background: var(--blue-deep);
}

/* ── Slim hero + urgent shortcut ── */
.dash-hero-slim {
  padding: 20px 26px;
  margin-bottom: 20px;
  align-items: center;
}

.dash-hero-alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  z-index: 1;
  animation: alertPulse 2s ease-in-out infinite;
}

.dash-hero-alert:hover {
  background: rgba(255, 255, 255, 0.26);
  text-decoration: none;
  color: #fff;
}

.dash-hero-alert strong { color: #FECACA; }
.dash-hero-alert-icon { font-size: 18px; }

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.0); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.18); }
}

/* ── Workflow rail (le parcours plombier) ── */
.dash-flow {
  margin-bottom: 28px;
}

.dash-flow-head {
  margin-bottom: 14px;
}

.dash-flow-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.dash-flow-hint {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.flow-rail {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.flow-step {
  position: relative;
  display: flex;
}

/* Connecteur "flèche" entre les étapes pour matérialiser l'ordre. */
.flow-step:not(.flow-step-last)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -8px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--border);
  border-right: 2px solid var(--border);
  transform: translateY(-50%) rotate(45deg);
  z-index: 2;
}

.flow-step-link {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.flow-step-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  border-color: #BFDBFE;
  text-decoration: none;
}

.flow-step-num {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.flow-step-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.flow-icon-blue { background: #EFF6FF; }
.flow-icon-indigo { background: #EEF2FF; }
.flow-icon-amber { background: #FEF3C7; }
.flow-icon-green { background: #D1FAE5; }
.flow-icon-teal { background: #CCFBF1; }

.flow-step-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.flow-step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.flow-step-metric {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.flow-step-unit {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.flow-step-desc {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.flow-step-pill {
  align-self: flex-start;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #FEF3C7;
  color: #92400E;
}

/* Étape avec du travail en attente : liseré coloré + puce d'appel à l'action. */
.flow-step-todo .flow-step-link {
  border-color: #FDE68A;
  background: linear-gradient(135deg, #fff 0%, #FFFBEB 100%);
}

.flow-step-urgent .flow-step-link {
  border-color: #FECACA;
  background: linear-gradient(135deg, #fff 0%, #FEF2F2 100%);
}

.flow-step-urgent .flow-step-pill {
  background: #FEE2E2;
  color: #B91C1C;
}

/* Puce numérotée réutilisée dans les titres de panneaux. */
.dash-panel-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  margin-right: 4px;
  flex-shrink: 0;
}

.dash-panel-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Actions par lead alignées sur l'ordre du workflow. */
.lead-actions-flow {
  flex-wrap: wrap;
}

@media (max-width: 1040px) {
  .flow-rail {
    grid-template-columns: repeat(3, 1fr);
  }
  .flow-step:nth-child(3)::after,
  .flow-step:not(.flow-step-last)::after {
    display: none;
  }
}

@media (max-width: 640px) {
  .flow-rail {
    grid-template-columns: repeat(2, 1fr);
  }
  .flow-step-metric { font-size: 26px; }
}

/* Animations */
@keyframes dashFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes kpiPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.8); }
}

.dash-animate,
.dash-card-in {
  opacity: 1;
  transform: none;
}

html.js-enabled .dash-animate,
html.js-enabled .dash-card-in {
  opacity: 0;
  transform: translateY(16px);
}

html.js-enabled .dash-animate.is-visible,
html.js-enabled .dash-card-in.is-visible {
  animation: dashFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dash-delay-1.is-visible { animation-delay: 0.05s; }
.dash-delay-2.is-visible { animation-delay: 0.1s; }
.dash-delay-3.is-visible { animation-delay: 0.15s; }
.dash-delay-4.is-visible { animation-delay: 0.2s; }
.dash-delay-5.is-visible { animation-delay: 0.25s; }
.dash-delay-6.is-visible { animation-delay: 0.3s; }
.dash-delay-7.is-visible { animation-delay: 0.35s; }

html.js-enabled .dash-card-in.is-visible {
  animation-delay: calc(var(--i, 0) * 0.06s + 0.2s);
}

/* KPI cards — dashboard override */
.page-dashboard .kpi-grid {
  gap: 14px;
  margin-bottom: 28px;
}

.page-dashboard .kpi-card {
  position: relative;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  text-decoration: none;
  color: inherit;
}

.page-dashboard .kpi-card-link:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  border-color: #BFDBFE;
  text-decoration: none;
}

.page-dashboard .kpi-card-alert {
  border-color: #FECACA;
  background: linear-gradient(135deg, #fff 0%, #FEF2F2 100%);
}

.page-dashboard .kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-dashboard .kpi-icon {
  font-size: 22px;
  width: auto;
  height: auto;
}

.page-dashboard .kpi-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.page-dashboard .kpi-trend {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.page-dashboard .kpi-pulse {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 10px;
  height: 10px;
  background: var(--red);
  border-radius: 50%;
  animation: kpiPulse 2s ease-in-out infinite;
}

/* Section header — dashboard panel */
.page-dashboard .dashboard-main.dash-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-sm);
}

.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.dash-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.dash-panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: #EFF6FF;
  color: var(--blue-primary);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}

.dash-see-all {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue-primary);
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.15s;
}

.dash-see-all:hover {
  color: var(--blue-deep);
  text-decoration: underline;
}

/* Lead cards — dashboard */
.page-dashboard .lead-card {
  border-radius: 12px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.page-dashboard .lead-card:hover {
  transform: translateY(-3px);
  border-color: #BFDBFE;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}

.page-dashboard .lead-card-header {
  align-items: center;
}

.lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563EB, #1E3A8A);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lead-card-meta {
  flex: 1;
  min-width: 0;
}

.page-dashboard .lead-card-header {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
}

/* Sidebar */
.page-dashboard .sidebar-card {
  border-radius: 14px;
  transition: box-shadow 0.2s;
}

.page-dashboard .sidebar-card:hover {
  box-shadow: var(--shadow-md);
}

.sidebar-card-highlight {
  border-color: #BFDBFE;
  background: linear-gradient(180deg, #fff 0%, #F8FAFF 100%);
}

.sidebar-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sidebar-card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.sidebar-count {
  background: var(--blue-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}

.sidebar-link {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-primary);
  text-decoration: none;
}

.sidebar-link:hover {
  text-decoration: underline;
}

/* Timeline schedule */
.schedule-timeline .schedule-item {
  display: flex;
  gap: 12px;
  padding: 0 0 16px;
  align-items: flex-start;
}

.schedule-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16px;
  flex-shrink: 0;
  padding-top: 4px;
}

.schedule-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue-primary);
  border: 2px solid #BFDBFE;
  flex-shrink: 0;
}

.schedule-line {
  width: 2px;
  flex: 1;
  min-height: 24px;
  background: #E2E8F0;
  margin-top: 4px;
}

.schedule-content {
  flex: 1;
  min-width: 0;
}

.schedule-content .schedule-time {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--blue-deep);
  line-height: 1.2;
  margin-bottom: 2px;
}

.schedule-address {
  margin: 2px 0 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.schedule-compact {
  list-style: none;
  margin: 0;
  padding: 0;
}

.schedule-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-row:last-child {
  border-bottom: none;
}

.schedule-date-badge {
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-deep);
}

.schedule-time-inline {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-primary);
}

/* Empty states */
.dash-empty {
  text-align: center;
  padding: 40px 24px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.dash-empty-sm {
  padding: 20px 16px;
  background: transparent;
  border: none;
}

.dash-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.dash-empty p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 768px) {
  .dash-hero {
    padding: 20px;
  }

  .dash-title {
    font-size: 22px;
  }

  .dash-quick-actions {
    width: 100%;
  }

  .dash-action {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-width: 0;
  }
}

/* ══════════════════════════════════════════
   Responsive — full application
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .appointments-map {
    height: 60vh !important;
    min-height: 380px;
  }

  .map-panel {
    position: static;
  }

  .page-dashboard .kpi-value {
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  /* GPS-first: give the map the room a navigation app needs. */
  .appointments-map {
    height: 66vh !important;
    min-height: 340px;
    border-radius: 14px;
  }
}

@media (min-width: 901px) {
  .topbar-logout {
    display: inline-flex;
    align-items: center;
  }

  .nav-logout-mobile {
    display: none !important;
  }

  .topbar-left {
    flex-wrap: nowrap;
    min-width: 0;
    flex: 1;
  }

  .topbar-right {
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
}

@media (max-width: 900px) {
  .container {
    padding: 0 20px;
  }

  .app-nav {
    border-top: none;
  }

  .topbar-shell {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .topbar-inner {
    min-height: 56px;
  }

  .nav-toggle {
    display: flex;
  }

  .topbar-logout {
    display: none;
  }

  .nav-logout-mobile {
    display: block;
  }

  .app-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1001;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    padding: 8px 20px 12px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }

  .app-nav.is-open {
    display: block;
  }

  .app-nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 0;
    overflow-x: visible;
  }

  .app-nav-inner a {
    padding: 12px 14px;
    border-radius: 8px;
  }

  .tenant-name {
    display: none;
  }

  .badge-active {
    display: none;
  }

  .card {
    padding: 16px 18px;
  }

  .agenda-day-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .agenda-day-count {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 20px 0 40px;
  }

  .container {
    padding: 0 16px;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .view-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .view-tab {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
  }

  .lead-cards,
  .lead-cards-full {
    grid-template-columns: 1fr;
  }

  .lead-actions {
    flex-direction: column;
  }

  .lead-actions .btn,
  .lead-action-form button {
    width: 100%;
  }

  .agenda-slot {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 16px;
  }

  .agenda-time-col {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .agenda-time {
    font-size: 20px;
  }

  .agenda-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .agenda-actions .btn {
    width: 100%;
    text-align: center;
  }

  .route-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .route-day-select {
    width: 100%;
  }

  .route-legend {
    flex-direction: column;
    gap: 8px;
  }

  .route-leg-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .route-leg-times-big {
    flex-direction: column;
    width: 100%;
  }

  .route-time-chip {
    width: 100%;
    min-width: 0;
  }

  .route-time-chip-value {
    font-size: 20px;
  }

  .settings-actions {
    justify-content: stretch;
  }

  .settings-actions .btn-primary {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .dash-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-dashboard .lead-card-header {
    grid-template-columns: 40px 1fr;
  }

  .page-dashboard .lead-card-badges {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
  }

  .scenario-list {
    max-height: none;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .brand {
    font-size: 15px;
  }

  .lp-logo--md {
    width: 32px;
    height: 32px;
  }

  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .page-dashboard .kpi-value {
    font-size: 26px;
  }

  .dash-hero {
    padding: 18px 16px;
    border-radius: 12px;
  }

  .dash-title {
    font-size: 20px;
  }

  .dash-action {
    flex: 1 1 100%;
    width: 100%;
  }

  .dash-greeting {
    font-size: 13px;
  }

  .landing-hero-cta .btn-lg,
  .btn-lg {
    width: 100%;
    text-align: center;
  }

  .schedule-row {
    flex-wrap: wrap;
  }

  .result-json {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-animate,
  .dash-card-in {
    opacity: 1;
    transform: none;
    animation: none !important;
  }

  .page-dashboard .kpi-card-link:hover,
  .page-dashboard .lead-card:hover,
  .dash-action:hover {
    transform: none;
  }

  .kpi-pulse {
    animation: none;
  }
}

/* ============================================================
   Live appointment notifications (PWA)
   ============================================================ */
/* ── Notification centre (bell + panel) ── */
.notif-center {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell {
  position: relative;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.notif-bell:hover {
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
}

.notif-bell-icon {
  font-size: 18px;
  line-height: 1;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red, #dc2626);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  z-index: 200;
  overflow: hidden;
  animation: notifPop 0.16s ease;
}

@keyframes notifPop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.notif-panel-head strong {
  font-size: 14px;
  color: var(--text);
}

.notif-mark-read {
  border: none;
  background: transparent;
  color: var(--blue-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.notif-mark-read:hover {
  text-decoration: underline;
}

.notif-list {
  max-height: min(60vh, 420px);
  overflow-y: auto;
}

.notif-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notif-item {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

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

.notif-item:hover {
  background: var(--bg-soft, rgba(37, 99, 235, 0.05));
  text-decoration: none;
}

.notif-item.is-unread {
  background: rgba(37, 99, 235, 0.07);
}

.notif-item.is-unread .notif-item-body strong::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-primary);
  margin-right: 6px;
  vertical-align: middle;
}

.notif-item-icon {
  font-size: 18px;
  line-height: 1.3;
  flex-shrink: 0;
}

.notif-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notif-item-body strong {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
}

.notif-item-body span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.notif-item-body time {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
  margin-top: 1px;
}

.lp-toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.lp-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 12px 14px;
  cursor: pointer;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.lp-toast.is-in {
  transform: translateX(0);
  opacity: 1;
}

.lp-toast-icon {
  font-size: 20px;
  line-height: 1.2;
}

.lp-toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lp-toast-body strong {
  font-size: 14px;
  color: var(--text);
}

.lp-toast-body span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.lp-toast-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.lp-toast-close:hover {
  color: var(--text);
}

.lp-notify-enable {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 9998;
  border: none;
  background: var(--blue-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lp-notify-enable:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.45);
}

/* ── Install-app prompt ── */
.lp-install {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  padding: 4px 6px 4px 4px;
}

.lp-install-btn {
  border: none;
  background: var(--blue-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.lp-install-btn:hover {
  transform: translateY(-1px);
}

.lp-install-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}

.lp-install-close:hover {
  color: var(--text);
}

.lp-install-hint {
  max-width: min(320px, calc(100vw - 36px));
  padding: 10px 6px 10px 14px;
  border-radius: var(--radius);
}

.lp-install-hint-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .lp-toast-root {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  /* The dropdown is anchored to a bell that isn't at the screen edge, so on a
     phone an absolutely-positioned panel would spill off-screen. Pin it to the
     viewport instead: full width, just below the top bar. */
  .notif-panel {
    position: fixed;
    top: 64px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
  }

  .notif-list {
    max-height: calc(100vh - 140px);
  }

  .lp-notify-enable {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  /* Sit above the full-width notifications button when both are visible. */
  .lp-install {
    left: 12px;
    right: 12px;
    bottom: 64px;
    justify-content: center;
  }

  .lp-install-btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lp-toast {
    transition: opacity 0.2s ease;
    transform: none;
  }
}

/* ══════════════════════════════════════════
   Mobile bottom tab bar (native app feel)
   ══════════════════════════════════════════ */
.tabbar {
  display: none;
}

@media (max-width: 768px) {
  .tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    background: var(--card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    min-height: 56px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
  }

  .tabbar-item:hover {
    text-decoration: none;
  }

  .tabbar-icon {
    font-size: 20px;
    line-height: 1;
    filter: grayscale(0.35);
    transition: transform 0.15s, filter 0.15s;
  }

  .tabbar-label {
    line-height: 1;
  }

  .tabbar-item.active {
    color: var(--blue-primary);
  }

  .tabbar-item.active .tabbar-icon {
    filter: none;
    transform: translateY(-1px) scale(1.08);
  }

  .tabbar-item-primary .tabbar-icon {
    filter: none;
  }

  /* Keep content clear of the fixed tab bar. */
  .main {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)) !important;
  }

  /* Float PWA / notification prompts above the tab bar. */
  .lp-install {
    bottom: calc(76px + env(safe-area-inset-bottom, 0)) !important;
  }

  .lp-notify-enable {
    bottom: calc(76px + env(safe-area-inset-bottom, 0)) !important;
  }
}

/* ══════════════════════════════════════════
   Live GPS map — controls, position, next stop
   ══════════════════════════════════════════ */
.map-shell {
  position: relative;
}

.map-fabs {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding: 0;
  transition: transform 0.12s, box-shadow 0.12s;
}

.map-fab:active {
  transform: scale(0.94);
}

.map-fab-primary {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
}

.map-fab-primary .map-fab-icon {
  filter: grayscale(1) brightness(3);
}

.map-fab-loading {
  animation: fabpulse 0.8s ease-in-out infinite;
}

@keyframes fabpulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); }
  50% { box-shadow: 0 4px 22px rgba(37, 99, 235, 0.7); }
}

/* User's live position marker */
.user-loc-icon {
  position: relative;
}

.user-loc-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: #2563EB;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.4);
  z-index: 2;
}

.user-loc-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: rgba(37, 99, 235, 0.4);
  border-radius: 50%;
  z-index: 1;
  animation: userpulse 1.8s ease-out infinite;
}

@keyframes userpulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(3.4); opacity: 0; }
}

/* Next-stop quick bar overlaid on the map */
.next-stop-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.next-stop-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.next-stop-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue-primary);
}

.next-stop-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-stop-eta {
  font-size: 12px;
  color: var(--text-muted);
}

.next-stop-nav {
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-navigate {
  font-weight: 700;
}

/* When the next-stop bar shows, lift the FABs above it. */
.map-shell:has(.next-stop-bar:not([hidden])) .map-fabs {
  bottom: 84px;
}

/* ══════════════════════════════════════════
   Badge placement — consistent & no overflow
   ══════════════════════════════════════════ */
.lead-card-badges {
  max-width: 55%;
}

.badge {
  line-height: 1.5;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  /* Badges read left-to-right and wrap instead of stacking narrowly. */
  .lead-card-badges {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
    max-width: none;
    gap: 6px;
  }

  .lead-card-header {
    flex-wrap: wrap;
  }

  /* Bigger, thumb-friendly badges on phones. */
  .badge {
    font-size: 12px;
    padding: 4px 11px;
  }

  .agenda-time-col .badge {
    white-space: nowrap;
  }

  /* Comfortable tap targets for primary actions. */
  .btn-sm {
    min-height: 42px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .agenda-slot {
    border-left-width: 5px;
  }
}

@media (max-width: 480px) {
  .next-stop-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .next-stop-nav {
    width: 100%;
    text-align: center;
  }

  .map-shell:has(.next-stop-bar:not([hidden])) .map-fabs {
    bottom: 128px;
  }
}

/* ── Commercial chatbot ─────────────────────────────────────────────── */
.chatbot-grid {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.chatbot-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chatbot-card-title {
  margin: 0 0 6px;
  font-size: 16px;
}

.chatbot-link-row {
  display: flex;
  gap: 8px;
  margin: 12px 0 8px;
}

.chatbot-link-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.chatbot-link-row .btn {
  white-space: nowrap;
}

.chatbot-open-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
}

.chatbot-steps {
  margin: 10px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.chatbot-steps li { padding-left: 4px; }

.chatbot-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot-preview-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.chatbot-preview-head .section-hint { margin-bottom: 0; }

/* Chat widget (shared: owner preview + public page) */
.lp-chat {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  overflow: hidden;
  min-height: 420px;
}

.lp-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 460px;
  scroll-behavior: smooth;
}

.lp-chat-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 82%;
}

.lp-chat-row-user { align-self: flex-end; align-items: flex-end; }
.lp-chat-row-assistant { align-self: flex-start; align-items: flex-start; }

.lp-chat-who {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
}

.lp-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
}

.lp-chat-bubble-assistant {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}

.lp-chat-bubble-user {
  background: var(--blue-primary);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.lp-chat-notice {
  align-self: center;
  text-align: center;
  max-width: 90%;
  font-size: 13px;
  font-weight: 600;
  color: #047857;
  background: #D1FAE5;
  border-radius: 999px;
  padding: 8px 16px;
}

.lp-chat-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.lp-chat-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.5;
  animation: lp-chat-blink 1.2s infinite both;
}
.lp-chat-dots span:nth-child(2) { animation-delay: 0.2s; }
.lp-chat-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes lp-chat-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-2px); }
}

.lp-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.lp-chat-input {
  flex: 1;
  min-width: 0;
  resize: none;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  max-height: 120px;
  background: var(--bg);
  color: var(--text);
}

.lp-chat-input:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.lp-chat-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lp-chat-send-icon { font-size: 15px; line-height: 1; }

/* Public full-page chat */
.chat-public-wrap {
  max-width: 640px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

.chat-public-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.chat-public-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-primary));
  color: #fff;
}

.chat-public-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-public-ident { display: flex; flex-direction: column; min-width: 0; }
.chat-public-name { font-weight: 700; font-size: 16px; }
.chat-public-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  opacity: 0.9;
}
.chat-public-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.chat-public-card .lp-chat {
  border: none;
  border-radius: 0;
  min-height: 60vh;
}

.chat-public-card .lp-chat-scroll {
  max-height: none;
  min-height: 52vh;
}

.chat-public-footnote {
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 14px 0 0;
}

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

@media (max-width: 640px) {
  .lp-chat { min-height: 380px; }
  .lp-chat-scroll { max-height: none; }
  .lp-chat-row { max-width: 88%; }
  .lp-chat-send-label { display: none; }
  .lp-chat-send { padding: 11px 14px; }
  .chat-public-wrap { margin: 12px auto 28px; padding: 0 10px; }
  .chat-public-card .lp-chat, .chat-public-card .lp-chat-scroll { min-height: 64vh; }
}

/* ── Signature pad (settings) ───────────────────────────────────────── */
.settings-section-signature {
  grid-column: 1 / -1;
}

.settings-section-signature .sig-pad {
  position: relative;
  margin-top: 10px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 11px, rgba(15,23,42,0.02) 11px, rgba(15,23,42,0.02) 12px),
    var(--card);
  overflow: hidden;
}

.sig-canvas {
  display: block;
  width: 100%;
  height: 180px;
  touch-action: none;
  cursor: crosshair;
}

.sig-current {
  position: absolute;
  inset: 0;
  margin: auto;
  max-height: 160px;
  max-width: 90%;
  object-fit: contain;
  pointer-events: none;
}

.sig-placeholder {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

.sig-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ── Artisan signature on the devis document ────────────────────────── */
.doc-artisan-sign {
  margin-top: 1.6rem;
  display: flex;
  justify-content: flex-end;
}

.doc-artisan-sign-box {
  text-align: center;
  min-width: 220px;
}

.doc-artisan-sign-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9CA3AF;
  margin: 0 0 .3rem;
}

.doc-artisan-sign-img {
  max-height: 90px;
  max-width: 240px;
  object-fit: contain;
}

.doc-artisan-sign-name {
  margin: .3rem 0 0;
  font-weight: 600;
  color: #111827;
  border-top: 1px solid #E5E7EB;
  padding-top: .4rem;
}

.doc-artisan-sign-typed {
  font-family: "Segoe Script", "Bradley Hand", cursive;
  font-size: 1.5rem;
  color: #1E3A8A;
  margin: 0;
  padding: .2rem 0;
}

/* Trade picker (settings / dashboard forms) */
.trade-picker { display: flex; flex-direction: column; gap: 12px; }
.trade-picker-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trade-picker-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid #D5E8F3; background: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.trade-picker-chip.is-active { border-color: #059CE0; background: #E8F6FC; color: #047BB8; }
.trade-select-wrap { position: relative; }
.trade-select-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 18px; pointer-events: none; }
.trade-select {
  width: 100%; padding: 12px 36px 12px 40px; border-radius: 12px;
  border: 1px solid var(--border); font-size: 15px; font-weight: 600;
  appearance: none; background: #fff;
}
.directory-toggle { align-items: flex-start; gap: 10px; font-weight: 600; }
