/* ==========================================================================
   多商家点餐系统 · 设计系统
   ========================================================================== */

:root {
    --bg: #f6f2ec;
    --surface: #ffffff;
    --surface-2: #fbf8f3;
    --surface-3: #f3ece3;
    --ink: #201b15;
    --ink-2: #5d554b;
    --ink-3: #9a9086;
    --line: #ebe3d8;
    --line-strong: #ddd2c4;

    --brand: #ee5b2b;
    --brand-2: #ff8a4c;
    --brand-soft: #fff1e8;
    --brand-ink: #b83d15;

    --green: #2f8a63;
    --green-soft: #e7f4ee;
    --gold: #b5863d;
    --gold-soft: #fbf2e0;
    --red: #cf4343;
    --red-soft: #fdecec;
    --blue: #37699b;
    --blue-soft: #eaf1f8;

    --shadow-sm: 0 1px 2px rgba(35, 27, 18, 0.05);
    --shadow: 0 4px 18px rgba(35, 27, 18, 0.07);
    --shadow-lg: 0 18px 50px rgba(35, 27, 18, 0.18);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "DIN Alternate", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.55;
}

h1, h2, h3, h4, p {
    margin: 0;
}

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

button {
    font-family: inherit;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #d9cec1;
    border-radius: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

.num {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

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

.text-brand { color: var(--brand); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ---------------------------------- 按钮 --------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    border-color: #c9bcac;
    background: #fffdfa;
}

.btn:active {
    transform: translateY(1px);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--brand-2), var(--brand));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 16px rgba(238, 91, 43, 0.24);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff9256, #e8521f);
    border-color: transparent;
}

.btn-dark {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.btn-dark:hover {
    background: #34302a;
    border-color: #34302a;
}

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

.btn-soft:hover {
    background: #ffe4d4;
    border-color: transparent;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-2);
}

.btn-ghost:hover {
    background: var(--surface-3);
    border-color: transparent;
}

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

.btn-sm {
    height: 30px;
    padding: 0 11px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn-lg {
    height: 48px;
    padding: 0 24px;
    font-size: 15px;
    border-radius: 12px;
}

.btn-block {
    width: 100%;
}

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

/* ---------------------------------- 表单 --------------------------------- */

.input,
.textarea,
.select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea {
    height: auto;
    min-height: 76px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.6;
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(238, 91, 43, 0.12);
}

.input::placeholder,
.textarea::placeholder {
    color: #b3a89a;
}

.field {
    margin-bottom: 14px;
}

.field > label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.field-row {
    display: flex;
    gap: 12px;
}

.field-row > .field {
    flex: 1;
}

.switch {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #ddd2c4;
    border: none;
    cursor: pointer;
    transition: background 0.18s;
    flex: none;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.18s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch.on {
    background: var(--green);
}

.switch.on::after {
    transform: translateX(18px);
}

/* ---------------------------------- 容器 --------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.divider {
    height: 1px;
    background: var(--line);
    border: none;
    margin: 0;
}

/* ---------------------------------- 徽标 --------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-3);
    color: var(--ink-2);
    white-space: nowrap;
}

.badge-dot::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-gold  { background: var(--gold-soft); color: var(--gold); }
.badge-red   { background: var(--red-soft); color: var(--red); }
.badge-blue  { background: var(--blue-soft); color: var(--blue); }
.badge-gray  { background: #f0ebe4; color: var(--ink-3); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
}

.chip.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

/* ---------------------------------- 分段 --------------------------------- */

.seg {
    display: inline-flex;
    padding: 3px;
    background: var(--surface-3);
    border-radius: 10px;
    gap: 2px;
}

.seg button {
    height: 30px;
    padding: 0 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.15s;
}

.seg button.active {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------- 弹层 --------------------------------- */

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(32, 27, 21, 0.45);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
    animation: fadeIn 0.16s ease;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    animation: popIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 12px;
    flex: none;
}

.modal-head h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-body {
    padding: 4px 22px 18px;
    overflow-y: auto;
}

.modal-foot {
    display: flex;
    gap: 10px;
    padding: 14px 22px 20px;
    border-top: 1px solid var(--line);
    flex: none;
}

.modal-foot .btn {
    flex: 1;
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: var(--surface-3);
    color: var(--ink-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #e9e0d5;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* ---------------------------------- 提示 --------------------------------- */

.toast-wrap {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(32, 27, 21, 0.92);
    color: #fff;
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: toastIn 0.2s ease;
    max-width: 80vw;
}

.toast.ok { background: rgba(36, 110, 80, 0.95); }
.toast.err { background: rgba(180, 50, 50, 0.95); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

/* ---------------------------------- 其他 --------------------------------- */

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}

.spin {
    width: 22px;
    height: 22px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
}

.dish-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    border-radius: 12px;
    flex: none;
    overflow: hidden;
    position: relative;
}

.dish-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 55%);
}
