/* ============================================================================
   Actual Magic — shared design tokens + primitives
   Single source of truth for color / type / space / radius / shadow / motion.
   Our brand identity (purple hue 275, Bricolage Grotesque / Figtree) wearing
   Soro's pattern layer: soft radii, diffuse shadows, pill CTAs, gradient accents.

   Consumed by onboarding.html (and, incrementally, index.html). Variables only
   replicate what the app already used, so linking this is non-destructive;
   the `.am-*` primitives are namespaced to avoid colliding with legacy classes.
   ========================================================================== */

:root {
  /* ── Surfaces ────────────────────────────────────────────────────────── */
  --bg:             oklch(0.99  0.002 275);
  --surface:        oklch(0.975 0.004 275);
  --surface-2:      oklch(0.96  0.005 275);
  --surface-raised: oklch(0.995 0.003 275);
  --surface-sunken: oklch(0.955 0.005 275);

  /* ── Borders ─────────────────────────────────────────────────────────── */
  --border:         oklch(0.90 0.008 275);
  --border-subtle:  oklch(0.93 0.006 275);
  --border-strong:  oklch(0.85 0.010 275);

  /* ── Brand accent (our purple) ───────────────────────────────────────── */
  --accent:         oklch(0.52 0.20 275);
  --accent-hover:   oklch(0.58 0.18 275);  /* legacy hover (lighter)        */
  --accent-press:   oklch(0.46 0.20 275);  /* pressed/darker, Soro-style    */
  --accent-subtle:  oklch(0.95 0.02 275);
  --accent-tint:    oklch(0.975 0.014 275);
  --accent-2:       oklch(0.52 0.20 312);  /* magenta gradient partner      */
  --on-accent:      #ffffff;

  /* ── Semantic ────────────────────────────────────────────────────────── */
  --gem:            oklch(0.65 0.17 160);
  --gem-subtle:     oklch(0.95 0.03 160);
  --success:        oklch(0.64 0.16 155);
  --success-subtle: oklch(0.95 0.04 155);
  --danger:         oklch(0.58 0.20 25);
  --danger-subtle:  oklch(0.95 0.04 25);
  --warn:           oklch(0.75 0.15 80);
  --warn-subtle:    oklch(0.95 0.03 80);
  --info:           oklch(0.60 0.15 250);

  /* ── Text ────────────────────────────────────────────────────────────── */
  --text:           oklch(0.20 0.010 275);
  --text-secondary: oklch(0.40 0.012 275);
  --muted:          oklch(0.58 0.008 275);
  --text-faint:     oklch(0.70 0.006 275);

  /* ── Typography ──────────────────────────────────────────────────────── */
  --font-display: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-display: clamp(34px, 5vw, 52px);
  --fs-h1:      clamp(26px, 3.4vw, 34px);
  --fs-h2:      22px;
  --fs-h3:      18px;
  --fs-lead:    17px;
  --fs-body:    15px;
  --fs-sm:      13px;
  --fs-xs:      12px;

  --lh-tight: 1.15;
  --lh-snug:  1.35;
  --lh-body:  1.6;
  --tracking-tight: -0.02em;

  /* ── Space (4px base) ────────────────────────────────────────────────── */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  /* ── Radius ──────────────────────────────────────────────────────────── */
  --r-sm:   6px;
  --r-md:   8px;    /* default controls / inputs */
  --r-lg:   12px;
  --r-xl:   16px;   /* feature & marketing cards  */
  --r-2xl:  22px;   /* hero / media panels        */
  --r-full: 9999px; /* pills, badges, hero CTA    */

  /* ── Elevation (warm, low-alpha, diffuse) ────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(30, 27, 60, 0.05);
  --shadow-sm: 0 1px 3px rgba(30, 27, 60, 0.08), 0 1px 2px rgba(30, 27, 60, 0.04);
  --shadow-md: 0 4px 12px rgba(30, 27, 60, 0.08), 0 2px 4px rgba(30, 27, 60, 0.04);
  --shadow-lg: 0 12px 28px rgba(30, 27, 60, 0.12), 0 4px 8px rgba(30, 27, 60, 0.06);
  --shadow-xl: 0 24px 56px rgba(30, 27, 60, 0.18);
  --shadow-accent: 0 8px 24px oklch(0.52 0.2 275 / 0.30);

  /* ── Motion ──────────────────────────────────────────────────────────── */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.15s;
  --dur:      0.20s;
  --dur-slow: 0.40s;

  /* ── Signature gradient ──────────────────────────────────────────────── */
  --gradient-brand: linear-gradient(135deg, var(--accent), var(--accent-2));
  --gradient-brand-soft: linear-gradient(135deg, oklch(0.97 0.02 275), oklch(0.97 0.02 312));
}

