:root {
    --ink: #182033;
    --muted: #667085;
    --line: #dde5ee;
    --paper: #ffffff;
    --bg: #f4f7f9;
    --nav: #11243d;
    --brand: #0f766e;
    --brand-dark: #0b4f4a;
    --gold: #f0b34d;
    --danger: #c2410c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a {
    color: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    padding: 22px;
    background: var(--nav);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.brand span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--gold);
    color: var(--nav);
    font-weight: 800;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar a {
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
}

.sidebar a:hover,
.logout:hover {
    background: rgba(255, 255, 255, .09);
    color: #fff;
}

.logout {
    margin-top: auto;
}

.main {
    margin-left: 240px;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.topbar p,
.section-title p,
.hero-panel p,
.muted,
.hint,
small {
    color: var(--muted);
}

.hero-panel,
.panel,
.invoice-page,
.stats article,
.login-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(16, 24, 40, .06);
}

.hero-panel {
    padding: 32px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff, #eef8f7);
}

.hero-panel h1 {
    max-width: 760px;
    margin: 6px 0 0;
    font-size: clamp(2rem, 4vw, 3.7rem);
    line-height: 1;
}

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

.stats article {
    padding: 22px;
}

.stats span {
    font-size: 1.8rem;
    font-weight: 800;
}

.panel,
.invoice-page {
    padding: 24px;
    margin-bottom: 20px;
}

.narrow {
    max-width: 680px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.section-title h1 {
    margin: 0;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-size: .85rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

.wide {
    grid-column: 1 / -1;
}

button,
.primary {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}

.primary {
    background: var(--brand);
    color: #fff;
}

.primary:hover {
    background: var(--brand-dark);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: .78rem;
    text-transform: uppercase;
    color: var(--muted);
}

td small {
    display: block;
    margin-top: 3px;
}

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

.actions a,
.actions button {
    color: var(--brand);
    background: transparent;
    padding: 0;
    font-weight: 800;
    text-decoration: none;
}

.actions button {
    color: var(--danger);
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: .78rem;
    font-weight: 800;
    background: #eef2f6;
    color: #475467;
}

.paid,
.active {
    background: #dcfce7;
    color: #166534;
}

.unpaid,
.paused {
    background: #fff7ed;
    color: #9a3412;
}

.overdue,
.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--nav), #0f766e);
}

.login-card {
    width: min(420px, 100%);
    padding: 28px;
}

.login-card h1 {
    margin-bottom: 0;
}

.login-card label {
    margin-top: 14px;
}

.login-card button {
    width: 100%;
    margin-top: 16px;
}

.mark {
    margin-bottom: 24px;
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
    margin: 14px 0;
}

.hint {
    font-size: .78rem;
}

.invoice-head,
.invoice-meta {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.total {
    margin-top: 20px;
    text-align: right;
    font-size: 1.6rem;
    font-weight: 900;
}

.print {
    margin-top: 18px;
    float: right;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
    }

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

    .stats,
    .grid-form {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}

@media print {
    .sidebar,
    .topbar,
    .print {
        display: none;
    }

    .main {
        margin: 0;
        padding: 0;
    }

    .invoice-page {
        box-shadow: none;
        border: 0;
    }
}
