/* =====================================================================
   小卖部零售管理系统 · 全局样式
   设计语言：清爽浅色 + 深色侧边栏，绿色主色，圆角卡片
   ===================================================================== */

:root {
    --bg: #f4f7f9;
    --card: #ffffff;
    --ink: #16232e;
    --ink-2: #34495c;
    --muted: #6b7f91;
    --line: #e4ebf1;
    --line-2: #eef3f7;
    --primary: #0f9d6e;
    --primary-dark: #0a7c56;
    --primary-soft: #e6f7f0;
    --primary-ink: #075e43;
    --danger: #e5484d;
    --danger-soft: #fdecec;
    --warn: #d97706;
    --warn-soft: #fef3e2;
    --info: #2563eb;
    --info-soft: #eaf1fe;
    --sidebar: #0d2531;
    --sidebar-2: #0a1c26;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15, 34, 46, .04), 0 10px 28px -16px rgba(15, 34, 46, .18);
    --shadow-lg: 0 24px 70px -24px rgba(9, 30, 42, .35);
    --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
    --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

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

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-3 { margin-bottom: 14px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.grow { flex: 1; }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------------- 布局 ---------------- */
.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #c7d5df;
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 19px;
    color: #04261a;
    background: linear-gradient(135deg, #4ade80, #14b8a6);
    box-shadow: 0 6px 16px -6px rgba(20, 184, 166, .7);
    flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { color: #fff; font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #7f97a6; font-size: 11.5px; letter-spacing: .06em; }

.nav { flex: 1; overflow-y: auto; padding: 14px 10px 8px; scrollbar-width: thin; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }

.nav-group { margin-bottom: 14px; }
.nav-label {
    font-size: 11px;
    letter-spacing: .12em;
    color: #5f7a8b;
    padding: 0 10px 7px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    color: #b9cbd6;
    font-size: 13.5px;
    transition: background .15s ease, color .15s ease;
    margin-bottom: 2px;
}
.nav-item .icon { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(45, 212, 168, .16); color: #6ef0c8; font-weight: 600; }
.nav-item.active .icon { opacity: 1; }

.sidebar-foot {
    border-top: 1px solid rgba(255, 255, 255, .07);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.me { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(45, 212, 168, .18);
    color: #6ef0c8;
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px; flex: none;
}
.me-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-info b { color: #ecf5fa; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info small { color: #7f97a6; font-size: 11.5px; }
.logout { color: #7f97a6; padding: 6px; border-radius: 8px; }
.logout:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.sidebar-mask { display: none; }

.main { margin-left: 248px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    padding: 0 26px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.crumb { font-size: 12px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.date-chip { font-size: 12.5px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; }
.user-chip { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg); border-radius: 999px; }
.user-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.menu-btn { display: none !important; }

.page { padding: 24px 26px 40px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------------- 通用组件 ---------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 18px; }
.card-head {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line-2);
    flex-wrap: wrap;
}
.card-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; }
.card-title .icon { color: var(--primary); width: 18px; height: 18px; }
.card-sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(15, 157, 110, .8); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn-soft:hover { background: #d6f3e7; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #c9d6e0; background: #fafcfd; }
.btn-danger { background: var(--danger-soft); color: #b42318; }
.btn-danger:hover { background: #fadcdc; }
.btn-dark { background: #1f2f3b; color: #fff; }
.btn-dark:hover { background: #16242e; }
.btn-lg { padding: 11px 18px; font-size: 15px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn .icon { width: 16px; height: 16px; }

.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid; place-items: center;
    cursor: pointer;
    font-size: 16px;
}

.input, .select, .textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 8px 11px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    min-height: 38px;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 157, 110, .13);
}
.input::placeholder, .textarea::placeholder { color: #a4b3bf; }
.input-sm { padding: 5px 9px; min-height: 32px; font-size: 13px; }
.select-sm { padding: 4px 9px; min-height: 32px; font-size: 13px; }
.textarea { min-height: 84px; resize: vertical; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.required::after { content: " *"; color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; padding-top: 6px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .input, .toolbar .select { width: auto; }
.toolbar .grow { min-width: 180px; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 12px;
    font-weight: 650;
    color: var(--muted);
    background: #fafcfd;
    border-bottom: 1px solid var(--line);
    padding: 11px 16px;
    white-space: nowrap;
    letter-spacing: .02em;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfdfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn { margin-left: 4px; }
.table-empty { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.6;
}
.badge-success { background: var(--primary-soft); color: var(--primary-ink); }
.badge-warn { background: var(--warn-soft); color: #9a5b04; }
.badge-danger { background: var(--danger-soft); color: #b42318; }
.badge-info { background: var(--info-soft); color: #1d4ed8; }
.badge-muted { background: #eef2f5; color: #5b6b78; }

.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #f1f5f8; color: #5b6b78; font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.kpi {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 116px;
}
.kpi-label { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-size: 27px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 7px; }
.kpi-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary);
    flex: none;
}
.kpi-icon.orange { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.blue { background: var(--info-soft); color: var(--info); }
.kpi-icon.red { background: var(--danger-soft); color: var(--danger); }
.kpi-icon .icon { width: 20px; height: 20px; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 16px; font-weight: 700; }

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 15px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.flash-success { background: #e9f9f1; border-color: #c9efdd; color: #0b6b4b; }
.flash-error { background: #fdeeee; border-color: #f6d3d3; color: #a22121; }
.flash-info { background: var(--info-soft); border-color: #d6e4fd; color: #1e40af; }
.flash-close { border: 0; background: transparent; color: inherit; opacity: .6; cursor: pointer; font-size: 17px; line-height: 1; }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 46px 20px;
    font-size: 13.5px;
}
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 5px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 18px; }
.pagination .page {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
}
.pagination .page:hover { border-color: #c9d6e0; }
.pagination .page.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------------- 看板 ---------------- */
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding: 6px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #34d399, #0f9d6e); position: relative; min-height: 4px; transition: filter .15s; }
.chart-bar:hover { filter: brightness(1.05); }
.chart-bar .chart-val {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chart-day { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.chart-day b { display: block; color: var(--ink-2); font-weight: 600; font-size: 12px; }

.rank-list { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rank-row:last-child { border-bottom: none; }
.rank-no { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #eef2f5; color: #5b6b78; flex: none; }
.rank-row:nth-child(1) .rank-no { background: #fff1d6; color: #b45309; }
.rank-row:nth-child(2) .rank-no { background: #eef1f5; color: #475569; }
.rank-row:nth-child(3) .rank-no { background: #fdeee5; color: #b45309; }
.rank-name { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

.progress { height: 6px; border-radius: 999px; background: #eef2f5; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #0f9d6e); }

/* ---------------- 收银台 ---------------- */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; align-items: start; }

.pos-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pos-search { display: flex; gap: 10px; }
.pos-search .input { min-height: 44px; font-size: 15px; }
.pos-search .btn { min-width: 88px; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 5px 13px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    font-weight: 550;
    transition: all .12s ease;
}
.chip:hover { border-color: #c9d6e0; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 10px; max-height: calc(100vh - 290px); overflow-y: auto; padding-right: 4px; align-content: start; }
.product-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s, transform .08s;
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 112px;
}
.product-card:hover { border-color: #b9e6d6; box-shadow: 0 8px 20px -14px rgba(15, 157, 110, .5); }
.product-card:active { transform: scale(.985); }
.product-card .p-name { font-size: 13.5px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.product-card .p-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: auto; }
.product-card .p-price { color: var(--primary-ink); font-weight: 750; font-size: 16px; font-variant-numeric: tabular-nums; }
.product-card .p-price small { font-size: 11px; font-weight: 600; }
.product-card .p-stock { font-size: 11.5px; color: var(--muted); }
.product-card .p-stock.low { color: var(--danger); font-weight: 650; }
.product-card .p-aux {
    align-self: flex-start;
    border: 1px dashed #b9e6d6;
    background: #f2fbf7;
    color: var(--primary-ink);
    border-radius: 7px;
    padding: 2px 8px;
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
    line-height: 1.7;
}
.product-card .p-aux:hover { background: var(--primary-soft); }
.p-exp {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 650;
    padding: 1px 7px;
    border-radius: 6px;
    line-height: 1.6;
}
.p-exp.near { background: var(--warn-soft); color: #9a5b04; }
.p-exp.expired { background: var(--danger-soft); color: #b42318; }
.product-card.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; filter: grayscale(.4); }
.product-empty { grid-column: 1 / -1; }

.pos-cart {
    position: sticky;
    top: 80px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    overflow: hidden;
}
.cart-head { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.cart-head h2 .icon { color: var(--primary); width: 17px; height: 17px; }
.cart-member { padding: 12px 18px; border-bottom: 1px dashed var(--line); }
.member-picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #f4fbf8; border: 1px solid #d3efe3; border-radius: 9px; padding: 8px 10px; font-size: 13px; }
.member-picked b { font-weight: 650; }
.member-picked small { color: var(--muted); display: block; font-size: 11.5px; margin-top: 1px; }
.member-search { position: relative; }
.member-results {
    position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 5px);
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; padding: 5px;
}
.member-results:empty { display: none; }
.member-result { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.member-result:hover { background: var(--primary-soft); }
.member-result small { color: var(--muted); }

.cart-lines { flex: 1; overflow-y: auto; padding: 4px 12px; min-height: 100px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 4px; border-bottom: 1px dashed var(--line); align-items: center; }
.cart-line:last-child { border-bottom: none; }
.cl-name { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.cl-price { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cl-right { display: flex; align-items: center; gap: 10px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.qty button { border: 0; background: transparent; width: 26px; height: 28px; cursor: pointer; font-size: 15px; color: var(--ink-2); }
.qty button:hover { background: #f4f7f9; }
.qty span { min-width: 26px; text-align: center; font-weight: 650; font-size: 13px; }
.cl-amount { min-width: 66px; text-align: right; font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cl-del { border: 0; background: transparent; color: #b3c1cc; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; }
.cl-del:hover { color: var(--danger); }

.cart-empty { padding: 38px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.cart-empty .icon { margin: 0 auto 8px; width: 34px; height: 34px; opacity: .35; }

.cart-summary { border-top: 1px solid var(--line); padding: 13px 18px; background: #fbfdfe; }
.sum-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); padding: 3px 0; }
.sum-row .money { font-variant-numeric: tabular-nums; font-weight: 600; }
.sum-row.total { padding-top: 7px; margin-top: 4px; border-top: 1px dashed var(--line); font-weight: 750; color: var(--ink); font-size: 14px; }
.sum-row.total .money { font-size: 21px; color: var(--danger); }
.pay-total { color: var(--danger); }

.discount-box { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; }
.discount-box .input { min-height: 34px; padding: 5px 10px; }

.cart-pay { padding: 0 18px 16px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 10px; }
.pay-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 8px 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    text-align: center;
    transition: all .12s;
}
.pay-btn:hover { border-color: #c9d6e0; }
.pay-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 1px var(--primary) inset; }
.pay-btn:disabled { opacity: .45; cursor: not-allowed; }
.cash-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cash-row .input { flex: 1; }
.change-chip { font-size: 12px; color: var(--muted); white-space: nowrap; }
.change-chip b { color: var(--danger); font-size: 13px; }

.btn-checkout { width: 100%; padding: 12px 16px; font-size: 16px; font-weight: 750; border-radius: 11px; }

/* 结算成功弹窗 */
.modal-mask {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(9, 30, 42, .5);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-mask[hidden] { display: none; }
.modal {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 26px;
    animation: modal-in .18s ease;
    max-height: 92vh;
    overflow-y: auto;
}
.modal.wide { max-width: 560px; }
@keyframes modal-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-icon { width: 54px; height: 54px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; }
.modal-icon .icon { width: 28px; height: 28px; }
.modal h3 { text-align: center; font-size: 18px; margin-bottom: 4px; }
.modal .modal-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.receipt-sum { background: #f8fbfa; border: 1px dashed #cfe9de; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.receipt-sum .row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; }
.receipt-sum .row b { font-variant-numeric: tabular-nums; }
.receipt-sum .row.big { font-size: 15px; font-weight: 750; }
.receipt-sum .row.big b { color: var(--danger); font-size: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ---------------- 登录页 ---------------- */
.login-body { background: #eef4f7; }
.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}
.login-side {
    background:
        radial-gradient(900px 500px at 10% 0%, rgba(52, 211, 153, .18), transparent 60%),
        radial-gradient(700px 500px at 90% 100%, rgba(20, 184, 166, .12), transparent 55%),
        linear-gradient(160deg, #0d2531, #0a1c26 70%);
    color: #dbe8f0;
    padding: 54px 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 44px; font-weight: 700; color: #fff; font-size: 16px; }
.login-side h2 { font-size: 40px; line-height: 1.25; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.login-sub { color: #93aab8; margin-top: 16px; font-size: 15px; max-width: 420px; }
.login-points { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 12px; color: #b9cbd6; font-size: 14px; }
.login-points li { display: flex; align-items: center; gap: 10px; }
.login-points li::before { content: "✓"; width: 20px; height: 20px; border-radius: 50%; background: rgba(45, 212, 168, .18); color: #6ef0c8; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.login-mock {
    margin-top: 44px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 16px;
    padding: 18px 22px;
    max-width: 380px;
}
.mock-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; color: #93aab8; }
.mock-row b { color: #ecf5fa; font-variant-numeric: tabular-nums; }
.login-card {
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 54px 64px;
}
.login-card h1 { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.login-tip { color: var(--muted); margin: 6px 0 24px; font-size: 14px; }
.login-form { max-width: 380px; }
.login-form .field > span { font-size: 13px; }
.login-form .input { min-height: 44px; }
.login-form .btn { margin-top: 6px; }
.login-hint { margin-top: 26px; font-size: 12.5px; color: var(--muted); line-height: 1.8; background: #f6f9fb; border: 1px dashed var(--line); padding: 10px 13px; border-radius: 9px; max-width: 380px; }

/* ---------------- 杂项 ---------------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    transform: translate(-50%, 16px);
    background: #13232e;
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 90;
    max-width: 86vw;
    box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7f1d1d; }

.divider { height: 1px; background: var(--line-2); margin: 6px 0 16px; }
.dot-sep { color: var(--line); margin: 0 6px; }
.price-tag { color: var(--primary-ink); font-weight: 700; }
.warn-text { color: var(--danger); font-weight: 600; }

.receipt-btn { display: inline-flex; align-items: center; gap: 6px; }

/* 打印小票时隐藏页面其它内容由小票页自身处理 */

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
    .pos-layout { grid-template-columns: minmax(0, 1fr) 390px; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    body.sidebar-open .sidebar { transform: none; }
    .sidebar-mask { display: block; position: fixed; inset: 0; background: rgba(9, 30, 42, .45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
    body.sidebar-open .sidebar-mask { opacity: 1; pointer-events: auto; }
    .main { margin-left: 0; }
    .menu-btn { display: grid !important; }
    .topbar { padding: 0 16px; }
    .page { padding: 16px 16px 34px; }
    .date-chip { display: none; }
    .pos-layout { grid-template-columns: 1fr; }
    .pos-cart { position: static; max-height: none; }
    .product-grid { max-height: none; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-side { display: none; }
    .login-card { padding: 40px 24px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .kpi-value { font-size: 23px; }
}

@media (max-width: 620px) {
    .grid-4 { grid-template-columns: 1fr; }
    .pay-methods { grid-template-columns: repeat(2, 1fr); }
    .topbar-title h1 { font-size: 16px; }
    .table th, .table td { padding: 10px 12px; }
}