/* ============================================================================
   Shared primitives (namespaced `.am-*`)
   ========================================================================== */

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.am-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-body);
  line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  border: 1px solid transparent; border-radius: var(--r-full);
  padding: 13px 22px; min-height: 46px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              opacity var(--dur) var(--ease);
}
.am-btn:disabled { opacity: 0.5; cursor: default; }
.am-btn--block { width: 100%; }

.am-btn--primary {
  background: var(--gradient-brand); color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}
@media (hover: hover) {
  .am-btn--primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 12px 30px oklch(0.52 0.2 275 / 0.38); }
}
.am-btn--primary:not(:disabled):active { transform: translateY(0); }

.am-btn--secondary {
  background: var(--surface-raised); color: var(--text);
  border-color: var(--border); box-shadow: var(--shadow-xs);
}
@media (hover: hover) {
  .am-btn--secondary:not(:disabled):hover { border-color: var(--border-strong); background: var(--surface); }
}

.am-btn--ghost { background: transparent; color: var(--text-secondary); border-radius: var(--r-md); }
@media (hover: hover) { .am-btn--ghost:hover { background: var(--surface-2); color: var(--text); } }

.am-btn--link {
  background: none; border: none; color: var(--muted);
  font-size: var(--fs-sm); padding: 6px 8px; min-height: 0; border-radius: var(--r-md);
}
@media (hover: hover) { .am-btn--link:hover { color: var(--accent); } }

/* ── Pills / chips ───────────────────────────────────────────────────────── */
.am-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  background: var(--accent-subtle); color: var(--accent);
}
.am-pill--gem    { background: var(--gem-subtle);     color: oklch(0.45 0.13 160); }
.am-pill--muted  { background: var(--surface-2);      color: var(--muted); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.am-card {
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
}

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.am-input {
  width: 100%; font-family: var(--font-body); font-size: var(--fs-body);
  color: var(--text); background: var(--surface-raised);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 16px; outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.am-input::placeholder { color: var(--text-faint); }
.am-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.52 0.2 275 / 0.15); }

/* ── Score gauge (legible-complexity primitive #1) ───────────────────────── */
/* Usage: <div class="am-gauge" style="--val:82"><span>82</span></div> */
.am-gauge {
  --val: 0; --size: 84px; --track: var(--surface-2); --fill: var(--accent);
  width: var(--size); height: var(--size); border-radius: var(--r-full);
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--fill) calc(var(--val) * 1%), var(--track) 0);
  transition: background var(--dur-slow) var(--ease);
}
.am-gauge::after {
  content: ""; position: absolute; inset: 9px; border-radius: var(--r-full);
  background: var(--surface-raised);
}
.am-gauge > span {
  position: relative; z-index: 1; font-family: var(--font-display);
  font-weight: 800; font-size: 22px; color: var(--text);
}
.am-gauge--good { --fill: var(--success); }
.am-gauge--warn { --fill: var(--warn); }

/* ── Checklist row (legible-complexity primitive #2) ─────────────────────── */
.am-check {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 12px 4px; border-bottom: 1px solid var(--border-subtle);
}
.am-check:last-child { border-bottom: 0; }
.am-check__dot {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: var(--r-full);
  border: 2px solid var(--border); display: grid; place-items: center;
  color: var(--on-accent); transition: all var(--dur) var(--ease);
}
.am-check.is-done .am-check__dot { background: var(--gem); border-color: var(--gem); }
.am-check__label { flex: 1; font-size: var(--fs-body); color: var(--text); }
.am-check.is-done .am-check__label { color: var(--muted); }
.am-check__meta { font-size: var(--fs-sm); color: var(--muted); font-family: var(--font-mono); }

