:root {
    --bg: #120d0b;
    --bg-deep: #1a120f;
    --bg-soft: #2d211b;
    --surface: rgba(37, 27, 22, 0.88);
    --surface-strong: #fffaf4;
    --surface-muted: rgba(255, 249, 241, 0.08);
    --card: #fffdf9;
    --text: #241915;
    --text-light: #fff8ef;
    --muted: #8e7e75;
    --muted-light: rgba(255, 243, 227, 0.74);
    --border: rgba(163, 124, 84, 0.24);
    --border-strong: rgba(228, 182, 108, 0.24);
    --shadow-soft: 0 18px 36px rgba(8, 5, 3, 0.24);
    --shadow-card: 0 18px 32px rgba(18, 12, 9, 0.09);
    --brand: #d9a441;
    --brand-strong: #f0be67;
    --brand-deep: #7d5120;
    --accent: #7c3f2c;
    --success: #1f8c5c;
    --warning: #c78016;
    --danger: #bc433c;
    --completed: #5d6b79;
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --font-ui: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(240, 190, 103, 0.18), transparent 20rem),
        radial-gradient(circle at top right, rgba(124, 63, 44, 0.18), transparent 18rem),
        linear-gradient(180deg, #201611 0%, #140e0b 50%, #0f0a08 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 80%);
}

.app-toast {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 50;
    width: min(calc(100% - 24px), 420px);
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(31, 22, 18, 0.96);
    color: #fff8ef;
    border: 1px solid rgba(240, 190, 103, 0.16);
    box-shadow: 0 18px 34px rgba(8, 5, 3, 0.28);
    font-size: 0.92rem;
    font-weight: 700;
}

.app-toast.is-success {
    border-color: rgba(31, 140, 92, 0.28);
}

.app-toast.is-warning {
    border-color: rgba(199, 128, 22, 0.28);
}

.app-toast.is-error {
    border-color: rgba(188, 67, 60, 0.28);
}

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

img {
    max-width: 100%;
    display: block;
}

code {
    font-family: Consolas, "Courier New", monospace;
    background: rgba(36, 25, 21, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 0.45rem;
}

.app-body,
.auth-body {
    min-height: 100vh;
}

.app-shell,
.auth-layout {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 12px 12px 24px;
    min-width: 0;
}

.auth-layout {
    display: grid;
    place-items: center;
}

.content-stack {
    display: grid;
    gap: 10px;
}

.topbar,
.panel,
.auth-card,
.order-card,
.item-card,
.notice {
    backdrop-filter: blur(16px);
}

.topbar,
.panel,
.auth-card {
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-soft);
}

.topbar {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(53, 36, 28, 0.96), rgba(28, 20, 16, 0.92)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
    color: var(--text-light);
    min-width: 0;
}

.panel,
.auth-card {
    border-radius: var(--radius-lg);
    padding: 12px;
    background: rgba(255, 249, 242, 0.96);
    min-width: 0;
}

.topbar h1,
.panel h2,
.auth-card h1,
.auth-card h2,
.order-card h3,
.item-card h3,
.empty-state h2,
.empty-state h3 {
    margin: 0;
}

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

.topbar .hero-text,
.topbar .muted,
.auth-card .hero-text {
    color: var(--muted-light);
}

.hero-text {
    margin: 8px 0 0;
    max-width: 44rem;
    font-size: 0.98rem;
    line-height: 1.5;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-block-compact {
    min-width: 0;
    justify-content: center;
}

.brand-block-login {
    margin-bottom: 18px;
}

.brand-block-login-compact {
    justify-content: center;
    margin-bottom: 10px;
}

.brand-mark {
    flex: 0 0 auto;
    width: clamp(116px, 18vw, 176px);
    padding: 8px 10px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 241, 216, 0.16), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(240, 190, 103, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 245, 225, 0.12), 0 12px 24px rgba(8, 5, 3, 0.16);
}

.brand-mark-header {
    width: clamp(92px, 24vw, 128px);
    padding: 4px 8px;
    border-radius: 14px;
}

.brand-mark-login {
    width: min(100%, 220px);
    padding: 6px 10px;
}

.brand-mark-compact {
    width: clamp(88px, 20vw, 116px);
}

.brand-logo {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.topbar-actions,
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.topbar-actions {
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
}

.topbar-spacer {
    width: 40px;
    height: 40px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 241, 216, 0.12);
    border: 1px solid rgba(240, 190, 103, 0.18);
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 800;
}

.icon-button:hover {
    transform: translateY(-1px);
    border-color: rgba(240, 190, 103, 0.28);
    background: rgba(255, 241, 216, 0.18);
}

.icon-button:active {
    transform: translateY(0);
}

.icon-button:focus-visible {
    outline: 2px solid rgba(240, 190, 103, 0.42);
    outline-offset: 2px;
}

