/* TradesPro CRM — Design System v2 */

:root {
    --orange: #f97316;
    --orange-dark: #ea6a0a;
    --orange-light: #fff7ed;
    --orange-muted: rgba(249,115,22,0.12);
    --slate-900: #0F172A;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --surface: #f7f9fb;
    --white: #ffffff;
    --text: #191c1e;
    --text-muted: #475569;
    --text-faint: #94a3b8;
    --border: rgba(0,0,0,0.10);
    --border-strong: rgba(0,0,0,0.16);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-w: 220px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--surface);
    color: var(--text);
    line-height: 1.5;
    font-size: 16px;
    overflow-x: hidden;
}

/* ── Typography ── */
h1 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h3 { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.font-mono { font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace; }

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

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--slate-900);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
    flex-shrink: 0;
}
.sidebar-brand-dot {
    width: 28px;
    height: 28px;
    background: var(--orange);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-brand-dot svg { width: 14px; height: 14px; color: white; }
.sidebar-brand-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.sidebar-brand-name span {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: rgba(255,255,255,0.75);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.12s, background 0.12s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
}
.sidebar-link img {
    width: 16px;
    height: 16px;
    opacity: 0.5;
    flex-shrink: 0;
    filter: invert(1);
    transition: opacity 0.12s;
}
.sidebar-link:hover {
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.06);
}
.sidebar-link:hover img { opacity: 0.85; }
.sidebar-link.active {
    color: var(--orange);
    background: rgba(249,115,22,0.12);
}
.sidebar-link.active img {
    opacity: 1;
    filter: invert(1) sepia(1) saturate(5) hue-rotate(330deg) brightness(1.1);
}
.sidebar-link.danger { color: rgba(255,255,255,0.3); }
.sidebar-link.danger:hover { color: #f87171; background: rgba(248,113,113,0.08); }

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 8px 10px;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}
.main-content > main {
    padding: 32px;
}
/* Pages using .container already have padding — avoid double padding */
.main-content > main > .container {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
}
/* Kanban fills full height — no extra padding */
.main-content > main > .kanban-wrapper {
    margin: -32px;
    height: calc(100vh);
}

/* ── Page top bar (content header) ── */
.page-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.page-topbar-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

/* ── Container ── */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 28px;
}

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

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

/* Stat values: clean mono number, no color variation */
.stat-card.hot .stat-value { color: var(--text); }
.stat-card.won .stat-value { color: var(--text); }
.stat-card.week .stat-value { color: var(--text); }

/* ── Filters Bar ── */
.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select, .filter-input {
    background: var(--white);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 1rem;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
    min-height: 44px;
}
.filter-select { padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-muted);
}
.filter-input { flex: 1; min-width: 200px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.4;
    min-height: 44px;
}
.btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.btn, .sidebar-link, .bottom-nav-item, .kanban-card, .domain-card, .style-card {
    touch-action: manipulation;
}

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

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface); }

.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--white); color: #ef4444; border: 1px solid var(--border-strong); }
.btn-danger:hover { background: #fef2f2; border-color: #ef4444; }

.btn-ghost { background: none; color: var(--text-muted); border: none; padding: 6px 10px; min-height: 44px; }
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.btn-sm { padding: 7px 14px; font-size: 0.8125rem; min-height: 36px; }

@media (max-width: 768px) {
    .btn-sm { padding: 10px 16px; min-height: 44px; font-size: 0.9375rem; }
}

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

/* ── Lead List ── */
.lead-list { display: flex; flex-direction: column; gap: 4px; }

.lead-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
}
.lead-item:hover {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-muted), var(--shadow-card);
}
.lead-item-left { flex: 1; min-width: 0; }
.lead-name {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lead-meta {
    display: flex;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.lead-meta span { display: flex; align-items: center; gap: 4px; }
.lead-right { text-align: right; flex-shrink: 0; margin-left: 20px; }
.lead-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--orange);
}
.lead-time { font-size: 0.8125rem; color: var(--text-faint); margin-top: 3px; }

