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

/* ─── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8f9fc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f4f9;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg-sidebar-active: rgba(99, 132, 255, 0.15);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);

    --success: #10b981;
    --success-dark: #059669;
    --success-glow: rgba(16, 185, 129, 0.2);

    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-glow: rgba(239, 68, 68, 0.2);

    --warning: #f59e0b;
    --warning-dark: #d97706;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px -4px rgba(0, 0, 0, 0.1), 0 8px 16px -6px rgba(0, 0, 0, 0.05);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-width: 280px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ─── Sidebar ──────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-header {
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    transition-property: background, color, border-color;
    text-decoration: none;
    text-align: left;
    width: 100%;
}

.sidebar-btn:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-btn.active {
    background: var(--bg-sidebar-active);
    color: var(--accent-light);
    border-color: rgba(99, 132, 255, 0.1);
}

.sidebar-btn-logout {
    margin-top: 4px;
    color: #fca5a5;
}

.sidebar-btn-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}

.sidebar-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* ─── Sidebar Tabs ─────────────────────────────────────── */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 14px;
    gap: 4px;
}

.sidebar-tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    color: #64748b;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    border-bottom: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-tab:hover {
    color: #cbd5e1;
}

.sidebar-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent-light);
}

.sidebar-section {
    padding: 14px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-tab-content {
    display: none;
}

.sidebar-tab-content.active {
    display: block;
}

.sidebar-section h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 600;
}

.sheets-list,
.customers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sheet-item,
.customer-item {
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-base);
    transition-property: background, border-color;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-item:hover,
.customer-item:hover {
    background: var(--bg-sidebar-hover);
}

.sheet-item.active,
.customer-item.active {
    background: var(--bg-sidebar-active);
    border-color: rgba(99, 132, 255, 0.12);
}

.sheet-item-info,
.customer-item-info {
    flex: 1;
    min-width: 0;
}

.sheet-item-name,
.customer-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 1px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-item.active .sheet-item-name,
.customer-item.active .customer-item-name {
    color: #fff;
}

.sheet-item-customer,
.customer-item-meta {
    font-size: 0.72rem;
    color: #64748b;
}

.sheet-item.active .sheet-item-customer,
.customer-item.active .customer-item-meta {
    color: rgba(255, 255, 255, 0.6);
}

.item-delete-btn {
    background: transparent;
    border: none;
    color: #64748b;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0;
    transition: var(--transition-fast);
    transition-property: opacity, background, color;
    flex-shrink: 0;
    margin-left: 6px;
}

.sheet-item:hover .item-delete-btn,
.customer-item:hover .item-delete-btn {
    opacity: 1;
}

.item-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.customer-item-sheets {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
}

.empty-hint {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.6;
    padding: 12px 4px;
}

/* ─── Main Content ─────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ─── Welcome Screen ───────────────────────────────────── */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
}

.welcome-box {
    text-align: center;
    max-width: 520px;
    padding: 56px 48px;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.welcome-box h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.welcome-box p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.6;
}

.welcome-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-large {
    padding: 15px 32px;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}

/* ─── Sheet Header ─────────────────────────────────────── */
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding: 24px 28px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.sheet-info h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sheet-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sheet-actions {
    display: flex;
    gap: 8px;
}

/* ─── Costing Sheet ────────────────────────────────────── */
.costing-sheet {
    max-width: 1200px;
}

/* ─── Customer Choice Radio ────────────────────────────── */
.customer-choice {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    font-weight: 500;
    font-size: 0.9rem;
}

