/*
  McCord Candies — Store admin (dashboard + sign-in)
  ---------------------------------------------------------------------------
  Self-contained: admin.html does NOT load the public styles.css, so nothing in
  here can change how the public site looks, and nothing on the public site can
  leak into the dashboard.
*/

:root {
  --a-bg: #f6f4f1;
  --a-surface: #ffffff;
  --a-surface-2: #faf9f7;
  --a-border: #e6e1da;
  --a-border-strong: #d6cfc5;
  --a-ink: #1f1b17;
  --a-ink-2: #4a433c;
  --a-muted: #7a7168;
  --a-accent: #b4161b;
  --a-accent-hover: #961216;
  --a-accent-soft: #fbeaea;
  --a-green: #1f7a4d;
  --a-green-soft: #e5f4ec;
  --a-amber: #9a6100;
  --a-amber-soft: #fdf1dc;
  --a-red-soft: #fdecec;
  --a-focus: 0 0 0 3px rgba(180, 22, 27, 0.18);
  --a-radius: 10px;
  --a-radius-sm: 7px;
  --a-shadow: 0 1px 2px rgba(31, 27, 23, 0.06), 0 1px 1px rgba(31, 27, 23, 0.03);
  --a-shadow-lg: 0 12px 40px rgba(31, 27, 23, 0.16), 0 2px 6px rgba(31, 27, 23, 0.08);
  --a-sidebar: 252px;
  --a-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Used by the shared stripe-ball helper from config.js (menu category colors). */
  --candy-red: #d92828;
  --gold: #e7b84d;
  --emerald: #215c45;
  --soft-white: #fffaf0;
  --sb-maroon: #7a1f1f;
  --sb-orange: #ef7d1a;
  --sb-brown: #6b4423;
  --sb-lime: #6bbf3a;
  --sb-teal: #0f9d9d;
  --sb-blue: #2f6fed;
  --sb-navy: #17235e;
  --sb-purple: #8a2be2;
  --pink: #ef90ae;
  --peach: #ffb98a;
  --small-plum-accent: #6a315c;
  --near-black: #171411;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.adm {
  margin: 0;
  min-height: 100vh;
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: var(--a-font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.adm [hidden] { display: none !important; }
:where(.adm) :where(h1, h2, h3, h4) { margin: 0; font-weight: 650; letter-spacing: -0.01em; color: var(--a-ink); }
:where(.adm) p { margin: 0; }
:where(.adm) a { color: var(--a-accent); }
:where(.adm) button { font: inherit; color: inherit; }
.adm svg { flex-shrink: 0; }
.adm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px;
  border-radius: var(--a-radius-sm);
  border: 1px solid var(--a-border-strong);
  background: var(--a-surface); color: var(--a-ink);
  font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.btn:hover { background: var(--a-surface-2); border-color: #c7bfb4; }
.btn:focus-visible { outline: none; box-shadow: var(--a-focus); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.btn-primary:hover { background: var(--a-accent-hover); border-color: var(--a-accent-hover); }
.btn-dark { background: var(--a-ink); border-color: var(--a-ink); color: #fff; }
.btn-dark:hover { background: #000; border-color: #000; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--a-ink-2); }
.btn-ghost:hover { background: rgba(31, 27, 23, 0.05); border-color: transparent; }
.btn-danger { color: var(--a-accent); }
.btn-danger:hover { background: var(--a-accent-soft); border-color: #efc9c9; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 34px; min-height: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: adm-spin 700ms linear infinite; }
@keyframes adm-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- form fields */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--a-ink-2); }
.hint { font-size: 13px; color: var(--a-muted); line-height: 1.45; }
.hint strong { color: var(--a-ink-2); font-weight: 600; }
.input, .adm select.input, .adm textarea.input {
  width: 100%; min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--a-border-strong);
  border-radius: var(--a-radius-sm);
  background: #fff; color: var(--a-ink);
  font: inherit; font-size: 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.adm textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: #a79e93; }
.input:hover { border-color: #c2b9ad; }
.input:focus { outline: none; border-color: var(--a-accent); box-shadow: var(--a-focus); }
.adm select.input { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7168' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }

/* Toggle switch (wraps a real checkbox so every existing id still works) */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; flex-shrink: 0; width: 40px; height: 24px; margin-top: 1px;
  border-radius: 999px; background: #d5cec5; transition: background 150ms ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 150ms ease;
}
.switch input:checked + .switch-track { background: var(--a-green); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--a-focus); }
.switch-text { display: grid; gap: 2px; }
.switch-text b { font-weight: 600; font-size: 14px; }
.switch-text span { font-size: 13px; color: var(--a-muted); }

/* ---------------------------------------------------------------- sign-in */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(180, 22, 27, 0.06), transparent 70%),
    var(--a-bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: 14px;
  box-shadow: var(--a-shadow-lg);
  padding: 36px 32px 30px;
}
.login-logo { display: block; height: 40px; width: auto; margin: 0 auto 22px; }
.login-card h1 { font-size: 21px; text-align: center; }
.login-sub { text-align: center; color: var(--a-muted); font-size: 14px; margin-top: 4px !important; margin-bottom: 26px !important; }
.login-form { display: grid; gap: 16px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--a-muted);
  font-size: 12px; font-weight: 600; padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.pw-toggle:hover { color: var(--a-ink); background: var(--a-surface-2); }
.login-error {
  display: none; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: var(--a-radius-sm);
  background: var(--a-red-soft); color: #8f1418; font-size: 13px; font-weight: 500;
}
.login-error.is-on { display: flex; }
.login-foot { margin-top: 22px; text-align: center; font-size: 13px; color: var(--a-muted); }
.login-foot a { color: var(--a-ink-2); text-decoration: none; font-weight: 500; }
.login-foot a:hover { color: var(--a-accent); }
.login .btn-primary { min-height: 44px; font-size: 15px; }
@media (max-width: 480px) {
  .login { justify-content: flex-start; padding-top: 12vh; }
  .login-card { padding: 28px 22px 24px; box-shadow: var(--a-shadow); }
}

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: var(--a-sidebar) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--a-surface);
  border-right: 1px solid var(--a-border);
  padding: 18px 12px 14px;
  overflow-y: auto;
  z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 18px; text-decoration: none; min-width: 0; }
.sb-brand img { height: 22px; width: auto; max-width: 150px; object-fit: contain; object-position: left center; }
.sb-brand span { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--a-muted); border: 1px solid var(--a-border); border-radius: 5px; padding: 2px 6px; }
.sb-group { padding: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--a-muted); }
.sb-nav { display: grid; gap: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%; min-height: 38px; padding: 0 10px;
  border: 0; border-radius: var(--a-radius-sm);
  background: transparent; color: var(--a-ink-2);
  font-size: 14px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.nav-item svg { color: var(--a-muted); }
.nav-item:hover { background: var(--a-surface-2); color: var(--a-ink); }
.nav-item.active { background: var(--a-accent-soft); color: var(--a-accent); font-weight: 600; }
.nav-item.active svg { color: var(--a-accent); }
.nav-item:focus-visible { outline: none; box-shadow: var(--a-focus); }
.nav-dirty { display: none; margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--a-amber); }
.nav-item.is-dirty .nav-dirty { display: block; }
.nav-count { margin-left: auto; font-size: 12px; color: var(--a-muted); font-weight: 500; }
.sb-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--a-border); display: grid; gap: 2px; }
.sb-user { padding: 8px 10px 10px; font-size: 12px; color: var(--a-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 12px 32px;
  background: rgba(246, 244, 241, 0.88);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--a-border);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.menu-btn { display: none; }

.conn-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--a-surface); border: 1px solid var(--a-border); color: var(--a-muted);
}
.conn-pill i { width: 7px; height: 7px; border-radius: 50%; background: #b9b0a5; }
.conn-pill[data-state="up"] { color: var(--a-green); }
.conn-pill[data-state="up"] i { background: #2ea36b; }
.conn-pill[data-state="down"] { color: #8f1418; background: var(--a-red-soft); border-color: #f2caca; }
.conn-pill[data-state="down"] i { background: var(--a-accent); }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 20px 32px 0; padding: 12px 14px;
  border-radius: var(--a-radius); font-size: 14px; font-weight: 500;
  background: var(--a-red-soft); color: #8f1418; border: 1px solid #f2caca;
}

.content { width: 100%; max-width: 980px; padding: 28px 32px 120px; }
.section-head { margin-bottom: 22px; }
.section-head h2 { font-size: 24px; letter-spacing: -0.02em; }
.section-head p { margin-top: 6px !important; color: var(--a-muted); font-size: 14.5px; max-width: 680px; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: 12px;
  box-shadow: var(--a-shadow);
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px 0; }
.card-head h3 { font-size: 15.5px; }
.card-head p { margin-top: 3px !important; font-size: 13px; color: var(--a-muted); }
.card-body { padding: 18px 22px 22px; }
.card-body > .stack + .stack { margin-top: 16px; }
.card-sep { height: 1px; background: var(--a-border); margin: 18px 0; }

/* Sticky save bar shown at the bottom of every editable section. */
.savebar {
  position: sticky; bottom: 16px; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px; padding: 10px 12px 10px 18px;
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: 12px;
  box-shadow: var(--a-shadow-lg);
}
.savebar-state { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--a-muted); }
.savebar-state span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar-state i { width: 8px; height: 8px; border-radius: 50%; background: #2ea36b; flex-shrink: 0; }
.savebar.is-dirty .savebar-state { color: var(--a-amber); font-weight: 600; }
.savebar.is-dirty .savebar-state i { background: #e09a1a; }

/* ---------------------------------------------------------------- overview */
.hero-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 24px;
  background: var(--a-ink); color: #fff;
  border-radius: 14px; margin-bottom: 18px;
}
.hero-card h3 { color: #fff; font-size: 17px; }
.hero-card p { color: rgba(255,255,255,0.72); font-size: 14px; margin-top: 4px !important; max-width: 560px; }
.hero-card .btn-primary { background: #fff; color: var(--a-ink); border-color: #fff; }
.hero-card .btn-primary:hover { background: #f1ede7; border-color: #f1ede7; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  display: grid; gap: 6px; align-content: start;
  padding: 16px 18px; text-align: left;
  background: var(--a-surface); border: 1px solid var(--a-border); border-radius: 12px; box-shadow: var(--a-shadow);
  cursor: pointer; transition: border-color 120ms ease, box-shadow 120ms ease;
}
.stat:hover { border-color: var(--a-border-strong); box-shadow: 0 4px 14px rgba(31,27,23,0.08); }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--a-muted); }
.stat-value { font-size: 15px; font-weight: 650; color: var(--a-ink); }
.stat-sub { font-size: 12.5px; color: var(--a-muted); }
.list-links { display: grid; }
.list-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; border-top: 1px solid var(--a-border);
  background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
  text-align: left; cursor: pointer; width: 100%;
}
.list-link:first-child { border-top: 0; }
.list-link:hover { background: var(--a-surface-2); }
.list-link-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--a-surface-2); border: 1px solid var(--a-border); color: var(--a-ink-2); }
.list-link-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.list-link-text b { font-size: 14px; font-weight: 600; }
.list-link-text span { font-size: 13px; color: var(--a-muted); }
.list-link > svg:last-child { color: #b5ada3; }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #f0ece6; color: var(--a-ink-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill[data-s="published"], .pill[data-s="on"] { background: var(--a-green-soft); color: var(--a-green); }
.pill[data-s="changed"], .pill[data-s="warn"] { background: var(--a-amber-soft); color: var(--a-amber); }
.pill[data-s="hidden"], .pill[data-s="off"] { background: #efebe6; color: #6c645b; }
.pill[data-s="local"] { background: var(--a-red-soft); color: #8f1418; }
.pill[data-s="draft"] { background: #eaf0fb; color: #2d5bb5; }

/* ---------------------------------------------------------------- store hours */
.store-block + .store-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--a-border); }
.store-block h4 { font-size: 14px; margin-bottom: 12px; }
.hours-table { display: grid; gap: 8px; margin-top: 14px; }
.hours-head, .hours-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) 34px; gap: 8px; align-items: center; }
.hours-head { font-size: 12px; font-weight: 600; color: var(--a-muted); }