.logout-button {
    background:
        linear-gradient(180deg, rgba(255, 250, 244, 0.16), rgba(255, 241, 216, 0.08)),
        rgba(255, 241, 216, 0.08);
    border-color: rgba(240, 190, 103, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 6px 14px rgba(8, 5, 3, 0.18);
}

.logout-button span {
    transform: translateX(0.5px);
}

.logout-button:hover {
    background:
        linear-gradient(180deg, rgba(255, 250, 244, 0.22), rgba(255, 241, 216, 0.12)),
        rgba(255, 241, 216, 0.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 10px 18px rgba(8, 5, 3, 0.22);
}

.logout-button:focus-visible {
    outline-color: rgba(255, 227, 168, 0.58);
}

.notification-button {
    background:
        linear-gradient(180deg, rgba(255, 252, 246, 0.18), rgba(255, 241, 216, 0.08)),
        rgba(255, 241, 216, 0.08);
    border-color: rgba(240, 190, 103, 0.18);
}

.notification-button.is-enabled {
    color: #fff7df;
    background:
        linear-gradient(180deg, rgba(240, 190, 103, 0.34), rgba(186, 124, 42, 0.32)),
        rgba(255, 241, 216, 0.12);
    border-color: rgba(255, 227, 168, 0.42);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 8px 18px rgba(125, 81, 32, 0.24);
}

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

.status-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 2px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.status-tabs-desktop {
    display: flex;
}

.status-nav-mobile,
.status-menu-mobile {
    display: none;
}

.status-nav-mobile {
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.status-menu-mobile {
    margin-top: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
}

.status-nav-mobile.is-open + .status-menu-mobile {
    display: grid;
}

.status-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 241, 231, 0.96));
    border: 1px solid rgba(167, 131, 96, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.status-tab-primary {
    flex: 1 1 auto;
    justify-content: space-between;
    min-width: 0;
}

.status-tab-menu {
    justify-content: space-between;
    width: 100%;
}

.status-tab span {
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-tab strong {
    min-width: 1.8rem;
    text-align: center;
    font-size: 0.98rem;
}

.status-tab.is-active {
    border-color: rgba(217, 164, 65, 0.42);
    box-shadow: 0 12px 28px rgba(125, 81, 32, 0.12);
    transform: translateY(-2px);
    background: linear-gradient(180deg, rgba(255, 252, 246, 1), rgba(249, 237, 216, 0.96));
}

.status-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    min-width: 46px;
    height: 46px;
    border: 1px solid rgba(167, 131, 96, 0.16);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 241, 231, 0.96));
    color: var(--brand-deep);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    flex: 0 0 auto;
}

.status-toggle:hover {
    border-color: rgba(217, 164, 65, 0.28);
}

.status-toggle:focus-visible {
    outline: 2px solid rgba(217, 164, 65, 0.35);
    outline-offset: 2px;
}

.status-nav-mobile.is-open .status-toggle span {
    transform: rotate(180deg);
}

