:root {
    --panel: #ffffff;
    --line: #d8deea;
    --text: #121826;
    --muted: #5f6b85;
    --primary: #1c2fc9;
    --primary-dark: #14239a;
    --danger: #b91c1c;
    --warning: #b45309;
    --success: #166534;
    --ink-soft: #f4f7ff;
    --accent: #454545;
    --shadow-soft: 0 18px 40px rgba(16, 24, 40, 0.08);
    --shadow-strong: 0 24px 60px rgba(16, 24, 40, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(28, 47, 201, 0.18), transparent 24%),
        radial-gradient(circle at right bottom, rgba(69, 69, 69, 0.14), transparent 20%),
        linear-gradient(135deg, #eef3ff 0%, #f8faff 50%, #eff2f8 100%);
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    transition: grid-template-columns 0.25s ease;
    position: relative;
    isolation: isolate;
}

.sidebar {
    background: linear-gradient(180deg, #111827 0%, #1b2536 100%);
    color: #f8fafc;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    transition: transform 0.25s ease, opacity 0.25s ease, padding 0.25s ease;
    box-shadow: 24px 0 50px rgba(10, 15, 24, 0.24);
}

.sidebar-top {
    width: 100%;
    display: grid;
    gap: 22px;
}

.brand-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.brand-block {
    width: 100%;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 170px;
    height: auto;
    margin-bottom: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    padding: 10px 12px;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.22);
}

.sidebar h1 {
    margin: 0 0 8px;
    font-size: 1.9rem;
    line-height: 1.1;
}

.eyebrow {
    margin: 0 0 8px;
    color: #a9b4cd;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-copy {
    margin: 0;
    color: #d5def0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.menu {
    display: grid;
    gap: 10px;
    margin-top: 0;
    width: 100%;
}

.menu a {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.menu a:hover {
    background: rgba(28, 47, 201, 0.22);
    border-color: rgba(102, 132, 255, 0.35);
    transform: translateX(4px);
    box-shadow: 0 10px 18px rgba(28, 47, 201, 0.12);
}

.menu a.active {
    background: linear-gradient(135deg, rgba(28, 47, 201, 0.38) 0%, rgba(49, 70, 224, 0.2) 100%);
    border-color: rgba(145, 164, 255, 0.42);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.content {
    padding: 28px;
    min-width: 0;
}

.sidebar-toggle {
    width: auto;
    min-width: 46px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: white;
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: rgba(28, 47, 201, 0.3);
}

.sidebar-reopen {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 30;
    width: auto;
    min-width: 48px;
    padding: 11px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1c2fc9 0%, #3146e0 100%);
    color: white;
    border: 0;
    box-shadow: 0 12px 24px rgba(28, 47, 201, 0.22);
    display: none;
}

.sidebar-reopen:hover {
    background: linear-gradient(135deg, #14239a 0%, #293bc3 100%);
}

.shell.sidebar-collapsed {
    grid-template-columns: 0 1fr;
}

.shell.sidebar-collapsed .sidebar-reopen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shell.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    padding: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding: 20px 22px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--line);
    border-radius: 20px;
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow-soft);
}

.page-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-logo {
    width: 72px;
    height: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 8px;
    border: 1px solid #dce4f1;
}

.page-header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.page-user {
    display: grid;
    gap: 4px;
    justify-items: end;
    text-align: right;
}

.page-user strong {
    font-size: 1rem;
}

.page-user span {
    color: var(--muted);
    font-size: 0.9rem;
}

.page-footer {
    margin-top: 24px;
    padding: 18px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.65);
    border-radius: 18px;
}

.page-footer p {
    margin: 4px 0 0;
}

.text-link {
    color: var(--primary);
    font-weight: 700;
    transition: color 0.18s ease;
}

.text-link:hover {
    color: var(--primary-dark);
}

.topbar,
.stats,
.two-col,
.table-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.topbar {
    padding: 28px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.topbar::after {
    content: "";
    position: absolute;
    inset: auto -40px -60px auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(28, 47, 201, 0.14), transparent 68%);
    pointer-events: none;
}

.hero-row,
.section-head,
.employee-header,
.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.hero-chip,
.soft-badge,
.menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 700;
}

.hero-chip {
    min-width: 140px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #1c2fc9 0%, #3146e0 100%);
    color: #f8fafc;
    flex-direction: column;
    align-items: flex-start;
}

.hero-chip span {
    font-size: 0.82rem;
    opacity: 0.8;
}

