:root {
  --bg: #f1ece4;
  --panel: #faf7f2;
  --white: #fffdf9;
  --ink: #151212;
  --muted: #776e64;
  --line: rgba(21,18,18,.1);
  --dark: #111010;
  --red: #a61f25;
  --red2: #c63e43;
  --green: #1f7a55;
  --shadow: 0 22px 60px rgba(25,19,15,.1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(166,31,37,.28), transparent 26%),
    radial-gradient(circle at 82% 16%, rgba(255,255,255,.08), transparent 20%),
    #111010;
}
.login-card {
  width: min(100%, 440px);
  padding: 38px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.055);
  box-shadow: 0 34px 100px rgba(0,0,0,.3);
  backdrop-filter: blur(16px);
}
.login-brand img { height: 62px; }
.kicker, .topbar-kicker, .section-label, .card-heading span {
  text-transform: uppercase;
  letter-spacing: .18em;
}
.kicker { margin: 28px 0 10px; color: #d9a6a3; font-size: 10px; }
.login-card h1 { margin: 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 40px; font-weight: 500; }
.login-copy { color: rgba(255,255,255,.66); line-height: 1.8; }
.login-card form { display: grid; gap: 18px; margin-top: 28px; }
.login-card label span { display: block; margin-bottom: 8px; color: rgba(255,255,255,.7); font-size: 12px; }
.login-card input {
  width: 100%; padding: 13px 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.22); outline: 0; background: transparent; color: #fff;
}
.login-card input:focus { border-color: #fff; }

.primary-button, .secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.primary-button { color: #fff; background: linear-gradient(135deg,var(--red),var(--red2)); box-shadow: 0 14px 32px rgba(105,16,18,.22); }
.secondary-button { color: var(--ink); background: var(--white); border: 1px solid var(--line); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.form-message { min-height: 18px; margin: 0; color: #e9b5b3; font-size: 12px; }

.admin-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: 246px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  color: rgba(255,255,255,.78);
  background: #111010;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand img { width: 130px; }
.sidebar-brand span { color: rgba(255,255,255,.5); font-size: 11px; letter-spacing: .12em; }
.side-nav { display: grid; gap: 8px; margin-top: 28px; }
.side-nav button {
  width: 100%; min-height: 50px; padding: 0 14px;
  display: flex; align-items: center; gap: 14px;
  border: 1px solid transparent; border-radius: 10px;
  color: rgba(255,255,255,.68); background: transparent; text-align: left;
}
.side-nav button i { color: #a99b91; font-style: normal; font-size: 10px; letter-spacing: .14em; }
.side-nav button.active, .side-nav button:hover { color: #fff; background: rgba(255,255,255,.065); border-color: rgba(255,255,255,.08); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot a, .sidebar-foot button { color: rgba(255,255,255,.55); background: none; border: 0; padding: 6px 0; text-align: left; font-size: 12px; }

.admin-main { margin-left: 246px; min-height: 100vh; padding: 0 34px 70px; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  min-height: 94px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: rgba(241,236,228,.88); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line);
}
.topbar-kicker { margin: 0 0 6px; color: var(--red); font-size: 9px; }
.topbar h2 { margin: 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 32px; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.save-state { color: var(--muted); font-size: 12px; }
.password-warning { margin: 22px 0 0; padding: 14px 18px; color: #6d4912; background: #fff1d5; border: 1px solid #efd8a8; font-size: 13px; }

.panel { display: none; padding-top: 28px; }
.panel.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.metric-card, .admin-card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.75);
  box-shadow: var(--shadow);
}
.metric-card { min-height: 180px; padding: 24px; }
.metric-card > span { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.metric-card strong { display: block; margin: 20px 0 12px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 30px; font-weight: 500; }
.metric-card strong.domain { font-size: 20px; word-break: break-all; }
.metric-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.dashboard-grid { margin-top: 18px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.admin-card { padding: 24px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-heading span { color: var(--red); font-size: 9px; }
.card-heading h3 { margin: 8px 0 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 26px; font-weight: 500; }
.quick-actions { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.quick-actions button { min-height: 100px; padding: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.75); text-align: left; }
.quick-actions b { display: block; margin-bottom: 8px; font-size: 15px; }
.quick-actions span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.audit-list { display: grid; gap: 10px; }
.audit-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.audit-item b { display: block; margin-bottom: 5px; font-size: 13px; }
.audit-item span { color: var(--muted); font-size: 11px; }
.empty-text { color: var(--muted); font-size: 13px; }

.panel-intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.section-label { margin: 0 0 8px; color: var(--red); font-size: 9px; }
.panel-intro h3 { margin: 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 34px; font-weight: 500; }
.panel-intro > p { max-width: 580px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.panel-intro code { padding: 2px 5px; border-radius: 4px; background: #e7dfd3; }

.status-card { padding: 10px; }
.status-choice { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; background: var(--line); }
.status-option { min-height: 126px; padding: 22px; display: flex; gap: 16px; align-items: flex-start; background: var(--white); cursor: pointer; }
.status-option input { position: absolute; opacity: 0; }
.status-dot { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; border: 4px solid #ddd; border-radius: 50%; background: #fff; }
.status-dot.paused { border-color: #b98832; }
.status-dot.open { border-color: var(--green); }
.status-option:has(input:checked) { outline: 2px solid var(--red); outline-offset: -2px; }
.status-option b { display: block; margin-bottom: 8px; }
.status-option p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.form-card-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; margin-top: 18px; }
.form-card-grid .wide { grid-column: span 1; }
.form-card { display: grid; gap: 18px; }
.form-card label > span, .security-card label > span { display: block; margin-bottom: 8px; color: #5f574f; font-size: 12px; }
.form-card input, .form-card textarea, .form-card select, .security-card input {
  width: 100%; padding: 12px 13px; border: 1px solid #d8cfc4; border-radius: 8px; outline: 0; background: #fffdf9; color: var(--ink); resize: vertical;
}
.form-card input:focus, .form-card textarea:focus, .security-card input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(166,31,37,.08); }

.content-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.content-tabs button { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.65); }
.content-tabs button.active { color: #fff; background: var(--dark); }
.content-pane { display: none; }
.content-pane.active { display: block; }
.repeater { display: grid; gap: 14px; }
.repeater-item { padding: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.65); }
.repeater-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.repeater-item-head b { font-size: 14px; }
.repeater-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.repeater-fields .full { grid-column: 1 / -1; }

.image-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.image-card { overflow: hidden; padding: 0; }
.image-preview {
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
  background-color: #ddd4c8;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.32) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.32) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.32) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.32) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}
.image-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}
.image-card-body { padding: 18px; }
.image-card-body h4 { margin: 0 0 6px; }
.image-card-body p { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.image-card-body input[type=file] { width: 100%; font-size: 12px; }
.image-upload-state { min-height: 16px; margin-top: 10px; color: var(--muted); font-size: 11px; }

.lead-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.lead-status-note { color: var(--muted); font-size: 13px; }
.leads-list { display: grid; gap: 14px; }
.lead-card { padding: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.78); box-shadow: var(--shadow); }
.lead-head { display: flex; justify-content: space-between; gap: 18px; }
.lead-head h4 { margin: 0; font-size: 18px; }
.lead-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.lead-meta { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 18px 0; }
.lead-meta div { padding: 12px; background: #f6f1e9; }
.lead-meta span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.lead-meta b { font-size: 13px; font-weight: 500; }
.lead-actions { display: grid; grid-template-columns: 180px 1fr auto auto; gap: 10px; align-items: end; }
.lead-actions label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.lead-actions select, .lead-actions input { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid #d8cfc4; border-radius: 7px; background: #fff; }
.danger-button { min-height: 42px; padding: 0 14px; border: 1px solid #e2b3b3; border-radius: 999px; color: #9b2222; background: #fff5f5; }

.security-card { max-width: 620px; }
.security-card form { display: grid; gap: 16px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 360px; padding: 14px 18px; border-radius: 10px; color: #fff; background: #171414; box-shadow: 0 20px 50px rgba(0,0,0,.25); font-size: 13px; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid, .form-card-grid { grid-template-columns: 1fr; }
  .image-grid { grid-template-columns: repeat(2,1fr); }
  .lead-meta { grid-template-columns: repeat(2,1fr); }
  .lead-actions { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .side-nav { grid-template-columns: repeat(2,1fr); }
  .sidebar-foot { display: flex; justify-content: space-between; }
  .admin-main { margin-left: 0; padding: 0 18px 50px; }
  .topbar { position: static; align-items: flex-start; flex-direction: column; padding: 20px 0; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .panel-intro { align-items: flex-start; flex-direction: column; }
  .status-choice, .image-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .login-card { padding: 26px; }
  .metric-grid, .quick-actions, .repeater-fields { grid-template-columns: 1fr; }
  .side-nav { grid-template-columns: 1fr; }
  .topbar-actions button { flex: 1; }
}

.resolution-tip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid rgba(166,31,37,.12);
  border-radius: 8px;
  background: rgba(166,31,37,.055);
}
.resolution-tip span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}
.resolution-tip strong {
  color: var(--red);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}
.current-resolution {
  margin: 0 0 12px;
  color: #746a60;
  font-size: 11px;
  line-height: 1.6;
}
