@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== VARIABLES ===== */
:root {
    --brand-navy: #0D2249;
    --brand-blue: #3498DB;
    --brand-blue-light: #5DADE2;
    --brand-blue-pale: #EBF5FB;
    --brand-blue-glow: rgba(52, 152, 219, 0.1);

    --bg: #F4F6F9;
    --bg-white: #FFFFFF;
    --text: #1A1D23;
    --text-secondary: #5F6B7A;
    --text-muted: #9CA3AF;
    --border: #E2E8F0;
    --border-light: #F1F3F5;

    --green: #10B981;
    --green-bg: #ECFDF5;
    --orange: #F59E0B;
    --orange-bg: #FFFBEB;
    --red: #EF4444;
    --red-bg: #FEF2F2;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
}

/* ===== AUTH SCREEN ===== */
#auth-screen {
    position: fixed;
    inset: 0;
    background: var(--brand-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.auth-card {
    background: var(--bg-white);
    padding: 36px 28px;
    border-radius: 16px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.auth-logo { font-size: 40px; margin-bottom: 8px; }

.auth-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 4px;
}

.auth-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-error {
    color: var(--red);
    font-size: 13px;
    margin-top: 12px;
}

/* OAuth Buttons */
.oauth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    margin-bottom: 12px;
}

.google-btn {
    background: #FFFFFF;
    color: #3c4043;
    border: 1px solid var(--border);
}
.google-btn:hover { background: #f8f9fa; box-shadow: var(--shadow); }

.apple-btn {
    background: #000000;
    color: #FFFFFF;
    border: 1px solid #000000;
}
.apple-btn:hover { background: #1a1a1a; box-shadow: var(--shadow); }

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--brand-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-spinner {
    border: 3px solid rgba(255,255,255,0.2);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOP BAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--brand-topbar, var(--brand-navy));
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon { font-size: 20px; }

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(255,255,255,0.15);
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}
.topbar-btn:hover { background: rgba(255,255,255,0.2); }

/* ===== NAVIGATION ===== */
.nav-bar {
    display: flex;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 15;
    padding: 0;
}

.nav-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 0 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
}

.nav-btn.active {
    color: var(--brand-blue);
    border-bottom-color: var(--brand-blue);
}

.nav-btn svg { flex-shrink: 0; opacity: 0.6; }
.nav-btn.active svg { opacity: 1; }

/* ===== MAIN CONTENT ===== */
.main-content { padding: 0; }

/* ===== TAB CONTENT ===== */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== TAB HEADERS ===== */
.tab-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 12px;
}

.tab-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-navy);
    margin: 0;
}

.tab-header-count {
    background: var(--brand-blue);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    min-width: 28px;
    text-align: center;
}

/* ===== STAT GRID ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 16px;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    order: 3;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-navy);
    line-height: 1.1;
    order: 2;
}

/* ===== CHART GRID ===== */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 16px 12px;
}

.chart-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chart-header {
    padding: 12px 16px 0;
}

.chart-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.chart-body {
    padding: 12px 16px 16px;
    position: relative;
    height: 220px;
}

.chart-body-sm {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-body canvas {
    max-width: 100%;
}

/* ===== SECTION CARDS ===== */
.section-card {
    background: var(--bg-white);
    margin: 0 16px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.section-card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.section-card-header-row h3 {
    border-bottom: none;
}

/* ===== ITEM LIST ===== */
.item-list { min-height: 40px; }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.1s;
}

.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--brand-blue-pale); }
.list-item:hover { background: var(--bg); }

.list-item-left { flex: 1; min-width: 0; }

.list-item-id {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-blue);
    letter-spacing: 0.3px;
}

.list-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.list-item-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.list-item-right {
    text-align: right;
    flex-shrink: 0;
    margin-left: 12px;
}

.list-item-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge-active { background: var(--green-bg); color: var(--green); }
.badge-proceed { background: #EDE9FE; color: #7C3AED; }
.badge-quote { background: var(--orange-bg); color: var(--orange); }
.badge-lead { background: var(--brand-blue-pale); color: var(--brand-blue); }
.badge-delayed { background: var(--red-bg); color: var(--red); }
.badge-complete { background: #F3F4F6; color: #6B7280; }

/* ===== FILTER ROW ===== */
.filter-row {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-light);
}

.filter-btn {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--brand-navy);
    color: white;
    border-color: var(--brand-navy);
}

