:root {
  --bg: #f0f2f7;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --card: #ffffff;
  --line: #e6eaf2;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1a5cff;
  --primary-2: #0b3fd9;
  --success: #059669;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(26,92,255,.25), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(201,168,106,.22), transparent 30%),
    linear-gradient(135deg, #0b1220, #14213d 55%, #1a2b4d);
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,.96);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 6px; font-size: 28px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #1a5cff, #c9a86a);
  margin-bottom: 18px;
}

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px;
  background: linear-gradient(180deg, var(--sidebar), #111827);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.sidebar .logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar .logo strong {
  display: block;
  color: #fff;
  font-size: 18px;
}
.sidebar .logo span { font-size: 12px; color: #94a3b8; }
.nav { padding: 14px 12px; overflow: auto; flex: 1; }
.nav-group {
  font-size: 11px;
  letter-spacing: .08em;
  color: #64748b;
  padding: 14px 12px 8px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: #cbd5e1;
  margin-bottom: 4px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(26,92,255,.9), rgba(26,92,255,.55));
  color: #fff;
  box-shadow: 0 8px 18px rgba(26,92,255,.25);
}
.nav-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: .7;
}
.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: 12px;
  color: #94a3b8;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 { margin: 0; font-size: 18px; }
.topbar .meta { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 22px 24px 40px; }

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.kpi .hint { margin-top: 6px; font-size: 12px; color: #94a3b8; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-hd h3 { margin: 0; font-size: 16px; }
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-bd { padding: 18px; }
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  outline: none;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,92,255,.12);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--primary-2); }
.btn.secondary { background: #eef2ff; color: var(--primary); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; background: #fafbff; position: sticky; top: 0; }
tr:hover td { background: #f8faff; }
.thumb {
  width: 56px; height: 40px; object-fit: cover; border-radius: 8px; background: #e5e7eb;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #e5e7eb;
}
.avatar.lead-av {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.avatar.lead-av.placeholder,
.avatar.lead-av.broken {
  font-size: 12px;
  color: #94a3b8;
  background: #eef2f7;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: var(--primary);
}
.badge.ok { background: #d1fae5; color: var(--success); }
.badge.off { background: #f1f5f9; color: #64748b; }
.badge.warn { background: #ffedd5; color: var(--warn); }
.badge.gender-m { background: #dbeafe; color: #1d4ed8; }
.badge.gender-f { background: #fce7f3; color: #be185d; }

.ops { display: flex; gap: 8px; flex-wrap: wrap; }
.msg { margin-top: 10px; font-size: 13px; color: var(--muted); }
.msg.ok { color: var(--success); }
.msg.err { color: var(--danger); }

.upload-box {
  border: 1px dashed #c7d2fe;
  background: #f8faff;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.upload-box img {
  width: 72px; height: 54px; object-fit: cover; border-radius: 8px; background: #e5e7eb;
}
.upload-box.long-upload {
  align-items: flex-start;
}
.upload-box.long-upload img {
  width: 120px;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  background: #f1f5f9;
}
.upload-box .u-meta { flex: 1; min-width: 0; }
.upload-box .u-meta input { margin-top: 6px; }
.upload-box .hint { margin-top: 6px; font-size: 12px; color: #889; line-height: 1.4; }
.upload-box.video-upload { align-items: flex-start; }
.video-preview {
  width: 180px; height: 102px; border-radius: 8px; overflow: hidden; background: #0f172a; flex-shrink: 0;
}
.video-preview video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0f172a; }
.video-empty {
  width: 100%; height: 100%; display: grid; place-items: center; color: #94a3b8; font-size: 12px;
}

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
  max-height: 90vh;
  overflow: auto;
}
.modal-hd {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal-bd { padding: 18px; }
.modal-ft {
  padding: 14px 18px 18px;
  display: flex; justify-content: flex-end; gap: 10px;
}

.empty {
  text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 18px;
}
.project-preview {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}
.project-preview::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(201,168,106,.25);
}
.project-preview .tagline { opacity: .75; font-size: 13px; }
.project-preview .pname { font-size: 28px; font-weight: 700; margin: 10px 0 6px; }
.project-preview .price { color: #fca5a5; font-size: 22px; font-weight: 700; }
.project-preview .addr { margin-top: 14px; font-size: 13px; opacity: .85; line-height: 1.5; }

@media (max-width: 1200px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .dash-grid, .grid-3 { grid-template-columns: 1fr 1fr; }
  .span-3 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .cards, .dash-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
}