/* ── Status Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}
.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-new { background: #eff6ff; color: #2563eb; }
.badge-new::before { background: #3b82f6; }
.badge-contacted { background: #fff7ed; color: #c2410c; }
.badge-contacted::before { background: var(--orange); }
.badge-quotesent, .badge-quote_sent { background: #faf5ff; color: #7c3aed; }
.badge-quotesent::before, .badge-quote_sent::before { background: #8b5cf6; }
.badge-won { background: #f0fdf4; color: #15803d; }
.badge-won::before { background: #22c55e; }
.badge-lost { background: #f8fafc; color: var(--text-muted); }
.badge-lost::before { background: #94a3b8; }
.badge-hot { background: #fef2f2; color: #dc2626; }
.badge-hot::before { background: #ef4444; }
.badge-source { background: var(--surface); color: var(--text-muted); font-weight: 500; }
.badge-source::before { display: none; }

/* ── Lead Detail (full page) ── */
.lead-header {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}
.lead-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.lead-header-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.info-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-bottom: 3px; }
.info-value { font-size: 1rem; color: var(--text); font-weight: 500; }
.info-value a { color: var(--orange); text-decoration: none; font-weight: 600; }
.info-value a:hover { text-decoration: underline; }
.lead-actions { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background 0.1s;
}
.timeline-item:hover { background: var(--surface); }
.timeline-icon { font-size: 1rem; flex-shrink: 0; width: 28px; text-align: center; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-label { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.timeline-meta { font-size: 0.8125rem; color: var(--text-muted); margin-top: 2px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 64px 20px; }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; }
.empty-state h2 { color: var(--text-muted); margin-bottom: 6px; font-size: 1rem; }
.empty-state p { color: var(--text-faint); margin-bottom: 20px; font-size: 0.9375rem; }
/* Error empty state: ghost retry button instead of orange filled */
.empty-state .btn-primary.retry-btn, .empty-state .btn-primary {
    background: none;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    box-shadow: none;
}
.empty-state .btn-primary.retry-btn:hover, .empty-state .btn-primary:hover {
    background: var(--surface);
    color: var(--text);
}

/* ── Login / Auth ── */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    padding: 20px;
}
.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    justify-content: center;
}
.auth-logo-dot {
    width: 32px;
    height: 32px;
    background: var(--orange);
    border-radius: 8px;
}
.auth-logo-name { font-size: 1.125rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.auth-card h1 { text-align: center; font-size: 1.125rem; color: var(--text); margin-bottom: 4px; }
.auth-card .subtitle { text-align: center; color: var(--text-muted); font-size: 0.875rem; margin-bottom: 28px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-muted);
}
.form-submit {
    width: 100%;
    padding: 10px;
    min-height: 44px;
    background: var(--orange);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.form-submit:hover { background: var(--orange-dark); }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--text-muted); }
.auth-footer a { color: var(--orange); font-weight: 600; text-decoration: none; padding: 12px 8px; display: inline-block; min-height: 44px; line-height: 20px; }
.auth-footer a:hover { text-decoration: underline; }
.forgot-link { padding: 12px 8px; display: inline-block; min-height: 44px; line-height: 20px; }
.auth-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: 12px;
    display: none;
    text-align: center;
}
.auth-error.show { display: block; }

/* ── Settings ── */
.settings-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}
.settings-section h2 {
    margin-bottom: 18px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
}
.toggle-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; min-height: 44px; }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1; border-radius: 100px; transition: 0.2s;
}
.toggle-slider:before {
    position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle-switch input:checked + .toggle-slider { background: var(--orange); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* ── Automations ── */
.automation-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.12s;
}
.automation-card:hover { border-color: var(--border-strong); }
.automation-card.inactive { opacity: 0.5; }
.automation-card-info { flex: 1; }
.automation-card-name { font-weight: 600; font-size: 0.9375rem; color: var(--text); margin-bottom: 4px; }
.automation-card-meta { font-size: 0.8125rem; color: var(--text-muted); }
.automation-card-meta strong { color: var(--orange); font-weight: 600; }
.automation-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.add-rule-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
    display: none;
}
.add-rule-form.open { display: block; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.action-detail { margin-top: 12px; }

/* ── Toast ── */
.toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}
.toast-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.875rem;
    min-width: 260px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    animation: slideIn 0.2s ease;
}
.toast-item.success { border-color: #22c55e; }
.toast-item.error { border-color: #ef4444; }
.toast-item.info { border-color: var(--orange); }

@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Drawer ── */
.drawer-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.25); z-index: 80; opacity: 0; visibility: hidden;
    transition: opacity 0.2s;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }

.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 100vw;
    background: var(--white); z-index: 90; box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
    position: sticky; top: 0; z-index: 10; background: var(--white);
}
.drawer-header h2 { font-size: 1rem; font-weight: 600; color: var(--text); }
.drawer-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 13px; border-radius: var(--radius-sm);
    transition: all 0.15s; line-height: 1; display: flex;
}
.drawer-close:hover { background: var(--surface); color: var(--text); }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

.drawer-lead-header { margin-bottom: 20px; }
.drawer-lead-top { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.drawer-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.drawer-info-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-bottom: 2px; }
.drawer-info-value { font-size: 0.875rem; color: var(--text); font-weight: 500; }
.drawer-info-value a { color: var(--orange); text-decoration: none; font-weight: 600; }
.drawer-message { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.875rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.6; }
.drawer-actions { display: flex; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.drawer-timeline-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-bottom: 8px; }