.hero-chip strong {
    font-size: 1.25rem;
    margin-top: 6px;
}

.menu-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary);
    color: white;
    font-size: 0.82rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 18px;
    margin-bottom: 20px;
}

.stat {
    padding: 18px;
    background: var(--ink-soft);
    border-radius: 16px;
    border: 1px solid #e3e9f7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stat strong {
    display: block;
    font-size: 2rem;
    margin-top: 8px;
}

.two-col {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.panel,
.table-card {
    padding: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.quick-link-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 14px 36px rgba(31, 41, 51, 0.08);
}

.quick-link-card h3 {
    margin: 14px 0 8px;
}

.pie-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: center;
}

.pie-chart {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 14px solid #fffdf8;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.pie-legend {
    display: grid;
    gap: 12px;
}

.legend-row {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    gap: 10px;
    align-items: center;
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.chart-list {
    display: grid;
    gap: 16px;
}

.chart-row {
    display: grid;
    gap: 8px;
}

.chart-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 600;
}

.chart-track {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: #e6ebf5;
    overflow: hidden;
}

.chart-track.warm {
    background: #e9edf4;
}

.chart-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1c2fc9 0%, #5570ff 100%);
}

.chart-fill.contacted {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.chart-fill.qualified {
    background: linear-gradient(90deg, #15803d 0%, #4ade80 100%);
}

.chart-fill.not_qualified {
    background: linear-gradient(90deg, #dc2626 0%, #fb7185 100%);
}

.chart-fill.closed {
    background: linear-gradient(90deg, #64748b 0%, #94a3b8 100%);
}

.warm-fill {
    background: linear-gradient(90deg, #454545 0%, #6b7280 100%);
}

.stack-list {
    display: grid;
    gap: 12px;
}

.stack-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    background: #fbfcff;
    border: 1px solid var(--line);
}

.stack-item p {
    margin: 6px 0 0;
}

.stack-item-form {
    align-items: flex-start;
}

.inline-form {
    width: auto;
    min-width: 150px;
}

.inline-form button {
    white-space: nowrap;
}

.employee-panel,
.notification-panel,
.followup-panel {
    margin-top: 20px;
}

.table-card {
    margin-top: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 16px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(4px);
    z-index: 1;
}

tbody tr {
    transition: background 0.16s ease, transform 0.16s ease;
}

tbody tr:hover {
    background: linear-gradient(90deg, rgba(28, 47, 201, 0.04), rgba(255, 255, 255, 0));
}

.form-grid {
    display: grid;
    gap: 14px;
}

.followup-toggle-box {
    display: grid;
    gap: 12px;
}

.inline-row-form {
    display: none;
}

.followup-cell,
.status-stack,
.product-stack {
    display: grid;
    gap: 10px;
}

.table-input {
    min-width: 140px;
}

.table-textarea {
    min-height: 110px;
}

.sales-update-table {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: #fbfcff;
}

.sales-update-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    align-items: center;
}

.sales-update-row-textarea {
    align-items: start;
}

.sales-update-label {
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
}

.sales-update-field {
    width: 100%;
}

.followup-date-field.is-hidden {
    display: none;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label span {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

input,
select,
textarea,
button {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    background: rgba(255, 255, 255, 0.96);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(28, 47, 201, 0.48);
    box-shadow: 0 0 0 4px rgba(28, 47, 201, 0.08);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    background: var(--primary);
    color: white;
    border: 0;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(28, 47, 201, 0.22);
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.muted {
    color: var(--muted);
}

.auth-card {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card .panel {
    width: min(520px, 100%);
    padding: 30px;
    box-shadow: var(--shadow-strong);
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.alert.success {
    background: #dcfce7;
    color: var(--success);
}

.alert.error {
    background: #fee2e2;
    color: var(--danger);
}

.status {
    padding: 6px 10px;
    border-radius: 999px;
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    background: #e5e7eb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.status.new {
    background: #dbeafe;
    color: #1d4ed8;
}

.status.contacted {
    background: #fef3c7;
    color: var(--warning);
}

.status.qualified {
    background: #dcfce7;
    color: var(--success);
}

.status.not_qualified {
    background: #fee2e2;
    color: var(--danger);
}

.status.closed {
    background: #e5e7eb;
    color: #374151;
}

.soft-badge {
    padding: 8px 12px;
    background: #e9edff;
    color: var(--primary);
    font-size: 0.82rem;
}

.employee-grid,
.notification-list,
.followup-grid {
    display: grid;
    gap: 16px;
}

.employee-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.employee-card,
.notification-item,
.followup-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.info-card {
    padding: 16px;
    border-radius: 16px;
    background: #eef2ff;
    border: 1px dashed #b9c7ff;
}

.info-card p {
    margin: 8px 0 0;
}

.mini-stats {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mini-stats div {
    padding: 12px;
    border-radius: 14px;
    background: white;
    border: 1px solid #e6ebf5;
}

.mini-stats strong {
    display: block;
    margin-top: 6px;
    font-size: 1.2rem;
}

.notification-item.unread {
    border-color: #c9d4ff;
    background: #f3f6ff;
}

.notification-item p {
    margin: 8px 0;
}

.followup-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.followup-card h4 {
    margin: 8px 0 10px;
    font-size: 1.1rem;
}

.followup-card p {
    margin: 6px 0;
}

.histogram {
    min-height: 260px;
    display: flex;
    align-items: end;
    gap: 12px;
    padding-top: 14px;
}

.hist-bar-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.hist-bar {
    width: 100%;
    min-height: 18px;
    background: linear-gradient(180deg, #1c2fc9 0%, #5b74ff 100%);
    border-radius: 16px 16px 6px 6px;
    display: flex;
    align-items: start;
    justify-content: center;
    padding-top: 8px;
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(28, 47, 201, 0.18);
}

.app-guest .shell {
    grid-template-columns: minmax(320px, 420px) 1fr;
}

.app-guest .sidebar {
    justify-content: center;
}

.app-guest .page-header,
.app-guest .page-footer {
    display: none;
}

.hist-bar-wrap label {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.helper-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    background: #f3f4f6;
}

@media (max-width: 980px) {
    .shell,
    .two-col,
    .dashboard-grid,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 20px;
    }

    .stats {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 760px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar,
    .content {
        padding: 18px;
    }

    .sales-update-row {
        grid-template-columns: 1fr;
    }

    .hero-row,
    .section-head,
    .employee-header,
    .notification-item,
    .stack-item,
    .page-header,
    .page-footer,
    .page-title-block {
        flex-direction: column;
    }

    .hero-chip {
        width: 100%;
    }

    .pie-layout {
        grid-template-columns: 1fr;
    }

    .pie-chart {
        width: min(220px, 100%);
        height: min(220px, 100vw - 90px);
        justify-self: center;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .page-user {
        justify-items: start;
        text-align: left;
    }

    .brand-logo {
        max-width: 150px;
    }

    .table-input,
    .table-textarea {
        min-width: 100%;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        margin-bottom: 16px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: #fffdf8;
        overflow: hidden;
    }

    .responsive-table td {
        border-bottom: 1px solid #eee7da;
        padding: 12px 14px;
    }

    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--muted);
        font-size: 0.82rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
}

.filter-search {
    flex: 1 1 220px;
    min-width: 180px;
}

.filter-select {
    flex: 0 1 180px;
    min-width: 140px;
}

.filter-btn {
    width: auto;
    min-width: 90px;
    padding: 12px 18px;
    box-shadow: none;
}

.filter-clear {
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #f4f7ff;
    color: var(--muted);
    font-weight: 600;
    transition: background 0.18s ease;
}

.filter-clear:hover {
    background: #e6ebff;
}

.export-btn {
    padding: 11px 16px;
    border-radius: 12px;
    background: #166534;
    color: white;
    font-weight: 700;
    transition: background 0.18s ease;
    margin-left: auto;
}

.export-btn:hover {
    background: #14532d;
}

.filter-count {
    margin: 8px 0 0;
    font-size: 0.9rem;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 18px 0 4px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: #f4f7ff;
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.page-link:hover {
    background: #e6ebff;
    border-color: rgba(28, 47, 201, 0.3);
}

.page-link.page-current {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 6px 14px rgba(28, 47, 201, 0.28);
}

.page-info {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.88rem;
}

/* ── CSV import section ──────────────────────────────────────────────────── */

.import-section {
    margin-top: 20px;
}

.import-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 14px;
}

.import-instructions {
    padding: 18px;
    background: #f4f7ff;
    border-radius: 16px;
    border: 1px dashed #b9c7ff;
}

.import-instructions p {
    margin: 0 0 10px;
}

.csv-header-example {
    display: block;
    padding: 10px 14px;
    background: #1e293b;
    color: #93c5fd;
    border-radius: 10px;
    font-size: 0.88rem;
    word-break: break-all;
}

.import-form {
    align-self: start;
}

.import-btn {
    background: #166534;
    box-shadow: 0 10px 22px rgba(22, 101, 52, 0.22);
}

.import-btn:hover {
    background: #14532d;
}

/* ── Employee password reset ─────────────────────────────────────────────── */

.reset-details {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.reset-summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    list-style: none;
    padding: 4px 0;
}

.reset-summary::-webkit-details-marker {
    display: none;
}

.reset-summary::before {
    content: '+ ';
}

details[open] .reset-summary::before {
    content: '− ';
}

.reset-form {
    margin-top: 12px;
    gap: 10px;
}

.reset-form button {
    background: var(--danger);
    box-shadow: 0 8px 18px rgba(185, 28, 28, 0.2);
}

.reset-form button:hover {
    background: #991b1b;
}

/* ── Responsive adjustments for new components ───────────────────────────── */

@media (max-width: 760px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search,
    .filter-select {
        flex: none;
        width: 100%;
    }

    .export-btn {
        margin-left: 0;
    }

    .pagination {
        justify-content: center;
    }

    .page-info {
        width: 100%;
        text-align: center;
        margin-left: 0;
    }

    .import-body {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE-FIRST REDESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Mobile sidebar overlay backdrop ────────────────────────────────────── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ── Sidebar user chip ───────────────────────────────────────────────────── */

.sidebar-user-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-chip strong {
    display: block;
    font-size: 0.95rem;
    color: #f8fafc;
}

.sidebar-user-chip span {
    font-size: 0.78rem;
    color: #a9b4cd;
}

.nav-logout {
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.08) !important;
    color: #fca5a5 !important;
}

.nav-logout:hover {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

/* ── Mobile menu button in page header ───────────────────────────────────── */

.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 12px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 1.1rem;
    box-shadow: none;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: #e6ebff;
}

/* ── Header notification badge ───────────────────────────────────────────── */

.header-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fee2e2;
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ── Stat urgent highlight ───────────────────────────────────────────────── */

.stat-urgent {
    background: #fff7ed;
    border-color: #fed7aa;
}

.stat-urgent strong {
    color: var(--warning);
}

/* ── Notifications panel (collapsible) ───────────────────────────────────── */

.notif-details {
    width: 100%;
}

.notif-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    list-style: none;
    padding: 4px 0;
    user-select: none;
}

.notif-summary::-webkit-details-marker {
    display: none;
}

.notif-summary::after {
    content: '▸';
    font-size: 0.8rem;
    color: var(--muted);
    transition: transform 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
}

details[open] .notif-summary::after {
    transform: rotate(90deg);
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-time {
    font-size: 0.78rem;
    display: block;
    margin-top: 4px;
}

.notif-form {
    flex-shrink: 0;
}

.btn-read {
    width: auto;
    min-width: 96px;
    padding: 10px 14px;
    font-size: 0.88rem;
    box-shadow: none;
    background: var(--ink-soft);
    color: var(--primary);
    border: 1px solid rgba(28, 47, 201, 0.3);
}

.btn-read:hover {
    background: #e6ebff;
}

/* ── Lead cards grid ─────────────────────────────────────────────────────── */

.leads-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    margin-top: 16px;
}

.lead-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.lead-card:hover {
    box-shadow: var(--shadow-strong);
    transform: translateY(-2px);
}

/* Status-tinted card top border */
.lead-card--new        { border-top: 3px solid #3b82f6; }
.lead-card--contacted  { border-top: 3px solid #f59e0b; }
.lead-card--qualified  { border-top: 3px solid #22c55e; }
.lead-card--not_qualified { border-top: 3px solid #ef4444; }
.lead-card--closed     { border-top: 3px solid #94a3b8; }

.lead-card-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lead-card-top {
    padding: 18px 18px 14px;
    background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
    border-bottom: 1px solid var(--line);
}

.lead-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.lead-number {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lead-card-name {
    margin: 0 0 4px;
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--text);
}

.lead-card-company {
    margin: 0 0 8px;
    font-size: 0.88rem;
}

/* Follow-up alert badges */
.follow-up-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 6px;
}

.follow-up-today {
    background: #dcfce7;
    color: #166534;
}

.follow-up-overdue {
    background: #fee2e2;
    color: #b91c1c;
}

.follow-up-scheduled {
    background: #fef3c7;
    color: #92400e;
}

/* Lead detail info grid */
.lead-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.detail-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 600;
    word-break: break-word;
    color: var(--text);
}

.detail-link {
    color: var(--primary);
    text-decoration: none;
}

.detail-link:hover {
    text-decoration: underline;
}

/* Card form fields */
.lead-card-form-fields {
    padding: 16px 18px;
    display: grid;
    gap: 14px;
    flex: 1;
}

.field-group {
    display: grid;
    gap: 6px;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-input:focus {
    outline: none;
    border-color: rgba(28, 47, 201, 0.48);
    box-shadow: 0 0 0 4px rgba(28, 47, 201, 0.08);
}

.field-textarea {
    width: 100%;
    min-height: 90px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    resize: vertical;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-textarea:focus {
    outline: none;
    border-color: rgba(28, 47, 201, 0.48);
    box-shadow: 0 0 0 4px rgba(28, 47, 201, 0.08);
}

.field-subgroup {
    display: grid;
    gap: 6px;
}

/* Locked follow-up date (admin set) */
.locked-followup {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.locked-date {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Card footer + save button */
.lead-card-footer {
    padding: 12px 18px 16px;
    border-top: 1px solid var(--line);
}

.lead-save-btn {
    width: 100%;
    padding: 15px;
    border-radius: 14px;
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    color: white;
    border: 0;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(22, 101, 52, 0.22);
    transition: background 0.18s ease, transform 0.18s ease;
    min-height: 50px;
}

.lead-save-btn:hover {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    transform: translateY(-1px);
}

/* ── Global touch target minimum ─────────────────────────────────────────── */

button,
.page-link,
.filter-btn,
.export-btn,
.filter-clear,
input[type="submit"],
.btn-read {
    min-height: 44px;
}

/* ── @media ≤ 760px — mobile overrides ──────────────────────────────────── */

@media (max-width: 760px) {

    /* Sidebar becomes a fixed overlay drawer */
    .shell {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        width: min(290px, 85vw);
        height: 100%;
        height: 100dvh;
        z-index: 100;
        transform: translateX(0);
        opacity: 1 !important;
        pointer-events: auto !important;
        padding: 22px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .shell.sidebar-collapsed .sidebar {
        transform: translateX(-100%) !important;
    }

    /* Always show the reopen button on mobile */
    .sidebar-reopen {
        display: none !important; /* hidden — we use mobile-menu-btn instead */
    }

    /* Show hamburger inside page header */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Compact page header */
    .page-header {
        padding: 14px 16px;
        border-radius: 16px;
    }

    .page-header h2 {
        font-size: 1.15rem;
    }

    .page-title-block {
        gap: 10px;
    }

    .page-logo {
        width: 44px;
    }

    .eyebrow {
        display: none;
    }

    /* Content padding */
    .content {
        padding: 14px !important;
    }

    /* Stats: 2 columns on mobile */
    .stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
        padding: 12px;
    }

    .stat {
        padding: 14px;
    }

    .stat strong {
        font-size: 1.6rem;
    }

    /* Topbar compact */
    .topbar {
        padding: 18px;
    }

    /* Hero row stacks */
    .hero-row {
        flex-direction: column;
        gap: 12px;
    }

    .hero-chip {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
    }

    .hero-chip strong {
        font-size: 1.1rem;
        margin-top: 0;
    }

    /* Filter bar stacks */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-search,
    .filter-select {
        flex: none;
        width: 100%;
    }

    .export-btn {
        margin-left: 0;
        text-align: center;
    }

    /* Lead cards: single column */
    .leads-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Larger touch targets in cards */
    .field-input,
    .field-textarea {
        font-size: 1rem;
        padding: 14px;
    }

    .lead-save-btn {
        padding: 16px;
        font-size: 1.05rem;
        min-height: 54px;
    }

    /* Notification items stack */
    .notification-item {
        flex-direction: column;
        gap: 12px;
    }

    .notif-form {
        width: 100%;
    }

    .btn-read {
        width: 100%;
        text-align: center;
    }

    /* Pagination centered */
    .pagination {
        justify-content: center;
        gap: 6px;
        padding: 14px 0;
    }

    .page-info {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 4px;
    }

    .page-link {
        min-width: 42px;
        height: 42px;
    }

    /* Import */
    .import-body {
        grid-template-columns: 1fr;
    }

    /* Dashboard grid stacks */
    .dashboard-grid,
    .grid-2,
    .two-col {
        grid-template-columns: 1fr;
    }

    /* Table responsive */
    .responsive-table thead {
        display: none;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        margin-bottom: 16px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: #fffdf8;
        overflow: hidden;
    }

    .responsive-table td {
        border-bottom: 1px solid #eee7da;
        padding: 12px 14px;
    }

    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .table-input,
    .table-textarea {
        min-width: 100%;
    }

    /* Auth card */
    .auth-card {
        align-items: flex-start;
        padding: 16px;
    }

    /* Section heads */
    .section-head,
    .employee-header,
    .page-footer {
        flex-direction: column;
        gap: 10px;
    }

    /* Stack items */
    .stack-item,
    .page-title-block {
        flex-direction: column;
    }

    /* Pie chart */
    .pie-layout {
        grid-template-columns: 1fr;
    }

    .pie-chart {
        width: min(220px, 100%);
        height: min(220px, 100vw - 64px);
        justify-self: center;
    }

    .page-user {
        justify-items: start;
        text-align: left;
    }

    .brand-logo {
        max-width: 140px;
    }

    .sales-update-row {
        grid-template-columns: 1fr;
    }
}

/* ── @media ≤ 480px — small phone tweaks ────────────────────────────────── */

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr 1fr !important;
    }

    .lead-card-details {
        grid-template-columns: 1fr;
    }

    .leads-grid {
        gap: 12px;
    }

    .lead-card-top,
    .lead-card-form-fields,
    .lead-card-footer,
    .lead-card-details {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALL LEADS PAGE — REDESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Topbar chips ────────────────────────────────────────────────────────── */

.leads-topbar {
    margin-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: linear-gradient(135deg, #111827 0%, #1b2a44 100%);
    color: #f8fafc;
    padding: 24px 28px;
}

.leads-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.leads-topbar h2 {
    margin: 0 0 4px;
    font-size: 1.5rem;
    color: #f8fafc;
}

.leads-topbar .muted {
    color: #8899bb;
    font-size: 0.88rem;
    margin: 0;
}

.topbar-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tbar-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 18px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
    color: #cbd5e1;
    transition: background 0.18s ease, transform 0.15s ease;
    text-decoration: none;
    min-width: 72px;
}

.tbar-chip strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1;
    color: #f8fafc;
    font-weight: 800;
    margin-top: 2px;
}

.tbar-chip:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.tbar-chip--total {
    border-color: rgba(148, 163, 184, 0.3);
    background: rgba(148, 163, 184, 0.1);
}

.tbar-chip--new {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.12);
}

.tbar-chip--new strong { color: #93c5fd; }

.tbar-chip--qualified {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
}

.tbar-chip--qualified strong { color: #86efac; }

.tbar-chip--followup {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.12);
}

.tbar-chip--followup strong { color: #fde68a; }

/* ── Collapsible create-lead panel ───────────────────────────────────────── */

.create-lead-panel {
    border-radius: 0;
    border-top: 1px solid var(--line);
    box-shadow: none;
    background: #fafbff;
}

.create-lead-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 18px 28px;
    list-style: none;
    user-select: none;
    border-radius: 0;
    transition: background 0.18s ease;
}

.create-lead-summary::-webkit-details-marker {
    display: none;
}

.create-lead-summary:hover {
    background: #f0f4ff;
}

.cls-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.18s ease;
}

details[open] .cls-icon {
    background: var(--primary-dark);
}

.cls-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.cls-hint {
    font-size: 0.82rem;
    margin-left: auto;
}

details[open] .cls-hint {
    display: none;
}

.create-lead-body {
    padding: 0 28px 24px;
    border-top: 1px solid var(--line);
    background: white;
}

.create-lead-body .form-grid {
    padding-top: 20px;
}

.req {
    color: #ef4444;
    font-weight: 900;
    margin-left: 2px;
}

.btn-create-lead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: 0;
    border-radius: 14px;
    padding: 15px 28px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(28, 47, 201, 0.28);
    transition: background 0.18s ease, transform 0.15s ease;
    min-height: 50px;
}

.btn-create-lead:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #0f1a7a 100%);
    transform: translateY(-1px);
}

/* ── Filter panel ────────────────────────────────────────────────────────── */

.leads-filter-panel {
    border-radius: 0;
    border-top: 1px solid var(--line);
    padding: 18px 28px 14px;
    background: white;
    box-shadow: none;
}

.leads-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.leads-search-wrap {
    flex: 1 1 260px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 0.95rem;
    pointer-events: none;
    line-height: 1;
}

.leads-search-input {
    width: 100%;
    padding: 11px 38px 11px 38px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    font-size: 0.95rem;
    background: #f8faff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.leads-search-input:focus {
    outline: none;
    border-color: rgba(28, 47, 201, 0.45);
    box-shadow: 0 0 0 4px rgba(28, 47, 201, 0.08);
    background: white;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    min-height: unset;
    border: 0;
    background: #e2e8ff;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.search-clear-btn:hover {
    background: #c7d2ff;
    color: var(--text);
}

.leads-search-row .filter-select {
    flex: 0 1 200px;
    min-width: 150px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    font-size: 0.92rem;
    background: #f8faff;
}

.leads-search-row .filter-btn {
    padding: 11px 20px;
    font-size: 0.92rem;
    min-height: 44px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    border: 0;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease;
}

.leads-search-row .filter-btn:hover {
    background: var(--primary-dark);
}

.leads-search-row .export-btn {
    margin-left: 0;
    padding: 11px 16px;
    font-size: 0.88rem;
    min-height: 44px;
}

/* ── Status pill tabs ────────────────────────────────────────────────────── */

.status-pill-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.spt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1.5px solid transparent;
    color: var(--muted);
    background: #f1f5f9;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.spt:hover {
    background: #e2e8ff;
    color: var(--primary);
}

.spt-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.74rem;
    font-weight: 800;
}

/* Active pill */
.spt--active {
    border-color: currentColor;
}

.spt--all.spt--active        { background: #e0e7ff; color: var(--primary);  border-color: rgba(28,47,201,0.4); }
.spt--new.spt--active        { background: #dbeafe; color: #1d4ed8;         border-color: rgba(59,130,246,0.5); }
.spt--contacted.spt--active  { background: #fef3c7; color: #92400e;         border-color: rgba(245,158,11,0.5); }
.spt--qualified.spt--active  { background: #dcfce7; color: #166534;         border-color: rgba(34,197,94,0.5); }
.spt--not_qualified.spt--active { background: #fee2e2; color: #b91c1c;      border-color: rgba(239,68,68,0.5); }
.spt--closed.spt--active     { background: #f1f5f9; color: #475569;         border-color: rgba(100,116,139,0.5); }

/* Inactive pill hover tints */
.spt--new:hover        { background: #dbeafe; color: #1d4ed8; }
.spt--contacted:hover  { background: #fef3c7; color: #92400e; }
.spt--qualified:hover  { background: #dcfce7; color: #166534; }
.spt--not_qualified:hover { background: #fee2e2; color: #b91c1c; }
.spt--closed:hover     { background: #f1f5f9; color: #475569; }

.filter-count {
    margin: 6px 0 0;
    font-size: 0.88rem;
    color: var(--muted);
}

/* ── Leads table wrap ────────────────────────────────────────────────────── */

.leads-table-wrap {
    border-radius: 0 0 22px 22px;
    border-top: 1px solid var(--line);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leads-table thead tr {
    background: #f8faff;
    border-bottom: 2px solid var(--line);
}

.leads-table thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

/* ── Lead rows ───────────────────────────────────────────────────────────── */

.lead-row {
    border-bottom: 1px solid #eef0f6;
    background: white;
    transition: background 0.15s ease;
    vertical-align: top;
}

.lead-row:hover {
    background: #f8faff;
}

.lead-row td {
    padding: 12px 14px;
    vertical-align: top;
}

/* Status-tinted left border via first-child border */
.lead-row--new         td:first-child { border-left: 4px solid #3b82f6; }
.lead-row--contacted   td:first-child { border-left: 4px solid #f59e0b; }
.lead-row--qualified   td:first-child { border-left: 4px solid #22c55e; }
.lead-row--not_qualified td:first-child { border-left: 4px solid #ef4444; }
.lead-row--closed      td:first-child { border-left: 4px solid #94a3b8; }

/* Subtle row-level tints for urgent states */
.lead-row--overdue { background: #fff8f8; }
.lead-row--today   { background: #fffdf4; }
.lead-row--overdue:hover { background: #fff0f0; }
.lead-row--today:hover   { background: #fff8e8; }

/* ── Lead cell ───────────────────────────────────────────────────────────── */

.lead-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 160px;
}

.lead-num-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e0e7ff;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    width: fit-content;
    margin-bottom: 2px;
}

.lead-cell-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}

.lead-cell-company {
    font-size: 0.82rem;
    line-height: 1.2;
}

.source-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f0f4ff;
    border: 1px solid #c7d2ff;
    color: #3b50c8;
    font-size: 0.74rem;
    font-weight: 600;
    width: fit-content;
    margin-top: 1px;
}

.lead-cell-location {
    font-size: 0.8rem;
    margin-top: 1px;
}

.lead-cell-date {
    font-size: 0.78rem;
    margin-top: 3px;
}

/* ── Contact cell ────────────────────────────────────────────────────────── */

.contact-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border-radius: 8px;
    padding: 3px 0;
    transition: color 0.15s ease;
    word-break: break-all;
}

.contact-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.contact-phone {
    color: #166534;
}

.contact-phone:hover {
    color: #14532d;
}

.contact-email {
    color: var(--primary);
}

.contact-none {
    font-size: 0.82rem;
}

/* ── Assignee chip ───────────────────────────────────────────────────────── */

.assign-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
}

.assignee-chip {
    display: flex;
    align-items: center;
    gap: 9px;
}

.assignee-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1c2fc9 0%, #3b50e8 100%);
    color: white;
    font-size: 0.78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 8px rgba(28, 47, 201, 0.25);
}

.assignee-avatar--empty {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    box-shadow: none;
}

.assignee-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.assignee-info strong {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.assignee-info span {
    font-size: 0.75rem;
}

.assignee-chip--empty .muted {
    font-size: 0.82rem;
}

/* ── Follow-up cell ──────────────────────────────────────────────────────── */

.fp-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
}

.fp-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    width: fit-content;
    white-space: nowrap;
}

.fp-overdue {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.fp-today {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.fp-upcoming {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

/* ── Status cell ─────────────────────────────────────────────────────────── */

.status-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 130px;
}

/* ── Notes cell ──────────────────────────────────────────────────────────── */

.notes-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 170px;
}

/* ── Table inline form controls ──────────────────────────────────────────── */

.tbl-select,
.tbl-input,
.tbl-textarea {
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--line);
    font: inherit;
    font-size: 0.86rem;
    background: #f8faff;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tbl-select:focus,
.tbl-input:focus,
.tbl-textarea:focus {
    outline: none;
    border-color: rgba(28, 47, 201, 0.45);
    box-shadow: 0 0 0 3px rgba(28, 47, 201, 0.08);
    background: white;
}

.tbl-textarea {
    min-height: 80px;
    resize: vertical;
}

/* ── Row update button ───────────────────────────────────────────────────── */

.btn-update-lead {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: 0;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(28, 47, 201, 0.22);
    transition: background 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    min-height: 40px;
}

.btn-update-lead:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #0f1a7a 100%);
    transform: translateY(-1px);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.leads-empty {
    text-align: center;
    padding: 50px 20px !important;
    color: var(--muted);
}

.leads-empty p {
    font-size: 2.5rem;
    margin: 0 0 10px;
    line-height: 1;
}

.leads-empty strong {
    display: block;
    font-size: 1rem;
    color: var(--muted);
}

/* ── Inline row form (hidden anchor for CSRF + hidden fields) ────────────── */

.inline-row-form {
    display: none;
}

/* ── Mobile overrides for All Leads ─────────────────────────────────────── */

@media (max-width: 900px) {
    .leads-topbar-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .topbar-chips {
        width: 100%;
    }

    .tbar-chip {
        flex: 1;
        min-width: 60px;
        padding: 8px 12px;
    }
}

@media (max-width: 760px) {
    .leads-topbar {
        border-radius: 16px 16px 0 0;
        padding: 18px;
    }

    .leads-filter-panel {
        padding: 14px 16px 10px;
    }

    .create-lead-summary {
        padding: 14px 16px;
    }

    .create-lead-body {
        padding: 0 16px 18px;
    }

    .leads-search-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .leads-search-wrap {
        flex: none;
        width: 100%;
    }

    .leads-search-row .filter-select {
        flex: none;
        width: 100%;
    }

    .leads-search-row .filter-btn,
    .leads-search-row .export-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .status-pill-tabs {
        gap: 5px;
    }

    .spt {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .leads-table-wrap {
        border-radius: 0 0 16px 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .leads-table {
        min-width: 640px;
    }

    .assignee-info strong {
        max-width: 80px;
    }

    .cls-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .topbar-chips {
        gap: 6px;
    }

    .tbar-chip {
        padding: 8px 10px;
        min-width: 54px;
    }

    .tbar-chip strong {
        font-size: 1.15rem;
    }
}