/* ===== SEARCH INPUT ===== */
.search-input-inline {
    font-family: var(--font);
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-inline:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-glow);
    background: var(--bg-white);
}

/* ===== FORM ELEMENTS ===== */
label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: -6px;
}

.hint-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input, select, textarea {
    font-family: var(--font);
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-glow);
    background: var(--bg-white);
}

/* ===== BUTTONS ===== */
.action-btn {
    font-family: var(--font);
    background: var(--brand-blue);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.action-btn:hover { background: var(--brand-navy); }

.small-btn {
    font-family: var(--font);
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-blue);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.small-btn:hover { border-color: var(--brand-blue); background: var(--brand-blue-pale); }

/* ===== OVERLAY ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.overlay.hidden { display: none !important; }

/* ===== EDIT MODAL ===== */
.edit-modal {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 92%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-white);
    border-radius: 16px 16px 0 0;
    z-index: 1;
}

.edit-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-navy);
    margin: 0;
}

.edit-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

/* ===== JOB DETAIL BODY ===== */
.job-detail-body {
    padding: 16px 20px 20px;
}

.detail-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

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

.detail-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 16px;
}

.detail-field.full-width { grid-column: 1 / -1; }

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
    color: var(--text);
    word-break: break-word;
}

/* ===== FINANCIAL SECTIONS ===== */
.fin-section { margin-bottom: 16px; }

.fin-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 8px;
}

/* Hours table in job detail */
.hours-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
}

.hours-table-header {
    display: grid;
    grid-template-columns: 1fr 70px 70px;
    padding: 8px 12px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
}

.hours-group { border-bottom: 1px solid var(--border-light); }
.hours-group:last-child { border-bottom: none; }

.hours-group-header {
    display: grid;
    grid-template-columns: 1fr 70px 70px;
    padding: 8px 12px;
    background: rgba(52,152,219,0.04);
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
}

.hours-group-header .emp-name { color: var(--text); }
.hours-group-header .emp-hours { text-align: right; }
.hours-group-header .emp-cost { text-align: right; color: var(--brand-blue); }

.hours-entry {
    display: grid;
    grid-template-columns: 1fr 70px 70px;
    padding: 5px 12px 5px 24px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.hours-entry:last-child { border-bottom: none; }
.hours-entry .entry-date { color: var(--text-muted); }
.hours-entry .entry-hours { text-align: right; }
.hours-entry .entry-cost { text-align: right; color: var(--text-muted); }

.hours-entry-notes {
    grid-column: 1 / -1;
    padding: 0 0 4px 0;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Financial summary rows */
.fin-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--brand-blue-pale);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
}

.fin-summary-row .sum-label { color: var(--text-secondary); }
.fin-summary-row .sum-value { color: var(--brand-navy); }

.fin-summary-detail {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Job total row (grand total) */
.fin-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin-top: 8px;
    background: var(--brand-navy);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 700;
}

/* PO items in job detail */
.po-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

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

.po-item-id { font-weight: 600; color: var(--brand-blue); margin-right: 8px; white-space: nowrap; }
.po-item-supplier { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-item-amount { font-weight: 600; margin-left: 8px; white-space: nowrap; }

.po-item-badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; white-space: nowrap; }
.po-badge-paid { background: rgba(16,185,129,0.12); color: var(--green); }
.po-badge-invoiced { background: rgba(52,152,219,0.12); color: var(--brand-blue); }
.po-badge-open { background: rgba(245,158,11,0.12); color: var(--orange); }

.po-list-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
}

/* ===== STATUS BAR (overview) ===== */
.status-bar-container { padding: 12px 16px; }

.status-bar {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.status-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    min-width: 20px;
    transition: flex 0.3s;
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.status-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.status-legend-count {
    font-weight: 600;
    color: var(--text);
}

/* ===== PO SUMMARY ROW ===== */
.po-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px 12px;
}

.po-summary-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.po-summary-item .sum-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-navy);
}

.po-summary-item .sum-lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== PAYROLL TAB ===== */
.payroll-stat {
    display: flex;
    gap: 4px;
    align-items: baseline;
}

