/* ============================================================
   百城联创『油烟管道清洗记录管理系统』- 公共样式
   三端口配色：清洗端=深蓝 / 餐饮端=暖橙 / 监管端=翠绿
   ============================================================ */
:root {
  --radius: 10px;
  --shadow: 0 2px 10px rgba(15, 23, 42, .08);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, .14);
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --main: #1d4ed8;       /* 清洗端主色 */
  --main-dark: #1e3a8a;
  --main-light: #eff6ff;
  --accent: #0ea5e9;
}
[data-theme="restaurant"] {
  --main: #ea580c;
  --main-dark: #9a3412;
  --main-light: #fff7ed;
  --accent: #f59e0b;
}
[data-theme="inspect"] {
  --main: #059669;
  --main-dark: #065f46;
  --main-light: #ecfdf5;
  --accent: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--main); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 通用布局 ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-size: 12px; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---------- 顶部导航 ---------- */
.topbar {
  background: linear-gradient(120deg, var(--main-dark), var(--main));
  color: #fff; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
.topbar .inner { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.brand small { display: block; font-size: 10.5px; font-weight: 400; opacity: .85; margin-top: 1px; }
.topbar nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a {
  color: rgba(255,255,255,.9); padding: 7px 13px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
}
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.18); color: #fff; }
.topbar .user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255,255,255,.95); flex-wrap: wrap; }
.topbar .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.btn-ghost-light {
  background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
  padding: 5px 12px; border-radius: 8px; font-size: 12.5px;
}
.btn-ghost-light:hover { background: rgba(255,255,255,.15); }

/* ---------- 激活状态横幅 ---------- */
.act-banner {
  max-width: 1120px; margin: 12px auto 0; padding: 8px 16px; border-radius: 10px;
  font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.act-banner a { font-weight: 700; text-decoration: underline; }
.act-ok { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }
.act-warn { background: #fef3c7; border: 1px solid #fde68a; color: #78350f; }
.act-expired { background: #fee2e2; border: 1px solid #fca5a5; color: #7f1d1d; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--main); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; transition: .15s;
}
.btn:hover { background: var(--main-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; color: var(--main); border: 1.5px solid var(--main); }
.btn-outline:hover { background: var(--main-light); }
.btn-weak { background: #f1f5f9; color: #334155; }
.btn-weak:hover { background: #e2e8f0; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #b91c1c; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #15803d; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--main); box-shadow: 0 0 0 3px color-mix(in srgb, var(--main) 14%, transparent); }
.textarea { min-height: 84px; resize: vertical; }
.form-error { display: none; background: #fef2f2; border: 1px solid #fecaca; color: var(--bad); padding: 10px 14px; border-radius: 8px; margin-top: 12px; font-size: 13px; }
.form-error.show { display: block; }
.form-tip { background: var(--main-light); border: 1px solid color-mix(in srgb, var(--main) 22%, transparent); color: var(--main-dark); padding: 10px 14px; border-radius: 8px; margin-top: 12px; font-size: 12.5px; }

/* ---------- 认证页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px; background:
  radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--main) 22%, transparent), transparent 60%),
  radial-gradient(800px 500px at 110% 110%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%), var(--bg);
}
.auth-box { width: 100%; max-width: 440px; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 30px 30px 26px; }
.auth-card .logo-big { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--main), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; margin-bottom: 14px; }
.auth-card h1 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; background: #f1f5f9; padding: 4px; border-radius: 10px; }
.auth-tabs button { flex: 1; border: none; background: transparent; padding: 8px 0; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--main); box-shadow: var(--shadow); }
.auth-foot { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.auth-foot a { color: var(--main); font-weight: 600; }

/* ---------- 记录卡片/列表 ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow); transition: .15s; cursor: pointer; }
.item:hover { border-color: var(--main); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.item-title { font-size: 15px; font-weight: 700; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-ok { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-archived { background: #e2e8f0; color: #64748b; }
.badge-active { background: #dbeafe; color: #1d4ed8; }
.badge-due { background: #fee2e2; color: #b91c1c; }
.tag { display: inline-block; background: #f1f5f9; color: #475569; border-radius: 6px; padding: 1px 8px; font-size: 11.5px; }

/* ---------- 对比照片 ---------- */
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.photo-box { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f8fafc; }
.photo-box img { width: 100%; height: 168px; object-fit: cover; display: block; }
.photo-box .cap { padding: 6px 10px; font-size: 12px; font-weight: 600; color: #475569; }
.photo-box.before .cap { background: #fef2f2; color: #b91c1c; }
.photo-box.after .cap { background: #f0fdf4; color: #15803d; }
.photo-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo-thumbs .thumb { border-radius: 8px; border: 1px solid var(--line); overflow: hidden; position: relative; }
.photo-thumbs .thumb img { width: 100%; height: 96px; object-fit: cover; display: block; }
.photo-thumbs .thumb .tt { position: absolute; left: 6px; bottom: 6px; background: rgba(15,23,42,.65); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 6px; }
.upload-zone {
  border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center;
  color: var(--muted); transition: .15s; cursor: pointer; background: #fafbfd;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--main); background: var(--main-light); }
.upload-zone input[type=file] { display: none; }
.upload-zone .u-icon { font-size: 26px; }

/* ---------- 统计/徽标 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-card .k { font-size: 12.5px; color: var(--muted); }
.stat-card .v { font-size: 26px; font-weight: 800; margin-top: 4px; color: var(--main-dark); }
.stat-card .v small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- 栈 / 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 99; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); max-width: 620px; width: 100%; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; }
.modal-close { width: 30px; height: 30px; border-radius: 8px; border: none; background: #f1f5f9; color: #475569; font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .icon { font-size: 40px; margin-bottom: 8px; opacity: .5; }

/* ---------- 合规状态横幅 ---------- */
.banner { border-radius: 12px; padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.banner-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.banner-due { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }
.banner-none { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner .big { font-size: 26px; }
.banner h3 { font-size: 17px; }

/* ---------- 客服工单 ---------- */
.ticket { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow); }
.ticket .t-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ticket .t-subject { font-weight: 700; font-size: 14.5px; }
.ticket .t-body { color: #334155; font-size: 13.5px; }
.ticket .t-reply { background: var(--main-light); border-left: 3px solid var(--main); border-radius: 8px; padding: 10px 14px; margin-top: 10px; font-size: 13px; color: var(--main-dark); }

/* ---------- 打印 ---------- */
.print-area { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 30px 34px; }
.print-head { display: flex; justify-content: space-between; border-bottom: 3px solid var(--main); padding-bottom: 12px; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.print-head h1 { font-size: 21px; color: var(--main-dark); }
.print-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin-bottom: 16px; }
.print-kv .kv { display: flex; gap: 8px; font-size: 13.5px; }
.print-kv .kv b { color: var(--muted); font-weight: 600; min-width: 64px; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .topbar nav a { padding: 6px 9px; font-size: 12.5px; }
  .brand { font-size: 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .photo-pair { grid-template-columns: 1fr; }
  .print-kv { grid-template-columns: 1fr; }
  .page { padding: 18px 12px 60px; }
}
@media print {
  body { background: #fff; }
  .topbar, .no-print { display: none !important; }
  .page { padding: 0; max-width: none; }
}