/* ── Metric card (Soro-style: label · big number · delta · sub · sparkline) ── */
.am-metric { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.am-metric__label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.am-metric__value { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1.1; margin-top: 4px; }
.am-metric__delta { font-size: var(--fs-sm); font-weight: 600; }
.am-metric__delta.up { color: var(--success); }
.am-metric__delta.down { color: var(--danger); }
.am-metric__delta.flat { color: var(--muted); }
.am-metric__sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.am-metric__spark { margin-top: 10px; height: 38px; }
.am-metric__spark svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* ── Callout (friendly takeaway banner) ──────────────────────────────────── */
.am-callout { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border-radius: var(--r-xl); background: var(--success-subtle); border: 1px solid oklch(0.64 0.16 155 / 0.25); }
.am-callout__icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: var(--r-full); background: var(--surface-raised); display: grid; place-items: center; box-shadow: var(--shadow-xs); }
.am-callout__title { font-weight: 700; font-size: var(--fs-body); }
.am-callout__body { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-snug); margin-top: 2px; }
.am-callout--neutral { background: var(--accent-tint); border-color: oklch(0.52 0.2 275 / 0.18); }

/* ── Locked "connect to unlock" treatment ───────────────────────────────── */
/* Wrap the sample/real content in .am-locked__content and overlay a CTA. */
.am-locked { position: relative; border-radius: var(--r-md); overflow: hidden; }
.am-locked__content { filter: blur(5px); pointer-events: none; user-select: none; opacity: 0.75; }
.am-locked__overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 16px; border-radius: inherit;
  background: linear-gradient(to bottom, oklch(0.99 0.002 275 / 0.35), oklch(0.99 0.002 275 / 0.9));
}
.am-locked__overlay .am-lock {
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: var(--accent-subtle); color: var(--accent);
  display: grid; place-items: center; margin: 0 auto 10px; font-size: 18px;
}
.am-locked__overlay h4 { font-family: var(--font-display); font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.am-locked__overlay p { font-size: var(--fs-sm); color: var(--muted); margin: 0 auto 12px; max-width: 280px; line-height: var(--lh-snug); }

/* ── Mascot helper ───────────────────────────────────────────────────────── */
.am-mascot { display: block; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; }

/* ============================================================================
   Article reader (full-page) — Soro two-column + MagicPost sidebar
   ========================================================================== */

/* ── Header / breadcrumb ─────────────────────────────────────────────────── */
.reader-top { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.reader-back {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: none; border: none; padding: 6px 10px 6px 2px; border-radius: var(--r-md);
  color: var(--text-secondary); font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 600;
}
@media (hover: hover) { .reader-back:hover { color: var(--accent); } }
.reader-crumb { font-size: var(--fs-sm); color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Two-column grid ─────────────────────────────────────────────────────── */
.reader-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--space-6); align-items: start; }
@media (max-width: 980px) { .reader-grid { grid-template-columns: 1fr; } }
.reader-aside { display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: var(--space-4); }
@media (max-width: 980px) { .reader-aside { position: static; } }

/* ── Main column card ────────────────────────────────────────────────────── */
.reader-main { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); padding: var(--space-6) var(--space-8); }
.reader-title-input {
  width: 100%; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h1);
  line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md);
  padding: 6px 8px; margin: 0 -8px var(--space-4); outline: none; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.reader-title-input:hover { border-color: var(--border-subtle); }
.reader-title-input:focus { border-color: var(--accent); background: var(--surface-raised); box-shadow: 0 0 0 3px oklch(0.52 0.2 275 / 0.12); }

