:root {
    color-scheme: light;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --brand: #0284c7;
    --brand-soft: #f0f9ff;
}

[x-cloak] {
    display: none !important;
}

*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    background: #f7fbff;
}

body {
    min-width: 320px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-rendering: optimizeLegibility;
}

a, button, input, select, textarea {
    touch-action: manipulation;
}

button, a {
    -webkit-user-select: none;
    user-select: none;
}

input, select, textarea {
    font-size: 16px;
}

@media (min-width: 640px) {
    input, select, textarea {
        font-size: 14px;
    }
}

.app-shell, .staff-shell {
    width: min(100%, 1180px);
}

.soft-card,
.surface {
    border: 1px solid rgba(226, 232, 240, .92);
    background: rgba(255, 255, 255, .96);
    border-radius: 1.15rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .045);
}

.surface-muted {
    border: 1px solid rgba(226, 232, 240, .8);
    background: #f8fafc;
    border-radius: 1rem;
}

.focus-ring:focus,
.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus {
    border-color: rgba(14, 165, 233, .9);
    outline: 3px solid rgba(14, 165, 233, .16);
    outline-offset: 1px;
}

.ui-input,
.ui-select,
.ui-textarea {
    width: 100%;
    border: 1px solid #dbe4ee;
    border-radius: .9rem;
    background: #fff;
    color: var(--ink);
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.ui-input,
.ui-select {
    min-height: 3rem;
    padding: .75rem .9rem;
}

.ui-textarea {
    min-height: 6rem;
    padding: .8rem .9rem;
    resize: vertical;
}

.ui-input::placeholder,
.ui-textarea::placeholder {
    color: #94a3b8;
}

.ui-input:hover,
.ui-select:hover,
.ui-textarea:hover {
    border-color: #b9c9d9;
}

.select-wrap {
    position: relative;
}

.select-wrap::after {
    position: absolute;
    top: 50%;
    right: .9rem;
    width: .55rem;
    height: .55rem;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    content: "";
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}

.ui-select {
    appearance: none;
    padding-right: 2.5rem;
}

.ui-search {
    display: flex;
    min-height: 3.25rem;
    align-items: center;
    gap: .65rem;
    border: 1px solid #dbeafe;
    border-radius: 1.05rem;
    background: #fff;
    padding: .35rem .4rem .35rem .9rem;
    box-shadow: 0 8px 22px rgba(2, 132, 199, .07);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ui-search:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .12), 0 10px 24px rgba(2, 132, 199, .1);
}

.ui-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--ink);
    outline: 0;
}

.ui-search input[type="search"] {
    appearance: none;
    -webkit-appearance: none;
}

.ui-search input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.ui-search input::placeholder {
    color: #94a3b8;
}

