/* ============ 电子巡查系统 共享样式 ============ */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #0a8f3c;
  --danger: #d93025;
  --warning: #f29900;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7280;
  --border: #e2e6ee;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
}

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

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  width: 100%; background: #fff; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
}
textarea { resize: vertical; min-height: 70px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h3 { font-size: 16px; margin-bottom: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.card-head h3 { margin-bottom: 0; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 600; color: #475467; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.tag-green { background: #e6f4ea; color: var(--success); }
.tag-red { background: #fce8e6; color: var(--danger); }
.tag-blue { background: #e8f0fe; color: var(--primary); }
.tag-gray { background: #f1f3f6; color: var(--muted); }
.tag-orange { background: #fef3e0; color: var(--warning); }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; color: #475467; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.required::after { content: " *"; color: var(--danger); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; padding: 24px;
}
.modal h3 { margin-bottom: 18px; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 提示 */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 2000; box-shadow: var(--shadow-lg); opacity: 0;
  transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat .num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.blue .num { color: var(--primary); }
.stat.green .num { color: var(--success); }
.stat.red .num { color: var(--danger); }
.stat.orange .num { color: var(--warning); }

/* 工具类 */
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.w-full { width: 100%; }

/* 服务端连接状态提示 */
.conn-ok { color: var(--success); }
.conn-off { color: var(--warning); }

/* 地图容器（后台点位地图样式见 admin.html 的 .map-frame / .map-canvas） */
#map, .map-box { width: 100%; height: 420px; border-radius: var(--radius); border: 1px solid var(--border); }

/* 二维码 */
.qr-box { display: inline-block; background: #fff; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.qr-box img { display: block; }

/* 打印 */
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}

/* 响应式 */
@media (max-width: 720px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
