/* ==========================================================================
   Admin panel — layered on top of the public design tokens
   ========================================================================== */

.admin-body { background: var(--cream); color: var(--text); font-family: var(--font-body); }

/* ---------- Shell ---------- */
.admin-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 16px;
  background: linear-gradient(180deg, #0b1220 0%, #0a1526 100%);
  color: rgba(255, 255, 255, .7);
  overflow-y: auto;
  z-index: 40;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  color: #fff;
}
.admin-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--red-bright), var(--red-deep));
  color: #fff;
  box-shadow: 0 8px 20px rgba(20, 184, 166, .28);
}
.admin-brand-mark svg { width: 21px; height: 21px; }
.admin-brand-text { display: grid; line-height: 1.15; }
.admin-brand-text strong { font-family: var(--font-display); font-size: 14.5px; letter-spacing: -.01em; }
.admin-brand-text span { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .45); }

.admin-nav { display: grid; gap: 3px; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .66);
  transition: background .18s ease, color .18s ease;
}
.admin-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-nav a.is-active {
  background: rgba(20, 184, 166, .14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, .28);
}
.admin-nav .ai { width: 17px; height: 17px; flex: none; opacity: .85; }
.admin-nav a.is-active .ai { color: var(--red-bright); opacity: 1; }

.admin-side-foot { margin-top: auto; display: grid; gap: 3px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.admin-side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .6);
  transition: background .18s ease, color .18s ease;
}
.admin-side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-side-link .ai { width: 15px; height: 15px; }
.admin-side-note { margin: 12px 0 0; padding: 0 11px; font-size: 10px; color: rgba(255, 255, 255, .3); }

