:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-strong: #eef4f7;
    --text: #17222b;
    --muted: #647482;
    --border: #d8e1e8;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --navy: #17324d;
    --warning: #b7791f;
    --danger: #b42318;
    --success: #047857;
    --shadow: 0 18px 48px rgba(23, 50, 77, .08);
    --radius: 8px;
    --focus: 0 0 0 3px rgba(15, 118, 110, .18);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.login-body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, .10), rgba(23, 50, 77, .02)),
        var(--bg);
}

.login-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 48px;
    align-items: center;
    width: min(1120px, calc(100vw - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 40px 0;
}

.login-copy h1 {
    max-width: 760px;
    margin: 24px 0 18px;
    font-size: clamp(42px, 7vw, 78px);
    line-height: .98;
    font-weight: 760;
}

.login-copy p {
    max-width: 600px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.brand-row,
.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
}

.brand {
    width: 100%;
    padding: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand small,
.kicker,
.muted,
.demo-note {
    color: var(--muted);
}

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

.login-panel,
.setup-panel {
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
}

.login-panel h2 {
    margin: 0 0 22px;
    font-size: 26px;
}

.login-panel form,
.admin-form,
.filter-bar {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: #314250;
    font-size: 13px;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.side-nav {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #edf6f7;
    background: var(--navy);
}

.side-nav nav {
    display: grid;
    gap: 4px;
    padding: 20px 14px;
}

.side-nav nav a {
    padding: 12px 14px;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, .78);
    font-weight: 650;
}

.side-nav nav a.active,
.side-nav nav a:hover {
    color: white;
    background: rgba(255, 255, 255, .10);
}

.side-footer {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding: 18px 22px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .72);
    font-size: 14px;
}

.side-footer a {
    color: white;
    font-weight: 700;
}

.main-area {
    min-width: 0;
    padding: 28px;
}

.top-bar {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.top-bar h1 {
    margin: 2px 0 0;
    font-size: 32px;
    line-height: 1.15;
}

.kicker {
    margin: 0;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: uppercase;
}

.customer-switch {
    display: grid;
    gap: 8px;
    width: min(380px, 42vw);
}

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

.metric-panel,
.work-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(23, 50, 77, .05);
}

.metric-panel {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.metric-panel span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-panel strong {
    font-size: 34px;
    line-height: 1;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr);
    gap: 18px;
}

.work-panel {
    padding: 18px;
}

.work-panel.wide {
    min-height: 320px;
}

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

.panel-head h2,
.subsection h3 {
    margin: 0;
}

.text-button {
    color: var(--accent);
    font-weight: 750;
}

.primary-button,
.ghost-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 760;
}

.primary-button {
    padding: 0 18px;
    color: white;
    background: var(--accent);
}

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

.ghost-button {
    padding: 0 14px;
    border: 1px solid var(--border);
    color: var(--text);
    background: white;
}

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

.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.icon-button {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    color: white;
    background: var(--accent);
}

.icon-button.muted {
    color: var(--warning);
    border: 1px solid var(--border);
    background: white;
}

.flash {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-weight: 700;
}

.flash.success {
    color: var(--success);
    background: #e7f7ef;
}

.flash.error {
    color: var(--danger);
    background: #fff0ef;
}

.empty-state {
    display: grid;
    place-items: start;
    gap: 8px;
    min-height: 180px;
    padding: 28px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.empty-state h3,
.empty-state p {
    margin: 0;
}

.detail-list {
    display: grid;
    gap: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-list div {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.detail-list div:last-child {
    border-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

.catalog-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.catalog-tabs a {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 750;
    background: white;
}

.catalog-tabs a.active {
    color: white;
    border-color: var(--accent);
    background: var(--accent);
}

.catalog-tabs.compact {
    margin: 0;
}

.filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
    align-items: end;
    margin-bottom: 16px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    background: white;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

.data-table th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.data-table td span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.row-form {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.row-form input[type="number"] {
    width: 78px;
    min-height: 38px;
}

.inline-check {
    display: inline-flex;
    grid-template-columns: none;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.inline-check input {
    width: 16px;
    min-height: 16px;
}

.subsection {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

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

.admin-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}

.admin-form .primary-button {
    align-self: end;
}

@media (max-width: 980px) {
    .login-screen,
    .app-shell,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .side-nav {
        position: static;
        height: auto;
    }

    .side-nav nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .top-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .customer-switch {
        width: 100%;
    }

    .summary-grid,
    .filter-bar,
    .admin-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main-area {
        padding: 18px;
    }

    .login-screen {
        width: min(100vw - 24px, 460px);
    }

    .login-copy h1 {
        font-size: 40px;
    }

    .side-nav nav {
        grid-template-columns: 1fr 1fr;
    }

    .detail-list div {
        grid-template-columns: 1fr;
    }
}

