/**
 * SEVA Admin SPA - layered on top of seva-modern.css + Bootstrap.
 *
 * Goals:
 *   - Modern, dense, professional layout (sidebar + main pane)
 *   - Brand-aligned with the public site (reuses seva-modern tokens)
 *   - No reliance on Bootstrap utilities for color/typography so we can
 *     also run with a strict CSP that forbids inline styles.
 */

:root {
  --admin-sidebar-bg: linear-gradient(165deg, #0f172a 0%, #1e293b 100%);
  --admin-bg: #f1f5f9;
  --admin-card: #ffffff;
  --admin-card-border: #e2e8f0;
  --admin-text: #0f172a;
  --admin-text-soft: #475569;
  --admin-text-faint: #94a3b8;
  --admin-line: #e2e8f0;
  --admin-accent: var(--seva-blue, #2563eb);
  --admin-accent-2: #38bdf8;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-shadow: 0 4px 18px -8px rgba(15, 23, 42, 0.18);
  --admin-radius: 12px;
}

html, body { height: 100%; }

body.admin-body {
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: var(--seva-font-body, 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login screen ---------- */

.admin-login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(60% 80% at 75% 20%, rgba(56, 189, 248, 0.18), transparent 70%),
    radial-gradient(55% 70% at 18% 85%, rgba(99, 102, 241, 0.15), transparent 70%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 2rem 1rem;
}

.admin-login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 16px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: 0 24px 48px -16px rgba(2, 6, 23, 0.45);
}

.admin-login-card__brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-login-card__brand img {
  height: 36px;
  width: auto;
}

.admin-login-card__title {
  font-family: var(--seva-font-display, 'Montserrat', sans-serif);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--admin-text);
}

.admin-login-card__subtitle {
  margin: 0.25rem 0 1.25rem 0;
  color: var(--admin-text-soft);
  font-size: 0.95rem;
}

.admin-form-group { margin-bottom: 1rem; }
.admin-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--admin-text);
}

