/* ============ union-platform · PC 端基础样式（深色侧边栏 + 浅色主区） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-light: #eff6ff;
  --success: #16a34a; --success-light: #f0fdf4;
  --warning: #d97706; --warning-light: #fffbeb;
  --danger: #dc2626;  --danger-light: #fef2f2;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0;
  --gray-400: #94a3b8; --gray-500: #64748b; --gray-700: #334155; --gray-900: #0f172a;
  --sidebar-bg: #1e293b; --sidebar-text: #cbd5e1; --sidebar-active: #2563eb;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15,23,42,.08);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gray-50); color: var(--gray-900); font-size: 14px; line-height: 1.55;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }
a { color: var(--primary); text-decoration: none; }

/* ─── 登录 ─── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #16a34a 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 36px 30px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg,#2563eb,#16a34a);
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff; margin: 0 auto 14px; }
.login-title { text-align: center; font-size: 20px; font-weight: 700; }
.login-sub { text-align: center; color: var(--gray-500); font-size: 13px; margin: 4px 0 24px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--gray-50); transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; transition: all .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 5px; }
.btn-block { width: 100%; }
.btn-outline { border: 1px solid var(--gray-200); color: var(--gray-700); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ─── 主框架 ─── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); padding: 16px 0; position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow-y: auto; }
.sidebar .brand { padding: 0 20px 20px; display: flex; align-items: center; gap: 10px; font-size: 16px; color: #fff; font-weight: 700; border-bottom: 1px solid #334155; }
.sidebar .brand .logo { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg,#2563eb,#16a34a);
  display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sidebar .menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--sidebar-text);
  font-size: 14px; cursor: pointer; border-left: 3px solid transparent; transition: all .12s; }
.sidebar .menu-item:hover { background: #334155; color: #fff; }
.sidebar .menu-item.active { background: #334155; color: #fff; border-left-color: var(--sidebar-active); font-weight: 600; }
.sidebar .menu-item .ico { font-size: 16px; }
.sidebar .menu-item .caret { margin-left: auto; color: #94a3b8; font-size: 12px; }
.sidebar .menu-item.parent.open { color: #fff; }
.sidebar .menu-item.sub { padding-left: 38px; font-size: 13px; color: #94a3b8; }
.sidebar .menu-item.sub:hover { background: #334155; color: #fff; }
.sidebar .menu-item.sub.active { background: #334155; color: #fff; border-left-color: var(--sidebar-active); font-weight: 600; }
.sidebar .menu-item.sub .ico { opacity: 0.8; }

.main { flex: 1; min-width: 0; padding: 20px 28px 60px; }
.main-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200); margin-bottom: 20px; }
.main-title { font-size: 20px; font-weight: 700; }
.main-sub { color: var(--gray-500); font-size: 13px; margin-top: 2px; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-info .name { font-weight: 600; }
.user-info .role { font-size: 12px; padding: 2px 10px; border-radius: 20px; background: var(--primary-light); color: var(--primary); font-weight: 600; }
.user-info .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }

/* ─── 通用组件 ─── */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title .btn { width: auto; flex: none; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.stat .num { font-size: 26px; font-weight: 800; }
.stat.blue .num { color: var(--primary); }
.stat.green .num { color: var(--success); }
.stat.orange .num { color: var(--warning); }
.stat.red .num { color: var(--danger); }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: #fff; min-width: 140px; }
.toolbar .btn { flex-shrink: 0; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th { background: var(--gray-50); text-align: left; padding: 11px 14px; font-size: 13px; color: var(--gray-700); font-weight: 600; border-bottom: 1px solid var(--gray-200); }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); font-size: 14px; vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: var(--gray-50); }
table.list .actions { display: flex; gap: 6px; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-blue { background: var(--primary-light); color: var(--primary); }
.tag-green { background: var(--success-light); color: var(--success); }
.tag-orange { background: var(--warning-light); color: var(--warning); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-gray { background: var(--gray-100); color: var(--gray-500); }

.empty { text-align: center; padding: 50px 20px; color: var(--gray-400); font-size: 14px; }
.empty .ico { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* ─── 表单弹层 ─── */
.mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet { background: #fff; width: 100%; max-width: 640px; border-radius: 14px;
  max-height: 90vh; overflow-y: auto; padding: 22px 26px 28px; animation: slideIn .22s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.sheet-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.sheet-close { font-size: 22px; color: var(--gray-400); cursor: pointer; padding: 0 4px; }
.sheet-close:hover { color: var(--gray-700); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.section-title { font-size: 14px; font-weight: 700; margin: 14px 0 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--gray-200); color: var(--gray-700); }

/* ─── 详情 ─── */
.detail-row { display: flex; padding: 8px 0; border-bottom: 1px dashed var(--gray-100); font-size: 14px; }
.detail-row .k { width: 100px; color: var(--gray-500); flex-shrink: 0; }
.detail-row .v { flex: 1; font-weight: 500; word-break: break-all; }

/* ─── Toast ─── */
#toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--gray-900); color: #fff; padding: 10px 20px; border-radius: 30px; font-size: 14px;
  opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 80vw; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
#toast.show { opacity: 1; }

/* 树状 */
.tree { list-style: none; padding-left: 0; }
.tree ul { list-style: none; padding-left: 24px; border-left: 1px dashed var(--gray-200); }
.tree li { padding: 6px 0; }
.tree li.parent > .node { font-weight: 600; color: var(--gray-700); }
.tree .node { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; }
.tree .node:hover { background: var(--gray-100); }
.tree .count { color: var(--primary); font-weight: 700; }

/* utility */
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--gray-500); font-size: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; }
.money { font-weight: 700; color: var(--primary); }

/* ─── 照片上传 / 展示 ─── */
.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.upload-item label { font-size: 13px; color: var(--gray-500); font-weight: 600; display: block; margin-bottom: 6px; }
.upload-box { width: 100%; aspect-ratio: 1/0.75; border: 1.5px dashed var(--gray-200); border-radius: 8px;
  background: var(--gray-50); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; position: relative; transition: border-color .15s; }
.upload-box:hover { border-color: var(--primary); }
.upload-box img { width: 100%; height: 100%; object-fit: cover; }
.upload-plus { font-size: 30px; color: var(--gray-400); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.photo-item label { font-size: 12px; color: var(--gray-500); display: block; margin-bottom: 6px; }
.photo-item img { width: 100%; aspect-ratio: 1/0.75; object-fit: cover; border-radius: 8px; cursor: zoom-in; border: 1px solid var(--gray-100); }