:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a2d4a;
    --sidebar-text: #c8d8ea;
    --sidebar-active-bg: #2563eb;
    --sidebar-hover-bg: #1e3a5f;
    --topbar-height: 56px;
    --brand-color: #2563eb;
}

/* ── Layout ── */
body {
    background: #f0f4f8;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    margin: 0;
}

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: .625rem;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    letter-spacing: .02em;
}

.sidebar-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav {
    list-style: none;
    padding: .75rem 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .55rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0;
    transition: background .15s, color .15s;
    font-size: .875rem;
    white-space: nowrap;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

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

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: .5rem 1.25rem;
}

.sidebar-footer {
    padding: .875rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column;
    gap: .125rem;
    font-size: .75rem;
    color: rgba(200,216,234,.7);
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-title {
    font-weight: 600;
    color: #1e293b;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    color: #64748b;
    padding: .25rem;
    display: none;
}

/* ── Auth Page ── */
.auth-body {
    background: linear-gradient(135deg, #1a2d4a 0%, #2563eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

/* ── Cards ── */
.stat-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    transition: box-shadow .2s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-label {
    font-size: .8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* ── Tables ── */
.table-card {
    background: #fff;
    border-radius: .75rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* ── Items Editor ── */
.items-table th { font-size: .8rem; }
.items-table input { font-size: .875rem; }

/* ── PDF template ── */
.pdf-wrap { font-family: DejaVu Sans, sans-serif; font-size: 10pt; }
.pdf-header { display: flex; justify-content: space-between; margin-bottom: 20px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
}

/* ── Utilities ── */
.text-money { font-variant-numeric: tabular-nums; font-weight: 600; }
.badge { font-size: .75rem; }
.form-section { background: #fff; border-radius: .75rem; border: 1px solid #e2e8f0; padding: 1.5rem; margin-bottom: 1.5rem; }
.form-section-title { font-size: .9rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid #e2e8f0; }
