:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #637083;
    --line: #dbe2ec;
    --primary: #0f7fa8;
    --primary-dark: #0b5f7d;
    --accent: #1d9a72;
    --danger: #b93232;
    --shadow: 0 18px 50px rgba(25, 37, 52, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    display: grid;
    grid-template-columns: 260px 1fr;
}

a {
    color: var(--primary);
    text-decoration: none;
}

.sidebar {
    min-height: 100vh;
    padding: 24px 18px;
    background: #101820;
    color: #fff;
    position: sticky;
    top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 8px 6px 26px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #9fb1c4;
    margin-top: 2px;
}

nav {
    display: grid;
    gap: 6px;
}

nav a {
    color: #c9d5e1;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 650;
}

nav a:hover,
nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.nav-logout {
    margin: 10px 0 0;
}

.nav-logout button {
    width: 100%;
    justify-content: flex-start;
    border: 0;
    background: transparent;
    color: #c9d5e1;
    padding: 12px 14px;
}

.nav-logout button:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.main {
    padding: 34px;
    max-width: 1320px;
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: 0;
}

.page-header p {
    margin: 8px 0 0;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 6px !important;
    color: var(--primary) !important;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

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

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

.button.danger {
    color: #fff;
    border-color: var(--danger);
    background: var(--danger);
}

.button.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.button-row,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.button-row form {
    margin: 0;
}

.panel,
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
    margin-bottom: 22px;
}

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

.panel h2,
.panel-header h2 {
    margin: 0;
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat {
    padding: 20px;
}

.stat span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 650;
}

.stat strong {
    font-size: 28px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.empty,
.muted {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #e9f6f2;
    color: #126c53;
    font-size: 12px;
    font-weight: 800;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.actions form {
    margin: 0;
}

.actions button {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 750;
}

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

.notice {
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid #b8e2d4;
    background: #eefaf6;
    color: #126c53;
    margin-bottom: 18px;
    font-weight: 650;
}

.notice.danger {
    border-color: #f0b7b7;
    background: #fff1f1;
    color: #9f2424;
}

.auth-page {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg);
}

.auth-shell {
    width: min(100%, 430px);
}

.auth-card {
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.auth-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-header h1 {
    margin: 0;
    font-size: 28px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: #2c3745;
    font-weight: 700;
}

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

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

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

.items-block {
    margin: 24px 0;
}

.items-table {
    display: grid;
    gap: 8px;
}

.items-head,
.item-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 110px 140px 140px 42px;
    gap: 10px;
    align-items: center;
}

.items-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.item-row output {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    background: #f2f5f9;
    font-weight: 800;
}

.item-row [data-remove-item] {
    width: 38px;
    min-height: 38px;
    padding: 0;
    color: var(--danger);
}

.invoice-total {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 18px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.invoice-total span {
    color: var(--muted);
    font-weight: 750;
}

.invoice-total strong {
    font-size: 24px;
}

.invoice-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.setup-list {
    line-height: 1.8;
}

@media (max-width: 860px) {
    body {
        display: block;
    }

    .sidebar {
        position: static;
        min-height: 0;
    }

    .main {
        padding: 22px;
    }

    .page-header,
    .invoice-preview {
        display: block;
    }

    .page-header .button,
    .page-header .button-row {
        margin-top: 16px;
    }

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

    .items-head {
        display: none;
    }

    .item-row {
        grid-template-columns: 1fr;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
    }
}
