/* ───────── Mailchimp-flavored design tokens ───────── */
:root {
  /* Brand */
  --mc-yellow: #FFE01B;
  --mc-yellow-soft: #fff4a3;
  --mc-yellow-deep: #e6c800;
  --mc-black: #241C15;
  --mc-black-soft: #3a3027;
  --mc-cream: #FFF5E1;
  --mc-peach: #FFB05A;

  /* Surfaces */
  --bg: #ffffff;
  --bg-alt: #faf9f6;
  --surface: #ffffff;
  --border: #ebe8e1;
  --border-strong: #d1cdbf;
  --text: #0a0a0a;
  --text-2: #4a4438;
  --muted: #8a8472;

  /* States */
  --success: #1f8a4c;
  --success-light: #ecf8f0;
  --warning: #b06200;
  --warning-light: #fff4dd;
  --danger: #b91c1c;
  --danger-light: #fef2f2;

  --shadow-xs: 0 1px 2px rgba(36, 28, 21, 0.05);
  --shadow-sm: 0 1px 3px rgba(36, 28, 21, 0.07), 0 1px 2px rgba(36, 28, 21, 0.04);
  --shadow: 0 4px 8px rgba(36, 28, 21, 0.08), 0 2px 4px rgba(36, 28, 21, 0.05);
  --shadow-md: 0 10px 20px rgba(36, 28, 21, 0.10), 0 4px 8px rgba(36, 28, 21, 0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 56px;
  --space-9: 80px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Archivo Black", "Inter", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--mc-yellow); text-decoration-thickness: 3px; text-underline-offset: 4px; }

button { font: inherit; }

/* ───────────────────────────────────────────────────────────
   FRONTEND — public, Google-feel knowledge base search
   ─────────────────────────────────────────────────────────── */

.fe { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.fe-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid transparent;
}
.fe-topbar a { color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.fe-topbar a:hover { color: var(--text); }
.fe-topbar__logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px;
}
.fe-topbar__logo .mark { width: 28px; height: 28px; }
.fe-topbar__right { display: inline-flex; gap: 16px; align-items: center; }

/* Mark — yellow square with black "KB" */
.mark {
  background: var(--mc-yellow);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-family: var(--font-display);
  color: var(--mc-black);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.mark--lg { width: 96px; height: 96px; border-radius: 18px; font-size: 36px; }
.mark--md { width: 56px; height: 56px; border-radius: 12px; font-size: 22px; }

/* Landing (hero) */
.fe-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5) var(--space-9);
  text-align: center;
}
.fe-hero__mark { margin-bottom: var(--space-5); }
.fe-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
  font-weight: 900;
  color: var(--mc-black);
}
.fe-hero h1 .accent { background: var(--mc-yellow); padding: 0 8px; border-radius: 6px; }
.fe-hero__sub { color: var(--text-2); font-size: 16px; margin-bottom: var(--space-7); }

.fe-search {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.fe-search__box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: 2px solid var(--mc-black);
  border-radius: var(--radius-pill);
  padding: 6px 6px 6px 22px;
  box-shadow: 0 6px 0 var(--mc-black);
  transition: transform 80ms ease;
}
.fe-search__box:focus-within { transform: translateY(-1px); }
.fe-search__box svg { color: var(--text-2); flex: 0 0 auto; }
.fe-search__box textarea {
  flex: 1;
  border: 0; outline: none;
  font: inherit;
  font-size: 17px;
  line-height: 1.4;
  background: transparent;
  resize: none;
  padding: 14px 8px;
  color: var(--text);
  min-height: 28px;
  max-height: 240px;
}
.fe-search__box textarea::placeholder { color: var(--muted); }
.fe-search__btn {
  flex: 0 0 auto;
  background: var(--mc-yellow);
  color: var(--mc-black);
  border: 0;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 120ms ease;
}
.fe-search__btn:hover { background: #ffd60a; box-shadow: var(--shadow-sm); }
.fe-search__btn:active { transform: translateY(1px); }

.fe-quick-tags {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: var(--space-3);
}
.fe-quick-tag {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.fe-quick-tag:hover { background: var(--mc-yellow-soft); border-color: var(--mc-yellow); color: var(--mc-black); }

/* Results page */
.fe-results-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-9);
}