.payroll-hours {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

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

.payroll-rate-badge {
    font-size: 11px;
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 4px;
    display: inline-block;
}

/* ===== SETTINGS TAB ===== */
.settings-body {
    padding: 16px;
}

.settings-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.rate-default-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.rate-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rate-input-group:focus-within {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-glow);
    background: var(--bg-white);
}

.rate-prefix {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.rate-suffix {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.rate-default-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 11px 8px !important;
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-navy);
    text-align: center;
    width: 80px;
    flex-shrink: 0;
}

.rate-default-input:focus {
    box-shadow: none !important;
}

/* Employee rate rows */
.rate-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.rate-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.rate-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.rate-name-col {
    flex: 1;
    min-width: 0;
}

.rate-input {
    width: 90px;
    padding: 8px 10px;
    font-size: 14px;
    text-align: right;
}

.rate-save-btn {
    font-family: var(--font);
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.rate-save-btn:hover { background: var(--brand-navy); }

/* ===== SITE REPORTS IN JOB DETAIL ===== */
.report-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.report-item:last-child { border-bottom: none; }
.report-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.report-notes { color: var(--text-secondary); }
.report-materials { font-size: 12px; color: var(--brand-blue); margin-top: 2px; }

/* ===== SUCCESS OVERLAY ===== */
.success-card {
    background: var(--bg-white);
    padding: 36px 28px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 85%;
    max-width: 360px;
}

.success-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--green-bg);
    color: var(--green);
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.success-card h3 { color: var(--text); font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.success-card p { font-size: 13px; color: var(--text-muted); }

/* ===== EMPTY STATE ===== */
.empty-state {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== RECENT ACTIVITY ===== */
.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-icon.time { background: var(--green-bg); }
.activity-icon.po { background: var(--brand-blue-pale); }
.activity-icon.report { background: var(--orange-bg); }

.activity-text { flex: 1; color: var(--text-secondary); }
.activity-text strong { color: var(--text); font-weight: 600; }
.activity-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== DESKTOP LAYOUT (768px+) ===== */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
        overflow: hidden;
        height: 100vh;
    }

    #app {
        display: grid;
        grid-template-columns: 220px 1fr;
        grid-template-rows: auto 1fr;
        height: 100vh;
        overflow: hidden;
    }

    .topbar {
        grid-column: 1 / -1;
        grid-row: 1;
        padding: 14px 28px;
    }

    .brand-name { font-size: 18px; }

    .nav-bar {
        grid-column: 1;
        grid-row: 2;
        flex-direction: column;
        border-bottom: none;
        border-right: 1px solid var(--border);
        position: static;
        padding: 16px 0;
        overflow-y: auto;
        background: var(--bg-white);
    }

    .nav-btn {
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 24px;
        font-size: 14px;
        font-weight: 500;
        border-bottom: none;
        border-left: 3px solid transparent;
        border-radius: 0;
        transition: background 0.15s, color 0.15s;
    }

    .nav-btn:hover { background: var(--brand-blue-pale); color: var(--brand-blue); }

    .nav-btn.active {
        color: var(--brand-blue);
        border-bottom: none;
        border-left-color: var(--brand-blue);
        background: var(--brand-blue-pale);
        font-weight: 600;
    }

    .nav-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

    .main-content {
        grid-column: 2;
        grid-row: 2;
        overflow-y: auto;
        background: var(--bg);
        padding: 24px 32px;
    }

    .tab-header {
        padding: 0 0 16px;
    }

    .tab-header h2 { font-size: 22px; }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
        padding: 0 0 16px;
        max-width: 100%;
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
    .stat-value { font-size: 28px; }
    .stat-label { font-size: 12px; }

    .chart-grid {
        grid-template-columns: 1fr 1fr;
        padding: 0 0 16px;
        gap: 16px;
    }

    .chart-body { height: 240px; }

    .section-card {
        max-width: 100%;
        margin: 0 0 16px 0;
    }

    .po-summary-row {
        padding: 0 0 16px;
        gap: 16px;
    }

    .search-input-inline {
        max-width: 360px;
    }

    .filter-row { padding: 12px 16px; }

    .edit-modal {
        max-width: 560px;
        width: 560px;
    }

    #auth-screen .auth-card {
        padding: 48px 40px;
        max-width: 420px;
    }
}

@media (min-width: 1200px) {
    #app {
        grid-template-columns: 240px 1fr;
    }

    .chart-body { height: 260px; }
}