.ui-search-submit,
.ui-icon-button {
    display: inline-flex;
    min-height: 2.65rem;
    min-width: 2.65rem;
    align-items: center;
    justify-content: center;
    border-radius: .85rem;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.ui-search-submit {
    background: #e0f2fe;
    color: #0369a1;
}

.ui-search-submit:hover {
    background: #bae6fd;
}

.ui-icon-button {
    color: #94a3b8;
}

.ui-icon-button:hover {
    background: #fef2f2;
    color: #e11d48;
}

.ui-btn {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border-radius: .9rem;
    padding: .75rem 1rem;
    font-size: .875rem;
    font-weight: 800;
    line-height: 1.1;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ui-btn:active,
.ui-icon-button:active,
.ui-search-submit:active {
    transform: scale(.98);
}

.ui-btn-primary {
    background: #0284c7;
    color: #fff;
    box-shadow: 0 8px 16px rgba(2, 132, 199, .16);
}

.ui-btn-primary:hover {
    background: #0369a1;
}

.ui-btn-dark {
    background: #0f172a;
    color: #fff;
}

.ui-btn-dark:hover {
    background: #1e293b;
}

.ui-btn-soft {
    border: 1px solid #bae6fd;
    background: #f0f9ff;
    color: #0369a1;
}

.ui-btn-soft:hover {
    background: #e0f2fe;
}

.ui-btn-ghost {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
}

.ui-btn-ghost:hover {
    border-color: #bae6fd;
    color: #0369a1;
}

.ui-btn-danger {
    background: #e11d48;
    color: #fff;
}

.ui-btn-danger:hover {
    background: #be123c;
}

.ui-btn:disabled {
    cursor: not-allowed;
    opacity: .58;
    transform: none;
}

.ui-chip {
    display: inline-flex;
    min-height: 2.55rem;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    padding: .55rem .9rem;
    color: #475569;
    font-size: .75rem;
    font-weight: 800;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

.ui-chip:hover {
    border-color: #7dd3fc;
    color: #0369a1;
}

.ui-chip-active {
    border-color: #0284c7;
    background: #0284c7;
    color: #fff;
    box-shadow: 0 6px 14px rgba(2, 132, 199, .15);
}

.ui-chip:active {
    transform: scale(.98);
}

.ui-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.ui-choice-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ui-choice {
    position: relative;
    display: block;
    min-width: 0;
    cursor: pointer;
}

.ui-choice > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.ui-choice > span {
    display: flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: .9rem;
    background: #fff;
    padding: .65rem .7rem;
    color: #475569;
    font-size: .75rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ui-choice:hover > span {
    border-color: #7dd3fc;
    background: #f8fdff;
    color: #0369a1;
}

.ui-choice > input:checked + span {
    border-color: #38bdf8;
    background: #e0f2fe;
    color: #0369a1;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .08);
}

.ui-choice > input:focus-visible + span {
    outline: 3px solid rgba(14, 165, 233, .2);
    outline-offset: 2px;
}

.ui-choice:active > span {
    transform: scale(.98);
}

.ui-choice-danger > span {
    border-color: #fecdd3;
    background: #fff1f2;
    color: #be123c;
}

.ui-choice-danger:hover > span,
.ui-choice-danger > input:checked + span {
    border-color: #fb7185;
    background: #ffe4e6;
    color: #be123c;
}

.order-status-control-compact .ui-btn {
    min-height: 2.8rem;
    font-size: .75rem;
}

.order-timeline {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.order-timeline-item {
    display: flex;
    min-width: 0;
    flex: 1 1 0%;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    color: #94a3b8;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
}

.order-timeline-dot {
    display: flex;
    width: 1.8rem;
    height: 1.8rem;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #94a3b8;
    font-size: .7rem;
    font-weight: 900;
}

.order-timeline-item.is-done,
.order-timeline-item.is-current {
    color: #0369a1;
}

.order-timeline-item.is-done .order-timeline-dot {
    border-color: #38bdf8;
    background: #e0f2fe;
    color: #0369a1;
}

.order-timeline-item.is-current .order-timeline-dot {
    border-color: #0284c7;
    background: #0284c7;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .14);
}

.order-timeline-connector {
    flex: 0 1 2.25rem;
    height: 2px;
    margin-top: .9rem;
    background: #e2e8f0;
}

.order-timeline-connector.is-done {
    background: #7dd3fc;
}

.modal-backdrop {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow-y: auto;
    background: rgba(15, 23, 42, .54);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 1.5rem 1rem max(1rem, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
}

.modal-panel {
    width: 100%;
    max-height: min(90dvh, 760px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(226, 232, 240, .9);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
    border-radius: 1.35rem;
    background: #fff;
    box-shadow: 0 -16px 60px rgba(15, 23, 42, .2);
    padding: 1.2rem 1rem max(1.25rem, env(safe-area-inset-bottom));
    touch-action: pan-y;
}

.modal-handle {
    width: 2.8rem;
    height: .3rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    background: #cbd5e1;
}

@media (min-width: 640px) {
    .modal-backdrop {
        align-items: center;
        padding: 1.5rem;
    }

    .modal-panel {
        width: min(100%, 34rem);
        max-height: 86dvh;
        border-bottom: 1px solid rgba(226, 232, 240, .9);
        border-radius: 1.35rem;
        padding: 1.4rem;
    }

    .modal-handle {
        display: none;
    }
}

.safe-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.bottom-nav-spacer {
    height: max(5.6rem, calc(5.6rem + env(safe-area-inset-bottom)));
}

.public-bottom-nav {
    padding-top: .5rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(18px);
}

.nav-item {
    min-height: 3.35rem;
    border: 1px solid transparent;
    border-radius: 1rem;
}

.nav-item-active {
    border-color: #bae6fd;
    background: #f0f9ff;
    color: #0369a1;
}

.staff-nav-item-active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    box-shadow: 0 7px 16px rgba(14, 165, 233, .22);
}

.eyebrow {
    color: #0284c7;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .16em;
    line-height: 1.2;
    text-transform: uppercase;
}

.section-title {
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -.025em;
    line-height: 1.2;
}

.data-row {
    border-bottom: 1px solid #f1f5f9;
}

.data-row:last-child {
    border-bottom: 0;
}

.line-clamp-2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