/* ---------- Content ---------- */
.admin-content { min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.admin-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
.admin-burger .ai { width: 17px; height: 17px; }
.admin-topbar-title { min-width: 0; margin-right: auto; }
.admin-topbar-title h1 { font-family: var(--font-display); font-size: 19px; letter-spacing: -.015em; line-height: 1.2; }
.admin-topbar-title p { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.admin-user { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.admin-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red-ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}
.admin-user-name { font-size: 12px; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-main { padding: 26px 28px 60px; display: grid; gap: 18px; align-content: start; }

/* ---------- Flash ---------- */
.admin-flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.admin-flash .ai { width: 16px; height: 16px; flex: none; }
.admin-flash--success { border-color: #bfe6de; background: #f2fbf8; color: #0a5b51; }
.admin-flash--error { border-color: #f1cfcb; background: #fdf5f4; color: #93231c; }
.admin-flash--info { border-color: #cdE0ef; background: #f4f9fd; color: #1d4a6b; }
.admin-flash span { flex: 1; }
.admin-flash-close { border: 0; background: none; color: inherit; cursor: pointer; opacity: .6; padding: 2px; display: inline-flex; }
.admin-flash-close:hover { opacity: 1; }
.admin-flash-close .ai { width: 14px; height: 14px; }

/* ---------- Cards / sections ---------- */
.acard {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.acard-head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; margin-bottom: 16px; }
.acard-head h2 { font-size: 16px; letter-spacing: -.01em; }
.acard-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.acard-head--tight { margin-bottom: 10px; }

.agrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.agrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agrid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.acard--full { grid-column: 1 / -1; }

.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }
.stat-card .num { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); }
.stat-card .lab { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.stat-card .ico { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px; border-radius: 9px; background: var(--red-soft); color: var(--red-ink); }
.stat-card .ico .ai { width: 16px; height: 16px; }

/* ---------- Forms ---------- */
.aform { display: grid; gap: 16px; }
.agrid .afield { min-width: 0; }
.afield { display: grid; gap: 6px; align-content: start; }
.afield--full { grid-column: 1 / -1; }
.afield > label { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.afield > label .req { color: var(--red-deep); }
.ahint { font-size: 11px; line-height: 1.5; color: var(--muted-light); }
.ahint code { padding: 1px 4px; border-radius: 4px; background: #eef5f3; font-size: 10.5px; }

.ainput {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.ainput::placeholder { color: var(--muted-light); }
.ainput:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(20, 184, 166, .13); }
.ainput--mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.65; }
.atextarea { min-height: 96px; resize: vertical; }
.atextarea--tall { min-height: 220px; }
.aselect { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23566a6b' stroke-width='1.8' stroke-linecap='round' d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.aselect[multiple] { padding-right: 12px; background-image: none; }

.acheck { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text); cursor: pointer; }
.acheck input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--red-deep); flex: none; }
.acheck span { line-height: 1.5; }

.aform-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}
.aform-foot .spacer { flex: 1; }

/* ---------- Buttons (extend public .btn) ---------- */
.btn--danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn--danger:hover { background: #941d17; border-color: #941d17; }
.btn--xs { padding: 6px 10px; font-size: 11.5px; border-radius: 8px; gap: 5px; }
.btn--xs .ai { width: 13px; height: 13px; }
.btn--ghost-ink { background: #fff; border: 1px solid var(--line-strong); color: var(--ink); }
.btn--ghost-ink:hover { border-color: var(--red); color: var(--red-ink); }
.btn .ai { width: 15px; height: 15px; }

/* ---------- Tables ---------- */
.atable-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.atable { width: 100%; border-collapse: collapse; font-size: 13px; }
.atable th {
  padding: 11px 14px;
  background: #f7fbfa;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.atable td { padding: 12px 14px; border-bottom: 1px solid #eef4f2; vertical-align: middle; }
.atable tr:last-child td { border-bottom: 0; }
.atable tbody tr:hover { background: #fbfdfc; }
.atable .t-title { font-weight: 600; color: var(--ink); }
.atable .t-title a:hover { color: var(--red-ink); }
.atable .t-sub { display: block; margin-top: 2px; font-size: 11px; color: var(--muted-light); }
.atable .t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.atable .t-num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.atable td.t-right, .atable th.t-right { text-align: right; }
.atable--compact td { padding: 9px 12px; }
.atable th a { color: inherit; }
.atable th a:hover { color: var(--red-ink); }

.abadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #eef4f2;
  color: var(--muted);
  white-space: nowrap;
}
.abadge--ok { background: #e6f7f1; color: #0a6b57; }
.abadge--warn { background: var(--gold-soft); color: #8a5b06; }
.abadge--info { background: #e8f1fb; color: #1d527d; }
.abadge--muted { background: #f0f3f3; color: #6d7f80; }
.abadge--draft { background: #f1f2f5; color: #6c7484; }
.abadge--accent { background: var(--red-soft); color: var(--red-ink); }

.aempty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.aempty strong { display: block; margin-bottom: 6px; font-family: var(--font-display); font-size: 15px; color: var(--ink); }

/* ---------- Filters ---------- */
.afilters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.afilters .ainput, .afilters .aselect { width: auto; min-width: 160px; padding-top: 8px; padding-bottom: 8px; font-size: 12.5px; }
.afilters form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Repeaters ---------- */
.rep { display: grid; gap: 8px; }
.rep-rows { display: grid; gap: 7px; }
.rep-row { display: flex; gap: 7px; align-items: center; }
.rep-row .ainput { flex: 1; }
.rep-row--grid { display: grid; grid-template-columns: repeat(var(--rep-cols, 2), minmax(0, 1fr)) auto; }
.rep-del {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #9a6b68;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.rep-del:hover { border-color: #e5b5b0; background: #fdf5f4; color: var(--danger); }
.rep-del .ai { width: 14px; height: 14px; }
.rep-add { justify-self: start; margin-top: 2px; }

/* ---------- Tabs / segmented ---------- */
.aseg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f7fbfa; gap: 3px; flex-wrap: wrap; }
.aseg a, .aseg span { padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.aseg a:hover { color: var(--ink); }
.aseg .is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(11, 18, 32, .12); }

/* ---------- Pagination ---------- */
.apagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.apagination a, .apagination span {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.apagination a:hover { border-color: var(--red); color: var(--red-ink); }
.apagination .is-current { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Misc ---------- */
.amuted { color: var(--muted); font-size: 12px; }
.asplit { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.asticky { position: sticky; top: 88px; display: grid; gap: 16px; }
.ainline { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.alink { color: var(--red-ink); font-weight: 600; }
.alink:hover { text-decoration: underline; text-underline-offset: 3px; }

.help-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.help-list li { display: flex; gap: 9px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.help-list .ai { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--red-ink); }

.lead-detail { display: grid; gap: 10px; }
.lead-quote { padding: 12px 14px; border-left: 3px solid var(--red-deep); border-radius: 0 10px 10px 0; background: var(--cream); font-size: 13px; line-height: 1.6; color: #33474c; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); word-break: break-word; }

.preview-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--red-soft); color: var(--red-ink); font-size: 11px; font-weight: 700; }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; background: radial-gradient(circle at 20% 10%, #0e1a2c 0%, #0b1220 55%, #060b14 100%); }
.login-card { width: 100%; max-width: 420px; padding: 32px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 22px; background: rgba(255, 255, 255, .04); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; }
.login-card h1 { margin: 18px 0 6px; font-size: 22px; color: #fff; }
.login-card > p { font-size: 13px; line-height: 1.6; color: rgba(255, 255, 255, .6); }
.login-card .afield > label { color: rgba(255, 255, 255, .78); }
.login-card .ainput { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .16); color: #fff; }
.login-card .ainput:focus { border-color: var(--red-bright); box-shadow: 0 0 0 3px rgba(20, 184, 166, .2); }
.login-card .btn--primary { margin-top: 4px; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .admin-brand-mark { width: 40px; height: 40px; }
.login-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 11.5px; color: rgba(255, 255, 255, .45); text-align: center; }
.login-foot a { color: rgba(255, 255, 255, .7); }
.login-foot a:hover { color: var(--red-bright); }
.login-error { display: flex; gap: 8px; align-items: center; margin-top: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 120, 110, .35); background: rgba(179, 38, 30, .16); font-size: 12.5px; color: #ffd9d5; }
.login-error .ai { width: 15px; height: 15px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .agrid--4, .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asplit { grid-template-columns: minmax(0, 1fr); }
  .asticky { position: static; }
}
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 262px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, .4);
  }
  .admin-side.is-open { transform: none; }
  .admin-burger { display: inline-flex; }
  .admin-main { padding: 20px 16px 50px; }
  .admin-topbar { padding: 12px 16px; gap: 10px; }
  .admin-user-name { display: none; }
  .agrid, .agrid--3, .agrid--4 { grid-template-columns: minmax(0, 1fr); }
  .rep-row--grid { grid-template-columns: minmax(0, 1fr) auto; }
  .rep-row--grid .ainput { grid-column: 1; }
  .rep-row--grid .ainput ~ .ainput { margin-top: -1px; }
  .atable th, .atable td { padding: 10px; }
}
@media (max-width: 620px) {
  .stat-cards { grid-template-columns: minmax(0, 1fr); }
  .admin-topbar-actions .btn { display: none; }
  .acard { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { font-weight: 600; }
}