/* ── Rendered article body (reading typography) ──────────────────────────── */
.reader-article { font-family: var(--font-body); font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--text-secondary); }
.reader-article h1, .reader-article h2, .reader-article h3 { font-family: var(--font-display); color: var(--text); letter-spacing: var(--tracking-tight); line-height: var(--lh-snug); }
.reader-article h1 { font-size: 30px; font-weight: 800; margin: var(--space-8) 0 var(--space-4); }
.reader-article h2 { font-size: 25px; font-weight: 700; margin: var(--space-8) 0 var(--space-3); }
.reader-article h3 { font-size: 19px; font-weight: 700; margin: var(--space-6) 0 var(--space-2); }
.reader-article h2:first-child, .reader-article h1:first-child { margin-top: 0; }
.reader-article p { margin: 0 0 var(--space-4); }
.reader-article ul, .reader-article ol { margin: 0 0 var(--space-4) var(--space-5); }
.reader-article li { margin-bottom: var(--space-2); }
.reader-article a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.reader-article figure { margin: var(--space-6) 0; }
.reader-article figure img { width: 100%; border-radius: var(--r-lg); display: block; box-shadow: var(--shadow-sm); }
.reader-article figcaption { font-size: var(--fs-sm); color: var(--muted); margin-top: 8px; text-align: center; }
.reader-article > img, .reader-article p > img { width: 100%; border-radius: var(--r-lg); }
.reader-editor { width: 100%; min-height: 520px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.7; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-4); outline: none; resize: vertical; }
.reader-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.52 0.2 275 / 0.12); }

/* ── Segmented Preview/Edit toggle ───────────────────────────────────────── */
.am-segment { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r-md); margin-bottom: var(--space-5); }
.am-segment__btn { appearance: none; border: none; cursor: pointer; background: transparent; color: var(--muted);
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-sm); padding: 7px 18px; border-radius: var(--r-sm);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.am-segment__btn.is-active { background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-xs); }

/* ── Sidebar panels ──────────────────────────────────────────────────────── */
.reader-panel { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); padding: var(--space-5); }
.reader-panel__title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-4); }
.reader-gaugewrap { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.reader-gaugewrap .am-gauge { --size: 76px; }
.reader-gauge-caption { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-snug); }
.reader-gauge-caption strong { color: var(--text); font-weight: 700; display: block; font-size: var(--fs-body); }
.reader-actions { display: flex; flex-direction: column; gap: var(--space-2); }
.reader-actions .am-btn { width: 100%; min-height: 42px; padding: 10px 16px; font-size: var(--fs-sm); }
.reader-actions__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.reader-actions__div { height: 1px; background: var(--border-subtle); margin: var(--space-2) 0; }
/* Schedule group: input + button stacked tightly */
.reader-sched { display: flex; flex-direction: column; gap: var(--space-2); }
.reader-sched__input { padding: 9px 12px; }
.reader-sched__confirm { font-size: var(--fs-xs); color: var(--success); opacity: 0; transition: opacity var(--dur) var(--ease); }
/* Utility actions — quiet, evenly-tiled buttons (not floating text) */
.reader-actions__util { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.am-ubtn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 10px; border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  background: var(--surface-raised); color: var(--text-secondary);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.am-ubtn svg { flex: 0 0 auto; opacity: 0.6; }
@media (hover: hover) { .am-ubtn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); } }
.am-ubtn--wide { grid-column: 1 / -1; }
.am-ubtn--danger { grid-column: 1 / -1; color: var(--danger); border-color: transparent; background: transparent; }
@media (hover: hover) { .am-ubtn--danger:hover { background: var(--danger-subtle); border-color: oklch(0.58 0.2 25 / 0.25); color: var(--danger); } }
.reader-field { margin-bottom: var(--space-4); }
.reader-field:last-child { margin-bottom: 0; }
.reader-field label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.reader-field textarea.am-input { resize: vertical; min-height: 84px; line-height: var(--lh-snug); }
.reader-charcount { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }
.reader-charcount.over { color: var(--danger); }
.reader-charcount.good { color: var(--success); }
.reader-featimg { width: 100%; border-radius: var(--r-lg); margin-top: 6px; display: block; box-shadow: var(--shadow-xs); }
.reader-meta-list { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: var(--fs-sm); }
.reader-meta-list dt { color: var(--muted); }
.reader-meta-list dd { margin: 0; color: var(--text); font-family: var(--font-mono); text-align: right; }
.reader-panel details > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent); font-weight: 600; list-style: none; }
.reader-panel details > summary::-webkit-details-marker { display: none; }
.reader-panel pre { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: var(--space-3); font-size: var(--fs-xs); overflow: auto; max-height: 260px; }
.reader-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* ── Background build chip (promoted from #bg-toast) ──────────────────────── */
.am-chip {
  position: fixed; right: 20px; bottom: 20px; z-index: 1200; max-width: 340px;
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-full);
  box-shadow: var(--shadow-lg); padding: 10px 16px 10px 12px;
  font-family: var(--font-body); animation: am-chip-in var(--dur) var(--ease-out);
}
@keyframes am-chip-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.am-chip__spin { flex: 0 0 auto; width: 18px; height: 18px; border-radius: var(--r-full);
  border: 2px solid var(--accent-subtle); border-top-color: var(--accent); animation: am-spin 0.8s linear infinite; }
