/* 云味餐饮 SaaS - 后台样式（无第三方依赖） */
:root {
    --ink: #1f2430;
    --muted: #6b7280;
    --line: #e6e8ee;
    --bg: #f5f6f8;
    --brand: #d9482b;
    --brand-dark: #b53a21;
    --amber: #e8a33d;
    --ok: #12805c;
    --warn: #b7791f;
    --danger: #c0392b;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 16px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--ink); }

/* 布局 */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.sidebar {
    background: #1c2029;
    color: #cfd3dc;
    padding: 20px 14px 28px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    padding: 4px 10px 18px;
    letter-spacing: .5px;
}
.brand span {
    font-size: 10px;
    font-weight: 500;
    color: #f0b08e;
    border: 1px solid rgba(240, 176, 142, .5);
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 6px;
    vertical-align: 2px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
    padding: 9px 12px;
    border-radius: 7px;
    color: #cfd3dc;
    font-size: 13.5px;
    transition: .15s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: #6d7380; padding: 10px; line-height: 1.6; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar .left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; }
.topbar .who { color: var(--muted); }
.switcher { display: flex; gap: 4px; }
.switcher a { font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.switcher a.on { border-color: var(--brand); color: var(--brand); background: #fdf1ee; }

.content { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }

.alert { margin: 14px 24px 0; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.alert.ok { background: #e8f6f0; color: #0b6b4c; border: 1px solid #bfe6d5; }
.alert.err { background: #fdecea; color: #a5271b; border: 1px solid #f5c6c0; }

/* 卡片 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card.narrow { max-width: 780px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat span { display: block; color: var(--muted); font-size: 12.5px; }
.stat strong { display: block; font-size: 26px; margin: 8px 0 4px; font-weight: 700; letter-spacing: .3px; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); }

.two-col { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left; padding: 9px 10px; color: var(--muted);
    font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
.table td { padding: 10px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.table tbody tr:hover { background: #fcfcfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact th, .table.compact td { padding: 7px 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.strike td { color: #a0a4ad; text-decoration: line-through; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }

/* 徽标 */
.badge {
    display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
    background: #eef1f5; color: #4b5563; white-space: nowrap;
}
.badge.st-pending { background: #fdf3e3; color: #a5681a; }
.badge.st-paid { background: #e6f5ee; color: #0d6b4a; }
.badge.st-preparing { background: #e8f1fd; color: #1d4f91; }
.badge.st-completed { background: #eceff4; color: #4b5563; }
.badge.st-cancelled, .badge.st-refunded { background: #fdecea; color: #a5271b; }
.badge.st-item-pending { background: #fdf3e3; color: #a5681a; }
.badge.st-item-cooking { background: #e8f1fd; color: #1d4f91; }
.badge.st-item-done, .badge.st-item-served { background: #e6f5ee; color: #0d6b4a; }
.badge.st-item-cancelled { background: #fdecea; color: #a5271b; }
.badge.rec { background: #fdece7; color: var(--brand); }
.badge.lv { background: #f3ecdb; color: #8a6415; }

/* 表单 */
input, select, textarea {
    font: inherit; color: inherit; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 7px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(217, 72, 43, .08); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
label.check, label.check-line { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
textarea { resize: vertical; }

.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.inline-form input[type=text] { width: 200px; }
.filter { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack.bordered { border: 1px dashed var(--line); padding: 12px; border-radius: 8px; margin-bottom: 12px; }
.w-70 { width: 70px !important; } .w-80 { width: 80px !important; } .w-90 { width: 90px !important; }
.w-110 { width: 110px !important; } .w-120 { width: 120px !important; } .w-140 { width: 140px !important; }

button { font: inherit; cursor: pointer; }
.primary {
    background: var(--brand); color: #fff; border: 1px solid var(--brand);
    padding: 8px 18px; border-radius: 7px; font-weight: 600;
}
.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.primary.block { width: 100%; padding: 11px; letter-spacing: 2px; }
.ghost {
    background: #fff; color: var(--ink); border: 1px solid var(--line);
    padding: 7px 14px; border-radius: 7px; font-size: 12.5px; display: inline-block;
}
.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn { display: inline-block; }
.link { background: none; border: none; color: var(--muted); padding: 0; font-size: 12.5px; }
.link:hover { color: var(--ink); text-decoration: underline; }
.link.danger { color: var(--danger); }
.block { width: 100%; text-align: center; }

/* 明细 */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 14px; }
.kv div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #eef0f4; padding-bottom: 7px; font-size: 12.5px; }
.kv span { color: var(--muted); }
.kv-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed #eef0f4; font-size: 12.5px; }

.totals { margin-top: 12px; border-top: 2px solid #f0f2f5; padding-top: 10px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.totals span { color: var(--muted); }
.totals .grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-size: 15px; }
.totals .grand b { color: var(--brand); font-size: 20px; }

/* 桌台 */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.table-chip {
    border: 1px solid var(--line); border-radius: 9px; padding: 12px; display: flex; flex-direction: column; gap: 3px;
    background: #fbfcfd;
}
.table-chip b { font-size: 16px; }
.table-chip span { font-size: 11px; color: var(--muted); }
.table-chip i { font-style: normal; font-size: 11px; color: var(--ok); }
.table-chip.open { background: #fdf1ee; border-color: #f2c4b8; }
.table-chip.open i { color: var(--brand); }

.table-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; gap: 12px; }
.table-card .qr img { width: 92px; height: 92px; display: block; border: 1px solid #f0f2f5; border-radius: 6px; }
.table-card .meta { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.table-card details { margin-top: 4px; }
.table-card summary { cursor: pointer; font-size: 11.5px; color: var(--muted); }

/* 图表 */
.bar-row { display: grid; grid-template-columns: 76px 1fr 92px; align-items: center; gap: 10px; padding: 6px 0; font-size: 12.5px; }
.bar { height: 8px; background: #f0f2f5; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--amber)); border-radius: 999px; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }

.hourly { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 10px 0 0; border-top: 1px dashed var(--line); overflow-x: auto; }
.hour { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 34px; }
.h-bar { width: 18px; background: linear-gradient(180deg, #f0b28e, var(--brand)); border-radius: 4px 4px 0 0; }
.hour span { font-size: 11px; color: var(--muted); }

/* 分页 */
.pager { display: flex; align-items: center; gap: 12px; padding-top: 14px; font-size: 12.5px; }
.pager .page { border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; }
.pager .page.disabled { color: #b8bcc4; }
.page-info { color: var(--muted); }

.ticket { background: #fbfbfa; border: 1px dashed #d9dce3; padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; margin: 8px 0 0; }

.page-actions { display: flex; gap: 12px; align-items: center; }

/* 登录 */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1200px 600px at 20% 10%, #2a2f3a, #16191f 60%), #16191f;
}
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 30px 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card h1 small { font-size: 10px; color: var(--brand); border: 1px solid #f0c6b9; border-radius: 3px; padding: 1px 4px; vertical-align: 3px; }
.login-card p { font-size: 12px; margin: 0 0 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { color: var(--ink); }
.login-card .check { flex-direction: row; font-size: 12px; color: var(--muted); }
.demo-tip { margin-top: 16px; font-size: 11.5px; color: var(--muted); line-height: 1.7; border-top: 1px dashed var(--line); padding-top: 12px; }

@media (max-width: 1100px) {
    .two-col { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: column; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .content, .topbar { padding-left: 14px; padding-right: 14px; }
    .form-grid { grid-template-columns: 1fr; }
}