/* ---------------------------------------------------------------- tours + FAQ */
.tour-type + .tour-type { border-top: 1px solid var(--a-border); }
.faq-item { border: 1px solid var(--a-border); border-radius: var(--a-radius); padding: 14px; background: var(--a-surface-2); display: grid; gap: 10px; }
.faq-head { display: flex; align-items: center; gap: 6px; }
.faq-num { margin-right: auto; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--a-muted); }
.empty-box { padding: 22px; border: 1px dashed var(--a-border-strong); border-radius: var(--a-radius); text-align: center; color: var(--a-muted); font-size: 14px; }

/* ---------------------------------------------------------------- menu editor */
.menu-pages { display: grid; gap: 8px; }
.menu-page-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--a-ink-2); cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--a-accent); margin: 0; }
.menu-group { margin-top: 26px; }
.menu-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.menu-group-head h4 { font-size: 15px; }
.cat { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: 12px; box-shadow: var(--a-shadow); margin-bottom: 10px; overflow: hidden; }
.cat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.cat-ball { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--a-ink); flex-shrink: 0; }
.cat-head .input { font-weight: 600; border-color: transparent; background: transparent; }
.cat-head .input:hover { border-color: var(--a-border-strong); background: #fff; }
.cat-head .input:focus { background: #fff; }
.cat-meta { font-size: 12.5px; color: var(--a-muted); white-space: nowrap; }
.cat-toggle svg { transition: transform 150ms ease; }
.cat.is-open .cat-toggle svg { transform: rotate(180deg); }
.cat-body { display: none; padding: 4px 16px 18px; border-top: 1px solid var(--a-border); }
.cat.is-open > .cat-body { display: block; }
.cat-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 14px; }
.cat-toolbar select.input { width: auto; min-width: 200px; min-height: 32px; font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--a-ink); cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--a-accent); }
.sub-head { margin: 20px 0 8px; font-size: 13px; font-weight: 650; color: var(--a-ink); }
.sub-head .hint { font-weight: 400; }
.rows { display: grid; gap: 6px; }
.row { display: grid; gap: 6px; align-items: center; }
.row-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 34px; }
.row-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 34px; }
.row .input { min-height: 36px; font-size: 13.5px; padding-top: 6px; padding-bottom: 6px; }
.row-x { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--a-radius-sm); background: transparent; color: var(--a-muted); cursor: pointer; }
.row-x:hover { background: var(--a-accent-soft); color: var(--a-accent); }
.add-link { margin-top: 8px; border: 0; background: transparent; color: var(--a-accent); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0; }
.add-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- journal */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: #ece8e2; border-radius: 9px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--a-ink-2); cursor: pointer; white-space: nowrap; }
.seg button.is-on { background: #fff; color: var(--a-ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.seg button span { color: var(--a-muted); font-weight: 500; margin-left: 4px; }
.posts { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: 12px; box-shadow: var(--a-shadow); overflow: hidden; }
.post-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--a-border); }
.post-row:first-child { border-top: 0; }
.post-thumb { width: 64px; height: 48px; border-radius: 7px; object-fit: cover; background: var(--a-surface-2); border: 1px solid var(--a-border); flex-shrink: 0; }
.post-meta { flex: 1; min-width: 0; display: grid; gap: 4px; }
.post-meta a.post-title { color: var(--a-ink); font-weight: 600; font-size: 14.5px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-meta a.post-title:hover { color: var(--a-accent); }
.post-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--a-muted); }
.post-actions { display: flex; gap: 6px; flex-shrink: 0; }
.posts-empty { padding: 36px 20px; text-align: center; color: var(--a-muted); font-size: 14px; }

