/* 奶茶小吃收银系统 - 全局样式（触摸屏友好） */
:root {
    --primary: #e8590c;
    --primary-dark: #c7510c;
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #dc2626;
    --success: #16a34a;
    --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- 登录 ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #fff4e6 0%, #ffd8a8 100%);
}
.login-box {
    background: var(--card); border-radius: 16px; padding: 36px 40px;
    width: 360px; box-shadow: 0 12px 32px rgba(0,0,0,.12); text-align: center;
}
.login-logo { font-size: 48px; }
.login-box h1 { font-size: 22px; margin: 8px 0 2px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }
.login-box input {
    display: block; width: 100%; padding: 12px 14px; margin-bottom: 12px;
    border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
}
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-tip { margin-top: 12px; font-size: 13px; min-height: 18px; }

/* ---------- 布局 ---------- */
.app-body { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
    width: 190px; background: #1f2937; color: #fff;
    display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-logo {
    padding: 20px 16px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-icon { font-size: 26px; }
.logo-text { font-weight: 700; font-size: 15px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 18px; color: #cbd5e1; text-decoration: none; font-size: 14px;
    transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-icon { font-size: 18px; }
.sidebar-user {
    padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
    display: flex; justify-content: space-between; align-items: center;
}
.user-name { font-size: 13px; }
.badge-admin {
    background: var(--primary); color: #fff; font-size: 11px;
    padding: 2px 6px; border-radius: 4px; margin-left: 6px;
}
.logout-link { color: #9ca3af; font-size: 12px; text-decoration: none; }
.logout-link:hover { color: #fff; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 54px; background: var(--card); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; flex-shrink: 0;
}
.page-title { font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.print-indicator {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fef3c7; color: #92400e; padding: 6px 12px; border-radius: 20px;
    font-size: 13px; font-weight: 600;
}
.print-indicator.has-task { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

.content-area { flex: 1; overflow-y: auto; padding: 18px 20px; }

/* ---------- 通用组件 ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 16px 18px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 12px; }
.page-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .page-grid { grid-template-columns: 1fr; } }

.btn {
    border: 1px solid var(--border); background: var(--card); color: var(--text);
    padding: 9px 16px; border-radius: 8px; font-size: 14px; cursor: pointer;
    transition: all .15s;
}
.btn:hover { border-color: #cbd5e1; background: #f9fafb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; font-weight: 700; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input-sm, .data-table input, .data-table select, select.input-sm {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.input-sm:focus, select.input-sm:focus { outline: none; border-color: var(--primary); }

.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row label { min-width: 110px; color: var(--muted); font-size: 13px; }
.form-row input, .form-row select { flex: 1; max-width: 320px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--muted); font-weight: 600; background: #fafafa; }
.data-table tr:hover td { background: #fafafa; }

.empty-tip { color: var(--muted); text-align: center; padding: 20px; }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px;
}
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }

.tip { color: var(--muted); font-size: 12px; margin: 6px 0 12px; }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ---------- 弹层 ---------- */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
    display: flex; align-items: center; justify-content: center;
}
.modal-box {
    background: var(--card); border-radius: 12px; width: 420px; max-width: 92vw;
    max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-wide { width: 640px; }
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot {
    padding: 12px 18px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------- 收银台 ---------- */
.pos-layout { display: flex; gap: 14px; height: calc(100vh - 54px - 36px); min-height: 520px; }
.pos-cats {
    width: 130px; background: var(--card); border-radius: var(--radius);
    border: 1px solid var(--border); overflow-y: auto; flex-shrink: 0;
}
.cat-btn {
    display: block; width: 100%; padding: 16px 10px; text-align: center;
    border: none; border-bottom: 1px solid var(--border); background: none;
    font-size: 14px; cursor: pointer; color: var(--text);
}
.cat-btn.active { background: var(--primary); color: #fff; font-weight: 700; }

.pos-goods { flex: 1; background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow-y: auto; min-width: 0; }
.pos-goods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding: 12px; }
.goods-card {
    border: 1px solid var(--border); border-radius: 10px; padding: 12px 8px;
    text-align: center; cursor: pointer; user-select: none; transition: all .12s;
    background: #fff; display: flex; flex-direction: column; gap: 4px; min-height: 88px;
    justify-content: center;
}
.goods-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(232,89,12,.15); }
.goods-card.off { opacity: .45; }
.goods-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.goods-price { color: var(--primary); font-weight: 700; }
.goods-img { width: 100%; height: 64px; object-fit: cover; border-radius: 8px; }

.pos-cart {
    width: 340px; background: var(--card); border-radius: var(--radius);
    border: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0;
}
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cart-type { display: flex; gap: 6px; }
.type-btn {
    padding: 7px 12px; border: 1px solid var(--border); background: #fff; border-radius: 8px;
    font-size: 13px; cursor: pointer;
}
.type-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.cart-tools { display: flex; gap: 6px; }

.cart-items { flex: 1; overflow-y: auto; padding: 8px 10px; }
.cart-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 8px; border-bottom: 1px dashed var(--border); gap: 8px;
}
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-size: 13px; font-weight: 600; }
.ci-spec { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ci-price { font-size: 13px; color: var(--primary); font-weight: 700; white-space: nowrap; }
.ci-qty { display: flex; align-items: center; gap: 6px; }
.qty-btn {
    width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
    background: #fff; font-size: 16px; cursor: pointer; line-height: 1;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }

.cart-member { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border); align-items: center; }
.cart-member input { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.member-info { font-size: 12px; color: var(--success); white-space: nowrap; }

.cart-summary { padding: 10px 12px; border-top: 1px solid var(--border); }
.sum-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 2px 0; }
.sum-row.big { font-size: 18px; color: var(--text); font-weight: 700; margin-top: 4px; }
.sum-row.big span:last-child { color: var(--primary); }

.pay-methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0 12px 10px; }
.pay-btn {
    padding: 9px 0; border: 1px solid var(--border); background: #fff; border-radius: 8px;
    font-size: 12px; cursor: pointer;
}
.pay-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

.cart-actions { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.cart-actions .btn { flex: 1; }

/* 规格弹层 */
.modal-spec { width: 480px; }
.spec-group { margin-bottom: 14px; }
.spec-group-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--muted); }
.spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-opt {
    padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; font-size: 13px; cursor: pointer;
}
.spec-opt.selected { border-color: var(--primary); background: #fff4e6; color: var(--primary); font-weight: 700; }
.spec-qty { display: flex; align-items: center; gap: 14px; }
.spec-qty .qty-btn { width: 34px; height: 34px; font-size: 20px; }
.spec-qty span { font-size: 20px; font-weight: 700; min-width: 24px; text-align: center; }

/* 结算 */
.pay-info { display: flex; flex-direction: column; gap: 10px; }
.pay-line { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.pay-amount { font-size: 26px; font-weight: 800; color: var(--primary); }

/* ---------- 报表 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; text-align: center;
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--primary); margin-top: 6px; }
.trend-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 12px; }
.trend-bar {
    flex: 1; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 4px;
    position: relative;
}
.trend-bar span {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 11px; color: var(--muted); white-space: nowrap;
}

/* ---------- 订单筛选 ---------- */
.order-filter { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }

/* 外卖平台 */
.wm-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px;
}
.wm-item .wm-name { font-weight: 700; }
.wm-item .wm-status { font-size: 12px; }

/* toast */
#toastRoot { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 300; }
.toast {
    background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: 14px; margin-bottom: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.2);
    animation: slideIn .2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }
