/* ============================================================
   工程项目管理后台 —— 样式
   沿用小程序端的品牌色与视觉语言
   ============================================================ */
:root {
  --primary: #E4572E;
  --primary-light: #FDEEE9;
  --primary-dark: #C8431F;
  --success: #27AE60;
  --warning: #F2994A;
  --danger: #EB5757;
  --info: #2F80ED;
  --text: #1F2329;
  --text-sub: #646A73;
  --text-weak: #8F959E;
  --border: #EFF0F1;
  --border-strong: #DEE0E3;
  --bg: #F5F6F7;
  --card: #FFFFFF;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(31, 35, 41, 0.08);
}

/* ============ ICP 备案号（法定展示，链接工信部） ============ */
.icp-line {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-weak);
}
.icp-line a { color: var(--text-weak); text-decoration: none; }
.icp-line a:hover { color: var(--primary); text-decoration: underline; }
.app-foot {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-weak);
  background: var(--card);
  border-top: 1px solid var(--border);
}
.app-foot a { color: var(--text-weak); text-decoration: none; }
.app-foot a:hover { color: var(--primary); text-decoration: underline; }

/* 表格里的现场照片缩略图（点击看大图） */
.cell-photo {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  cursor: zoom-in;
  display: block;
  background: #F2F3F5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  user-select: none;
}

.hidden { display: none !important; }

/* ---------------- 居中视图（加载/配置/登录） ---------------- */
.center-view {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, #E4572E 0%, #F2994A 55%, #F7C08A 100%);
}
.panel {
  width: 460px;
  background: #fff;
  border-radius: 14px;
  padding: 40px 40px 32px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}
.panel-title { font-size: 22px; font-weight: 700; }
.panel-sub { font-size: 13px; color: var(--text-weak); margin-top: 6px; margin-bottom: 28px; }

.brand { text-align: center; margin-bottom: 30px; }
.brand-logo {
  width: 62px; height: 62px; margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #E4572E, #F2994A);
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 1px;
}
.brand-title { font-size: 20px; font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-weak); margin-top: 6px; word-break: break-all; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 7px; }
.field input {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: #fff;
  outline: none; transition: border-color .15s;
  user-select: text;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(228, 87, 46, .12); }
.field .hint { font-size: 12px; color: var(--text-weak); line-height: 1.7; margin-top: 8px; }
.field .hint b { color: var(--primary); }

.check-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-sub); margin: 4px 0 18px; cursor: pointer;
}
.check-line input { width: 15px; height: 15px; accent-color: var(--primary); }

.msg { min-height: 20px; font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--success); }
.msg.info { color: var(--text-sub); }

.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

