:root {
    --bg: #f4efe7;
    --panel: #fffdf9;
    --panel-strong: #fffaf1;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e7dccb;
    --primary: #a44f2f;
    --primary-dark: #7f3a21;
    --accent: #e7b05a;
    --success-bg: #ecfdf3;
    --success-text: #166534;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --shadow: 0 18px 40px rgba(94, 63, 34, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(231, 176, 90, 0.35), transparent 24rem),
        radial-gradient(circle at left center, rgba(164, 79, 47, 0.12), transparent 28rem),
        linear-gradient(180deg, #fbf6ee 0%, var(--bg) 100%);
}

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

a:hover {
    color: var(--primary-dark);
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

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

.auth-card,
.panel {
    background: rgba(255, 253, 249, 0.96);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(460px, 100%);
    overflow: hidden;
}

.auth-card__hero {
    padding: 28px 28px 18px;
    background: linear-gradient(135deg, rgba(164, 79, 47, 0.12), rgba(231, 176, 90, 0.28));
    border-bottom: 1px solid rgba(164, 79, 47, 0.08);
    text-align: left;
}

.auth-card__hero h1 {
    margin-bottom: 0;
    font-size: 27px;
    line-height: 1.05;
    white-space: nowrap;
}

.auth-card__body {
    padding: 24px 28px 28px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    justify-content: flex-start;
}

.brand-lockup img {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
}

.brand-copy {
    display: grid;
    gap: 2px;
}

.brand-title {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 26px;
    line-height: 1;
}

.brand-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow {
    display: block;
    width: max-content;
    margin-bottom: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    line-height: 1.1;
}

p {
    margin: 0 0 14px;
    line-height: 1.6;
}

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

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

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

.field__hint {
    margin: -2px 0 2px;
    color: var(--primary-dark);
    font-size: 12px;
    line-height: 1.4;
}

.field label {
    font-size: 14px;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d9c9b3;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.field--highlight input {
    background: #fff7e7;
    border-color: #e7b05a;
    box-shadow: inset 0 0 0 1px rgba(231, 176, 90, 0.24);
}

.field--highlight label {
    color: var(--primary-dark);
}

.field--highlight-order-email {
    padding: 16px 16px 18px;
    border: 1px solid #efc97f;
    border-left: 8px solid #d89b31;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff4d6 0%, #ffeabe 100%);
    box-shadow: 0 12px 24px rgba(216, 155, 49, 0.14);
}

.field--highlight-order-email input {
    background: #fffdf7;
    border-color: #c98518;
    box-shadow:
        inset 0 0 0 1px rgba(201, 133, 24, 0.2),
        0 8px 18px rgba(216, 155, 49, 0.1);
}

.field input:focus,
.field select:focus {
    outline: 2px solid rgba(164, 79, 47, 0.2);
    border-color: var(--primary);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #2f7d32, #4fa845);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(47, 125, 50, 0.22);
}

.button:hover,
button:hover {
    background: linear-gradient(135deg, #27672a, #3c8f39);
}

.button--secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.button--secondary:hover {
    background: #faf4ec;
}

.button--danger {
    background: linear-gradient(135deg, #b42318, #d92d20);
    box-shadow: 0 10px 24px rgba(185, 35, 24, 0.2);
}

.button--danger:hover {
    background: linear-gradient(135deg, #8f1c13, #b42318);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.button-row--compact {
    margin-top: 0;
}

.alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid transparent;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

.alert--error {
    background: var(--danger-bg);
    border-color: #fecaca;
    color: var(--danger-text);
}

.alert--success {
    background: var(--success-bg);
    border-color: #bbf7d0;
    color: var(--success-text);
}

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

.topbar--dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    align-items: start;
}

.brand h1 {
    margin-bottom: 6px;
}

.brand--dashboard {
    min-width: 0;
}

.brand img {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
    margin-bottom: 12px;
}

.topbar-aside {
    display: grid;
    gap: 12px;
    justify-items: end;
}

.topbar-aside--dashboard {
    width: 100%;
    max-width: 420px;
    justify-self: end;
}

.topbar-aside__buttons {
    justify-content: flex-end;
    margin-top: 0;
}

.user-mini-card {
    width: 100%;
    min-width: 320px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 250, 241, 0.9);
}

.user-mini-card__row + .user-mini-card__row {
    margin-top: 10px;
}

.user-mini-card__label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.user-mini-card__value--nowrap {
    display: inline-block;
    white-space: nowrap;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.admin-card {
    position: relative;
    display: block;
    gap: 10px;
    min-height: 260px;
    padding-bottom: 92px;
}

.admin-card .button-row {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
    margin-top: 0;
}

.panel {
    padding: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    padding: 18px;
    border-radius: 18px;
    background: var(--panel-strong);
    border: 1px solid var(--border);
}

.stat-card__label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card__value {
    font-size: 28px;
    font-weight: 700;
}

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

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

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

th {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.table--compact {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.table--compact th,
.table--compact td {
    padding: 8px 6px;
    font-size: 12px;
    line-height: 1.2;
}

.table--compact th {
    font-size: 10px;
    letter-spacing: 0.04em;
}

.table--compact td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table--compact th:nth-child(1),
.table--compact td:nth-child(1) {
    width: 95px;
}

.table--compact th:nth-child(2),
.table--compact td:nth-child(2) {
    width: 95px;
}

.table--compact th:nth-child(3),
.table--compact td:nth-child(3) {
    width: 120px;
}

.table--compact th:nth-child(4),
.table--compact td:nth-child(4) {
    width: 180px;
}

.table--compact th:nth-child(5),
.table--compact td:nth-child(5) {
    width: 80px;
}

.table--compact th:nth-child(6),
.table--compact td:nth-child(6),
.table--compact th:nth-child(7),
.table--compact td:nth-child(7),
.table--compact th:nth-child(8),
.table--compact td:nth-child(8) {
    width: 78px;
}

.table--compact th:nth-child(9),
.table--compact td:nth-child(9) {
    width: 120px;
}

.table--compact th:nth-child(10),
.table--compact td:nth-child(10) {
    width: 78px;
    position: sticky;
    right: 0;
    background: rgba(255, 253, 249, 0.98);
    z-index: 2;
}

.table--compact th:nth-child(10) {
    z-index: 3;
}

.table-filters th {
    padding-top: 6px;
    padding-bottom: 10px;
    vertical-align: top;
}

.table-filter-select {
    width: 100%;
    min-width: 0;
    padding: 6px 7px;
    border: 1px solid #d9c9b3;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 11px;
}

.table-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 14px;
    flex-wrap: wrap;
}

.table-filter-actions--spread {
    justify-content: space-between;
}

.table-filter-actions__left,
.table-filter-actions__right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.table-filter-actions__right {
    margin-left: auto;
}

.table-filter-actions .button,
.table-filter-actions .button--secondary {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    box-shadow: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f7ead7;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.badge--admin {
    background: #fee4d3;
}

.inline-form {
    margin: 0;
}

.inline-form button {
    padding: 9px 14px;
    font-size: 14px;
}

.stack {
    display: grid;
    gap: 24px;
}

.price-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    min-width: 0;
}

.price-form input,
.table-input {
    width: 100%;
    min-width: 0;
    padding: 6px 7px;
    border: 1px solid #d9c9b3;
    border-radius: 10px;
    font: inherit;
    font-size: 11px;
}

.price-form button {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    box-shadow: none;
}

.table-input {
    padding: 6px 7px;
    font-size: 11px;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.table-actions .button,
.table-actions .button--danger {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 9px;
    font-size: 16px;
    line-height: 1;
    box-shadow: none;
}

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

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

.compact-form__row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.compact-form__row label {
    font-size: 14px;
    font-weight: 700;
}

.compact-form__row input,
.compact-form__row select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d9c9b3;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.table-wrap--products {
    overflow-x: auto;
    padding-bottom: 8px;
    position: relative;
}

.table--catalog {
    width: 100%;
    table-layout: fixed;
}

.table--catalog th,
.table--catalog td {
    padding: 8px 6px;
    font-size: 12px;
    line-height: 1.25;
}

.table--catalog th:nth-child(1),
.table--catalog td:nth-child(1) {
    width: 11%;
}

.table--catalog th:nth-child(2),
.table--catalog td:nth-child(2) {
    width: 11%;
}

.table--catalog th:nth-child(3),
.table--catalog td:nth-child(3) {
    width: 17%;
}

.table--catalog th:nth-child(4),
.table--catalog td:nth-child(4) {
    width: 23%;
}

.table--catalog th:nth-child(5),
.table--catalog td:nth-child(5) {
    width: 9%;
}

.table--catalog th:nth-child(6),
.table--catalog td:nth-child(6) {
    width: 10%;
}

.table--catalog-with-cart th:nth-child(7),
.table--catalog-with-cart td:nth-child(7) {
    width: 7%;
}

.table--catalog-with-cart th:nth-child(8),
.table--catalog-with-cart td:nth-child(8) {
    width: 12%;
}

.table--catalog td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table-price {
    white-space: nowrap;
    font-weight: 700;
    color: var(--success-text);
}

.table-empty {
    padding: 24px 12px;
    color: var(--muted);
    text-align: center;
}

.table-filter-actions__left--full {
    width: 100%;
}

.table-filter-actions__left--full .table-filter-select:first-child {
    width: min(360px, 100%);
}

.table-wrap--catalog-dashboard {
    overflow-x: visible;
}

.table-wrap--catalog-dashboard .cart-inline-form {
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: nowrap;
}

.table-wrap--catalog-dashboard .qty-input {
    width: 52px;
    min-width: 52px;
    padding: 5px 6px;
}

.table-wrap--catalog-dashboard .button--small {
    padding: 7px 10px;
    font-size: 11px;
}

.cart-inline-form,
.cart-update-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-input {
    width: 58px;
    min-width: 58px;
    padding: 6px 7px;
    border: 1px solid #d9c9b3;
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 11px;
}

.button--small {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 11px;
    box-shadow: none;
}

.button--icon {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    border: none;
    color: #fff;
    cursor: pointer;
}

.panel--cart {
    padding-top: 20px;
}

.cart-order-box {
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fffaf2;
}

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

.cart-order-form__field {
    display: grid;
    gap: 8px;
}

.cart-order-form__field label {
    font-size: 14px;
    font-weight: 700;
}

.cart-order-form__field input {
    width: 100%;
    max-width: 420px;
    padding: 12px 14px;
    border: 1px solid #d9c9b3;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.cart-order-form__hint {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.cart-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.cart-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.cart-table th,
.cart-table td {
    padding: 10px 8px;
    font-size: 12px;
    line-height: 1.3;
}

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

.order-card {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-strong);
}

.order-card[open] {
    background: #fffdf9;
}

.order-card__summary {
    list-style: none;
    cursor: pointer;
}

.order-card__summary::-webkit-details-marker {
    display: none;
}

.order-card__summary::marker {
    display: none;
}

.order-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.order-card__body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.order-items-table th,
.order-items-table td {
    padding: 10px 8px;
    font-size: 12px;
    line-height: 1.3;
}

.order-card h2 {
    margin: 0 0 2px;
    font-size: 18px;
    line-height: 1.1;
}

.order-card .muted {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
}

.order-card .badge {
    padding: 4px 8px;
    font-size: 11px;
}

.settings-list {
    display: grid;
    gap: 12px;
}

.settings-list__row {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-strong);
}

.settings-list__label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

.pagination__info {
    color: var(--muted);
    font-size: 13px;
    margin-right: 8px;
}

.pagination .button,
.pagination .button--secondary {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    box-shadow: none;
}

@media (max-width: 840px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    .page-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 20px;
    }

    .panel {
        padding: 20px;
    }

    .compact-form__row {
        grid-template-columns: 1fr;
        gap: 8px;
        align-items: stretch;
    }

    .topbar-aside {
        width: 100%;
        justify-items: stretch;
    }

    .topbar-aside--dashboard {
        max-width: none;
        justify-self: stretch;
    }

    .topbar--dashboard {
        grid-template-columns: 1fr;
    }

    .topbar-aside__buttons {
        justify-content: flex-start;
    }

    .user-mini-card {
        min-width: 0;
    }

    .cart-panel__header {
        align-items: stretch;
        flex-direction: column;
    }

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

    .order-card__header {
        flex-direction: column;
    }

    .order-meta {
        justify-content: flex-start;
    }
}
