@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
}

:root {
    --bg: #f3f6f4;
    --surface: #ffffff;
    --border: #e3e8e4;
    --text: #1a2420;
    --text-muted: #667a70;

    --primary: #0b6e1f;
    --primary-dark: #074f16;
    --primary-light: #e8f5ea;
    --primary-gradient: linear-gradient(135deg, #12812a 0%, #075a18 100%);

    --accent-blue: #2563eb;
    --accent-blue-light: #eaf1fe;
    --accent-amber: #d97706;
    --accent-amber-light: #fef3e2;
    --accent-purple: #7c3aed;
    --accent-purple-light: #f2ebfe;
    --accent-teal: #0d9488;
    --accent-teal-light: #e4f7f5;
    --accent-coral: #e11d48;
    --accent-coral-light: #fde9ee;

    --danger: #dc2626;
    --danger-hover: #b91c1c;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 30, 20, 0.06);
    --shadow-md: 0 4px 14px rgba(16, 30, 20, 0.08);
    --shadow-lg: 0 10px 30px rgba(16, 30, 20, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background-image: radial-gradient(circle at 8% 0%, rgba(11, 110, 31, 0.06), transparent 40%),
                       radial-gradient(circle at 92% 12%, rgba(37, 99, 235, 0.05), transparent 38%);
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

svg.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }

.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    font-weight: 600;
    animation: toast-in 0.2s ease;
}
.toast.toast-danger { border-left-color: var(--accent-coral); }
.toast.toast-danger svg { color: var(--accent-coral); }
.toast:not(.toast-danger) svg { color: var(--primary); }
.toast span { flex: 1; }
.toast-close {
    background: none; border: none; color: var(--text-muted); font-size: 18px;
    line-height: 1; cursor: pointer; padding: 0 2px;
}
.toast.toast-hide { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 30, 20, 0.45);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-overlay.show { display: flex; animation: modal-fade-in 0.15s ease; }
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    animation: modal-pop-in 0.18s ease;
}
.modal-box h3 { margin: 0 0 8px; font-size: 17px; }
.modal-box p { margin: 0 0 20px; color: var(--text-muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.topnav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    gap: 22px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topnav .brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 18px;
    margin-right: 12px;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex-shrink: 0;
}

.topnav .brand-logo { height: 30px; width: auto; border-radius: 4px; }

.topnav a {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.topnav a:hover { color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 22px; flex: 1; min-width: 0; }
.nav-links > a { white-space: nowrap; }
.nav-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text);
}

.nav-right-group { margin-left: auto; display: flex; align-items: center; gap: 18px; }

.quick-add { position: relative; }
.quick-add-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 14px 7px 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(11, 110, 31, 0.28);
}
.quick-add-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    overflow: hidden;
    z-index: 100;
}
.quick-add-menu.open { display: block; }
.quick-add-menu a {
    display: block;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.quick-add-menu a:last-child { border-bottom: none; }
.quick-add-menu a:hover { background: var(--primary-light); color: var(--primary); }

.user-menu { position: relative; }
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    transition: background 0.12s ease;
}
.user-menu-btn:hover { background: var(--bg); }
.user-menu-btn .avatar { width: 30px; height: 30px; font-size: 12px; }
.user-avatar-img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-menu-name { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 170px;
    overflow: hidden;
    z-index: 100;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown a, .user-menu-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.user-menu-dropdown form:last-child button { border-bottom: none; color: var(--danger); }
.user-menu-dropdown a:hover, .user-menu-dropdown button:hover { background: var(--primary-light); color: var(--primary); }
.user-menu-dropdown form:last-child button:hover { background: var(--accent-coral-light); color: var(--danger); }

@media (max-width: 900px) {
    .user-menu-name { display: none; }
    .user-menu-dropdown { position: static; box-shadow: none; border: none; display: none; }
    .user-menu-dropdown.open { display: block; }
    .user-menu { padding: 4px 24px; }
}

@media (max-width: 900px) {
    .nav-toggle { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 12px 24px; border-bottom: 1px solid var(--border); }
    .nav-right-group {
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-top: 4px;
    }
    .nav-right-group a { padding: 12px 24px; }
    .nav-search { margin: 10px 24px; }
    .quick-add { padding: 4px 24px; }
    .quick-add-menu { position: static; box-shadow: none; border: none; display: none; }
    .quick-add-menu.open { display: block; }
    .topnav { position: relative; flex-wrap: wrap; }
}

.nav-search {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px;
    color: var(--text-muted);
}
.nav-search svg { width: 15px; height: 15px; }
.nav-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    width: 140px;
    color: var(--text);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
}