@keyframes am-spin { to { transform: rotate(360deg); } }
.am-chip__body { min-width: 0; }
.am-chip__title { font-size: var(--fs-sm); font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-chip__stage { font-size: var(--fs-xs); color: var(--muted); }
.am-chip__action { background: none; border: none; cursor: pointer; color: var(--accent); font-weight: 700; font-size: var(--fs-sm); padding: 4px 6px; border-radius: var(--r-sm); white-space: nowrap; }
.am-chip--done { border-color: oklch(0.64 0.16 155 / 0.4); }
.am-chip--done .am-chip__spin { border-color: var(--success-subtle); border-top-color: var(--success); animation: none; }
.am-chip--error { border-color: oklch(0.58 0.20 25 / 0.4); }
.am-chip--error .am-chip__spin { border: none; }

/* ── Skeleton shimmer ────────────────────────────────────────────────────── */
.am-skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-md); }
.am-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, oklch(0.99 0.002 275 / 0.6), transparent); animation: am-shimmer 1.4s infinite; }
@keyframes am-shimmer { 100% { transform: translateX(100%); } }
.am-skel--line { height: 14px; margin-bottom: 12px; }
.am-skel--title { height: 32px; width: 70%; margin-bottom: 20px; }
.am-skel--img { height: 240px; margin: 20px 0; border-radius: var(--r-lg); }
.reader-skel-stage { display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--space-5); font-size: var(--fs-sm); font-weight: 600; color: var(--accent); }

/* ── Status filter tabs (content list) ───────────────────────────────────── */
.am-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-5); }
.am-tab { appearance: none; border: none; background: none; cursor: pointer; position: relative;
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-sm); color: var(--muted);
  padding: 10px 14px; border-radius: var(--r-md) var(--r-md) 0 0; transition: color var(--dur) var(--ease); }
@media (hover: hover) { .am-tab:hover { color: var(--text); } }
.am-tab.is-active { color: var(--accent); }
.am-tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.am-tab__count { display: inline-block; margin-left: 6px; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2); border-radius: var(--r-full); padding: 1px 7px; }
.am-tab.is-active .am-tab__count { background: var(--accent-subtle); color: var(--accent); }

/* ── Article list rows ───────────────────────────────────────────────────── */
.am-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); background: var(--surface-raised); cursor: pointer; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); margin-bottom: var(--space-3); }
@media (hover: hover) { .am-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); } }
.am-row__thumb { flex: 0 0 auto; width: 56px; height: 56px; border-radius: var(--r-md); object-fit: cover; background: var(--surface-2); }
.am-row__thumb--ph { display: grid; place-items: center; color: var(--text-faint); font-size: 20px; }
.am-row__main { flex: 1; min-width: 0; }
.am-row__title { font-weight: 600; font-size: var(--fs-body); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-row__meta { display: flex; align-items: center; gap: var(--space-3); margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); flex-wrap: wrap; }
.am-row__metrics { flex: 0 0 auto; display: flex; gap: var(--space-5); text-align: right; }
@media (max-width: 640px) { .am-row__metrics { display: none; } }
.am-row__metric .n { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-body); color: var(--text); display: block; }
.am-row__metric .l { font-size: var(--fs-xs); color: var(--muted); }

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  /* B-017: loading spinners are STATUS indicators, not decoration — the
     blanket kill above froze them into static circles for every user with
     OS-level Reduce Motion on, making "loading" look like "broken". WCAG
     treats essential motion as exempt; keep spinners turning, just slower. */
  .spinner { animation-duration: 1.2s !important; }
}

