:root {
    --bg: #f7f7f9;
    --panel: #ffffff;
    --panel-2: #fbfbfc;
    --text: #18181b;
    --muted: #71717a;
    --line: #e4e4e7;
    --brand: #0f766e;
    --brand-strong: #115e59;
    --brand-soft: #ccfbf1;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --shadow: 0 18px 45px rgba(24, 24, 27, 0.08);
    --sidebar: 280px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
}

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

button,
input,
select {
    font: inherit;
}

.shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar);
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px;
    background: #ffffff;
    border-right: 1px solid var(--line);
    transition: width 0.2s ease, transform 0.2s ease;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand), #15803d);
    font-weight: 800;
}

.brand-mark.large {
    width: 56px;
    height: 56px;
    font-size: 1.1rem;
}

.brand-mark.image-mark {
    width: 54px;
    height: 54px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(24, 24, 27, 0.08);
}

.brand-mark.image-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-brand .image-mark {
    width: 108px;
    height: 82px;
}

.brand-copy {
    min-width: 0;
    flex: 1;
}

.brand-copy strong,
.user-meta strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-copy span,
.user-meta small,
.eyebrow,
.panel-header p,
td small {
    color: var(--muted);
    font-size: 0.78rem;
}

.nav-list {
    display: grid;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    color: #3f3f46;
    font-weight: 650;
}

.nav-item:hover,
.nav-item.active {
    color: var(--brand-strong);
    background: var(--brand-soft);
}

.sidebar-footer {
    margin-top: auto;
}

.user-chip {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #ffffff;
    background: #27272a;
    font-weight: 800;
}

.main {
    min-width: 0;
    margin-left: var(--sidebar);
    padding: 22px;
    transition: margin-left 0.2s ease;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    margin-bottom: 18px;
}

.topbar h1,
.auth-brand h1 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 2px;
    text-transform: uppercase;
    font-weight: 800;
}

.topbar-actions {
    margin-left: auto;
}

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

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

.panel {
    padding: 18px;
}

.panel.narrow {
    max-width: 900px;
}

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

.panel-header h2 {
    margin: 0;
    font-size: 1rem;
}

.panel-header p {
    margin: 4px 0 0;
}

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

.stat-card {
    padding: 16px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.5rem;
}

.stat-card.warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.grid-two {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
    gap: 18px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

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

th {
    color: #52525b;
    background: #fafafa;
    font-size: 0.76rem;
    text-transform: uppercase;
}

td strong,
td small {
    display: block;
}

.right {
    text-align: right;
}

.actions-col {
    width: 132px;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.btn,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    font-weight: 750;
}

.btn {
    padding: 0 13px;
}

.btn.primary {
    border-color: var(--brand);
    color: #ffffff;
    background: var(--brand);
}

.btn.soft {
    border-color: transparent;
    color: var(--brand-strong);
    background: var(--brand-soft);
}

.btn.ghost {
    background: transparent;
}

.btn.wide {
    width: 100%;
}

.icon-btn {
    width: 38px;
    padding: 0;
}

.icon-btn.danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: transparent;
}

.icon,
.icon-btn svg,
.btn svg,
.nav-item svg {
    width: 18px;
    height: 18px;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.search-field {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.search-field input {
    width: 100%;
    border: 0;
    outline: 0;
}

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

.form-stack {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.field.wide,
.form-actions.wide {
    grid-column: 1 / -1;
}

.field span {
    color: #52525b;
    font-size: 0.82rem;
    font-weight: 750;
}

.field input,
.field select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    outline: 0;
}

.field input:focus,
.field select:focus,
.search-field:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: #f4f4f5;
    color: #52525b;
    font-size: 0.78rem;
    font-weight: 800;
}

.city-list {
    display: grid;
    gap: 10px;
}

.city-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.city-row small {
    color: var(--muted);
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    background: #ffffff;
}

.alert.success {
    color: var(--brand-strong);
    border-color: #99f6e4;
    background: #f0fdfa;
}

.alert.error {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.auth-page {
    background: linear-gradient(140deg, #0f766e 0%, #155e75 45%, #111827 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
}

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

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

.branding-preview {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 14px;
    margin-bottom: 18px;
}

.branding-preview article {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.branding-preview span {
    color: #52525b;
    font-size: 0.82rem;
    font-weight: 800;
}

.branding-preview small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.preview-logo,
.preview-icon {
    display: grid;
    place-items: center;
    min-height: 130px;
    border: 1px dashed #d4d4d8;
    border-radius: 8px;
    background: #ffffff;
}

.preview-logo img {
    max-width: 260px;
    max-height: 120px;
    object-fit: contain;
}

.preview-icon img {
    max-width: 96px;
    max-height: 96px;
    object-fit: contain;
}

.reset-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.empty-state,
.empty-cell {
    text-align: center;
    color: var(--muted);
}

.receipt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.receipt {
    max-width: 760px;
    margin: 0 auto;
    padding: 34px;
}

.receipt header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

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

.receipt-brand img {
    width: 112px;
    height: 82px;
    object-fit: contain;
}

.receipt h2 {
    margin: 0;
    font-size: 1.4rem;
}

.receipt dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 26px 0;
}

.receipt dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.receipt dd {
    margin: 4px 0 0;
    font-size: 1rem;
    font-weight: 750;
}

.receipt footer {
    display: grid;
    justify-items: end;
    gap: 40px;
    margin-top: 48px;
}

.signature-line {
    width: 220px;
    border-bottom: 1px solid #27272a;
}

.mobile-only {
    display: none;
}

.shell.is-collapsed {
    --sidebar: 78px;
}

.shell.is-collapsed .brand-copy,
.shell.is-collapsed .nav-label,
.shell.is-collapsed .user-meta {
    display: none;
}

.shell.is-collapsed .brand,
.shell.is-collapsed .nav-item,
.shell.is-collapsed .user-chip {
    justify-content: center;
}

.shell.is-collapsed .brand-mark.image-mark {
    width: 46px;
    height: 46px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        display: block;
    }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
    }

    .shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-shade {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(24, 24, 27, 0.45);
        z-index: 20;
    }

    .shell.sidebar-open .mobile-shade {
        display: block;
    }

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

    .topbar {
        align-items: center;
    }

    .topbar-actions .btn span:not(.icon) {
        display: none;
    }

    .mobile-only {
        display: inline-flex;
    }

    .desktop-only {
        display: none;
    }

    .panel-header,
    .toolbar,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid,
    .form-grid,
    .receipt dl,
    .branding-preview {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 14px;
    }

    .receipt {
        padding: 20px;
    }
}

@media print {
    .sidebar,
    .topbar,
    .receipt-actions,
    .alert {
        display: none !important;
    }

    .shell,
    .main,
    .content {
        display: block;
        padding: 0;
    }

    body {
        background: #ffffff;
    }

    .receipt {
        box-shadow: none;
        border: 0;
    }
}
