/* ============================================================
   厨房燃油配送记账系统 - 前端样式（移动优先，兼顾电脑）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warn: #d97706;
  --warn-light: #fef3c7;
  --info: #2563eb;
  --info-light: #dbeafe;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
}
html, body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* 主容器：手机全宽，电脑居中 */
.app-container { max-width: 720px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 70px; }
.page { display: none; padding: 12px; }
.page.active { display: block; }

/* 顶部标题栏 */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; }
.topbar .title { font-size: 17px; font-weight: 700; }
.topbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.topbar .btn-icon { background: rgba(255,255,255,.18); border: none; color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .more { font-size: 12px; color: var(--info); font-weight: 400; }

/* 今日统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.stat-card .label { font-size: 12px; color: var(--text-2); }
.stat-card .value { font-size: 22px; font-weight: 800; margin-top: 6px; }
.stat-card .value.green { color: var(--primary); }
.stat-card .value.red { color: var(--danger); }
.stat-card .value.blue { color: var(--info); }
.stat-card .value.amber { color: var(--warn); }
.stat-card .extra { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* 列表 */
.list-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .name { font-size: 15px; font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .right { text-align: right; flex-shrink: 0; }
.list-item .right .v { font-size: 15px; font-weight: 700; }
.list-item .right .s { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 徽标 */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge.red { background: var(--danger-light); color: var(--danger); }
.badge.green { background: var(--primary-light); color: var(--primary-dark); }
.badge.amber { background: var(--warn-light); color: var(--warn); }
.badge.blue { background: var(--info-light); color: var(--info); }
.badge.gray { background: #f3f4f6; color: var(--text-2); }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.form-control { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; background: #fff; outline: none; }
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 60px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 按钮 */
.btn { border: none; border-radius: 10px; padding: 12px 16px; font-size: 15px; font-weight: 600; width: 100%; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn:disabled { opacity: .5; }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; border-radius: 8px; }
.btn-block { display: block; }

/* 底部导航 */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); display: flex; z-index: 30; }
.bottom-nav .nav-item { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--text-3); font-size: 11px; text-decoration: none; }
.bottom-nav .nav-item .icon { font-size: 20px; display: block; margin-bottom: 2px; }
.bottom-nav .nav-item.active { color: var(--primary); font-weight: 700; }
@media (min-width: 720px) {
  .bottom-nav { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 12px 12px 0 0; }
}

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: none; align-items: flex-end; justify-content: center; }
.modal-mask.show { display: flex; }
.modal { background: #fff; width: 100%; max-width: 720px; border-radius: 16px 16px 0 0; padding: 18px 16px 24px; max-height: 85vh; overflow-y: auto; }
.modal .modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal .modal-close { float: right; border: none; background: none; font-size: 18px; color: var(--text-3); }

/* 提示 */
.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(17,24,39,.9); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 100; display: none; max-width: 90%; }
.toast.show { display: block; }

/* 油品选择卡片 */
.product-select { display: flex; gap: 10px; flex-wrap: wrap; }
.product-card { flex: 1 1 45%; background: #fff; border: 2px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.product-card.selected { border-color: var(--primary); background: var(--primary-light); }
.product-card .p-name { font-size: 15px; font-weight: 700; }
.product-card .p-price { font-size: 18px; font-weight: 800; color: var(--primary-dark); margin-top: 6px; }
.product-card .p-unit { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 数量步进器 */
.qty-stepper { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 10px 0; }
.qty-stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 22px; color: var(--primary); }
.qty-stepper .qty { font-size: 26px; font-weight: 800; min-width: 70px; text-align: center; }

/* 结算方式切换 */
.settle-toggle { display: flex; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.settle-toggle .st-item { flex: 1; text-align: center; padding: 12px 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.settle-toggle .st-item.active-cash { background: var(--primary); color: #fff; }
.settle-toggle .st-item.active-credit { background: var(--warn); color: #fff; }

/* 金额展示 */
.amount-box { text-align: center; padding: 16px; background: #f9fafb; border-radius: var(--radius); margin: 12px 0; }
.amount-box .amount { font-size: 34px; font-weight: 800; color: var(--primary-dark); }

/* 收款订单勾选 */
.pay-order-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.pay-order-item .check { width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; flex-shrink: 0; }
.pay-order-item.checked .check { background: var(--primary); border-color: var(--primary); }
.pay-order-item .info { flex: 1; font-size: 13px; }
.pay-order-item .info .d { color: var(--text-3); font-size: 11px; margin-top: 2px; }

/* 分段标题 */
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 14px 0 8px; display: flex; justify-content: space-between; align-items: center; }

/* 标签页 */
.tabs { display: flex; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 12px; }
.tabs .tab { flex: 1; text-align: center; padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tabs .tab.active { background: var(--primary); color: #fff; }

/* 空状态 */
.empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 30px 0; }

/* 简单柱状图 */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 10px; }
.bar-chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-chart .bar { width: 70%; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-chart .bar-label { font-size: 9px; color: var(--text-3); white-space: nowrap; }

/* 对账单样式 */
.statement-head { text-align: center; padding: 6px 0 14px; }
.statement-head .shop { font-size: 20px; font-weight: 800; }
.statement-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.statement-summary .s-item { background: #f9fafb; border-radius: 10px; padding: 10px; text-align: center; }
.statement-summary .s-item .l { font-size: 11px; color: var(--text-2); }
.statement-summary .s-item .v { font-size: 17px; font-weight: 800; margin-top: 4px; }

/* 登录页 */
.login-wrap { max-width: 420px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--primary); color: #fff; font-size: 30px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.login-logo .app-name { font-size: 22px; font-weight: 800; margin-top: 12px; }
.login-logo .app-desc { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* 描述文本 */
.desc { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.center { text-align: center; }
.money { font-variant-numeric: tabular-nums; }

/* ===== 迭代：居中大成功弹窗 ===== */
.success-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.success-overlay.show { opacity: 1; pointer-events: auto; }
.success-card { background: #fff; border-radius: 18px; padding: 36px 48px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.success-icon { width: 72px; height: 72px; line-height: 72px; border-radius: 50%; background: #dcfce7; color: #16a34a; font-size: 44px; font-weight: 700; margin: 0 auto; }
.success-text { font-size: 18px; font-weight: 600; margin-top: 14px; color: #111; }

/* ===== 迭代：工作台快速收款按钮 ===== */
.quick-pay { white-space: nowrap; padding: 6px 12px; }

/* 客户下拉选择器 */
.customer-picker { position: relative; }
.customer-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); z-index: 60; max-height: 300px; overflow-y: auto; padding: 10px; display: none; }
.customer-dropdown.show { display: block; }

.mark-btn.active { background: #2563eb !important; color: #fff !important; border-color: #2563eb !important; }