.btn {
  height: 40px; padding: 0 18px; border: none; border-radius: var(--radius);
  font-size: 14px; cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-plain { background: #fff; color: var(--text); border: 1px solid var(--border-strong); }
.btn-plain:hover { background: #F7F8F9; }
.btn-ghost { background: transparent; color: var(--text-sub); }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-danger { background: #FDECEC; color: var(--danger); }
.btn-danger:hover { background: #FBDDDD; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.spinner {
  width: 34px; height: 34px; margin: 0 auto 16px;
  border: 3px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 14px; }

/* ---------------- 主界面 ---------------- */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 218px; flex-shrink: 0;
  background: #1F2329; color: #fff;
  display: flex; flex-direction: column;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.side-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #E4572E, #F2994A);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.side-title { font-size: 14px; font-weight: 600; }

.nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; color: rgba(255, 255, 255, .78);
  font-size: 14px; margin-bottom: 2px; transition: all .12s;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-group {
  font-size: 11px; color: rgba(255, 255, 255, .35);
  padding: 14px 12px 6px; letter-spacing: .5px;
}

.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-user {
  display: flex; align-items: center; gap: 10px;
  margin: 0 -6px 10px; padding: 7px 6px;
  border-radius: 6px; cursor: pointer; transition: background .12s;
}
.side-user:hover { background: rgba(255, 255, 255, .1); }
.user-gear { margin-left: auto; opacity: .35; font-size: 14px; transition: opacity .12s; }
.side-user:hover .user-gear { opacity: .9; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255, 255, 255, .5); }
#btn-logout { width: 100%; color: rgba(255, 255, 255, .7); }
#btn-logout:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.search {
  width: 240px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 13px; outline: none; user-select: text; font-family: inherit;
}
.search:focus { border-color: var(--primary); }

.content { flex: 1; overflow-y: auto; padding: 20px 22px; }

/* ---------------- 卡片 / 统计 ---------------- */
.card {
  background: #fff; border-radius: 10px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title::before {
  content: ''; width: 3px; height: 15px; border-radius: 2px; background: var(--primary);
}
.card-body { padding: 18px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: 10px; padding: 18px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-weak); margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 19px; }
.stat-sub { font-size: 12px; color: var(--text-weak); margin-top: 6px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 11px 14px;
  background: #FAFBFC; color: var(--text-sub); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
tbody tr:hover { background: #FCFCFD; }
tbody tr:last-child td { border-bottom: none; }
.cell-ellipsis { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-money { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions .btn { height: 28px; padding: 0 10px; font-size: 12px; margin-left: 6px; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 11px;
  font-size: 12px; line-height: 18px; white-space: nowrap;
}
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: #E8F7EF; color: var(--success); }
.tag-warning { background: #FEF4E9; color: var(--warning); }
.tag-danger { background: #FDECEC; color: var(--danger); }
.tag-info { background: #EAF2FE; color: var(--info); }
.tag-plain { background: #F2F3F5; color: var(--text-sub); }

.progress { height: 6px; border-radius: 3px; background: #EFF0F1; overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #E4572E, #F2994A); }

.empty-state { padding: 60px 20px; text-align: center; color: var(--text-weak); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }

/* ---------------- 抽屉表单 ---------------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 90;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px;
  background: #fff; z-index: 91; display: flex; flex-direction: column;
  box-shadow: -6px 0 28px rgba(0, 0, 0, .12);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600;
}
.btn-close {
  width: 30px; height: 30px; border: none; background: transparent;
  font-size: 17px; color: var(--text-weak); cursor: pointer; border-radius: 6px;
}
.btn-close:hover { background: #F2F3F5; color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  display: flex; gap: 12px; padding: 15px 22px;
  border-top: 1px solid var(--border);
}
.drawer-foot .btn { flex: 1; }

.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 7px; }
.form-item label.req::before { content: '*'; color: var(--danger); margin-right: 4px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-family: inherit; color: var(--text); background: #fff;
  outline: none; user-select: text;
}
.form-item textarea { min-height: 82px; resize: vertical; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(228, 87, 46, .12);
}
.form-item .hint { font-size: 12px; color: var(--text-weak); margin-top: 6px; }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  background: rgba(31, 35, 41, .92); color: #fff;
  padding: 11px 22px; border-radius: 8px; font-size: 14px;
  z-index: 999; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  max-width: 70vw; text-align: center;
}
.toast.ok { background: rgba(39, 174, 96, .95); }
.toast.error { background: rgba(235, 87, 87, .95); }

/* ---------------- 权限配置页 ---------------- */
.perm-group { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.perm-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.perm-head { margin-bottom: 10px; }
.perm-name { font-size: 14px; font-weight: 600; }
.perm-desc { font-size: 12px; color: var(--text-weak); margin-top: 4px; line-height: 1.6; }
.perm-roles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.perm-role {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 18px;
  background: #F2F3F5; cursor: pointer; font-size: 13px;
  border: 1px solid transparent; transition: all .12s;
}
.perm-role:hover { background: #EAEBED; }
.perm-role.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.perm-role .dot {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; line-height: 1;
}
.perm-role.on .dot { background: var(--primary); border-color: var(--primary); }

.scroll-y { max-height: 420px; overflow-y: auto; }

/* ---------------- 附件区 ---------------- */
.attach-box {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed #E5E6EB;
}
.attach-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.attach-list { margin-bottom: 10px; }
.attach-empty {
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-weak);
  background: #FAFBFC;
  border-radius: 6px;
}
.attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  transition: background .12s;
}
.attach-row:hover { background: #F7F8F9; }
.attach-icon { flex-shrink: 0; }
.attach-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.attach-size {
  font-size: 12px;
  color: var(--text-weak);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.attach-bar { display: flex; gap: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; }
