@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Barlow+Condensed:wght@600;700;800&display=swap');

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

:root {
  /* TPC Brand — naranja suave como acento principal */
  --c-accent:    #E8712A;
  --c-accent-dk: #C85E1E;
  --c-success:   #2D9E6B;
  --c-danger:    #D95C5C;
  --c-purple:    #7C6FCD;
  --c-blue:      #4A7EC7;

  /* Modo oscuro — azul marino TPC, no negro puro */
  --c-bg:        #0F1B2D;
  --c-bg2:       #142236;
  --c-surface:   #1A2E45;
  --c-surf2:     #1F3550;
  --c-border:    #2A4060;
  --c-border2:   #243856;
  --c-text:      #EDF2F7;
  --c-text2:     #CBD5E0;
  --c-muted:     #8FA8C0;
  --c-muted2:    #5E7A94;
  --c-input-bg:  #1A2E45;
  --shadow:      0 2px 8px rgba(0,0,0,0.3);
  --radius:      8px;
}

body.outdoor {
  /* Modo claro — blanco limpio con toques azul marino */
  --c-bg:       #F4F7FA;
  --c-bg2:      #EBF0F6;
  --c-surface:  #FFFFFF;
  --c-surf2:    #F0F5FB;
  --c-border:   #C8D6E5;
  --c-border2:  #DDE6F0;
  --c-text:     #0F1B2D;
  --c-text2:    #1E3A52;
  --c-muted:    #4A6480;
  --c-muted2:   #8FA8C0;
  --c-input-bg: #FFFFFF;
  --shadow:     0 1px 4px rgba(15,27,45,0.08);
}

html, body { height: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: oklch(28% 0.01 240); border-radius: 3px; }

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

/* Sidebar — siempre navy oscuro, independiente del modo outdoor */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #0D1A2B;
  border-right: 1px solid #1A2E45;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100;
  transition: width 0.22s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }

/* Sidebar logo */
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid #1A2E45;
  min-height: 64px; text-decoration: none;
}
.sidebar.collapsed .sidebar-logo { padding: 22px 0; justify-content: center; }
.sidebar-logo-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--c-accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px; font-weight: 900; color: #fff;
}
.sidebar-logo-text-wrap { display: flex; flex-direction: column; }
.sidebar-logo-line1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700;
  color: #EDF2F7;
  letter-spacing: 0.03em; white-space: nowrap;
}
.sidebar-logo-line2 {
  font-size: 10px; font-weight: 500;
  color: #5E7A94;
  letter-spacing: 0.06em;
}
.sidebar.collapsed .sidebar-logo-text-wrap { display: none; }

/* Sidebar nav */
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 9px; border: none; cursor: pointer;
  background: transparent;
  color: #8FA8C0;
  font-weight: 500; font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  transition: all 0.12s; width: 100%;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-link { padding: 11px 0; justify-content: center; }
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #CBD5E0; }
.sidebar-link.active {
  background: rgba(232,113,42,0.15);
  color: #E8712A;
  font-weight: 600;
}
.sidebar-link .nav-icon { font-size: 17px; flex-shrink: 0; }
.sidebar-link .nav-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--c-accent); }
.sidebar.collapsed .sidebar-link span:not(.nav-icon) { display: none; }