.orders-list,
.item-list {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.order-card,
.item-card {
    background: var(--card);
    border: 1px solid rgba(167, 131, 96, 0.16);
    border-radius: 22px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.order-card {
    position: relative;
}

.order-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: rgba(217, 164, 65, 0.32);
}

.order-card.status-new::before {
    background: linear-gradient(180deg, #e0b05d, #d18d2d);
}

.order-card.status-preparing::before {
    background: linear-gradient(180deg, #df9c39, #bf6b16);
}

.order-card.status-ready::before {
    background: linear-gradient(180deg, #4ba876, #1f8c5c);
}

.order-card.status-completed::before {
    background: linear-gradient(180deg, #7f8d9d, #5d6b79);
}

.order-card.status-cancelled::before {
    background: linear-gradient(180deg, #d76a60, #bc433c);
}

.order-card-link {
    display: block;
    padding: 14px 14px 12px 18px;
    min-width: 0;
    max-width: 100%;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 36px rgba(18, 12, 9, 0.12);
}

.order-card-header,
.item-main {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
}

.order-card-header {
    margin-bottom: 10px;
}

.order-number {
    margin: 0 0 6px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-deep);
}

.order-card h3,
.item-card h3 {
    font-size: 1rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.order-meta,
.item-meta,
.details-grid {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.order-meta {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    margin: 0;
}

.details-grid {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.order-meta div,
.item-meta div,
.details-grid div {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #fffdfb, #fbf5ee);
    border: 1px solid rgba(174, 137, 94, 0.14);
    min-width: 0;
}

dt {
    margin-bottom: 6px;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

dd {
    margin: 0;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.79rem;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-badge.large {
    min-height: 38px;
    padding: 0 14px;
}

.status-new {
    background: rgba(217, 164, 65, 0.14);
    color: #9b6110;
    border-color: rgba(217, 164, 65, 0.24);
}

.status-preparing {
    background: rgba(199, 128, 22, 0.14);
    color: #a05f0d;
    border-color: rgba(199, 128, 22, 0.24);
}

.status-ready {
    background: rgba(31, 140, 92, 0.14);
    color: #16684a;
    border-color: rgba(31, 140, 92, 0.2);
}

.status-completed {
    background: rgba(93, 107, 121, 0.14);
    color: #475564;
    border-color: rgba(93, 107, 121, 0.2);
}

.status-cancelled {
    background: rgba(188, 67, 60, 0.14);
    color: #9c2f29;
    border-color: rgba(188, 67, 60, 0.2);
}

.status-default {
    background: rgba(111, 98, 86, 0.12);
    color: #67564d;
    border-color: rgba(111, 98, 86, 0.18);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
    font: inherit;
}

.button:hover,
.status-tab:hover {
    filter: brightness(1.02);
}

.button:active,
.status-tab:active {
    transform: scale(0.99);
}

.button-primary {
    background: linear-gradient(135deg, #ba7c2a, #7d5120);
    color: #fffaf2;
    box-shadow: 0 12px 24px rgba(125, 81, 32, 0.24);
}

.button-secondary {
    background: rgba(255, 249, 242, 0.08);
    color: inherit;
    border-color: rgba(240, 190, 103, 0.16);
}

.panel .button-secondary,
.auth-panel .button-secondary,
.empty-state .button-secondary {
    background: #fffaf4;
    color: var(--text);
    border-color: rgba(167, 131, 96, 0.18);
}

.button-block {
    width: 100%;
}

.empty-state {
    padding: 18px 10px;
    text-align: center;
}

.empty-state-inline {
    padding: 8px 0 4px;
}

.auth-card {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    background:
        linear-gradient(135deg, rgba(35, 24, 19, 0.96), rgba(24, 17, 14, 0.94)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
    color: var(--text-light);
    min-width: 0;
}

.auth-card-wide {
    border-color: rgba(240, 190, 103, 0.2);
}

.auth-panel {
    border-radius: 22px;
    background: rgba(255, 250, 244, 0.98);
    padding: 14px;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    min-width: 0;
}

.panel-intro {
    margin-bottom: 16px;
}

.auth-form {
    display: grid;
    gap: 12px;
    margin-top: 0;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 50px;
    padding: 0 15px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(167, 131, 96, 0.24);
    background: #fffdf9;
    font: inherit;
    color: var(--text);
    box-shadow: inset 0 1px 2px rgba(36, 25, 21, 0.05);
    min-width: 0;
}

.form-error {
    margin: 0 0 10px;
    color: #972d28;
    font-weight: 700;
    font-size: 0.92rem;
}

input:focus {
    outline: 2px solid rgba(217, 164, 65, 0.35);
    outline-offset: 1px;
}

.note-box {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #fffdfb, #fbf5ee);
    border: 1px solid rgba(174, 137, 94, 0.14);
}

.note-box strong {
    display: block;
    margin-bottom: 8px;
}

.note-box p {
    margin: 0;
    line-height: 1.55;
}

.item-card {
    padding: 12px;
}

.action-row form {
    margin: 0;
}

.item-main strong {
    font-size: 1rem;
}

@media (max-width: 920px) {
    .auth-card {
        grid-template-columns: 1fr;
    }

    .brand-block-login {
        margin-bottom: 0;
    }
}

@media (max-width: 760px) {
    .app-shell,
    .auth-layout {
        padding: 10px 8px 20px;
    }

    .topbar,
    .panel-header,
    .order-card-header,
    .item-main {
        flex-direction: column;
    }

    .topbar {
        grid-template-columns: 40px 1fr auto;
        padding: 8px 10px;
    }

    .topbar-actions,
    .action-row {
        width: auto;
    }

    .topbar-actions .button,
    .action-row form,
    .action-row .button {
        width: 100%;
    }

    .brand-mark,
    .brand-mark-compact {
        width: min(100%, 118px);
    }

    .order-card-link {
        padding: 14px 12px 12px 18px;
    }

    .topbar-actions {
        align-self: start;
    }

    .status-tabs-desktop {
        display: none;
    }

    .status-nav-mobile {
        display: flex;
    }
}

@media (max-width: 520px) {
    .panel,
    .auth-card,
    .auth-panel {
        padding: 10px;
    }

    .order-meta,
    .details-grid,
    .item-meta {
        grid-template-columns: 1fr;
    }

    .order-card-link,
    .item-card,
    .note-box {
        padding-left: 10px;
        padding-right: 10px;
    }

    .button,
    input {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .topbar,
    .panel,
    .order-card,
    .auth-card {
        animation: rise-in 0.34s ease both;
    }

    @keyframes rise-in {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
