/* 夜市巡查系统 - 公共基础样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* ===== 主题变量 =====
   默认主题 = 橙色（夜市烟火）
   html.theme-blue   = 经典蓝色主题
   html.theme-custom = 自定义主色（--custom-primary 由前端注入）
*/
:root, html.theme-orange {
  --primary: #ff6b35;
  --primary-dark: #e55a28;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #26303e;
  --text2: #7a869a;
  --border: #e8ecf2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.05);
  --soft-bg: #fff0e8;        /* 主色浅底（标签/悬停） */
  --grad-end: #ff9a6b;       /* 渐变浅端 */
  --login-bg1: #ff6b35;      /* 登录页渐变起点 */
  --login-bg2: #e5522a;      /* 登录页渐变终点 */
}
html.theme-blue {
  --primary: #1a6ef5;
  --primary-dark: #0f55c4;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2937;
  --text2: #6b7280;
  --border: #e5e7eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --soft-bg: #eef2ff;
  --grad-end: #4f8ef7;
  --login-bg1: #0f172a;
  --login-bg2: #1e3a5f;
}
html.theme-custom {
  --primary: var(--custom-primary, #ff6b35);
  --primary-dark: color-mix(in srgb, var(--primary) 82%, #000);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #26303e;
  --text2: #7a869a;
  --border: #e8ecf2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.05);
  --soft-bg: color-mix(in srgb, var(--primary) 12%, #fff);
  --grad-end: color-mix(in srgb, var(--primary) 72%, #fff);
  --login-bg1: var(--primary);
  --login-bg2: var(--primary-dark);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
img { max-width: 100%; }

/* 通用按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: none; border-radius: 8px; padding: 8px 16px;
  font-size: 14px; font-weight: 500; color: #fff; background: var(--primary);
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-green { background: var(--success); }
.btn-orange { background: var(--warning); color: #fff; }
.btn-red { background: var(--danger); }
.btn-gray { background: #e5e7eb; color: #374151; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
th { background: #fafbfc; font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafbfc; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.tag-normal { background: #dcfce7; color: #15803d; }
.tag-absent { background: #f3f4f6; color: #4b5563; }
.tag-abnormal { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.tag-pending { background: #fef3c7; color: #b45309; }
.tag-done { background: #dcfce7; color: #15803d; }
.tag-overdue { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.tag-expired { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.tag-soon { background: #fef3c7; color: #b45309; }
.tag-ok { background: #dcfce7; color: #15803d; }

/* 异常标红行 */
tr.row-abnormal td { background: #fff1f1 !important; }
.row-abnormal .stall-no { color: var(--danger); font-weight: 700; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; padding: 22px;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text2); line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 照片缩略 */
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-thumb {
  width: 72px; height: 72px; border-radius: 8px; object-fit: cover; cursor: zoom-in;
  border: 1px solid var(--border); background: #f3f4f6;
}
.photo-thumb.large { width: 96px; height: 96px; }
.photo-empty { color: var(--text2); font-size: 12px; line-height: 72px; }

#photoMask { z-index: 300; }
#photoLayer { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: none; align-items: center; justify-content: center; z-index: 500; padding: 16px; cursor: zoom-out; }
#photoLayer.show { display: flex; }