:root {
  color-scheme: light;
  --ink: #0f172a;
  --gold: #b88a3c;
  --line: #e2e8f0;
  --muted: #64748b;
  --bg: #f8fafc;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-box, .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, .08);
}
.auth-box { width: min(420px, 100%); padding: 28px; }
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .22s ease;
}
.shell.is-sidebar-collapsed { grid-template-columns: 82px 1fr; }
.sidebar {
  background: #0b1120;
  color: #dbe4f0;
  padding: 22px;
  transition: padding .22s ease, transform .22s ease;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand { flex: 1; min-width: 0; color: #fff; font-weight: 800; font-size: 20px; }
.brand-mini { display: none; }
.site-brand-full {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-logo {
  display: block;
  max-width: 168px;
  max-height: 42px;
  object-fit: contain;
}
.brand-icon-img,
.brand-mini-img {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: cover;
}
.brand-copy { display: block; min-width: 0; line-height: 1.15; }
.brand-name,
.brand-tagline {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-name { color: #fff; font-size: 16px; font-weight: 800; }
.brand-tagline { margin-top: 3px; color: rgba(255,255,255,.68); font-size: 11px; font-weight: 600; }
.brand-mini {
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
}
.brand-mini-img { border-radius: 12px; }
.sidebar-toggle {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}
.sidebar-toggle:hover { border-color: var(--gold); color: var(--gold); }
.nav { display: grid; gap: 8px; }
.nav a, .nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.nav a:hover, .nav a.is-active, .nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-icon {
  display: inline-grid;
  flex: 0 0 22px;
  width: 22px;
  place-items: center;
}
.nav-text { min-width: 0; overflow: hidden; white-space: nowrap; }
.shell.is-sidebar-collapsed .sidebar { padding: 22px 14px; }
.shell.is-sidebar-collapsed .brand-full,
.shell.is-sidebar-collapsed .nav-text { display: none; }
.shell.is-sidebar-collapsed .brand-mini { display: inline-flex; }
.shell.is-sidebar-collapsed .nav a,
.shell.is-sidebar-collapsed .nav button {
  justify-content: center;
  padding-inline: 10px;
}
.main { padding: 28px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
h2 { margin: 0 0 16px; font-size: 18px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { padding: 18px; }
.stat { font-size: 32px; font-weight: 800; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 13px; color: var(--muted); background: #f8fafc; }
.table tr:last-child td { border-bottom: 0; }
.table small { display: block; margin-top: 4px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-table { min-width: 980px; border: 0; }
.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.metric-grid .metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.metric-grid .metric strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.status-pill.is-contacted { background: #fef3c7; color: #92400e; }
.status-pill.is-closed { background: #dcfce7; color: #166534; }
.compact-select { margin-top: 8px; min-width: 132px; padding: 8px 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list span {
  display: inline-flex;
  border-radius: 999px;
  background: #f1f5f9;
  padding: 4px 9px;
  color: #334155;
  font-size: 12px;
  text-transform: capitalize;
}
.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}
.empty-state i { color: var(--gold); font-size: 30px; }
.empty-state strong { color: var(--ink); }
.site-admin-page {
  --gold: #0d4f78;
  --bg: #eef7ff;
}
.site-admin-page .sidebar {
  background: linear-gradient(180deg, #082842, #0d4f78);
}
.site-admin-page .panel,
.site-admin-page .auth-box {
  border-radius: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 13px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: #991b1b; border-color: #fecaca; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 800; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.textarea { min-height: 110px; resize: vertical; }
.textarea.code {
  min-height: 180px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}
.notice {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.notice.success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.notice.error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.section-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.section-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.section-link:hover { border-color: var(--gold); }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #e2e8f0;
}
.admin-image-field {
  display: grid;
  gap: 10px;
  max-width: 520px;
}
.admin-image-preview {
  width: 160px;
  height: 120px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}
.admin-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-repeater {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.admin-json-source { display: none; }
.admin-rows { display: grid; gap: 12px; }
.admin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.admin-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
}
.admin-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.admin-subfield {
  display: grid;
  gap: 6px;
}
.admin-subfield label {
  font-size: 12px;
  font-weight: 800;
}
.admin-repeater-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.media-thumb {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: #f1f5f9;
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}
.media-link {
  font-size: 12px;
}
.domain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.danger-zone {
  border-color: #fecaca;
  background: #fffafa;
}
.danger-zone h2 {
  color: #991b1b;
}
.admin-icon-panel {
  position: fixed;
  inset: 8vh auto auto 50%;
  z-index: 1000;
  width: min(720px, 92vw);
  max-height: 78vh;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
}
.admin-icon-head {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.admin-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  max-height: 62vh;
  overflow: auto;
  padding: 12px;
}
.admin-icon-grid button {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
}
.admin-icon-grid button i {
  font-size: 20px;
}
.admin-icon-grid span {
  max-width: 68px;
  overflow-wrap: anywhere;
  font-size: 10px;
  color: var(--muted);
}
.admin-wysiwyg {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.admin-wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.admin-wysiwyg-toolbar button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.admin-color-tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}
.admin-color-tool input {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
}
.admin-wysiwyg-editor {
  min-height: 180px;
  padding: 14px;
  line-height: 1.6;
  outline: none;
}
.admin-wysiwyg[data-wysiwyg-key="hero_description"] .admin-wysiwyg-editor {
  background: #0f172a;
  color: #fff;
}
.admin-wysiwyg-editor:focus {
  box-shadow: inset 0 0 0 3px rgba(184, 138, 60, .18);
}
.admin-wysiwyg-source {
  display: none;
  min-height: 180px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}
.admin-wysiwyg.is-code .admin-wysiwyg-editor { display: none; }
.admin-wysiwyg.is-code .admin-wysiwyg-source { display: block; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 82px 1fr; }
  .shell.is-sidebar-collapsed { grid-template-columns: 0 1fr; }
  .sidebar { padding: 18px 14px; }
  .shell.is-sidebar-collapsed .sidebar {
    padding-inline: 0;
    transform: translateX(-100%);
    overflow: hidden;
  }
  .brand-full,
  .nav-text { display: none !important; }
  .brand-mini { display: inline-flex !important; }
  .nav a,
  .nav button {
    justify-content: center !important;
    padding-inline: 10px;
  }
  .main { min-width: 0; padding: 18px; }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .admin-panel-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 720px) {
  .admin-row-grid { grid-template-columns: 1fr; }
}