h1 { font-size: 25px; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 30px 0 12px; letter-spacing: -0.01em; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.page-header h1 { margin: 0; }

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card.c-blue { border-top-color: var(--accent-blue); }
.stat-card.c-purple { border-top-color: var(--accent-purple); }
.stat-card.c-amber { border-top-color: var(--accent-amber); }
.stat-card.c-green { border-top-color: var(--primary); }
.stat-card.c-teal { border-top-color: var(--accent-teal); }
.stat-card.c-coral { border-top-color: var(--accent-coral); }

.stat-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    margin-bottom: 10px;
}
.stat-card-icon svg { width: 19px; height: 19px; }

.stat-card.c-blue .stat-card-icon { background: var(--accent-blue-light); color: var(--accent-blue); }
.stat-card.c-purple .stat-card-icon { background: var(--accent-purple-light); color: var(--accent-purple); }
.stat-card.c-amber .stat-card-icon { background: var(--accent-amber-light); color: var(--accent-amber); }
.stat-card.c-green .stat-card-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.c-teal .stat-card-icon { background: var(--accent-teal-light); color: var(--accent-teal); }
.stat-card.c-coral .stat-card-icon { background: var(--accent-coral-light); color: var(--accent-coral); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 11.5px;
    font-weight: 800;
    flex-shrink: 0;
}
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }
.avatar.c-blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.avatar.c-purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.avatar.c-amber { background: var(--accent-amber-light); color: var(--accent-amber); }
.avatar.c-green { background: var(--primary-light); color: var(--primary); }
.avatar.c-teal { background: var(--accent-teal-light); color: var(--accent-teal); }
.avatar.c-coral { background: var(--accent-coral-light); color: var(--accent-coral); }

.name-cell { display: flex; align-items: center; gap: 10px; }

.profile-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 26px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.profile-banner h1 { margin: 0; }
.profile-banner.c-blue { background: linear-gradient(120deg, var(--accent-blue-light), var(--surface) 70%); }
.profile-banner.c-purple { background: linear-gradient(120deg, var(--accent-purple-light), var(--surface) 70%); }
.profile-banner.c-amber { background: linear-gradient(120deg, var(--accent-amber-light), var(--surface) 70%); }
.profile-banner.c-green { background: linear-gradient(120deg, var(--primary-light), var(--surface) 70%); }
.profile-banner.c-teal { background: linear-gradient(120deg, var(--accent-teal-light), var(--surface) 70%); }
.profile-banner.c-coral { background: linear-gradient(120deg, var(--accent-coral-light), var(--surface) 70%); }

.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; font-weight: 600; }
.stat-card.alert .stat-value { color: var(--accent-coral); }

/* Cards / widgets */
.widget-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.widget-card.accent-green { border-top-color: var(--primary); }
.widget-card.accent-blue { border-top-color: var(--accent-blue); }
.widget-card.accent-amber { border-top-color: var(--accent-amber); }
.widget-card.accent-purple { border-top-color: var(--accent-purple); }
.widget-card.accent-teal { border-top-color: var(--accent-teal); }
.widget-card.accent-coral { border-top-color: var(--accent-coral); }
.widget-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.widget-title svg { color: var(--primary); }

