/* 文玉公司智能化运营系统 · 网页版样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f9;
  color: #1f2329;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* 顶部导航 */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(31, 35, 41, .04);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand { font-size: 16px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 9px; color: #1f2329; }
.topbar .brand-logo {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b6de8, #5a8ff0);
  color: #fff; font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar .nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; }
.topbar .nav a {
  padding: 8px 16px; border-radius: 8px; font-size: 14px; color: #4e5969; white-space: nowrap;
  transition: all .15s ease;
}
.topbar .nav a:hover { background: #f2f6fd; color: #2b6de8; }
.topbar .nav a.active { background: #eaf2ff; color: #2b6de8; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #4e5969; }
.topbar .right span { white-space: nowrap; }
.topbar button {
  border: 1px solid #e5e6eb; background: #fff; border-radius: 8px;
  padding: 6px 14px; cursor: pointer; font-size: 13px; color: #4e5969;
  transition: all .15s ease;
}
.topbar button:hover { border-color: #2b6de8; color: #2b6de8; background: #f2f6fd; }

/* 内容区 */
.container { max-width: 960px; margin: 22px auto; padding: 0 16px 40px; }
.card {
  background: #fff; border-radius: 12px; padding: 22px;
  box-shadow: 0 1px 3px rgba(31,35,41,.05), 0 4px 14px rgba(31,35,41,.03); margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 14px; padding-left: 10px; border-left: 3px solid #2b6de8; line-height: 1.3; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.muted { color: #86909c; font-size: 13px; }

/* 汇总卡片 */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-box {
  flex: 1; min-width: 130px; background: #f7f8fa; border-radius: 8px;
  padding: 14px 16px; text-align: center;
}
.stat-box .label { font-size: 12px; color: #86909c; margin-bottom: 6px; }
.stat-box .value { font-size: 22px; font-weight: 700; color: #1f2329; }
.stat-box.student .value { color: #2b6de8; }
.stat-box.teacher .value { color: #e8752b; }
.stat-box.total .value { color: #d03050; }

/* 金额汇总条（订单页 早餐/米粉） */
.amount-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.amount-chip {
  flex: 1; min-width: 130px; border-radius: 8px; padding: 12px 16px; color: #fff;
}
.amount-chip.breakfast { background: linear-gradient(135deg, #2b6de8, #5a8ff0); }
.amount-chip.rice { background: linear-gradient(135deg, #e8752b, #f0a05a); }
.amount-chip .alabel { font-size: 12px; opacity: .9; }
.amount-chip .avalue { font-size: 22px; font-weight: 700; margin-top: 2px; }

/* 分类标题 */
.cat-title { font-size: 14px; font-weight: 600; color: #1f2329; margin: 14px 0 8px; padding-left: 8px; border-left: 3px solid #2b6de8; }

/* tab 切换 */
.tabs-nav { display: flex; gap: 4px; border-bottom: 1px solid #f0f1f3; margin-bottom: 16px; }
.tabs-nav .tab { padding: 9px 16px; cursor: pointer; font-size: 14px; color: #4e5969; border-bottom: 2px solid transparent; }
.tabs-nav .tab.active { color: #2b6de8; border-bottom-color: #2b6de8; font-weight: 500; }

/* 餐别切换 + 下载按钮 */
.meal-switch { display: flex; background: #f5f6f8; border-radius: 8px; padding: 4px; margin-bottom: 14px; }
.meal-btn { flex: 1; text-align: center; padding: 8px 0; font-size: 14px; color: #4e5969; border-radius: 6px; cursor: pointer; }
.meal-btn.active { background: #fff; color: #2b6de8; font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.action-bar { display: flex; gap: 10px; margin-top: 16px; }
.action-bar .btn { flex: 1; }

/* 账单标题/元信息/签字（与下载的 Excel 表格一致） */
.bill-title { text-align: center; font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.bill-meta { font-size: 13px; color: #1f2329; margin-bottom: 4px; }
.bill-sign { font-size: 13px; color: #4e5969; margin-top: 10px; line-height: 1.8; }

/* 账单表格：宋体 + 全边框 + 列宽/字号/对齐，全部由内联样式（openpyxl 转 HTML）控制，与下载的 Excel 完全一致 */
#billingBody { font-family: "SimSun", "宋体", serif; color: #000; overflow-x: auto; }
#billingBody .bill-preview { max-width: 100%; }
#billingBody table { width: 100%; border-collapse: collapse; table-layout: fixed; }
#billingBody th, #billingBody td {
  border: none;
  padding: 0;
  text-align: center;
  background: #fff;
  color: #000;
  word-break: break-all;
  vertical-align: middle;
}

/* 对账表 7列：序号6% 商品名称30% 下单数量15% 单位8% 单价11% 金额小计17% 备注13% */
#billingBody .rec-table th:nth-child(1), #billingBody .rec-table td:nth-child(1) { width: 6%; }
#billingBody .rec-table th:nth-child(2), #billingBody .rec-table td:nth-child(2) { width: 30%; text-align: left; }
#billingBody .rec-table th:nth-child(3), #billingBody .rec-table td:nth-child(3) { width: 15%; }
#billingBody .rec-table th:nth-child(4), #billingBody .rec-table td:nth-child(4) { width: 8%; }
#billingBody .rec-table th:nth-child(5), #billingBody .rec-table td:nth-child(5) { width: 11%; }
#billingBody .rec-table th:nth-child(6), #billingBody .rec-table td:nth-child(6) { width: 17%; }
#billingBody .rec-table th:nth-child(7), #billingBody .rec-table td:nth-child(7) { width: 13%; }

/* 明细表 9列 */
#billingBody .det-table th:nth-child(1), #billingBody .det-table td:nth-child(1) { width: 5%; }
#billingBody .det-table th:nth-child(2), #billingBody .det-table td:nth-child(2) { width: 11%; }
#billingBody .det-table th:nth-child(3), #billingBody .det-table td:nth-child(3) { width: 27%; text-align: left; }
#billingBody .det-table th:nth-child(4), #billingBody .det-table td:nth-child(4) { width: 8%; }
#billingBody .det-table th:nth-child(5), #billingBody .det-table td:nth-child(5) { width: 8%; }
#billingBody .det-table th:nth-child(6), #billingBody .det-table td:nth-child(6) { width: 9%; }
#billingBody .det-table th:nth-child(7), #billingBody .det-table td:nth-child(7) { width: 11%; }
#billingBody .det-table th:nth-child(8), #billingBody .det-table td:nth-child(8) { width: 11%; }
#billingBody .det-table th:nth-child(9), #billingBody .det-table td:nth-child(9) { width: 10%; text-align: left; }

/* 汇总表 6列（序号/供应商名称跨3列/合计/备注），列宽用 colgroup 控制 */

/* 订单表格：商品名称/单位/订购总数/客户名称/订购明细/送达时间/备注 七列 */
.order-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 15px; }
.order-table th, .order-table td {
  border: 1px solid #c9cdd4;
  padding: 8px 8px;
  text-align: center;
  vertical-align: middle;
  word-break: break-all;
}
.order-table th { background: #f5f6f8; font-weight: 600; color: #4e5969; white-space: nowrap; font-size: 15px; }
.order-table th:nth-child(1) { width: 20%; }
.order-table th:nth-child(2) { width: 6%; }
.order-table th:nth-child(3) { width: 9%; }
.order-table th:nth-child(4) { width: 22%; }
.order-table th:nth-child(5) { width: 13%; }
.order-table th:nth-child(6) { width: 18%; }
.order-table th:nth-child(7) { width: 12%; }
.order-table .op-name { font-weight: 600; white-space: nowrap; }
.order-table .op-cust { white-space: normal; word-break: break-all; }
.order-table .op-time { color: #4e5969; }
.order-table .op-note { color: #d08a00; }
.order-table td.num, .order-table th.num { text-align: center; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #f0f1f3; }
th { background: #fafafa; color: #86909c; font-weight: 500; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag.student { background: #eaf2ff; color: #2b6de8; }
.tag.teacher { background: #fff3e8; color: #e8752b; }
.tag.confirmed { background: #e8f8ef; color: #23a55a; }
.tag.pending { background: #fff7e6; color: #d08a00; }
.tag.appealed { background: #ffecec; color: #d03050; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: #4e5969; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #e5e6eb; border-radius: 8px;
  font-size: 14px; outline: none; font-family: inherit; transition: border-color .15s ease;
  background: #fff;
}
.form-row textarea { resize: vertical; min-height: 64px; }
.form-row input:hover, .form-row select:hover, .form-row textarea:hover { border-color: #c9cdd4; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: #2b6de8; box-shadow: 0 0 0 3px rgba(43,109,232,.12); }
.btn {
  background: #2b6de8; color: #fff; border: none; border-radius: 8px;
  padding: 11px 20px; font-size: 14px; cursor: pointer; width: 100%;
  transition: all .15s ease;
}
.btn:hover { background: #1f5cd0; box-shadow: 0 3px 10px rgba(43,109,232,.22); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: #2b6de8; border: 1px solid #2b6de8; }
.btn.secondary:hover { background: #f2f6fd; box-shadow: none; }
.btn.danger { background: #fff; color: #d03050; border: 1px solid #d03050; }
.btn.danger:hover { background: #fff3f5; box-shadow: none; }
.btn-sm { width: auto; padding: 7px 14px; font-size: 13px; }

/* 登录页 */
.login-wrap { max-width: 400px; margin: 11vh auto 0; padding: 0 16px; }
.login-wrap .title { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-wrap .login-logo {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b6de8, #5a8ff0);
  color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(43,109,232,.28);
}
.login-wrap .title-main { font-size: 20px; font-weight: 700; color: #1f2329; }
.login-wrap .title-sub { font-size: 13px; color: #86909c; margin-top: 3px; }
.login-wrap .card { padding: 26px; }

/* 记住账号密码 */
.remember-row { margin-bottom: 14px; }
.remember-label {
  display: flex !important; align-items: center; gap: 7px;
  font-size: 13px !important; color: #4e5969 !important; cursor: pointer;
  margin-bottom: 0 !important;
}
.remember-label input[type="checkbox"] {
  width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: #2b6de8;
}

/* 登录欢迎浮层 */
.welcome-overlay {
  position: fixed; inset: 0; background: rgba(31, 35, 41, .5);
  display: flex; align-items: center; justify-content: center; z-index: 999;
  backdrop-filter: blur(2px);
}
.welcome-box {
  background: #fff; border-radius: 16px; padding: 36px 44px; text-align: center;
  box-shadow: 0 12px 40px rgba(31,35,41,.18); animation: welcomeIn .35s ease;
}
.welcome-emoji { font-size: 44px; line-height: 1; margin-bottom: 14px; }
.welcome-text { font-size: 18px; color: #1f2329; margin-bottom: 6px; }
.welcome-text b { color: #2b6de8; font-size: 20px; }
.welcome-sub { font-size: 14px; color: #86909c; }
@keyframes welcomeIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 工具行 */
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .form-row { margin-bottom: 0; flex: 1; min-width: 150px; }
.toolbar .btn { width: auto; }

/* 工资卡片 */
.salary-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; border: 1px solid #eef0f3; border-radius: 8px; margin-bottom: 10px; }
.salary-item .smonth { font-weight: 600; font-size: 15px; min-width: 90px; }
.salary-item .samount { font-size: 18px; font-weight: 700; color: #1f2329; }
.salary-item .sstatus { margin-left: auto; }
.salary-item .sactions { display: flex; gap: 8px; }

/* 人工干预 */
.adjust-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #f0f1f3; font-size: 13px; }
.adjust-item .atext { flex: 1; }
.adjust-item .adel { color: #d03050; cursor: pointer; font-size: 12px; white-space: nowrap; }
.adjust-form { border-top: 1px solid #f0f1f3; margin-top: 12px; padding-top: 12px; }
.adjust-form .form-title { font-size: 13px; font-weight: 600; color: #4e5969; margin-bottom: 10px; }

/* 请假 */
.sub-title { font-size: 14px; font-weight: 600; color: #1f2329; margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid #f0f1f3; }
.leave-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f5f6f8; font-size: 13px; }
.leave-item:last-child { border-bottom: none; }
.leave-main { flex: 1; }
.leave-range { color: #4e5969; }
.leave-actions { display: flex; gap: 8px; white-space: nowrap; }
.adel { color: #d03050; cursor: pointer; font-size: 13px; white-space: nowrap; }
.adel.ok { color: #23a55a; }

/* 模板上传 */
.tpl-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f5f6f8; }
.tpl-item:last-child { border-bottom: none; }
.tpl-info { display: flex; align-items: center; gap: 10px; }
.tpl-name { font-size: 14px; font-weight: 600; }
.tpl-status { font-size: 12px; color: #86909c; }
.tpl-status.ok { color: #23a55a; }

/* 米粉厂：学校卡片 */
.rice-school { border: 1px solid #eef0f3; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.rice-school .school-name { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.rice-row { display: flex; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #f5f6f8; }
.rice-row .rice-name { flex: 1; }
.rice-row .rice-qty { color: #4e5969; }
.rice-row .rice-amt { color: #d03050; }
.rice-school .school-total { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; padding-top: 8px; }

/* 配送师傅：工作安排 */
.schedule-list { display: flex; flex-direction: column; gap: 10px; }
.schedule-item {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid #eef0f3; border-radius: 10px; padding: 14px 16px;
  transition: box-shadow .15s ease;
}
.schedule-item:hover { box-shadow: 0 2px 10px rgba(31,35,41,.06); }
.schedule-seq {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: #eaf2ff; color: #2b6de8; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.schedule-main { flex: 1; }
.schedule-school { font-size: 15px; font-weight: 600; }
.schedule-time { font-size: 16px; font-weight: 700; color: #d03050; white-space: nowrap; }

/* 品目拍照：照片网格 */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-card {
  border: 1px solid #eef0f3; border-radius: 10px; overflow: hidden; background: #fff;
  transition: box-shadow .15s ease;
}
.photo-card:hover { box-shadow: 0 3px 12px rgba(31,35,41,.08); }
.photo-card img { width: 100%; height: 160px; object-fit: cover; display: block; background: #f5f6f8; }
.photo-meta { padding: 10px 12px; }
.photo-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }

/* 提示 */
.error { color: #d03050; font-size: 13px; margin-top: 8px; }
.empty { text-align: center; color: #86909c; padding: 30px 0; font-size: 13px; }
.loading { text-align: center; color: #86909c; padding: 30px 0; font-size: 13px; }

/* 注册链接 */
.register-link { text-align: center; margin-top: 14px; font-size: 13px; color: #4e5969; }
.register-link a { color: #2b6de8; }
.hint { font-size: 13px; color: #86909c; margin-bottom: 16px; line-height: 1.6; }

/* 移动端适配 */
@media (max-width: 600px) {
  .topbar { padding: 0 12px; height: 54px; }
  .topbar .brand { font-size: 15px; }
  .topbar .brand-logo { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }
  .topbar .right span { display: none; }
  .topbar .nav a { padding: 7px 11px; font-size: 13px; }
  .container { padding: 0 12px 40px; margin-top: 16px; }
  .card { padding: 15px; }
  .stat-box { min-width: 100px; }
  .stat-box .value { font-size: 18px; }
  .amount-chip .avalue { font-size: 18px; }
  .table-wrap { overflow-x: auto; }
}

/* 打印样式：只打印账单表格本身（标题+表+签字），隐藏导航/筛选/收入/干预/按钮 */
@media print {
  body { background: #fff; }
  #topbar { display: none !important; }
  #app .card:not(.bill-card) { display: none !important; }
  .tabs-nav, .action-bar, .meal-switch, .toolbar, .btn { display: none !important; }
  .bill-card { box-shadow: none; border: none; padding: 0; margin: 0; }
  .container { max-width: none; margin: 0; padding: 0; }
}
