/* Admin dashboard shell — the one place the client signs in and picks a tool.
   It borrows the client's own colours and fonts from /css/theme.css when that's present
   (so it matches their site), and falls back to neutral defaults when it isn't. Each tool
   (site editor, quotes…) brings its own tools/<id>.css on top of this. */
:root {
  --a-accent: var(--accent, #1d4ed8);
  --a-accent-2: var(--accent-2, #7c3aed);
  --a-accent-ink: var(--accent-ink, #ffffff);
  --a-bg: var(--bg, #f6f7f9);
  --a-card: var(--surface, #ffffff);
  --a-ink: var(--text, #14181f);
  --a-soft: var(--text-soft, #4b5563);
  --a-line: var(--border, #dde1e7);
  --a-radius: var(--radius, 12px);
  --a-danger: #b42318;
  --a-ok: #067647;
  --a-grad: linear-gradient(135deg, var(--a-accent), var(--a-accent-2));
  --a-shadow: 0 1px 2px rgba(15, 22, 32, 0.04), 0 8px 24px -12px rgba(15, 22, 32, 0.18);
  --a-shadow-lift: 0 2px 6px rgba(15, 22, 32, 0.06), 0 18px 40px -16px rgba(15, 22, 32, 0.28);
  color-scheme: light;
}
/* No client theme loaded? Give the shell its own dark mode. (With a theme, its vars win.) */
@media (prefers-color-scheme: dark) {
  :root {
    --a-accent: var(--accent, #7aa2ff);
    --a-accent-2: var(--accent-2, #c08cff);
    --a-accent-ink: var(--accent-ink, #0f1216);
    --a-bg: var(--bg, #0f1216);
    --a-card: var(--surface, #171b21);
    --a-ink: var(--text, #eef1f6);
    --a-soft: var(--text-soft, #aab2c2);
    --a-line: var(--border, #2a313b);
    --a-danger: #ff8a7a;
    --a-ok: #6ee7a8;
    --a-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    --a-shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.4), 0 20px 46px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--a-bg); color: var(--a-ink);
  font: 16px/1.5 var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  -webkit-font-smoothing: antialiased;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- top bar + brand lockup --------------------------------------------- */
.bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left, 0px)) 12px max(16px, env(safe-area-inset-right, 0px));
  background: var(--a-card); border-bottom: 1px solid var(--a-line);
  position: sticky; top: 0; z-index: 10;
}
.bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--a-grad); opacity: 0.9; }
.brand { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 4px; margin: -4px; cursor: pointer; color: inherit; text-align: left; border-radius: 10px; }
.brand:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; }
.brand-mark { position: relative; flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--a-grad); box-shadow: var(--a-shadow); overflow: hidden; }
.brand-mono { font-family: var(--font-head, inherit); font-weight: 800; font-size: 1rem; letter-spacing: 0.02em; color: #fff; }
.brand-mark #brand-logo { display: none; width: 100%; height: 100%; object-fit: contain; }
/* Site ships its own logo? Show it, drop the gradient tile + monogram. */
.brand-mark.has-logo { background: none; box-shadow: none; border-radius: 8px; }
.brand-mark.has-logo #brand-logo { display: block; }
.brand-mark.has-logo .brand-mono { display: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--font-head, inherit); font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--a-soft); }
.bar-actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; font-size: 0.95rem; }
a { color: var(--a-accent); }

main { max-width: 900px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 48px; }

/* ---- cards + forms (tools rely on these) -------------------------------- */
.card { background: var(--a-card); border: 1px solid var(--a-line); border-radius: var(--a-radius); padding: 20px; box-shadow: var(--a-shadow); }
.narrow { max-width: 440px; margin: 40px auto; }
.narrow::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 0 16px; border-radius: 12px; background: var(--a-grad); box-shadow: var(--a-shadow); }
h2 { margin: 0 0 8px; font-size: 1.3rem; font-family: var(--font-head, inherit); letter-spacing: -0.01em; }
h3 { margin: 0 0 12px; font-size: 1.05rem; font-family: var(--font-head, inherit); }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
.optional { font-weight: 400; color: var(--a-soft); }
input[type="text"], input[type="password"], input[type="url"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: inherit; background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 8px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 1px; border-color: var(--a-accent); }
textarea { min-height: 120px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.btn { min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 1px solid transparent; background: var(--a-grad); color: #fff; font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--a-shadow); }
.btn:hover { filter: brightness(1.04); }
.btn.ghost { background: transparent; color: var(--a-ink); border-color: var(--a-line); box-shadow: none; }
.btn.danger { color: var(--a-danger); border-color: var(--a-danger); background: transparent; box-shadow: none; }
.btn[disabled] { opacity: 0.6; cursor: wait; filter: none; }
.link { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--a-accent); font: inherit; text-decoration: underline; cursor: pointer; }
.link[disabled] { opacity: 0.55; cursor: default; }
.hint { color: var(--a-soft); font-size: 0.92rem; margin: 6px 0 0; }
.error { color: var(--a-danger); font-weight: 600; margin: 12px 0 0; }
.status { min-height: 1.5em; margin: 0 0 12px; font-weight: 600; color: var(--a-ok); }
.status.is-error { color: var(--a-danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---- dashboard: one tile per tool --------------------------------------- */
.dash-intro { color: var(--a-soft); margin: 0 0 20px; font-size: 1.05rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.tile {
  display: flex; gap: 16px; align-items: center; text-align: left; width: 100%; padding: 20px;
  background: var(--a-card); border: 1px solid var(--a-line); border-radius: var(--a-radius); color: inherit; font: inherit; cursor: pointer;
  box-shadow: var(--a-shadow); transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.tile:hover { border-color: color-mix(in srgb, var(--a-accent) 55%, var(--a-line)); transform: translateY(-2px); box-shadow: var(--a-shadow-lift); }
.tile:active { transform: translateY(0); }
.tile:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; }
.tile .ic { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: var(--a-accent); background: color-mix(in srgb, var(--a-accent) 12%, transparent); }
.tile .ic svg { width: 24px; height: 24px; }
.tile > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.tile .t-name { display: block; font-weight: 700; font-family: var(--font-head, inherit); }
.tile .t-desc { display: block; color: var(--a-soft); font-size: 0.92rem; margin-top: 3px; }

/* Where a tool mounts. */
.tool-back { margin: 0 0 16px; }

@media (max-width: 480px) {
  .brand-sub { display: none; }
  .bar { flex-wrap: wrap; row-gap: 2px; }
  .bar-actions { gap: 0 14px; font-size: 0.9rem; flex-wrap: wrap; min-width: 0; }
  .brand { min-width: 0; max-width: 100%; }
}

/* Share sheet (window.Admin.share): a website page's link to the site's own social networks. */
.share-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 18, .55); display: grid; place-items: end center; padding: 0; }
@media (min-width: 640px) { .share-overlay { place-items: center; padding: 24px; } }
.share-box { background: var(--a-card); color: var(--a-ink); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; border-radius: var(--a-radius) var(--a-radius) 0 0; box-shadow: var(--a-shadow-lift); padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); }
@media (min-width: 640px) { .share-box { border-radius: var(--a-radius); } }
.share-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.share-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.share-head > div { flex: 1; min-width: 0; }
.share-head h2 { margin: 0; font-size: 1.15rem; }
.share-sub { margin: 2px 0 0; color: var(--a-soft); font-size: .9rem; overflow-wrap: anywhere; }
.share-close { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--a-ink); font-size: 1.6rem; line-height: 1; cursor: pointer; border-radius: 50%; }
.share-close:hover { background: var(--a-bg); }
.share-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.share-btn { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-bg); color: var(--a-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.share-btn:hover { border-color: var(--a-accent); }
.share-btn:focus-visible, .share-close:focus-visible { outline: 3px solid var(--a-accent); outline-offset: 2px; }
.share-note { margin: 12px 0 0; color: var(--a-soft); font-size: .9rem; min-height: 1.2em; }
.share-note:empty { margin: 0; min-height: 0; }
.share-link { width: 100%; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-bg); color: var(--a-soft); font: inherit; font-size: .88rem; box-sizing: border-box; }

/* Help (help/<tool>.json): a panel beside the screen on a computer, full screen on a phone
   (where it folds into a small "Guide: …" button while you follow the steps). */
.help-panel {
  position: fixed; z-index: 50; inset: 0; display: flex; flex-direction: column;
  background: var(--a-card); color: var(--a-ink);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.help-panel[hidden] { display: none; }
@media (min-width: 900px) {
  .help-panel { left: auto; width: 380px; border-left: 1px solid var(--a-line); box-shadow: var(--a-shadow-lift); }
  body.help-on { padding-right: 380px; }
  .help-min { display: none; }
}
.help-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--a-line); }
.help-head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.help-x { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--a-ink); font-size: 1.6rem; line-height: 1; cursor: pointer; border-radius: 50%; }
.help-x:hover { background: var(--a-bg); }
.help-x:focus-visible, .help-item:focus-visible, .help-pill:focus-visible { outline: 3px solid var(--a-accent); outline-offset: 2px; }
.help-body { flex: 1; overflow-y: auto; padding: 16px 20px 28px; overscroll-behavior: contain; }
.help-group { margin-top: 18px; }
.help-group h3 { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--a-soft); margin: 0 0 8px; }
.help-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.help-item { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 44px; padding: 10px 12px; text-align: left; font: inherit; color: inherit; background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 10px; cursor: pointer; }
.help-item:hover { border-color: var(--a-accent); }
.help-item-t { font-weight: 600; }
.help-item-s { color: var(--a-soft); font-size: 0.86rem; }
.help-none { margin-top: 16px; }
.help-back { margin: -8px 0 6px; }
.help-eyebrow { margin: 0; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--a-accent); font-weight: 700; }
#help-guide h3 { font-size: 1.2rem; margin: 4px 0 8px; }
#help-guide h3:focus { outline: none; }
.help-summary { color: var(--a-soft); margin: 0 0 12px; }
.help-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; }
.help-steps li { padding-left: 4px; }
.help-steps li::marker { color: var(--a-accent); font-weight: 700; }
.help-tip { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid var(--a-accent); background: var(--a-bg); border-radius: 0 8px 8px 0; font-size: 0.94rem; }
.help-go { margin-top: 16px; }
.help-stuck { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--a-line); color: var(--a-soft); font-size: 0.92rem; }
.help-stuck h3 { font-size: 0.95rem; color: var(--a-ink); margin: 0 0 4px; }
.help-stuck p { margin: 0 0 6px; }
.help-contact { color: var(--a-ink); font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.help-pill {
  position: fixed; z-index: 40; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 32px); min-height: 48px; padding: 10px 18px; border: 0; border-radius: 999px;
  background: var(--a-grad); color: #fff; font: inherit; font-weight: 600; box-shadow: var(--a-shadow-lift); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.help-pill[hidden] { display: none; }
body.help-pill-on main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
/* The top of the picture, where the ringed button is; tap for all of it. */
.help-shot { margin: 4px 0 16px; border: 1px solid var(--a-line); border-radius: 10px; overflow: hidden; background: var(--a-bg); }
.help-shot button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.help-shot img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover; object-position: top; }
.help-shot.is-full img { max-height: none; }
.help-shot.is-full button { cursor: zoom-out; }
.help-shot button:focus-visible { outline: 3px solid var(--a-accent); outline-offset: -3px; }