/* ── Kanban overrides (page-level styles stay in template) ── */
.kanban-stat { background: var(--white) !important; border: 1px solid var(--border) !important; }
.kanban-stat.hot .kanban-stat-value { color: #ef4444 !important; }
.kanban-stat.week .kanban-stat-value { color: var(--orange) !important; }
.kanban-stat.won .kanban-stat-value { color: #16a34a !important; }

/* Lighter kanban column headers — white bg, colored left border, slate text */
.kanban-column-header {
    background: var(--white) !important;
    color: var(--slate-900) !important;
    border-left: 4px solid var(--slate-700) !important;
    border-bottom: 1px solid var(--border) !important;
}
.kanban-column.new .kanban-column-header { border-left-color: #3b82f6 !important; }
.kanban-column.contacted .kanban-column-header { border-left-color: var(--orange) !important; }
.kanban-column.quote_sent .kanban-column-header { border-left-color: #8b5cf6 !important; }
.kanban-column.won .kanban-column-header {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-left-color: #22c55e !important;
    border-bottom-color: #bbf7d0 !important;
}
.kanban-column.won .kanban-column-header .column-count {
    background: rgba(22,163,74,0.12) !important;
    color: #15803d !important;
}
.kanban-column.lost .kanban-column-header {
    background: var(--white) !important;
    color: var(--text-muted) !important;
    border-left-color: #94a3b8 !important;
}
/* column count badge for non-won columns */
.kanban-column-header .column-count {
    background: var(--surface) !important;
    color: var(--text-muted) !important;
}

.kanban-cards { background: #f1f5f9 !important; }
.kanban-card { border: 1px solid var(--border) !important; }
.kanban-card:hover { border-color: var(--orange) !important; }
.kanban-card.sortable-chosen { border-color: var(--orange) !important; }
.kanban-nav-btn.active { background: var(--slate-900) !important; border-color: var(--slate-900) !important; }
.kanban-nav-btn.won.active { background: var(--orange) !important; border-color: var(--orange) !important; }
.kanban-card .card-service { background: var(--orange-light) !important; color: var(--orange-dark) !important; }

/* ── Swipe Actions ── */
.swipe-container { position: relative; overflow: hidden; touch-action: pan-y; }
.swipe-bg { position: absolute; top: 0; bottom: 0; width: 100%; display: flex; align-items: center; pointer-events: none; }
.swipe-bg-left { left: 0; justify-content: flex-start; padding-left: 16px; }
.swipe-bg-right { right: 0; justify-content: flex-end; padding-right: 16px; }
.swipe-action-btn {
    min-width: 48px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: 600;
    border: none; cursor: pointer; font-family: inherit; transition: transform 0.15s;
    pointer-events: auto; white-space: nowrap; padding: 8px 14px;
}
.swipe-action-btn:active { transform: scale(0.95); }
.swipe-action-archive { background: #fee2e2; color: #dc2626; }
.swipe-action-call { background: #dcfce7; color: #16a34a; text-decoration: none; }
.swipe-content { position: relative; z-index: 1; background: inherit; transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); will-change: transform; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 8px; }
.mr-2 { margin-right: 8px; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.inline { display: inline; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.text-sm { font-size: 0.8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Mobile ── */
@media (max-width: 900px) {
    :root { --sidebar-w: 56px; }
    .sidebar-brand-name,
    .sidebar-link span { display: none; }
    .sidebar-link { justify-content: center; padding: 10px; }
    .sidebar-link img { margin: 0; }
    .sidebar-brand { justify-content: center; padding: 16px 10px; }
    .sidebar-brand-dot { margin: 0; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.5rem; }
    #plan-cards { grid-template-columns: 1fr !important; }
    .auth-card { padding: 28px 20px; }
}

/* ── Mobile responsive (≤768px) ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .main-content > main { padding: 16px 16px 96px; /* bottom pad for nav bar */ }
    .main-content > main > .kanban-wrapper { margin: -16px; margin-bottom: calc(-16px - 80px); height: calc(100vh - 80px); }
    .container { padding: 16px 16px 80px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .page-header { padding-bottom: 16px; margin-bottom: 20px; }
    .lead-meta { gap: 8px; }
    .lead-header-info { grid-template-columns: 1fr; }
    .lead-actions { gap: 10px; }
    .lead-actions .btn { flex: 1; justify-content: center; }
    .lead-actions .filter-select { flex: 1; }
}

/* ── Bottom Nav (mobile only) ── */
.bottom-nav {
    display: none;
}
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--slate-900);
        border-top: 1px solid rgba(255,255,255,0.08);
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom);
        padding-bottom: constant(safe-area-inset-bottom);
    }
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: rgba(255,255,255,0.45);
        font-size: 0.6875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        min-height: 64px;
        transition: color 0.12s;
        -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav-item img {
        width: 22px;
        height: 22px;
        filter: invert(1);
        opacity: 0.45;
        transition: opacity 0.12s;
    }
    .bottom-nav-item.active {
        color: var(--orange);
    }
    .bottom-nav-item.active img {
        opacity: 1;
        filter: invert(1) sepia(1) saturate(5) hue-rotate(330deg) brightness(1.1);
    }
}