/* ── Content Calendar: month grid (MagicPost-style) ─────────────────────── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.cal-head__title { display: flex; align-items: center; gap: 12px; }
.cal-head__badge { display: inline-flex; flex-direction: column; align-items: center; padding: 4px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 9px; letter-spacing: 0.06em; color: var(--muted); background: var(--surface); }
.cal-head__badge b { font-size: 16px; color: var(--text); font-family: var(--font-display); line-height: 1.1; }
.cal-head__month { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.cal-head__nav { display: flex; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 0 0 12px 12px; overflow: hidden; }
.cal-grid--dow { border-radius: 12px 12px 0 0; border-bottom: none; }
.cal-dow { background: var(--surface); padding: 8px 6px; font-weight: 700; font-size: 12px; text-align: center; }
.cal-cell { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell--out { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 6px, var(--surface-2) 6px, var(--surface-2) 7px); }
.cal-cell--out .cal-cell__num { color: var(--muted); }
.cal-cell__num { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; }
.cal-cell__num.is-today { background: var(--accent); color: #fff; }
.cal-card { border-radius: 8px; padding: 4px 6px; cursor: pointer; border: 1px solid transparent; font-size: 11px; transition: border-color 0.15s; }
.cal-card--sched { background: oklch(0.96 0.05 80); border-color: oklch(0.86 0.09 80); }
.cal-card--sched:hover { border-color: oklch(0.7 0.12 80); }
.cal-card--pub { background: oklch(0.96 0.04 160); border-color: oklch(0.87 0.07 160); }
.cal-card--pub:hover { border-color: oklch(0.65 0.1 160); }
.cal-card__top { display: flex; gap: 5px; align-items: center; }
.cal-card__top img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex: none; }
.cal-card__title { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-card__chip { margin-top: 3px; font-size: 10px; font-family: 'Fira Code', monospace; color: var(--muted); }
.cal-more { background: none; border: none; font-size: 10px; color: var(--accent); cursor: pointer; text-align: left; padding: 0 2px; font-weight: 600; }
@media (max-width: 768px) { .cal-cell { min-height: 76px; } .cal-dow { font-size: 10px; padding: 6px 2px; } }

/* ── Drawer: right slide-over panel (calendar post details) ─────────────── */
.am-drawer-scrim { position: fixed; inset: 0; background: oklch(0.25 0.03 275 / 0.35); z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.am-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.am-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 92vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: -12px 0 40px oklch(0.25 0.05 275 / 0.12); z-index: 91; transform: translateX(102%); transition: transform 0.25s ease; display: flex; flex-direction: column; }
.am-drawer.is-open { transform: translateX(0); }
.am-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); flex: none; }
.am-drawer__body { padding: 20px; overflow-y: auto; flex: 1; }
@media (prefers-reduced-motion: reduce) { .am-drawer, .am-drawer-scrim { transition: none; } }

/* ── Content page: KPI grid (cards use the shared .am-metric style) ─────── */
.am-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.am-acard { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 12px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.am-acard:hover { border-color: var(--accent); box-shadow: 0 4px 18px oklch(0.52 0.2 275 / 0.08); }
.am-acard__thumb { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; flex: none; }
.am-acard__thumb--ph { display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); font-size: 22px; }
.am-acard__main { flex: 1; min-width: 0; }
.am-acard__title { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.am-acard__desc { font-size: 13px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; }
.am-acard__meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
@media (max-width: 640px) { .am-acard__thumb { width: 64px; height: 64px; } .am-acard .am-row__metrics { display: none; } }