.fe-results-bar {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}
.fe-results-bar .mark { flex: 0 0 auto; }
.fe-results-bar form { flex: 1; max-width: 540px; }
.fe-results-bar .fe-search__box {
  box-shadow: var(--shadow-xs);
  border-width: 1.5px;
  padding: 4px 4px 4px 16px;
}
.fe-results-bar .fe-search__box textarea { font-size: 15px; padding: 10px 6px; }
.fe-results-bar .fe-search__btn { padding: 9px 18px; font-size: 14px; }

.fe-results-meta {
  color: var(--muted); font-size: 13px;
  margin-bottom: var(--space-4);
}

.fe-result {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.fe-result:last-child { border-bottom: 0; }
.fe-result__breadcrumb {
  font-size: 12px; color: var(--muted); margin-bottom: 4px;
  font-family: var(--font-mono);
}
.fe-result__title {
  font-size: 19px;
  font-weight: 600;
  color: var(--mc-black);
  margin: 0 0 6px;
  line-height: 1.3;
}
.fe-result__title a:hover { text-decoration-color: var(--mc-yellow); }
.fe-result__summary { color: var(--text); margin: 4px 0; line-height: 1.55; }
.fe-result__snippet {
  background: var(--mc-yellow-soft);
  border-left: 3px solid var(--mc-yellow);
  padding: 10px 14px;
  border-radius: 4px;
  margin-top: 10px;
  font-size: 13.5px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  max-height: 14em;
  overflow: auto;
  color: var(--mc-black);
}
.fe-result__meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.fe-result__actions { margin-top: 10px; display: flex; gap: 8px; }

/* Tags / chips (frontend & shared) */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.tag--yellow { background: var(--mc-yellow); border-color: var(--mc-yellow); color: var(--mc-black); }
.tag--success { background: var(--success-light); border-color: rgba(31,138,76,0.18); color: var(--success); }
.tag--warning { background: var(--warning-light); border-color: rgba(176,98,0,0.18); color: var(--warning); }
.tag--mono { font-family: var(--font-mono); font-size: 11.5px; }

/* Frontend empty state */
.fe-empty {
  text-align: center; padding: var(--space-8) var(--space-5);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* ───────────────────────────────────────────────────────────
   ADMIN — sidebar + content dashboard
   ─────────────────────────────────────────────────────────── */

body.admin { background: var(--bg-alt); }

.adm {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.adm-sidebar {
  background: var(--mc-black);
  color: #d8d2c2;
  padding: var(--space-5) var(--space-3);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.adm-sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; color: #fff;
  margin: 0 var(--space-2) var(--space-6);
}
.adm-sidebar__brand .mark { background: var(--mc-yellow); }
.adm-sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.adm-sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #cfc8b8;
  transition: background 120ms ease, color 120ms ease;
}
.adm-sidebar a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.adm-sidebar a.is-active {
  background: var(--mc-yellow);
  color: var(--mc-black);
}
.adm-sidebar a.is-active svg { color: var(--mc-black); }
.adm-sidebar svg { color: #cfc8b8; flex: 0 0 auto; width: 16px; height: 16px; }
.adm-sidebar__footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
  display: flex; flex-direction: column; gap: 2px;
}
.adm-sidebar__footer .pill {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 4px 8px; font-size: 11.5px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.06); color: #cfc8b8;
}
.adm-sidebar__footer .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.adm-sidebar__footer .pill.is-on { background: rgba(31,138,76,0.18); color: #6ad391; }
.adm-sidebar__footer .pill.is-on .dot { background: #6ad391; }

/* Content area */
.adm-main { padding: 0; min-width: 0; }
.adm-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.adm-topbar h1 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
}
.adm-topbar__actions { display: flex; gap: 10px; align-items: center; }

.adm-page { padding: var(--space-6); max-width: 1400px; }

/* ───────────────────────────────────────────────────────────
   INBOX — two-column dashboard layout (PS Addons style)
   sidebar list (380px) + flex detail pane, full-height with
   internal scroll. The page breaks out of the centered .adm-page
   padding via the body.inbox-fullbleed class.
   ─────────────────────────────────────────────────────────── */

body.inbox-fullbleed .adm-page {
  padding: 0; max-width: none;
  display: flex; flex-direction: column;
  height: calc(100vh - 62px);
  min-height: 0;
}
body.inbox-fullbleed .adm-topbar { border-bottom: 1px solid var(--border); }

.inbox-split {
  display: grid;
  grid-template-columns: 380px 1fr;
  flex: 1;
  background: var(--surface);
  min-height: 0;
}

/* ── Sync status bar (above the split) ── */
.inbox-sync-status {
  flex: 0 0 auto;
  padding: 8px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
}
.inbox-sync-status.is-running { background: #fff8e0; }
.inbox-sync-status.is-error   { background: var(--danger-light); }
.inbox-sync-status.is-done    { background: var(--success-light); }
.inbox-sync-status__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.inbox-sync-status__label {
  display: inline-flex; align-items: center; gap: 8px;
}
.inbox-sync-status__counts {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text);
}
.inbox-sync-status__bar {
  margin-top: 6px;
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.inbox-sync-status__bar > span {
  display: block; height: 100%;
  background: var(--mc-yellow);
  transition: width 200ms linear;
}

.inbox-pane {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.inbox-list-pane {
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.inbox-list-pane__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.inbox-list-pane__head .title {
  font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.inbox-list-pane__head .count {
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.inbox-list-pane__filter {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fcfaf3;
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.inbox-list-pane__filter strong { color: var(--text); }
.inbox-list-pane__filter a { color: var(--mc-black); text-decoration: underline; text-decoration-color: var(--mc-yellow); text-decoration-thickness: 2px; }
.inbox-list-pane__list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.inbox-list-pane__foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.inbox-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 120ms ease;
}
.inbox-item:hover { background: var(--bg-alt); text-decoration: none; }
.inbox-item.is-active {
  background: #fffaf0;
  border-left: 3px solid var(--mc-yellow);
  padding-left: 13px;
}
.inbox-item__avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--mc-yellow);
  color: var(--mc-black);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.inbox-item.is-presale .inbox-item__avatar { background: #fff4dd; color: var(--warning); }
.inbox-item__body { min-width: 0; }
.inbox-item__top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 2px;
}
.inbox-item__subject {
  font-weight: 600; font-size: 13.5px; color: var(--mc-black);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.inbox-item__date {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  flex-shrink: 0;
}
.inbox-item__product {
  font-size: 12px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 4px;
}
.inbox-item__badges {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
}
.inbox-item__badges .tag {
  font-size: 10.5px; padding: 1px 7px;
}

.inbox-detail-pane {
  background: var(--surface);
  overflow-y: auto;
}
.inbox-detail-pane__empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}
.inbox-detail-pane__empty svg {
  width: 64px; height: 64px;
  color: var(--border-strong);
  margin-bottom: 16px;
}
.inbox-detail-pane__empty h3 {
  margin: 0 0 6px; font-size: 16px; color: var(--text-2); font-weight: 600;
}
.inbox-detail-pane__empty p { margin: 0; font-size: 13.5px; }

.inbox-detail__head {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.inbox-detail__subject {
  font-size: 18px; font-weight: 700; margin: 0 0 8px;
  color: var(--mc-black);
}
.inbox-detail__meta {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  font-size: 12.5px; color: var(--text-2);
}
.inbox-detail__meta .mono {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
}
.inbox-detail__meta-row + .inbox-detail__meta-row { margin-top: 6px; }

.inbox-detail__body { padding: 18px 24px; }

.inbox-msg {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.inbox-msg:last-child { border-bottom: 0; }
.inbox-msg__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: var(--text-2);
  flex-shrink: 0;
}
.inbox-msg.is-seller .inbox-msg__avatar {
  background: var(--mc-yellow); border-color: var(--mc-yellow-deep);
  color: var(--mc-black);
}
.inbox-msg__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 4px;
}
.inbox-msg__from {
  font-weight: 600; font-size: 13.5px; color: var(--mc-black);
}
.inbox-msg.is-seller .inbox-msg__from { color: var(--success); }
.inbox-msg__date {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
}
.inbox-msg__body {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}

.inbox-detail__draft {
  margin-top: 18px;
  padding: 16px;
  background: #fffaf0;
  border: 2px solid var(--mc-yellow);
  border-radius: var(--radius-lg);
}
.inbox-detail__draft h3 {
  margin: 0 0 10px; font-size: 15px; font-weight: 600;
}
.inbox-detail__draft .hint {
  color: var(--muted); font-size: 12.5px;
  display: block; margin-bottom: 12px;
}

@media (max-width: 900px) {
  .inbox-split { grid-template-columns: 1fr; height: auto; }
  .inbox-list-pane { border-right: 0; border-bottom: 1px solid var(--border); }
  .inbox-list-pane__list { max-height: 50vh; }
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}
.stat-card__label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-card__value { font-family: var(--font-display); font-size: 36px; line-height: 1; color: var(--mc-black); margin-top: 8px; }
.stat-card--accent { background: var(--mc-yellow); border-color: var(--mc-yellow-deep); }
.stat-card--accent .stat-card__label { color: var(--mc-black); }
.stat-card--dark { background: var(--mc-black); border-color: var(--mc-black); color: #fff; }
.stat-card--dark .stat-card__label { color: rgba(255,255,255,0.6); }
.stat-card--dark .stat-card__value { color: var(--mc-yellow); }

/* Admin card / section */
.admcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.admcard__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: var(--space-4);
}
.admcard__head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.admcard__head .hint { color: var(--muted); font-size: 13px; }

/* Admin tables */
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.adm-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.adm-table tr:hover td { background: var(--bg-alt); }
.adm-table .mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); }
.adm-table tr:last-child td { border-bottom: 0; }

/* ───────── Forms (shared) ───────── */

label.field { display: block; margin-bottom: var(--space-3); }
.field__label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.01em;
}
.field__hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

input[type="text"], input[type="search"], input:not([type]),
textarea, select {
  width: 100%;
  display: block;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 13px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { min-height: 100px; resize: vertical; line-height: 1.55; }
textarea.thread-paste { font-family: var(--font-mono); font-size: 13px; line-height: 1.6; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--mc-black);
  box-shadow: 0 0 0 3px var(--mc-yellow-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5l3 3 3-3' fill='none' stroke='%238a8472' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 32px;
}

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid > .field--full { grid-column: 1 / -1; }
.form-actions {
  display: flex; justify-content: flex-end; gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* ───────── Buttons (shared) ───────── */

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(0.5px); }

.btn--primary {
  background: var(--mc-yellow);
  border-color: var(--mc-yellow);
  color: var(--mc-black);
}
.btn--primary:hover:not(:disabled) { background: #ffd60a; border-color: #ffd60a; }

.btn--dark {
  background: var(--mc-black);
  color: var(--mc-yellow);
  border-color: var(--mc-black);
}
.btn--dark:hover:not(:disabled) { background: var(--mc-black-soft); }

.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover:not(:disabled) { background: var(--bg-alt); border-color: var(--mc-black); }

.btn--ghost {
  background: transparent; color: var(--text-2); border-color: transparent;
  height: 32px; padding: 0 12px; font-size: 13px;
}
.btn--ghost:hover:not(:disabled) { background: var(--bg-alt); color: var(--text); }

.btn--sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn--xs { height: 26px; padding: 0 10px; font-size: 12px; }

.btn--danger { color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--danger-light); border-color: var(--danger); }

/* ───────── Toast ───────── */

#toast-container {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: 100; pointer-events: none;
}
.toast {
  background: var(--mc-black);
  color: var(--mc-yellow);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  font-size: 13.5px; font-weight: 500;
  pointer-events: auto;
  animation: toast-in 200ms ease-out, toast-out 200ms ease-in 2.4s forwards;
}
.toast.toast--error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ───────── HTMX indicator ───────── */

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--mc-yellow-soft);
  border-top-color: var(--mc-black);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.htmx-indicator { display: none; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Misc ───────── */

.hide { display: none !important; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: var(--space-2); }
.row--end { justify-content: flex-end; }
.banner {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px;
  background: var(--mc-yellow-soft);
  color: var(--mc-black);
  border: 1px solid var(--mc-yellow);
  margin-bottom: var(--space-4);
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--mc-black);
  background: var(--mc-yellow-soft);
}
.dropzone__title { font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--mc-black); }
.dropzone__sub { color: var(--muted); font-size: 13px; margin-bottom: var(--space-3); }

.doc-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.doc-row:last-child { border-bottom: 0; }
.doc-row__title { font-weight: 600; }
.doc-row__meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; }
  .adm-sidebar { position: static; height: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
}