.radio-label:hover {
    border-color: var(--accent-light);
    background: rgba(99, 102, 241, 0.04);
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ─── Legacy Container ─────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

header {
    text-align: center;
    margin-bottom: 36px;
    padding: 28px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px var(--accent-glow);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1rem;
    opacity: 0.85;
}

/* ─── Dashboard ────────────────────────────────────────── */
.dashboard {
    margin-bottom: 28px;
}

.dashboard h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

.card {
    background: var(--bg-surface);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: left;
    transition: var(--transition-smooth);
    transition-property: transform, box-shadow;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
    transition: var(--transition-base);
}

.card:nth-child(1)::after { background: var(--accent); }
.card:nth-child(2)::after { background: var(--warning); }
.card:nth-child(4)::after { background: #06b6d4; }

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card.profit {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 20px var(--success-glow);
}

.card.profit::after {
    display: none;
}

.card h3 {
    font-size: 0.7rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.card.profit h3 {
    color: rgba(255, 255, 255, 0.8);
}

.amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.card.profit .amount {
    color: white;
}

.percentage {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* ─── Costs Sections ───────────────────────────────────── */
.costs-section {
    background: var(--bg-surface);
    padding: 28px;
    margin-bottom: 20px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.customer-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: var(--transition-base);
    transition-property: transform, box-shadow, border-color;
}

.customer-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.customer-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.customer-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.customer-card-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.costs-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

.costs-section h2::before {
    content: '';
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 3px;
    flex-shrink: 0;
}

.input-group {
    margin-bottom: 20px;
}

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition-base);
    transition-property: background, transform, box-shadow, border-color;
    text-transform: none;
    letter-spacing: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow-xs);
    position: relative;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 1px 3px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 1px 3px var(--danger-glow);
}

.btn-danger:hover {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px var(--danger-glow);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 1px 3px var(--success-glow);
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: white;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: var(--warning-dark);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    box-shadow: none;
}

/* ─── Tables ───────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.costs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.costs-table th,
.costs-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.costs-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.costs-table tbody tr {
    transition: background var(--transition-fast);
}

.costs-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.02);
}

.costs-table tbody tr:last-child td {
    border-bottom: none;
}

.costs-table .profit-positive {
    color: var(--success-dark);
    font-weight: 700;
}

.costs-table .profit-negative {
    color: var(--danger);
    font-weight: 700;
}

/* ─── Export Section ───────────────────────────────────── */
.export-section {
    background: var(--bg-surface);
    padding: 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--border);
}

.export-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── Modals ───────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-surface);
    margin: 6vh auto;
    padding: 32px;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 460px;
    position: relative;
    animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

@keyframes slideIn {
    from {
        transform: translateY(-16px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 20px;
    font-weight: 400;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.close:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.modal h2 {
    margin-bottom: 24px;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* ─── Forms ────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition-base);
    transition-property: border-color, box-shadow, background;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-surface);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ─── Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* ─── Admin Page ───────────────────────────────────────── */
.admin-header {
    margin-bottom: 28px;
    padding: 24px 28px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.admin-header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.admin-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-access-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition-base);
}

.user-access-card:hover {
    box-shadow: var(--shadow-sm);
}

.user-access-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-actions {
    display: flex;
    gap: 6px;
}

.btn-delete-user,
.btn-reset-password {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.btn-delete-user {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.btn-delete-user:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-reset-password {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.btn-reset-password:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.btn-reset-2fa {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.btn-reset-2fa:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}

.user-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.user-badge.totp {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-dark);
}

/* ─── Message Boxes ────────────────────────────────────── */
.message-box {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 0.9rem;
}

.message-box.success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success-dark);
}

.message-box.error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger-dark);
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.user-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-primary);
    color: var(--text-muted);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-badge.admin {
    background: var(--success);
    color: white;
}

.customer-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-base);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.checkbox-label:hover {
    border-color: var(--accent-light);
    background: rgba(99, 102, 241, 0.04);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .sidebar-header {
        width: 100%;
        padding: 14px 16px;
        text-align: center;
    }

    .sidebar-nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 8px 10px;
        gap: 4px;
    }

    .sidebar-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        flex: 0 0 auto;
    }

    .sidebar-section {
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .sidebar-section h3 {
        text-align: center;
    }

    .sheets-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .sheet-item {
        flex: 0 0 auto;
        min-width: 140px;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .welcome-box {
        padding: 32px 24px;
    }

    .welcome-box h1 {
        font-size: 1.5rem;
    }

    .welcome-actions {
        flex-direction: column;
    }

    .sheet-header {
        flex-direction: column;
        gap: 14px;
    }

    .sheet-actions {
        width: 100%;
        justify-content: center;
    }

    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .costs-table {
        font-size: 0.85rem;
    }

    .costs-table th,
    .costs-table td {
        padding: 8px 10px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

/* ─── Print ────────────────────────────────────────────── */
.print-only {
    display: none;
}

@media print {
    body {
        background: white;
    }

    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .costs-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .costs-table {
        page-break-inside: auto;
    }

    .sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}

/* ─── Row Animation ────────────────────────────────────── */
@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