.chart-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}
.widget-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}
.widget-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
@media (max-width: 800px) {
    .chart-row, .widget-row { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
    .widget-row-3 { grid-template-columns: 1fr; }
}

.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.leaderboard-item { display: flex; align-items: center; gap: 10px; }
.leaderboard-rank {
    width: 22px; height: 22px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
    font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.leaderboard-item:nth-child(1) .leaderboard-rank { background: #fef3c7; color: #92400e; }
.leaderboard-body { flex: 1; min-width: 0; }
.leaderboard-name { font-size: 13.5px; font-weight: 700; text-decoration: none; color: var(--text); display: block; }
.leaderboard-name:hover { color: var(--primary); }
.leaderboard-track { background: var(--bg); border-radius: 999px; height: 6px; margin-top: 5px; overflow: hidden; }
.leaderboard-fill { height: 100%; background: var(--primary-gradient); border-radius: 999px; }
.leaderboard-value { font-size: 12.5px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }

.chart-canvas-wrap { position: relative; height: 220px; }
.chart-canvas-wrap.donut { height: 200px; }

/* Pipeline funnel */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: 12px; font-size: 13px; }
.funnel-label { font-weight: 700; }
.funnel-track { background: var(--bg); border-radius: 999px; height: 14px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.funnel-fill.stage-lead { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.funnel-fill.stage-qualified { background: linear-gradient(90deg, #c4b5fd, #7c3aed); }
.funnel-fill.stage-proposal { background: linear-gradient(90deg, #fcd34d, #d97706); }
.funnel-fill.stage-negotiation { background: linear-gradient(90deg, #fdba74, #c2410c); }
.funnel-fill.stage-won { background: linear-gradient(90deg, #4ade80, #0b6e1f); }
.funnel-fill.stage-lost { background: linear-gradient(90deg, #fb7185, #e11d48); }
.funnel-value { text-align: right; color: var(--text-muted); font-weight: 600; }

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

.data-table th, .data-table td {
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table th { background: var(--bg); color: var(--text-muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table a { color: var(--primary); text-decoration: none; font-weight: 600; }
.data-table a:hover { text-decoration: underline; }

.empty { color: var(--text-muted); font-style: italic; }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 44px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state svg { width: 34px; height: 34px; margin-bottom: 10px; color: var(--text-muted); opacity: 0.6; }
.empty-state p { margin: 0 0 16px; font-size: 14px; }

.btn, .btn-secondary, .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active, .btn-secondary:active, .btn-danger:active { transform: translateY(1px); }

.btn { background: var(--primary-gradient); color: #fff; box-shadow: 0 2px 8px rgba(11, 110, 31, 0.28); }
.btn:hover { box-shadow: 0 4px 14px rgba(11, 110, 31, 0.38); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.inline-form { display: inline-block; margin-left: 8px; }
.link-danger {
    background: none; border: none; color: var(--danger); cursor: pointer;
    font-size: 13px; padding: 0; text-decoration: underline;
}

.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input {
    flex: 1; max-width: 320px; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}

.form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
.form input, .form select, .form textarea {
    font-family: inherit;
    font-size: 14px;
    font-weight: normal;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.notes-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 12px;
    white-space: pre-wrap;
}

.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #e5e7eb;
    color: #374151;
}
.badge.stage-lead { background: var(--accent-blue-light); color: var(--accent-blue); }
.badge.stage-qualified { background: var(--accent-purple-light); color: var(--accent-purple); }
.badge.stage-proposal { background: var(--accent-amber-light); color: var(--accent-amber); }
.badge.stage-negotiation { background: #ffe4e0; color: #c2410c; }
.badge.stage-won { background: var(--primary-light); color: var(--primary); }
.badge.stage-lost { background: var(--accent-coral-light); color: var(--accent-coral); }

.note-form { display: flex; gap: 8px; margin-bottom: 16px; align-items: flex-start; }
.note-form textarea {
    flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: inherit; resize: vertical;
}

.note-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.note-list li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.note-list p { margin: 4px 0; white-space: pre-wrap; }
.note-meta { color: var(--text-muted); font-size: 12px; font-weight: 600; }

/* Feed widget on dashboard */
.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.feed-item { display: flex; gap: 10px; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.feed-dot.feed-dot-activity { background: var(--accent-blue); }
.feed-body { font-size: 13.5px; }
.feed-meta { color: var(--text-muted); font-size: 12px; font-weight: 600; margin-bottom: 2px; }

/* Upcoming invoices widget */
.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.upcoming-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
}
.upcoming-item a { color: var(--text); text-decoration: none; font-weight: 700; }
.upcoming-item a:hover { color: var(--primary); }
.upcoming-due { font-size: 12px; color: var(--text-muted); }
.upcoming-due.is-overdue { color: var(--accent-coral); font-weight: 700; }
.upcoming-amount { font-weight: 700; }

.board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.board-column {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 0 12px;
    min-width: 230px;
    flex: 1;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.board-column-header {
    padding: 12px 14px;
    color: #fff;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.board-column-body { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; transition: background 0.12s ease; border-radius: var(--radius-sm); }
.board-column-body.drag-over { background: var(--primary-light); outline: 2px dashed var(--primary); outline-offset: -2px; }
.deal-card { cursor: grab; }
.deal-card.dragging { opacity: 0.4; cursor: grabbing; }

.col-lead .board-column-header { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.col-qualified .board-column-header { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.col-proposal .board-column-header { background: linear-gradient(135deg, #fbbf24, #d97706); }
.col-negotiation .board-column-header { background: linear-gradient(135deg, #fb923c, #c2410c); }
.col-won .board-column-header { background: linear-gradient(135deg, #22c55e, #0b6e1f); }
.col-lost .board-column-header { background: linear-gradient(135deg, #fb7185, #e11d48); }

.col-count { font-weight: 600; opacity: 0.9; }

.deal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.deal-card:hover { transform: translateY(-1px) translateX(1px); box-shadow: var(--shadow-md); }
.deal-card.stage-lead { border-left-color: var(--accent-blue); }
.deal-card.stage-qualified { border-left-color: var(--accent-purple); }
.deal-card.stage-proposal { border-left-color: var(--accent-amber); }
.deal-card.stage-negotiation { border-left-color: #c2410c; }
.deal-card.stage-won { border-left-color: var(--primary); }
.deal-card.stage-lost { border-left-color: var(--accent-coral); }

.deal-card a { text-decoration: none; color: var(--text); font-weight: 700; font-size: 14px; }
.deal-card a:hover { color: var(--primary); }
.deal-card-meta { color: var(--text-muted); font-size: 12px; margin: 6px 0; }
.deal-card-value { font-weight: 800; color: var(--primary); font-size: 14px; margin: 4px 0; }
.stage-move-form select { width: 100%; font-size: 12px; padding: 5px; border-radius: 5px; border: 1px solid var(--border); margin-top: 6px; }

/* Auth pages */
.auth-wrap {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.auth-logo { max-height: 60px; max-width: 220px; margin-bottom: 16px; border-radius: 6px; }
.auth-title { font-size: 22px; margin: 0 0 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 26px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 700; }
.auth-form input {
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.auth-submit { width: 100%; justify-content: center; margin-top: 6px; padding: 11px; font-size: 15px; }

/* Invoices */
.page-hint { color: var(--text-muted); font-size: 14px; margin: -8px 0 16px; }

.settings-links { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.settings-link-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    flex: 1;
    min-width: 220px;
}
.settings-link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.settings-link-card strong { display: block; font-size: 14.5px; }
.settings-link-card small { display: block; color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.settings-link-icon {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
}
.settings-link-icon.c-amber { background: var(--accent-amber-light); color: var(--accent-amber); }
.settings-link-icon.c-blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.settings-link-icon.c-purple { background: var(--accent-purple-light); color: var(--accent-purple); }

.logo-preview { margin: 6px 0; }
.logo-preview img { max-height: 80px; max-width: 100%; border: 1px solid var(--border); border-radius: 4px; }
.checkbox-label { display: flex !important; flex-direction: row !important; align-items: center; gap: 6px; font-weight: normal !important; font-size: 13px !important; margin: 4px 0; }
.invoice-logo { max-height: 70px; max-width: 260px; margin-bottom: 10px; }

.badge.invoice-draft { background: #e5e7eb; color: #374151; }
.badge.invoice-sent { background: var(--accent-blue-light); color: var(--accent-blue); }
.badge.invoice-paid { background: var(--primary-light); color: var(--primary); }
.badge.invoice-void { background: #f3f4f6; color: #6b7280; }
.badge.invoice-overdue { background: var(--accent-coral-light); color: var(--accent-coral); }
.badge.recurring-badge { background: var(--accent-purple-light); color: var(--accent-purple); }

.status-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    font-size: 14px;
}
.status-form select { padding: 7px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.invoice-form { max-width: 920px; }

.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }

.recurring-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--accent-purple-light);
    border: 1px solid #e4d8fd;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.recurring-box input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent-purple); flex-shrink: 0; }
.recurring-box label { margin: 0 !important; font-weight: 600 !important; font-size: 13.5px !important; color: #4c1d95; }

.line-items-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.catalog-picker {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    background: var(--primary-light);
    border: 1px solid #cdeed3;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.catalog-picker select { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-family: inherit; font-size: 13.5px; max-width: 320px; flex: 1; }
.catalog-picker a { font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; }

.item-table { table-layout: fixed; }
.item-table th:nth-child(1), .item-table td:nth-child(1) { width: auto; }
.item-table th:nth-child(2), .item-table td:nth-child(2) { width: 80px; }
.item-table th:nth-child(3), .item-table td:nth-child(3) { width: 130px; }
.item-table th:nth-child(4), .item-table td:nth-child(4) { width: 110px; }
.item-table th:nth-child(5), .item-table td:nth-child(5) { width: 70px; }

.item-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}
.item-table .amount-cell { font-size: 14px; white-space: nowrap; }

.invoice-totals {
    max-width: 320px;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 0;
    font-size: 14px;
}
.invoice-totals .total-line { font-weight: 800; font-size: 17px; color: var(--primary); border-top: 1px solid var(--border); padding-top: 8px; }
.invoice-totals div { display: flex; justify-content: space-between; }

.invoice-sheet {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 5px solid var(--primary);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 760px;
    box-shadow: var(--shadow-sm);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.invoice-from h2 { margin: 0 0 6px; font-size: 18px; }
.invoice-from div { font-size: 14px; color: var(--text-muted); }
.invoice-meta { text-align: right; font-size: 14px; }
.invoice-title { font-size: 22px; font-weight: 800; letter-spacing: 0.05em; margin-bottom: 8px; color: var(--primary); }

.invoice-billto { margin-bottom: 20px; font-size: 14px; }
.invoice-billto div { color: var(--text-muted); }

.invoice-items-table { margin-bottom: 4px; }

.invoice-notes, .invoice-footer {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: pre-wrap;
}
.invoice-footer { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 20px; }

@media print {
    .topnav, .no-print, .form-actions { display: none !important; }
    body { background: #fff; }
    .container { padding: 0; max-width: none; }
    .invoice-sheet { border: none; padding: 0; max-width: none; box-shadow: none; }
}