/* ---------------------------------------------------------------- toast (config.js showToast) */
.toast-notice {
  position: fixed; left: 50%; bottom: 88px; z-index: 300;
  transform: translate(-50%, 16px);
  display: flex; align-items: center; gap: 10px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 10px;
  background: var(--a-ink); color: #fff;
  font-family: var(--a-font); font-size: 14px; font-weight: 500; line-height: 1.4;
  box-shadow: var(--a-shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast-notice.show { opacity: 1; transform: translate(-50%, 0); }
.toast-notice .logo-mark { display: none; }

/* ---------------------------------------------------------------- dialog */
.dlg-back {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(23, 20, 17, 0.45);
  animation: adm-fade 120ms ease;
}
.dlg {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 14px; box-shadow: var(--a-shadow-lg);
  padding: 22px 22px 18px;
  animation: adm-pop 140ms ease;
}
.dlg h3 { font-size: 17px; }
.dlg p { margin-top: 8px !important; color: var(--a-ink-2); font-size: 14px; line-height: 1.5; white-space: pre-line; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes adm-fade { from { opacity: 0; } }
@keyframes adm-pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ---------------------------------------------------------------- mobile */
.scrim { display: none; }
@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform 200ms ease;
    box-shadow: var(--a-shadow-lg);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
  }
  .app.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(23,20,17,0.4); opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); min-height: 58px; gap: 10px; }
  .topbar-title h1 { font-size: 16.5px; }
  .content { padding: 20px 16px 120px; }
  .alert { margin: 14px 16px 0; }
}
@media (max-width: 640px) {
  body.adm { font-size: 15px; }
  .input, .adm select.input, .adm textarea.input { font-size: 16px; }   /* stops iOS zoom-on-focus */
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .section-head h2 { font-size: 21px; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 16px; }
  .list-link { padding: 14px 16px; }
  .hero-card { flex-direction: column; align-items: stretch; padding: 20px; }
  .conn-pill b { display: none; }
  .conn-pill { padding: 0 9px; }
  .topbar-actions .btn-edit-label { display: none; }
  .savebar {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0;
    border-radius: 0; border-width: 1px 0 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .savebar-state { font-size: 13px; }
  .savebar .btn { min-height: 40px; }
  .row-2, .row-item { grid-template-columns: minmax(0, 1fr) 34px; }
  .row-2 .input:nth-child(2), .row-item .input:nth-child(2) { grid-column: 1; }
  .row-2 .row-x, .row-item .row-x { grid-column: 2; grid-row: 1; }
  .row-2, .row-item { padding: 8px; border: 1px solid var(--a-border); border-radius: var(--a-radius-sm); background: var(--a-surface-2); }
  .menu-page-row { grid-template-columns: minmax(0, 1fr) auto; }
  .menu-page-row .btn { grid-column: 2; }
  .menu-page-row .check { grid-column: 1; grid-row: 2; }
  .cat-meta { display: none; }
  .cat-toolbar select.input { flex: 1 1 100%; min-width: 0; min-height: 40px; }
  .post-row { flex-wrap: wrap; padding: 14px; }
  .post-thumb { width: 56px; height: 44px; }
  .post-actions { width: 100%; padding-left: 70px; }
  .toolbar .seg { width: 100%; overflow-x: auto; }
  .toolbar .seg button { flex: 1; }
  .toolbar > .btn { width: 100%; }
  .toast-notice { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------------------------------------------------------------- nav sub-item */
.nav-item.nav-sub { padding-left: 39px; min-height: 34px; font-size: 13.5px; }
.nav-item.nav-sub svg { display: none; }
.nav-item.nav-sub::before { content: ""; position: absolute; left: 20px; top: 0; bottom: 50%; width: 9px; border-left: 1px solid var(--a-border-strong); border-bottom: 1px solid var(--a-border-strong); border-bottom-left-radius: 5px; }

/* ---------------------------------------------------------------- pages */
.pages-body { padding-top: 12px; padding-bottom: 12px; }
.page-list { display: grid; gap: 2px; min-height: 40px; border-radius: var(--a-radius-sm); }
.page-list.drop-into { box-shadow: inset 0 0 0 2px var(--a-accent); }
.page-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 4px; border-radius: var(--a-radius-sm); background: var(--a-surface); }
.page-row:hover { background: var(--a-surface-2); }
.page-row.is-dragging { opacity: 0.4; }
.page-row.drop-before { box-shadow: inset 0 2px 0 var(--a-accent); }
.page-row.drop-after { box-shadow: inset 0 -2px 0 var(--a-accent); }
.page-grip { display: grid; place-items: center; width: 22px; color: #b5ada3; cursor: grab; flex-shrink: 0; }
.page-meta { flex: 1; min-width: 0; }
.page-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14.5px; font-weight: 600; }
.page-label { font-size: 12px; font-weight: 500; color: var(--a-muted); }
.page-url { font-size: 12.5px; color: var(--a-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.page-actions .btn-icon:disabled { opacity: 0.3; }
.switch-sm { align-items: center; margin: 0 6px; }
.switch-sm .switch-track { width: 34px; height: 20px; margin: 0; }
.switch-sm .switch-track::after { width: 14px; height: 14px; }
.switch-sm input:checked + .switch-track::after { transform: translateX(14px); }
.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--a-border-strong); border-radius: var(--a-radius-sm); background: #fff; overflow: hidden; }
.input-prefix:focus-within { border-color: var(--a-accent); box-shadow: var(--a-focus); }
.input-prefix > span { display: flex; align-items: center; padding: 0 2px 0 12px; color: var(--a-muted); font-size: 14px; white-space: nowrap; background: var(--a-surface-2); border-right: 1px solid var(--a-border); padding-right: 10px; }
.input-prefix .input { border: 0; box-shadow: none !important; border-radius: 0; }
.input:disabled { background: var(--a-surface-2); color: var(--a-muted); }
.dlg.dlg-form { max-width: 480px; }
.dlg-error { margin-top: 12px !important; padding: 9px 12px; border-radius: var(--a-radius-sm); background: var(--a-red-soft); color: #8f1418 !important; font-size: 13px !important; font-weight: 500; }
@media (max-width: 640px) {
  .page-row { flex-wrap: wrap; padding: 10px 4px; }
  .page-grip { display: none; }
  .page-actions { width: 100%; justify-content: flex-end; }
  .input-prefix > span { font-size: 13px; padding-left: 8px; padding-right: 6px; }
}
