/* 数智联城采集平台 · 数据管理后台样式（浅色主题，主色 #1677ff） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #1677ff;
  --primary-light: #e8f1ff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e5e6eb;
  --text: #1f2329;
  --text-2: #646a73;
  --danger: #e03131;
  --success: #2f9e44;
  --warn: #f59f00;
}
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* ---- 顶部 ---- */
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; }
.brand-name { font-size: 16px; font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-2); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.health {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px; font-size: 12px;
  background: #f2f4f7; color: var(--text-2);
}
.health .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9cdd4; }
.health.ok { background: #e8f8ee; color: var(--success); }
.health.ok .dot { background: var(--success); }
.health.err { background: #fdecec; color: var(--danger); }
.health.err .dot { background: var(--danger); }

/* ---- 布局 ---- */
.layout { flex: 1; display: flex; min-height: 0; }

/* ---- 侧边栏 ---- */
.sidebar {
  width: 190px; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.nav { padding: 10px 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; margin-bottom: 2px; border: none; border-radius: 8px;
  background: transparent; color: var(--text); font-size: 14px; cursor: pointer;
  text-align: left; transition: background .15s;
}
.nav-item:hover { background: #f2f4f7; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 16px; }
.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-2); line-height: 1.7;
}
.sidebar-foot code { font-size: 11px; word-break: break-all; }

/* ---- 内容区 ---- */
.content { flex: 1; overflow: auto; padding: 22px 26px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 19px; }
.sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- 表单控件 ---- */
.input {
  height: 34px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; outline: none; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.15); }
.input.filter { width: 150px; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.input.err { border-color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c9cdd4; background: #f7f8fa; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #0f66e0; border-color: #0f66e0; }
.btn-danger { color: var(--danger); border-color: #f3c1c1; }
.btn-danger:hover { background: #fdecec; border-color: var(--danger); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-link { border: none; background: transparent; color: var(--primary); height: auto; padding: 4px 6px; }
.btn-link:hover { background: transparent; text-decoration: underline; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- 表格 ---- */
.table-wrap {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  overflow: auto; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
table { border-collapse: collapse; width: 100%; font-size: 13px; }
thead th {
  position: sticky; top: 0; background: #fafbfc; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-2); font-weight: 600; white-space: nowrap; z-index: 1;
}
tbody td { padding: 9px 14px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
.th-ops { width: 130px; }
.cell-ops { display: flex; gap: 6px; }
.empty-cell { text-align: center; color: var(--text-2); padding: 40px 0 !important; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px;
  background: #f2f4f7; color: var(--text-2);
}
.tag.active { background: #e8f8ee; color: var(--success); }
.tag.archived { background: #f2f4f7; color: #8a919b; }
.tag.cat { background: var(--primary-light); color: var(--primary); }
.tag.pin-blue { background: #e8f1ff; color: var(--primary); }
.tag.pin-red { background: #fdecec; color: var(--danger); }
.tag.tool { background: #fff7e6; color: #d48806; }
code.json { font-size: 12px; color: #b25d1a; word-break: break-all; }

/* ---- 弹窗 ---- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.mask.show { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-46%) scale(.97);
  width: 640px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px);
  background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
  z-index: 101; display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transition: all .18s;
}
.modal.show { opacity: 1; transform: translate(-50%,-50%) scale(1); pointer-events: auto; }
.modal.wide { width: 760px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 16px; color: var(--text-2); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ---- 表单网格 ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.form-item label b { color: var(--danger); font-weight: 400; }
.form-item .hint { font-size: 11px; color: #a9aeb8; margin-top: 4px; }
.form-item .input { width: 100%; }
.fieldset-title {
  grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--primary);
  margin-top: 6px; padding-bottom: 4px; border-bottom: 1px dashed var(--border);
}

/* ---- 项目照片网格 ---- */
.img-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  min-height: 64px; padding: 10px;
  border: 1px dashed var(--border); border-radius: 8px; background: #fafbfc;
}
.img-empty { font-size: 12px; color: #a9aeb8; align-self: center; }
.img-thumb {
  position: relative; width: 88px; height: 88px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del {
  position: absolute; top: 0; right: 0; width: 24px; height: 24px;
  border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 15px;
  cursor: pointer; line-height: 1; border-radius: 0 0 0 8px;
}
.img-del:hover { background: var(--danger); }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(31,35,41,.92); color: #fff; padding: 10px 22px; border-radius: 8px;
  font-size: 13px; z-index: 200; opacity: 0; pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(47,158,68,.95); }
.toast.error { background: rgba(224,49,49,.95); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d0d3da; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b6bac3; }

/* ---- 图片放大预览（lightbox） ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,17,21,.88);
  display: flex; flex-direction: column;
}
.lb-stage { flex: 1; position: relative; overflow: hidden; cursor: grab; user-select: none; }
.lightbox.dragging .lb-stage { cursor: grabbing; }
.lb-imgwrap {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.lb-imgwrap img {
  max-width: 92%; max-height: 92%;
  box-shadow: 0 6px 30px rgba(0,0,0,.5); border-radius: 4px;
  transform-origin: center center; will-change: transform;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 70px; border: none; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #fff; font-size: 34px;
  cursor: pointer; line-height: 1; transition: background .15s; z-index: 5;
}
.lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; background: rgba(0,0,0,.35);
  color: #e8eaf0; font-size: 13px;
}
.lb-counter { font-weight: 600; min-width: 52px; }
.lb-hint { flex: 1; color: #9aa0ab; font-size: 12px; }
.lb-btn, .lb-close {
  width: 34px; height: 34px; border: none; border-radius: 6px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 16px;
  cursor: pointer; line-height: 1; transition: background .15s;
}
.lb-btn:hover { background: rgba(255,255,255,.25); }
.lb-close { background: rgba(224,49,49,.8); font-size: 18px; }
.lb-close:hover { background: rgba(224,49,49,1); }