/* Sidebar footer */
.sidebar-footer { border-top: 1px solid #1A2E45; padding: 12px 8px; }
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 9px; border: none; cursor: pointer;
  background: transparent;
  color: #5E7A94;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  width: 100%; margin-bottom: 4px;
}
.sidebar.collapsed .sidebar-collapse-btn { padding: 10px 0; justify-content: center; }
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.06); color: #8FA8C0; }
.sidebar-lang-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #8FA8C0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.sidebar-lang-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #EDF2F7;
}
.sidebar-logout-btn { margin-left: auto; font-size: 1rem; color: #5E7A94; text-decoration: none; opacity: .7; transition: opacity .15s; flex-shrink: 0; }
.sidebar-logout-btn:hover { opacity: 1; color: var(--c-danger); }
.sidebar.collapsed .sidebar-logout-btn { display: none; }
.sidebar-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
}
.sidebar.collapsed .sidebar-user-row { padding: 8px 0; justify-content: center; }
.sidebar-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(232,113,42,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--c-accent);
  flex-shrink: 0;
}
.sidebar-user-info { display: flex; flex-direction: column; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #CBD5E0; white-space: nowrap; }
.sidebar-user-role { font-size: 10px; color: #5E7A94; }
.sidebar.collapsed .sidebar-user-info { display: none; }

/* Main content */
.main-content { flex: 1; margin-left: 220px; min-height: 100vh; transition: margin-left 0.22s ease; }
.sidebar.collapsed ~ .main-content { margin-left: 64px; }

/* Top bar */
.topbar {
  height: 52px; background: #0D1A2B;
  border-bottom: 1px solid #1A2E45;
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-spacer { flex: 1; }
.topbar-mode-btn {
  width: 32px; height: 32px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: background 0.15s;
}
.topbar-mode-btn:hover { background: rgba(255,255,255,0.1); }

/* Page */
.page { padding: 28px 32px; max-width: 1200px; }
@media (max-width: 768px) { .page { padding: 16px; padding-bottom: 100px; } }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px; font-weight: 700; color: var(--c-text);
}

/* Flash */
#flash         { display: none; background: rgba(239,68,68,0.12); color: #EF4444; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 500; border: 1px solid rgba(239,68,68,0.2); }
#flash-success { display: none; background: rgba(16,185,129,0.12); color: #10B981; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 500; border: 1px solid rgba(16,185,129,0.2); }

/* Cards */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 20px; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card-title { font-weight: 600; margin-bottom: .75rem; font-size: 14px; color: var(--c-text2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: 9px;
  border: none; cursor: pointer;
  font-size: 13px; font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none; transition: all 0.15s;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary   { background: linear-gradient(135deg, #E8712A, #C85E1E); color: #fff; box-shadow: 0 4px 16px rgba(232,113,42,0.3); }
.btn-secondary { background: var(--c-surf2); color: var(--c-text2); border: 1px solid var(--c-border); }
.btn-danger    { background: rgba(239,68,68,0.15); color: #EF4444; border: 1px solid rgba(239,68,68,0.3); }
.btn-success   { background: rgba(16,185,129,0.15); color: #10B981; border: 1px solid rgba(16,185,129,0.3); }
.btn-warn      { background: rgba(245,158,11,0.15); color: #F59E0B; border: 1px solid rgba(245,158,11,0.3); }
.btn-sm        { padding: .3rem .65rem; font-size: .8rem; }
.btn--secondary { background: var(--c-surf2); border: 1px solid var(--c-border); color: var(--c-muted); padding: 4px 10px; font-size: .82rem; cursor: pointer; border-radius: 8px; font-family: 'DM Sans', sans-serif; }
.btn--secondary:hover { background: var(--c-border); }
.btn--action { background: linear-gradient(135deg, #E8712A, #C85E1E); border: none; color: #fff; padding: 5px 12px; font-size: .82rem; cursor: pointer; border-radius: 8px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; font-family: 'DM Sans', sans-serif; box-shadow: 0 2px 8px rgba(232,113,42,0.3); }
.btn--action:hover { opacity: .88; }

/* Badges */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 6px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-new_lead          { background: rgba(59,130,246,0.15);  color: #3B82F6; }
.badge-contacted         { background: rgba(139,92,246,0.15);  color: #8B5CF6; }
.badge-measure_scheduled { background: rgba(245,158,11,0.15);  color: #F59E0B; }
.badge-measured          { background: rgba(245,158,11,0.2);   color: #D97706; }
.badge-quote_ready       { background: rgba(16,185,129,0.15);  color: #10B981; }
.badge-quote_sent        { background: rgba(59,130,246,0.15);  color: #60A5FA; }
.badge-won               { background: rgba(16,185,129,0.2);   color: #10B981; }
.badge-lost              { background: rgba(239,68,68,0.15);   color: #EF4444; }
.badge-draft             { background: rgba(107,114,128,0.15); color: #9CA3AF; }
.badge-finalized         { background: rgba(59,130,246,0.15);  color: #60A5FA; }
.badge-sent              { background: rgba(139,92,246,0.15);  color: #A78BFA; }
.badge-accepted          { background: rgba(16,185,129,0.2);   color: #10B981; }
.badge-rejected          { background: rgba(239,68,68,0.15);   color: #EF4444; }
.badge-expired           { background: rgba(107,114,128,0.1);  color: #6B7280; }
.badge-voided            { background: rgba(107,114,128,0.1);  color: #6B7280; }
.badge-authority         { background: rgba(16,185,129,0.2);   color: #10B981; }
.badge-stability         { background: rgba(59,130,246,0.15);  color: #60A5FA; }
.badge-survival          { background: rgba(245,158,11,0.15);  color: #F59E0B; }
.badge-danger            { background: rgba(239,68,68,0.15);   color: #EF4444; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: .55rem .75rem; border: 1px solid var(--c-border); border-radius: 10px; font-size: .9rem; background: var(--c-input-bg); color: var(--c-text); font-family: 'DM Sans', sans-serif; transition: border-color 0.15s, box-shadow 0.15s; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: rgba(245,158,11,0.5); box-shadow: 0 0 0 3px rgba(245,158,11,0.1); }
.form-group textarea { resize: vertical; min-height: 72px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--c-border); font-weight: 600; color: var(--c-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; color: var(--c-text2); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--c-surf2); }
.table a { color: var(--c-accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* Totals panel */
.totals-panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 20px; min-width: 220px; }
.totals-panel .totals-row { display: flex; justify-content: space-between; padding: .35rem 0; font-size: .9rem; color: var(--c-text2); }
.totals-panel .totals-row.total-line { font-weight: 700; font-size: 1.1rem; color: var(--c-text); border-top: 1px solid var(--c-border); margin-top: .5rem; padding-top: .75rem; }
.totals-panel .margin-row { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; }
.q-margin-row { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; }

/* Stage actions */
.stage-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; align-items: center; }
.btn-lost-link { background: none; border: none; color: var(--c-muted2); font-size: .8rem; cursor: pointer; padding: .25rem .5rem; text-decoration: underline; margin-left: auto; }
.btn-lost-link:hover { color: var(--c-danger); }

/* Notes */
.notes-list { list-style: none; }
.notes-list li { padding: .6rem 0; border-bottom: 1px solid var(--c-border); font-size: .9rem; }
.notes-list li:last-child { border-bottom: none; }
.note-meta { font-size: .78rem; color: var(--c-muted); margin-bottom: .2rem; }

/* Dashboard stage cards */
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.stage-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: .75rem 1rem; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.stage-card:hover { border-color: var(--c-accent); background: var(--c-surf2); }
.stage-card .stage-count { font-size: 1.8rem; font-weight: 700; color: var(--c-accent); font-family: 'Barlow Condensed', sans-serif; }
.stage-card .stage-label { font-size: .72rem; color: var(--c-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .04em; }

/* Action cards */
.action-cards { display: flex; flex-direction: column; gap: .75rem; }
.action-card { background: var(--c-surface); border: 1px solid var(--c-border); border-left: 3px solid var(--c-accent); border-radius: 12px; padding: 16px 20px; }
.action-card__title { font-size: 14px; font-weight: 700; color: var(--c-text); margin-bottom: 4px; }
.action-card__desc  { font-size: 12px; color: var(--c-muted); margin-bottom: 8px; }
.action-card__meta  { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.action-card__amount { font-size: 15px; font-weight: 700; color: var(--c-accent); font-family: 'Barlow Condensed', sans-serif; }
.action-card__age   { font-size: 11px; color: var(--c-muted); }
.action-card__actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.action-card--loading { opacity: 0.5; pointer-events: none; }
.action-card__error { color: var(--c-danger); font-size: .8rem; margin-top: 4px; }

/* Builder layout */
.builder-layout { display: grid; grid-template-columns: 1fr 240px; gap: 1.25rem; align-items: start; }
@media (max-width: 700px) { .builder-layout { grid-template-columns: 1fr; } }

/* Guided estimator */
.quick-subtitle { margin-top: .25rem; color: var(--c-muted); font-size: .9rem; }
.quick-steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.quick-step { border: 1px solid var(--c-border); border-radius: 8px; background: var(--c-surface); color: var(--c-muted); padding: .45rem .7rem; font-size: .85rem; font-weight: 600; }
.quick-step.is-active { border-color: var(--c-accent); color: var(--c-accent); }
.quick-panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.25rem; }
.quick-section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--c-text); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.project-card { min-height: 88px; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface); color: var(--c-text2); padding: 1rem; text-align: left; font-weight: 700; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.project-card:hover:not(:disabled), .project-card.is-selected { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent), 0 0 12px rgba(245,158,11,0.15); color: var(--c-text); }
.project-card:disabled { color: var(--c-muted2); background: var(--c-surf2); cursor: not-allowed; opacity: .5; }
.project-card--custom { grid-column: 1 / -1; border-style: dashed; color: var(--c-accent); text-align: center; min-height: 56px; font-size: .95rem; letter-spacing: .02em; }
.project-card--custom:hover:not(:disabled) { background: rgba(232,113,42,.06); }
.quick-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stepper { display: grid; grid-template-columns: 42px 1fr 42px; gap: .4rem; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: 42px; border: 1px solid var(--c-border); border-radius: 10px; padding: .5rem .75rem; font-weight: 600; background: var(--c-surf2); color: var(--c-text2); }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--c-accent); }
.toggle-check-group { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem 0; }
.toggle-check { display: flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border: 1px solid var(--c-border); border-radius: 8px; cursor: pointer; font-weight: 500; font-size: .9rem; background: var(--c-surf2); color: var(--c-text2); }
.toggle-check input { width: 16px; height: 16px; cursor: pointer; margin: 0; accent-color: var(--c-accent); }
.subfloor-options { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; border: 1px solid var(--c-border); border-radius: 10px; padding: .75rem; background: var(--c-surf2); }
.subfloor-options .form-group { margin-bottom: 0; }
.quick-urgency { border: 1px solid rgba(245,158,11,0.3); background: rgba(245,158,11,0.1); color: #F59E0B; border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: 1rem; font-weight: 700; }
.quick-estimate-top { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.quick-summary-card { min-height: 132px; }
.quick-table-input { width: 92px; padding: .35rem .45rem; border: 1px solid var(--c-border); border-radius: 8px; font-size: .9rem; background: var(--c-input-bg); color: var(--c-text); }
.quick-missing-price-row { background: rgba(245,158,11,0.05); }
.quick-missing-price-input { border-color: #F59E0B; background: rgba(245,158,11,0.08); }
.quick-margin-value { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.quick-margin-badge { border-radius: 6px; padding: .15rem .45rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.quick-margin-badge-healthy { background: rgba(16,185,129,0.15); color: #10B981; }
.quick-margin-badge-warning { background: rgba(245,158,11,0.15); color: #F59E0B; }
.quick-margin-badge-danger  { background: rgba(239,68,68,0.15);  color: #EF4444; }
.quick-warning { background: rgba(239,68,68,0.1); color: #EF4444; border: 1px solid rgba(239,68,68,0.2); border-radius: var(--radius); padding: .65rem .8rem; margin-bottom: .75rem; font-weight: 600; }
.store-summary { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--c-border); display: flex; flex-direction: column; gap: .3rem; }
.store-summary__row { display: flex; justify-content: space-between; font-size: .88rem; color: var(--c-text2); }
.store-summary__val { font-weight: 700; color: var(--c-text); }
.quick-setting-row { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--c-border); display: flex; justify-content: space-between; gap: .5rem; align-items: center; font-size: .85rem; color: var(--c-muted); }
.quick-send-btn { width: 100%; justify-content: center; margin-top: 1rem; }
.quick-sent-state { max-width: 520px; margin: 1rem auto; text-align: center; padding: 2rem 1rem; }
.quick-sent-title { font-size: 1.8rem; font-weight: 800; color: var(--c-success); margin-bottom: .5rem; font-family: 'Barlow Condensed', sans-serif; }
.quick-sent-meta { font-size: 1.15rem; font-weight: 700; margin-bottom: .75rem; }
.quick-sent-state p { color: var(--c-muted); margin-bottom: 1rem; }
@media (max-width: 700px) { .scope-grid, .quick-estimate-top, .subfloor-options { grid-template-columns: 1fr; } }

/* Kanban */
.kanban-board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kanban-col { flex: 0 0 200px; background: var(--c-surf2); border: 1px solid var(--c-border); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.kanban-col-header { display: flex; justify-content: space-between; align-items: center; padding: .6rem .75rem; border-bottom: 1px solid var(--c-border); background: var(--c-surface); border-radius: 12px 12px 0 0; }
.kanban-col-title { font-size: .75rem; font-weight: 700; color: var(--c-text2); text-transform: uppercase; letter-spacing: .05em; }
.kanban-col-count { font-size: .72rem; font-weight: 700; background: var(--c-border); color: var(--c-muted); border-radius: 99px; padding: .1rem .45rem; }
.kanban-cards { flex: 1; overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.kanban-card { display: block; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 10px; padding: .6rem .75rem; text-decoration: none; color: var(--c-text); transition: border-color .15s; cursor: grab; }
.kanban-card:hover { border-color: var(--c-accent); }
.kanban-card.is-dragging { opacity: .4; cursor: grabbing; }
.kanban-cards.drag-over { background: rgba(245,158,11,0.05); outline: 2px dashed var(--c-accent); outline-offset: -2px; }
.kanban-card-name { font-size: .875rem; font-weight: 600; margin-bottom: .3rem; }
.kanban-card-meta { display: flex; flex-direction: column; gap: .15rem; }
.kanban-card-meta span { font-size: .75rem; color: var(--c-muted); }
.kanban-empty { font-size: .8rem; color: var(--c-muted); text-align: center; padding: 1rem .5rem; }
.kanban-card-link { display: inline-block; margin-top: .4rem; font-size: .75rem; color: var(--c-accent); text-decoration: none; }

/* Quote urgency */
.quote-urgency-hot { font-size: .78rem; font-weight: 700; color: #F59E0B; background: rgba(245,158,11,0.1); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.quote-urgency-ok  { font-size: .78rem; color: var(--c-muted); white-space: nowrap; }

/* Lead revenue strip */
.lead-revenue-strip { display: flex; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.revenue-tile { flex: 1 1 120px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: .75rem 1rem; min-width: 100px; }
.revenue-tile--won { border-color: oklch(50% 0.15 145); background: oklch(20% 0.04 145); }
.revenue-tile__value { font-size: 1.4rem; font-weight: 700; color: var(--c-accent); line-height: 1.2; font-family: 'Barlow Condensed', sans-serif; }
.revenue-tile--won .revenue-tile__value { color: var(--c-success); }
.revenue-tile__label { font-size: .72rem; color: var(--c-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .06em; }
.b2b-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; background: oklch(25% 0.06 260); border: 1px solid oklch(45% 0.12 260); border-radius: 20px; color: oklch(75% 0.12 260); font-size: .82rem; font-weight: 600; text-decoration: none; }
.b2b-badge:hover { background: oklch(30% 0.08 260); }

/* Onboarding panel */
.onboarding-heading { margin-bottom: 1.25rem; }
.onboarding-heading h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 .25rem; }
.onboarding-heading p { font-size: .9rem; color: var(--c-muted); margin: 0; }
.onboarding-steps { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.onboarding-step { display: flex; align-items: center; gap: 1rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 1rem 1.25rem; }
.onboarding-step--done { opacity: .6; }
.onboarding-step--done .onboarding-step__icon { background: var(--c-success); color: #fff; }
.onboarding-step__icon { width: 2rem; height: 2rem; border-radius: 50%; background: var(--c-accent); color: #000; font-weight: 800; font-size: .9rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.onboarding-step__body { flex: 1; }
.onboarding-step__title { font-weight: 600; font-size: .95rem; margin-bottom: .2rem; }
.onboarding-step__desc { font-size: .82rem; color: var(--c-muted); }
.onboarding-step__btn { margin-left: auto; flex-shrink: 0; white-space: nowrap; }

/* ── Dashboard: Period filter ───────────────────────────────────────────── */
.period-filter {
  display: flex; gap: .4rem; margin-bottom: 1rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.period-filter::-webkit-scrollbar { display: none; }
.period-btn {
  flex-shrink: 0; padding: .35rem .85rem;
  border-radius: 99px; border: 1px solid var(--c-border);
  background: var(--c-surface); color: var(--c-muted);
  font-size: .8rem; font-weight: 500; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all .15s;
  white-space: nowrap;
}
.period-btn:hover { border-color: var(--c-accent); color: var(--c-text); }
.period-btn.active {
  background: var(--c-accent); border-color: var(--c-accent);
  color: #fff; font-weight: 600;
}

/* ── Dashboard: Pipeline hero ───────────────────────────────────────────── */
.pipeline-hero {
  background: linear-gradient(135deg, #0F1B2D 0%, #1A2E45 100%);
  border: 1px solid #1A2E45;
  border-left: 4px solid var(--c-accent);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.pipeline-hero__value {
  font-size: 2.6rem; font-weight: 700; color: var(--c-accent);
  font-family: 'Barlow Condensed', sans-serif; line-height: 1;
}
.pipeline-hero__label {
  font-size: .8rem; font-weight: 700; color: #CBD5E0;
  text-transform: uppercase; letter-spacing: .08em; margin-top: .3rem;
}
.pipeline-hero__sub {
  font-size: .72rem; color: #5E7A94; margin-top: .15rem;
}

/* ── Dashboard: Secondary metrics grid (2-per-row) ─────────────────────── */
.metrics-secondary {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .6rem; margin-bottom: 1.25rem;
}
.metric-tile {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 12px; padding: .75rem 1rem;
}
.metric-tile--won    { border-color: #16a34a; background: rgba(22,163,74,.07); }
.metric-tile--urgent { border-color: #f59e0b; background: rgba(245,158,11,.07); }
.metric-tile--urgent .metric-value { color: #b45309; }
.metric-value { font-size: 1.5rem; font-weight: 700; color: var(--c-accent); line-height: 1.2; font-family: 'Barlow Condensed', sans-serif; }
.metric-label { font-size: .68rem; color: var(--c-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .06em; }

/* Mobile bottom nav */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: 82px; background: #0D1A2B;
  border-top: 1px solid #1A2E45;
  z-index: 100; align-items: stretch; justify-content: stretch;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  border: none; cursor: pointer;
  background: transparent;
  border-top: 2px solid transparent;
  color: #5E7A94;
  font-size: 11px; font-weight: 500;
  letter-spacing: .02em; white-space: nowrap;
  text-decoration: none; font-family: 'DM Sans', sans-serif;
  transition: all 0.12s; padding: 8px 4px;
}
.bottom-nav-item .nav-icon { font-size: 20px; }
.bottom-nav-item.active { background: rgba(232,113,42,0.1); border-top-color: var(--c-accent); color: var(--c-accent); font-weight: 600; }
.bottom-nav-item:hover { color: #CBD5E0; }


/* Responsive two-column layouts — all collapse to single column on mobile */
.catalog-layout    { display: grid; grid-template-columns: 1fr 360px; gap: 1.25rem; align-items: start; }
.detail-layout     { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.quote-layout      { display: grid; grid-template-columns: 1fr 260px; gap: 1rem; align-items: start; }
.settings-layout   { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; align-items: start; }
.settings-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.settings-zip-row  { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .topbar { display: none; }
  .bottom-nav { display: flex; }
  .page { padding-bottom: 100px; }
  .catalog-layout    { grid-template-columns: 1fr; }
  .detail-layout     { grid-template-columns: 1fr; }
  .quote-layout      { grid-template-columns: 1fr; }
  .settings-layout   { grid-template-columns: 1fr; }
  .settings-form-row { grid-template-columns: 1fr; }
  .settings-zip-row  { grid-template-columns: 1fr 1fr; }
  .page-header { flex-wrap: wrap; gap: .5rem; }
  .page-header .btn { font-size: .8rem; padding: .35rem .75rem; }
}

/* ── New Lead type toggle ───────────────────────────────────────────────── */
.lead-type-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1.5rem;
}
.lead-type-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; padding: 1rem .75rem; border-radius: 12px;
  border: 2px solid var(--c-border); background: var(--c-surface);
  cursor: pointer; transition: all .15s; text-align: center;
  font-family: 'DM Sans', sans-serif;
}
.lead-type-btn:hover { border-color: var(--c-accent); }
.lead-type-btn.active {
  border-color: var(--c-accent); background: rgba(232,113,42,0.08);
}
.lead-type-icon  { font-size: 1.75rem; line-height: 1; }
.lead-type-label { font-size: .95rem; font-weight: 700; color: var(--c-text); }
.lead-type-sub   { font-size: .75rem; color: var(--c-muted); }
.lead-type-btn.active .lead-type-label { color: var(--c-accent); }

/* Section title */
.section-title { font-size: 13px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .75rem; }
.empty-state { color: var(--c-muted); font-size: .875rem; padding: 1.5rem; text-align: center; }


/* ── B2B Prospects ──────────────────────────────────────────────────────── */
.prospects-filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-btn { padding: .35rem .85rem; border-radius: 99px; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-muted); font-size: .8rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.filter-btn.active, .filter-btn:hover { border-color: var(--c-accent); color: var(--c-accent); background: rgba(245,158,11,.08); }

.prospect-list { display: flex; flex-direction: column; gap: .6rem; }
.prospect-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: 1rem 1.25rem; transition: border-color .15s; }
.prospect-card:hover { border-color: var(--c-accent); }
.prospect-card__header { display: flex; align-items: center; gap: .75rem; margin-bottom: .4rem; }
.prospect-card__name { font-size: 1rem; font-weight: 700; flex: 1; }
.prospect-card__meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .8rem; color: var(--c-muted); }
.prospect-card__jobs { color: var(--c-accent); font-weight: 600; }
.prospect-card__last { color: var(--c-muted2); }

.prospect-badge--prospect { background: rgba(245,158,11,.12); color: var(--c-accent); }
.prospect-badge--active_partner { background: rgba(16,185,129,.12); color: var(--c-success); }
.prospect-badge--inactive { background: rgba(107,114,128,.12); color: var(--c-muted); }

/* Company info strip */
.company-info-strip { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1.25rem; align-items: flex-start; }
.company-info-chip { font-size: .82rem; color: var(--c-muted); background: var(--c-surf2); border: 1px solid var(--c-border); border-radius: 99px; padding: .2rem .75rem; }
.company-notes { width: 100%; font-size: .85rem; color: var(--c-muted); font-style: italic; padding: .5rem 0; }

/* Tabs */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--c-border); margin-bottom: 1.25rem; }
.tab-btn { padding: .6rem 1.25rem; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--c-muted); font-size: .875rem; font-weight: 500; cursor: pointer; margin-bottom: -1px; transition: all .15s; }
.tab-btn.active { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.tab-btn:hover { color: var(--c-text); }
.tab-actions { margin-bottom: 1rem; }

/* Activity log */
.activity-log { display: flex; flex-direction: column; gap: .6rem; }
.activity-item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 10px; padding: .75rem 1rem; border-left: 3px solid var(--c-border); }
.activity-item--call { border-left-color: var(--c-accent); }
.activity-item--visit { border-left-color: var(--c-purple); }
.activity-item--won_job { border-left-color: var(--c-success); }
.activity-item--bid_submitted { border-left-color: #3B82F6; }
.activity-item__meta { display: flex; align-items: center; gap: .75rem; margin-bottom: .35rem; flex-wrap: wrap; }
.activity-item__type { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-accent); }
.activity-item__contact { font-size: .78rem; color: var(--c-muted); }
.activity-item__date { font-size: .75rem; color: var(--c-muted2); margin-left: auto; }
.activity-item__notes { font-size: .875rem; color: var(--c-text2); }

/* Contacts */
.contacts-list { display: flex; flex-direction: column; gap: .6rem; }
.contact-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 10px; padding: .75rem 1rem; display: flex; flex-direction: column; gap: .3rem; }
.contact-card--primary { border-color: var(--c-accent); }
.contact-card__name { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: .5rem; }
.contact-card__info { font-size: .82rem; color: var(--c-muted); }
.contact-card__info a { color: var(--c-accent); text-decoration: none; }

/* Jobs list */
.jobs-list { display: flex; flex-direction: column; gap: .5rem; }
.job-row { display: flex; align-items: center; gap: 1rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 10px; padding: .75rem 1rem; transition: border-color .15s; }
.job-row:hover { border-color: var(--c-accent); }
.job-row__name { flex: 1; font-weight: 600; font-size: .9rem; }
.job-row__amount { font-size: .9rem; font-weight: 700; color: var(--c-accent); font-family: 'Barlow Condensed', sans-serif; }
.job-row__date { font-size: .78rem; color: var(--c-muted); }

.btn--sm { padding: .25rem .6rem; font-size: .78rem; }

/* ── Follow-up section responsive ───────────────────────────────────────── */
.followup-cards--mobile { display: none; flex-direction: column; gap: .6rem; margin-top: .5rem; }
.followup-table--desktop { display: table; }

/* ── Mobile list cards (leads & quotes) ─────────────────────────────────── */
.lead-card-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }
.lead-mob-card {
  display: block; text-decoration: none;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 14px; padding: 1rem 1.1rem;
  transition: border-color .15s;
  color: var(--c-text);
}
.lead-mob-card:hover { border-color: var(--c-accent); }
.lead-mob-card__top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .35rem;
}
.lead-mob-card__name { font-weight: 700; font-size: 1rem; color: var(--c-text); text-decoration: none; }
.lead-mob-card__sub  { font-size: .85rem; color: var(--c-muted); margin-bottom: .4rem; }
.lead-mob-card__meta {
  display: flex; flex-wrap: wrap; gap: .3rem .9rem;
  font-size: .8rem; color: var(--c-muted2);
}
.lead-mob-card__actions { margin-top: .75rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.lead-mob-card__actions .btn { flex: 1; justify-content: center; }
.lead-mob-card__call { color: var(--c-accent); text-decoration: none; font-weight: 600; }
.lead-mob-card__call:hover { text-decoration: underline; }

/* ── Mobile responsiveness ──────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Page header — title + button stack cleanly */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Tables hidden on mobile — replaced by .lead-mob-card */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Dashboard New Lead button — full width on mobile */
  .dash-new-lead-btn { width: 100%; justify-content: center; font-size: 1rem; padding: .7rem 1rem; }

  /* Pipeline hero — compact on mobile */
  .pipeline-hero { padding: 1rem 1.1rem; }
  .pipeline-hero__value { font-size: 2rem; }

  /* Secondary metrics — already 2-per-row grid, stays as-is */
  .metrics-secondary { gap: .5rem; }
  .metric-tile { padding: .65rem .75rem; }
  .metric-value { font-size: 1.3rem; }

  /* Stage grid — 2 columns on mobile */
  .stage-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stage-card { padding: .65rem .5rem; }
  .stage-card .stage-count { font-size: 1.4rem; }
  .stage-card .stage-label { font-size: .7rem; }

  /* Action cards — full width, compact */
  .action-card { padding: 12px 14px; }
  .action-card__actions { flex-wrap: wrap; }
  .action-card__actions .btn,
  .action-card__actions .btn--action,
  .action-card__actions .btn--secondary { flex: 1; justify-content: center; text-align: center; }

  /* Lead revenue strip — 2 per row */
  .lead-revenue-strip { gap: .5rem; }
  .revenue-tile { flex: 1 1 calc(50% - .25rem); min-width: 0; }

  /* Onboarding steps — stack icon and text */
  .onboarding-step { flex-wrap: wrap; gap: .75rem; }
  .onboarding-step__btn { width: 100%; text-align: center; margin-left: 0; }

  /* Form rows — single column */
  .form-row { grid-template-columns: 1fr; }

  /* Builder layout — already 1fr via 700px breakpoint */

  /* Kanban — horizontal scroll, min-width per column */
  .kanban-board { overflow-x: auto; padding-bottom: 80px; }
  .kanban-col { flex: 0 0 180px; }

  /* Prospect cards — compact meta */
  .prospect-card__meta { gap: .35rem .75rem; }

  /* Quick estimate top — single column */
  .quick-estimate-top { grid-template-columns: 1fr; }

  /* Tab bar — scrollable */
  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; padding: .6rem 1rem; }

  /* Status tabs in quotes list */
  #status-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
  #status-tabs .btn { flex: 1 1 auto; justify-content: center; font-size: .78rem; padding: .35rem .5rem; }

  /* Page title smaller */
  .page-title { font-size: 20px; }

  /* Cards — less padding */
  .card { padding: 14px; }

  /* Follow-up section — hide table, show cards */
  .followup-table--desktop { display: none !important; }
  .followup-cards--mobile { display: block; }
}

/* Multi-area estimate */
.area-estimate-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.area-estimate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .75rem;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
}

.area-estimate-subtotal {
  font-size: .85rem;
  font-weight: 400;
  color: var(--c-muted);
}