.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
  width: 100%;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--admin-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .05s ease;
  text-decoration: none;
}
.admin-btn:active { transform: translateY(1px); }
.admin-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.admin-btn--primary {
  background: var(--admin-accent);
  color: #fff;
}
.admin-btn--primary:hover { background: #1d4ed8; }

.admin-btn--ghost {
  background: transparent;
  color: var(--admin-text-soft);
  border-color: var(--admin-line);
}
.admin-btn--ghost:hover { color: var(--admin-text); border-color: var(--admin-text-soft); }

.admin-btn--danger {
  background: var(--admin-danger);
  color: #fff;
}
.admin-btn--danger:hover { background: #b91c1c; }

.admin-btn--block { width: 100%; }

.admin-error,
.admin-warn {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin: 0.75rem 0;
  display: none;
}
.admin-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.admin-warn  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.admin-error.is-visible, .admin-warn.is-visible { display: block; }

.admin-success {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin: 0.75rem 0;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Strength meter */
.pw-meter {
  display: flex;
  gap: 4px;
  margin-top: 0.5rem;
}
.pw-meter__bar {
  flex: 1;
  height: 6px;
  border-radius: 4px;
  background: var(--admin-line);
}
.pw-meter[data-score="1"] .pw-meter__bar:nth-child(-n+1),
.pw-meter[data-score="2"] .pw-meter__bar:nth-child(-n+2),
.pw-meter[data-score="3"] .pw-meter__bar:nth-child(-n+3),
.pw-meter[data-score="4"] .pw-meter__bar:nth-child(-n+4) {
  background: var(--admin-accent);
}
.pw-meter[data-score="1"] .pw-meter__bar:nth-child(-n+1) { background: #ef4444; }
.pw-meter[data-score="2"] .pw-meter__bar:nth-child(-n+2) { background: #f97316; }
.pw-meter[data-score="3"] .pw-meter__bar:nth-child(-n+3) { background: #f59e0b; }
.pw-meter[data-score="4"] .pw-meter__bar:nth-child(-n+4) { background: #10b981; }

.pw-meter__label {
  font-size: 0.85rem;
  color: var(--admin-text-soft);
  margin-top: 0.35rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ---------- Shell: sidebar + main ---------- */

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--admin-sidebar-bg);
  color: rgba(255,255,255,0.85);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-sidebar__brand {
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.admin-sidebar__brand img { height: 32px; width: auto; }
.admin-sidebar__brand span {
  font-family: var(--seva-font-display, 'Montserrat', sans-serif);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.admin-sidebar__nav { flex: 1; padding: 0.75rem 0.5rem; overflow-y: auto; }
.admin-sidebar__group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
  margin: 1rem 0.85rem 0.4rem 0.85rem;
}
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  margin: 2px 0;
  font-size: 0.95rem;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.admin-nav-link i { width: 20px; text-align: center; }
.admin-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.admin-nav-link.is-active {
  background: rgba(56, 189, 248, 0.15);
  color: #fff;
}

.admin-sidebar__user {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-sidebar__user-name { color: #fff; font-weight: 600; font-size: 0.95rem; }
.admin-sidebar__user-role {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-main {
  padding: 1.5rem clamp(1rem, 2vw, 2rem);
  overflow-x: hidden;
}

.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-page-header h1 {
  font-family: var(--seva-font-display, 'Montserrat', sans-serif);
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 700;
  margin: 0;
  color: var(--admin-text);
}
.admin-page-header p {
  margin: 0.2rem 0 0 0;
  color: var(--admin-text-soft);
}

/* Cards / panels */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--admin-radius);
  padding: 1.25rem;
  box-shadow: var(--admin-shadow);
  margin-bottom: 1.25rem;
}
.admin-card h2,
.admin-card h3 {
  font-family: var(--seva-font-display, 'Montserrat', sans-serif);
  font-weight: 700;
  color: var(--admin-text);
}

/* Stat tiles */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-stat {
  background: #fff;
  border-radius: var(--admin-radius);
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--admin-card-border);
  box-shadow: var(--admin-shadow);
  position: relative;
  overflow: hidden;
}
.admin-stat__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-text-soft);
}
.admin-stat__value {
  font-family: var(--seva-font-display, 'Montserrat', sans-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--admin-text);
  margin-top: 0.2rem;
}
.admin-stat__sub {
  font-size: 0.85rem;
  color: var(--admin-text-faint);
  margin-top: 0.35rem;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--admin-line);
  vertical-align: middle;
}
.admin-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-text-soft);
  background: #f8fafc;
}
.admin-table tr:hover td { background: #f8fafc; }

/* Badges */
.admin-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-badge--success { background: #dcfce7; color: #166534; }
.admin-badge--warn    { background: #fef3c7; color: #92400e; }
.admin-badge--danger  { background: #fee2e2; color: #991b1b; }
.admin-badge--info    { background: #dbeafe; color: #1e3a8a; }
.admin-badge--neutral { background: #e2e8f0; color: #334155; }

/* Toolbar */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

/* Modal */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.admin-modal {
  background: #fff;
  border-radius: var(--admin-radius);
  padding: 1.25rem 1.5rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 32px 64px -12px rgba(2, 6, 23, 0.45);
}
.admin-modal h3 { margin-top: 0; }

/* Toasts */
.admin-toasts {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}
.admin-toast {
  background: #0f172a;
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.45);
  font-size: 0.9rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .25s ease, transform .25s ease;
}
.admin-toast--success { background: #065f46; }
.admin-toast--error   { background: #991b1b; }
.admin-toast--warn    { background: #92400e; }
.admin-toast--leaving { opacity: 0; transform: translateY(8px); }

/* QR card */
.admin-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-line);
}
.admin-qr-card img { width: 200px; height: 200px; image-rendering: pixelated; }
.admin-qr-card code {
  background: #fff;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  user-select: all;
}

.admin-recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.admin-recovery-codes code {
  background: #f1f5f9;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  text-align: center;
}

/* Mobile */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-sidebar__nav { display: flex; flex-wrap: wrap; }
  .admin-sidebar__group-label { display: none; }
  .admin-nav-link { flex: 1 1 auto; }
}

/* ==========================================================================
 * Page Content: visual editor
 * ========================================================================== */
.cms-toolbar { gap: 0.6rem; }
.cms-toolbar__label { font-weight: 600; font-size: 0.9rem; color: var(--admin-text-soft); }
.cms-select {
  border: 1px solid var(--admin-line); border-radius: 10px; padding: 0.5rem 0.75rem;
  font-size: 0.92rem; background: #fff; color: var(--admin-text); min-width: 210px;
}
.cms-seg { display: inline-flex; border: 1px solid var(--admin-line); border-radius: 10px; overflow: hidden; background: #fff; }
.cms-seg__btn { border: 0; background: transparent; padding: 0.5rem 0.7rem; color: var(--admin-text-soft); cursor: pointer; }
.cms-seg__btn + .cms-seg__btn { border-left: 1px solid var(--admin-line); }
.cms-seg__btn:hover { color: var(--admin-text); background: #f8fafc; }
.cms-seg__btn.is-active { background: #eff6ff; color: var(--admin-accent); }
.cms-check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--admin-text-soft); cursor: pointer; }
.cms-spacer { flex: 1; }
.admin-btn.cms-small { padding: 0.45rem 0.8rem; font-size: 0.88rem; }
.cms-muted { color: var(--admin-text-faint); font-size: 0.82rem; }
.cms-hidden { display: none; }
.cms-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.45rem; flex-wrap: wrap; }
.cms-row--end { justify-content: flex-end; margin-top: 1rem; }
.cms-link {
  border: 0; background: none; color: var(--admin-accent); cursor: pointer; font-size: 0.8rem;
  font-weight: 600; padding: 0.1rem 0.25rem; display: inline-flex; gap: 0.3rem; align-items: center;
}
.cms-link:hover { text-decoration: underline; }

.cms-notice {
  display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
  padding: 0.6rem 0.9rem; border-radius: 10px; font-size: 0.9rem; margin-bottom: 0.9rem;
}
.cms-notice--info  { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.cms-notice--warn  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.cms-notice--error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.cms-editor {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 400px); gap: 1rem;
  height: calc(100vh - 215px); min-height: 540px;
}
.cms-preview {
  position: relative; display: flex; justify-content: center; overflow: hidden;
  background: repeating-linear-gradient(45deg, #e2e8f0 0 12px, #e8edf3 12px 24px);
  border: 1px solid var(--admin-card-border); border-radius: var(--admin-radius);
}
.cms-frame { width: 100%; height: 100%; border: 0; background: #fff; transition: width .25s ease; }
.cms-preview[data-device="tablet"] .cms-frame { width: 820px; max-width: 100%; box-shadow: 0 10px 30px -12px rgba(15, 23, 42, .35); }
.cms-preview[data-device="phone"] .cms-frame {
  width: 390px; max-width: 100%; height: calc(100% - 2rem); margin-top: 1rem;
  border-radius: 22px; box-shadow: 0 0 0 8px #0f172a, 0 18px 40px -12px rgba(15, 23, 42, .5);
}

.cms-panel {
  display: flex; flex-direction: column; overflow: hidden; background: #fff;
  border: 1px solid var(--admin-card-border); border-radius: var(--admin-radius); box-shadow: var(--admin-shadow);
}
.cms-panel__head { padding: 0.75rem; border-bottom: 1px solid var(--admin-line); }
.cms-panel__body { flex: 1; overflow-y: auto; padding: 0.4rem 0.6rem 1.2rem; }
.cms-input {
  width: 100%; border: 1px solid var(--admin-line); border-radius: 9px; padding: 0.5rem 0.65rem;
  font: inherit; font-size: 0.92rem; line-height: 1.45; color: var(--admin-text); background: #fff; resize: none;
}
.cms-input:focus, .cms-rich:focus { outline: none; border-color: var(--admin-accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.cms-input.is-invalid { border-color: var(--admin-danger); }
.cms-input:disabled { background: #f8fafc; color: var(--admin-text-soft); }

.cms-section { border-bottom: 1px solid var(--admin-line); }
.cms-section > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0.35rem; font-weight: 700; font-size: 0.9rem; color: var(--admin-text);
}
.cms-section > summary::-webkit-details-marker { display: none; }
.cms-section > summary::before {
  content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 0.7rem;
  color: var(--admin-text-faint); transition: transform .15s ease; width: 0.8rem;
}
.cms-section[open] > summary::before { transform: rotate(90deg); }
.cms-section__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cms-section__count {
  font-size: 0.72rem; font-weight: 700; color: var(--admin-text-soft); background: #f1f5f9;
  border-radius: 999px; padding: 0.1rem 0.5rem;
}
.cms-section__count.is-dirty { background: #fef3c7; color: #92400e; }

.cms-field {
  padding: 0.55rem 0.6rem 0.65rem; margin: 0 0 0.35rem 0.2rem;
  border: 1px solid transparent; border-left: 3px solid transparent; border-radius: 10px;
}
.cms-field:hover { background: #f8fafc; }
.cms-field.is-selected { border-color: #bfdbfe; border-left-color: var(--admin-accent); background: #f5f9ff; }
.cms-field.is-dirty { border-left-color: var(--admin-warning); }
.cms-field__head { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.35rem; min-height: 1.4rem; }
.cms-field__label { font-size: 0.84rem; font-weight: 600; color: var(--admin-text); }
.cms-field__actions { margin-left: auto; display: inline-flex; gap: 0.25rem; }
.cms-field__note { font-size: 0.76rem; color: var(--admin-text-faint); margin-top: 0.3rem; }
.cms-field__note:empty { display: none; }
.cms-badge { font-size: 0.68rem; font-weight: 700; border-radius: 999px; padding: 0.08rem 0.45rem; }
.cms-badge:empty { display: none; }
.cms-badge.is-dirty { background: #fef3c7; color: #92400e; }
.cms-badge.is-custom { background: #dbeafe; color: #1e3a8a; }

.cms-rich {
  min-height: 2.4rem; border: 1px solid var(--admin-line); border-radius: 9px; padding: 0.5rem 0.65rem;
  font-size: 0.92rem; line-height: 1.5; background: #fff;
}
.cms-rich[contenteditable="false"] { background: #f8fafc; color: var(--admin-text-soft); }
.cms-rich a { color: var(--admin-accent); }
.cms-rich i[class*="fa-"] { color: var(--admin-success); margin-right: 0.35rem; }
.cms-rich__bar { display: flex; gap: 0.2rem; margin-bottom: 0.3rem; }
.cms-rich__btn {
  border: 1px solid var(--admin-line); background: #fff; border-radius: 7px; width: 30px; height: 28px;
  color: var(--admin-text-soft); cursor: pointer; font-size: 0.78rem;
}
.cms-rich__btn:hover { color: var(--admin-text); border-color: var(--admin-text-soft); }

.cms-drop {
  position: relative; border: 2px dashed var(--admin-line); border-radius: 10px; padding: 0.4rem;
  background: #f8fafc; text-align: center; transition: border-color .15s ease, background-color .15s ease;
}
.cms-drop.is-over { border-color: var(--admin-success); background: #ecfdf5; }
.cms-thumb { display: block; width: 100%; max-height: 170px; object-fit: contain; border-radius: 6px; background: #fff; }
.cms-drop__hint { font-size: 0.75rem; color: var(--admin-text-faint); margin-top: 0.25rem; }
.cms-drop__hint:empty { display: none; }
.cms-drop ~ .cms-input { margin-top: 0.45rem; }

.admin-modal.cms-review-modal { max-width: 780px; }
.cms-review { max-height: 58vh; overflow-y: auto; margin-top: 0.5rem; }
.cms-review__page {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--admin-text-soft);
  margin: 0.9rem 0 0.4rem;
}
.cms-review__item { border: 1px solid var(--admin-line); border-radius: 10px; padding: 0.6rem 0.75rem; margin-bottom: 0.5rem; }
.cms-review__label { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; }
.cms-review__diff { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; align-items: center; font-size: 0.86rem; }
.cms-review__old { color: var(--admin-text-faint); text-decoration: line-through; }
.cms-review__new { color: var(--admin-text); }
.cms-review__arrow { color: var(--admin-text-faint); }
.cms-review__img { max-width: 100%; max-height: 90px; border-radius: 6px; }
.cms-review__old .cms-review__img { opacity: 0.5; }

@media (max-width: 1150px) {
  .cms-editor { grid-template-columns: 1fr; height: auto; }
  .cms-preview { height: 62vh; }
  .cms-panel { max-height: 70vh; }
}

/* ==========================================================================
 * Chatbot FAQ editor
 * ========================================================================== */
.faq-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 330px; gap: 1rem; align-items: start; }
.faq-list {
  position: sticky; top: 1rem; background: #fff; border: 1px solid var(--admin-card-border);
  border-radius: var(--admin-radius); box-shadow: var(--admin-shadow); display: flex; flex-direction: column;
  max-height: calc(100vh - 2rem); overflow: hidden;
}
.faq-list__head { padding: 0.65rem; border-bottom: 1px solid var(--admin-line); }
.faq-list__items { overflow-y: auto; padding: 0.35rem; flex: 1; }
.faq-add { margin: 0.5rem 0.65rem 0.75rem; }
.faq-item {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 0.5rem 0.55rem; border-radius: 9px; cursor: pointer; color: var(--admin-text); font-size: 0.86rem;
}
.faq-item:hover { background: #f8fafc; }
.faq-item.is-active { background: #eff6ff; color: #1e3a8a; font-weight: 600; }
.faq-item.is-off .faq-item__q { color: var(--admin-text-faint); }
.faq-item--general { border-bottom: 1px solid var(--admin-line); border-radius: 9px 9px 0 0; margin-bottom: 0.3rem; color: var(--admin-text-soft); }
.faq-item--general i { width: 0.75rem; color: var(--admin-text-faint); }
.faq-item__q { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faq-item__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.faq-item__dot.is-bad { background: var(--admin-danger); }
.faq-item.is-active .faq-item__dot:not(.is-bad) { background: var(--admin-accent); }

.faq-editor, .faq-tester { margin-bottom: 0; }
.faq-editor__head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.9rem; }
.faq-editor__head h3 { margin: 0; font-size: 1.05rem; }
.faq-editor__actions { margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--admin-line); }
.faq-help { margin-top: 0.3rem; font-size: 0.78rem; }
.faq-id { max-width: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

.faq-tags {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; border: 1px solid var(--admin-line);
  border-radius: 9px; padding: 0.35rem 0.45rem; background: #fff; cursor: text; min-height: 2.5rem;
}
.faq-tags:focus-within { border-color: var(--admin-accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.faq-tag {
  display: inline-flex; align-items: center; gap: 0.25rem; background: #eff6ff; color: #1e3a8a;
  border-radius: 999px; padding: 0.12rem 0.25rem 0.12rem 0.6rem; font-size: 0.8rem; font-weight: 500;
}
.faq-tag__x { border: 0; background: transparent; color: #60a5fa; cursor: pointer; padding: 0 0.25rem; font-size: 0.7rem; }
.faq-tag__x:hover { color: #1e3a8a; }
.faq-tags__input { flex: 1; min-width: 140px; border: 0; outline: none; font: inherit; font-size: 0.88rem; padding: 0.2rem; background: transparent; }

.faq-picks { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.faq-pick {
  border: 1px solid #cbd5e1; background: #fff; color: var(--admin-text-soft); border-radius: 999px;
  padding: 0.25rem 0.7rem; font-size: 0.8rem; cursor: pointer; text-align: left;
}
.faq-pick:hover:not(:disabled) { border-color: var(--admin-accent); color: var(--admin-accent); }
.faq-pick.is-on { background: var(--admin-accent); border-color: var(--admin-accent); color: #fff; }
.faq-pick:disabled { cursor: default; }

.faq-links { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.faq-link { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 0.4rem; width: 100%; }

.faq-tester { position: sticky; top: 1rem; display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.faq-test__log {
  flex: 1; min-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.45rem;
  background: #f8fafc; border: 1px solid var(--admin-line); border-radius: 10px; padding: 0.7rem; margin-bottom: 0.6rem;
}
.faq-test__log > .faq-pick { align-self: flex-start; }
.faq-test__user {
  align-self: flex-end; background: #0f172a; color: #fff; border-radius: 14px 14px 4px 14px;
  padding: 0.4rem 0.7rem; font-size: 0.85rem; max-width: 85%;
}
.faq-test__bot {
  align-self: flex-start; background: #fff; border: 1px solid var(--admin-line); border-radius: 14px 14px 14px 4px;
  padding: 0.45rem 0.7rem; font-size: 0.85rem; max-width: 92%;
}
.faq-test__bot p { margin: 0; }
.faq-test__bot p + p { margin-top: 0.4rem; }
.faq-test__links { margin-top: 0.35rem; font-size: 0.78rem; color: var(--admin-accent); }
.faq-test__btn {
  display: inline-block; margin-top: 0.4rem; background: #0f172a; color: #fff; border-radius: 999px;
  padding: 0.18rem 0.65rem; font-size: 0.74rem;
}
.faq-test__why { font-size: 0.74rem; color: var(--admin-text-faint); margin: -0.15rem 0 0.3rem 0.2rem; }
.faq-test__why .cms-link { font-size: 0.74rem; padding: 0; }
.faq-test__form { display: flex; gap: 0.4rem; }

@media (max-width: 1400px) {
  .faq-layout { grid-template-columns: 250px minmax(0, 1fr); }
  .faq-tester { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 900px) {
  .faq-layout { grid-template-columns: 1fr; }
  .faq-list { position: static; max-height: 50vh; }
}

/* ==========================================================================
 * Demo Requests
 * ========================================================================== */
.leads-count { margin-left: 0.35rem; font-size: 0.72rem; opacity: 0.75; }
.leads-card { padding: 1rem 1.15rem; border-left: 4px solid transparent; }
.leads-card.is-new { border-left-color: var(--admin-accent); }
.leads-card__head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.leads-card__name { font-weight: 700; font-size: 1rem; }
.leads-card__org { font-weight: 500; color: var(--admin-text-soft); }
.leads-card__email { font-size: 0.88rem; color: var(--admin-accent); text-decoration: none; }
.leads-card__email:hover { text-decoration: underline; }
.leads-card__meta { display: flex; align-items: center; gap: 0.6rem; }
.leads-card__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 0.3rem; }
.leads-tag { font-size: 0.78rem; background: #f1f5f9; color: var(--admin-text-soft); border-radius: 999px; padding: 0.15rem 0.6rem; }
.leads-tag i { opacity: 0.7; }
.leads-card__msg { white-space: pre-wrap; margin: 0.6rem 0; font-size: 0.92rem; line-height: 1.55; color: var(--admin-text); }
.leads-card__foot { display: grid; grid-template-columns: auto 150px minmax(0, 1fr) auto; gap: 0.6rem; align-items: start; border-top: 1px solid var(--admin-line); padding-top: 0.75rem; }
.leads-card__label { font-size: 0.82rem; font-weight: 600; color: var(--admin-text-soft); align-self: center; }
.leads-status { min-width: 0; width: 100%; }
.leads-card__note { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.leads-card__updated { margin-top: 0.4rem; font-size: 0.76rem; }
.leads-empty { text-align: center; padding: 2.5rem 1rem; }
.leads-empty i { font-size: 2rem; color: var(--admin-text-faint); }
.leads-empty h3 { margin: 0.6rem 0 0.3rem; font-size: 1.05rem; }
@media (max-width: 760px) { .leads-card__foot { grid-template-columns: 1fr; } }

/* ==========================================================================
 * Site Settings
 * ========================================================================== */
.set-body { padding-bottom: 4.5rem; }
.set-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.set-card__head h3 { margin: 0; font-size: 1.1rem; }
.set-card__head .cms-muted { max-width: 560px; }
.set-sub { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--admin-text-soft); margin: 1.25rem 0 0.5rem; }
.set-ship { display: grid; grid-template-columns: 110px repeat(3, minmax(0, 1fr)); gap: 0.5rem 0.75rem; align-items: center; }
.set-ship__class { display: flex; gap: 0.6rem; align-items: center; padding-bottom: 0.25rem; border-bottom: 2px solid var(--admin-line); }
.set-ship__class i { color: var(--admin-accent); width: 1.2rem; text-align: center; }
.set-ship__class strong { font-size: 0.9rem; }
.set-ship__part { font-size: 0.85rem; font-weight: 600; color: var(--admin-text-soft); }
.set-money__wrap { position: relative; }
.set-money__sign { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--admin-text-faint); font-size: 0.9rem; pointer-events: none; }
.cms-input.set-money { padding-left: 1.4rem; font-variant-numeric: tabular-nums; }
.cms-input.is-changed { border-color: var(--admin-warning); background: #fffbeb; }
.set-preview td, .set-preview th { text-align: right; font-variant-numeric: tabular-nums; }
.set-preview td:first-child, .set-preview th:first-child { text-align: left; }
.set-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.set-split--even { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.set-mail { border: 1px solid var(--admin-line); border-radius: 12px; overflow: hidden; background: #f8fafc; font-size: 0.86rem; }
.set-mail__meta { background: #fff; border-bottom: 1px solid var(--admin-line); padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.15rem; }
.set-mail__meta strong { color: var(--admin-text-soft); font-weight: 600; }
.set-mail__body { margin: 0.75rem; background: #fff; border-radius: 10px; padding: 0.8rem 1rem; border-top: 4px solid #1e3a5f; }
.set-mail__body h4 { color: #1e3a5f; font-size: 1rem; margin: 0 0 0.4rem; }
.set-mail__body p { margin: 0 0 0.5rem; }
.set-mail__note { color: #0f172a; background: #eff6ff; border-left: 3px solid var(--admin-accent); padding: 0.4rem 0.6rem; margin: 0.2rem 0; border-radius: 0 6px 6px 0; }
.set-mail__invoice { margin-top: 0.6rem; padding: 0.6rem; border: 1px dashed var(--admin-line); border-radius: 8px; color: var(--admin-text-faint); text-align: center; font-size: 0.8rem; }
.set-notify { margin: 1rem 0 0; display: flex; gap: 0.4rem; align-items: center; }
.set-notify strong { color: var(--admin-text); }
.set-bar {
  position: sticky; bottom: 1rem; z-index: 20; display: flex; align-items: center; gap: 0.6rem;
  background: #0f172a; color: #e2e8f0; padding: 0.65rem 0.9rem; border-radius: 12px; box-shadow: 0 16px 32px -16px rgba(15, 23, 42, .6);
  font-size: 0.9rem; transform: translateY(0); transition: background-color .2s ease;
}
.set-bar.is-dirty { background: #92400e; }
.set-bar .admin-btn--ghost { color: #e2e8f0; border-color: rgba(226, 232, 240, .35); }
.set-bar .admin-btn--ghost:hover { color: #fff; border-color: #fff; }
@media (max-width: 900px) { .set-split, .set-split--even { grid-template-columns: 1fr; } .set-ship { grid-template-columns: 80px repeat(3, minmax(0, 1fr)); } }

/* ==========================================================================
 * Products
 * ========================================================================== */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.prod-card {
  background: #fff; border: 1px solid var(--admin-card-border); border-radius: var(--admin-radius); box-shadow: var(--admin-shadow);
  overflow: hidden; display: flex; flex-direction: column;
}
.prod-card.is-hidden .prod-card__img img { opacity: 0.45; filter: grayscale(0.6); }
.prod-card.is-bad { border-color: #fca5a5; }
.prod-card__img { position: relative; aspect-ratio: 16 / 10; background: #f1f5f9; }
.prod-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prod-card__noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--admin-text-faint); font-size: 2rem; background: #f1f5f9; min-height: 120px; }
.prod-card__flag { position: absolute; top: 0.6rem; left: 0.6rem; background: #0f172a; color: #fff; font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; }
.prod-card__body { padding: 0.8rem 0.9rem 0.4rem; flex: 1; }
.prod-card__cat { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--admin-text-faint); }
.prod-card__name { font-size: 1rem; margin: 0.2rem 0 0.3rem; line-height: 1.3; }
.prod-card__price { font-family: var(--seva-font-display, 'Montserrat', sans-serif); font-weight: 700; font-size: 1.25rem; color: var(--admin-text); }
.prod-card__sold { margin-top: 0.2rem; }
.prod-card__bad { margin-top: 0.4rem; font-size: 0.8rem; color: #b91c1c; }
.prod-card__foot { display: flex; align-items: center; gap: 0.35rem; padding: 0.6rem 0.9rem; border-top: 1px solid var(--admin-line); }
.admin-modal.prod-modal { max-width: 880px; }
.prod-modal__grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.25rem; margin-top: 0.5rem; }
.prod-preview { position: sticky; top: 0; }
.prod-preview__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--admin-text-faint); margin-bottom: 0.4rem; }
.prod-preview__card { border: 1px solid var(--admin-line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 10px 26px -18px rgba(15, 23, 42, .5); }
.prod-preview__card.is-hidden { opacity: 0.5; }
.prod-preview__card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.prod-preview__body { padding: 0.8rem 0.9rem; }
.prod-preview__body h5 { font-size: 1rem; margin: 0 0 0.35rem; }
.prod-preview__body p { font-size: 0.84rem; color: var(--admin-text-soft); margin: 0 0 0.6rem; }
.prod-preview__row { display: flex; align-items: center; justify-content: space-between; }
.prod-preview__btn { background: #0f172a; color: #fff; border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.prod-review { list-style: none; padding: 0; margin: 0.75rem 0; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.9rem; }
@media (max-width: 760px) { .prod-modal__grid { grid-template-columns: 1fr; } }

/* ==========================================================================
 * Dashboard
 * ========================================================================== */
.dash-kpi { text-align: left; font: inherit; color: inherit; }
.dash-kpi.is-link { cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.dash-kpi.is-link:hover { border-color: var(--admin-accent); transform: translateY(-1px); }
.dash-kpi.is-hot { border-color: #93c5fd; background: linear-gradient(180deg, #eff6ff, #fff 60%); }
.dash-delta { font-weight: 700; border-radius: 999px; padding: 0.05rem 0.4rem; font-size: 0.75rem; }
.dash-delta.is-up { background: #dcfce7; color: #166534; }
.dash-delta.is-down { background: #fee2e2; color: #991b1b; }
.dash-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.25rem; }
.dash-row > .admin-card h3 { margin-top: 0; font-size: 1.05rem; }
.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.dash-item {
  width: 100%; display: flex; align-items: center; gap: 0.7rem; text-align: left; border: 1px solid var(--admin-line);
  background: #fff; border-radius: 10px; padding: 0.55rem 0.7rem; cursor: pointer; font: inherit; color: inherit;
}
.dash-item:hover { border-color: var(--admin-accent); background: #f8fbff; }
.dash-item__icon { width: 1.6rem; height: 1.6rem; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; flex-shrink: 0; }
.dash-item__icon.is-danger { background: #fee2e2; color: #b91c1c; }
.dash-item__icon.is-warn { background: #fef3c7; color: #b45309; }
.dash-item__icon.is-info { background: #dbeafe; color: #1d4ed8; }
.dash-item__text { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 0.88rem; }
.dash-item__text .cms-muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-item__go { color: var(--admin-text-faint); font-size: 0.75rem; }
.dash-clear { display: flex; align-items: center; gap: 0.6rem; color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 0.8rem 0.9rem; }
.dash-chart { position: relative; height: 240px; }
.dash-bar { margin-bottom: 0.7rem; }
.dash-bar__top { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.88rem; margin-bottom: 0.25rem; }
.dash-bar__top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar__track { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.dash-bar__fill { height: 100%; background: linear-gradient(90deg, #2563eb, #38bdf8); border-radius: 999px; }
.dash-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.dash-quick__item {
  display: flex; align-items: center; gap: 0.6rem; border: 1px solid var(--admin-card-border); background: #fff; border-radius: 12px;
  padding: 0.8rem 0.9rem; cursor: pointer; font: inherit; font-weight: 600; color: var(--admin-text); box-shadow: var(--admin-shadow);
}
.dash-quick__item i { color: var(--admin-accent); width: 1.1rem; text-align: center; }
.dash-quick__item:hover { border-color: var(--admin-accent); }
.dash-activity { list-style: none; margin: 0; padding: 0; }
.dash-activity li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--admin-line); font-size: 0.88rem; }
.dash-activity__what { text-transform: capitalize; }
@media (max-width: 1100px) { .dash-row { grid-template-columns: 1fr; } }
