:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --line: #d6dde5;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --secondary: #334155;
    --danger: #b42318;
    --warning: #a16207;
    --success: #027a48;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 58px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
}

.brand {
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0;
}

.nav {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 16px;
    overflow-x: auto;
    white-space: nowrap;
}

.nav a {
    color: var(--secondary);
}

.logout {
    margin-left: auto;
}

.page {
    width: min(1160px, calc(100% - 32px));
    margin: 28px auto 56px;
}

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

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.15;
}

h2 {
    margin-bottom: 14px;
    font-size: 18px;
}

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

.panel,
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.panel {
    padding: 20px;
    margin-bottom: 18px;
}

.narrow {
    max-width: 560px;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.card {
    padding: 18px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 150px);
    place-items: center;
}

.auth-panel {
    width: min(420px, 100%);
}

form {
    margin: 0;
}

label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: #344054;
    font-weight: 600;
}

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

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

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

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

.primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.secondary {
    color: var(--secondary);
    border-color: #cbd5e1;
    background: #fff;
}

.link-button {
    min-height: auto;
    padding: 0;
    color: var(--secondary);
    border: 0;
    background: transparent;
    font-weight: 500;
}

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

.actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 11px 13px;
    background: #fff;
}

.flash.error {
    color: var(--danger);
    border-color: #f3b6ad;
    background: #fff5f5;
}

.flash.warning {
    color: var(--warning);
    border-color: #f5d48a;
    background: #fffbeb;
}

.flash.success {
    color: var(--success);
    border-color: #9bd5b7;
    background: #ecfdf3;
}

.status {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
}

.status.active {
    color: var(--success);
}

.status.inactive {
    color: var(--warning);
}

.metric,
.price {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
}

.quick-grid,
.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-grid a,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0 11px;
    color: var(--secondary);
    background: #f8fafc;
}

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

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

th {
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.empty,
.table-note {
    margin-bottom: 0;
}

.facts {
    display: grid;
    gap: 10px;
    margin: 0;
}

.facts div {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
    font-weight: 700;
}

.inline-form {
    display: inline-grid;
    grid-template-columns: 86px auto;
    gap: 8px;
    align-items: center;
}

.inline-form input {
    min-height: 34px;
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 14px 16px;
    }

    .nav {
        width: 100%;
        flex-wrap: wrap;
        overflow-x: visible;
        white-space: normal;
    }

    .logout {
        margin-left: 0;
    }

    .page-head,
    .grid.two,
    .field-row {
        grid-template-columns: 1fr;
    }

    .page-head {
        display: grid;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
