/* Tool DM Admin — framed-sheet redesign (taste v2 app run, seed 620179220)
 *
 * Shell: one tinted L-frame (frame = one low-chroma step of brand blue,
 * #eef3fb) holds the 228px sidebar + 48px top bar with NO rule between
 * them. The work sits on a white sheet inset 8px from the window's
 * right/bottom edges, 1px #eaeaea edge, 16px radius, NO shadow.
 * Grid arithmetic: 228px sidebar + sheet (margin 0 8px 8px 0, padding 24px);
 * overview grid is 1fr + 384px rail on a 24px gap.
 *
 * User taste (binding, overrides taste where they conflict):
 * light-blue clay / soft neumorphism, clean LIGHT theme. Brand blue
 * #2d7ff9, blue-dark #1f6ae0, blue-soft #eaf2ff, ground #f3f5f9,
 * ink #1c2434, card white, ONE radius 14px everywhere — the sheet's
 * 16px is the one deliberate exception (plus 999px pills and the
 * 16px settings panel dealt by the direction). One system font family
 * + one monospace face used ONLY for IDs/keys/table figures.
 * Soft clay shadows are allowed by user taste, but in framed-sheet the
 * depth comes from the tone step: shadows live ONLY on floating
 * menus/dialogs/toasts, never on resting cards or the sheet.
 * NO gradients, NO violet/indigo, NO glass, NO dark sidebar,
 * NO icon-topped cards, NO emoji, NO eyebrows, NO zebra striping,
 * NO fake data — honest empty/zero/dash states throughout.
 */
:root {
  --blue: #2d7ff9;        /* brand — data hue / logo / selected underline (3.8:1 on white, data only) */
  --blue-dark: #1f6ae0;   /* text links + primary buttons (4.9:1 white on blue-dark) */
  --blue-text: #1859c2;   /* darker step of brand blue, for small text on blue-soft (5.5:1) */
  --blue-hover: #1b5ecf;
  --blue-soft: #eaf2ff;
  --frame: #eef3fb;       /* the one tinted frame: one low-chroma step of brand blue */
  --canvas: #f3f5f9;
  --sheet: #ffffff;
  --ink: #1c2434;
  --ink-2: #4a5568;
  --muted: #5b6b80;       /* 5.0:1 on white — grey text stays readable */
  --line: #eaeaea;        /* sheet edge + card edges */
  --rule: #f0f1f2;        /* 1px rules inside the sheet */
  --panel: #fafafa;       /* settings panels */
  --card: #ffffff;
  --green: #15803d;
  --green-soft: #e6f6ec;
  --red: #b91c1c;
  --red-soft: #fdecec;
  --amber: #92400e;
  --amber-soft: #fdf3e3;
  --radius: 14px;
  --sheet-radius: 16px;
  --shadow-float: 0 12px 32px rgba(28, 36, 52, .16), 0 2px 8px rgba(28, 36, 52, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--frame);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible,
summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue-dark);
  outline-offset: 2px;
}

/* ---------- Boot / login / 403 ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.boot-card { text-align: center; }
.logo-mark {
  width: 56px; height: 56px; margin: 0 auto 16px;
  display: block;
  border-radius: var(--radius);
  /* Clay wins over the taste no-shadow rule on brand elements (user call).
     The mark is an <img> of logo.svg now — no background/font: the SVG tile
     carries its own clay styling, and a blue background here would show
     through the tile's transparent rounded corners. */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 14px rgba(45, 127, 249, .35), 0 1px 3px rgba(28, 36, 52, .12);
}
.boot-text { color: var(--ink-2); }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px 28px;
  animation: rise 360ms ease-out both;
}
.auth-card h1 { font-size: 20px; margin: 12px 0 4px; }
.auth-card .sub { color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }
.forbidden-card { max-width: 480px; text-align: center; }
.forbidden-card .code {
  display: inline-block; background: var(--red-soft); color: var(--red);
  font-weight: 700; border-radius: 999px; padding: 4px 14px; margin-bottom: 12px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 8px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.textarea { height: auto; min-height: 220px; padding: 10px 12px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; } /* taste-skill-ignore — Markdown is literal code */
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Switch row (blog editor AI-assisted flag): 28x16 toggle, right edge. */
.switch-row > label { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 28px; height: 16px; margin: 0; padding: 0; border: 0;
  border-radius: 999px; background: #cbd5e1; cursor: pointer;
  position: relative; transition: background-color 200ms ease-out;
}
.switch:checked { background: var(--blue); }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform 200ms ease-out;
}
.switch:checked::after { transform: translateX(12px); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 16px; border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1.43;
  background: var(--blue-dark); color: #fff;
  /* Clay wins over the taste no-shadow rule on the primary button (user call). */
  box-shadow: 0 6px 14px rgba(31, 106, 224, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: background-color 200ms ease-out, transform 200ms ease-out, box-shadow 200ms ease-out;
}
/* Shine sweep on hover — a translucent bar, no gradient. */
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -80px; width: 56px;
  background: rgba(255, 255, 255, .35);
  transform: skewX(-18deg);
  transition: left 500ms ease-out;
  pointer-events: none;
}
.btn:hover::after { left: 110%; }
.btn:hover { background: var(--blue-hover); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .20); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); box-shadow: none; }
.btn-ghost:hover { background: var(--frame); }
.btn-ghost::after { background: rgba(45, 127, 249, .12); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 6px 14px rgba(185, 28, 28, .28), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.btn-danger-outline { background: #fff; border-color: var(--red); color: var(--red); box-shadow: none; }
.btn-danger-outline:hover { background: var(--red-soft); }
.btn-danger-outline::after { background: rgba(185, 28, 28, .08); }

/* ---------- Shell: tinted L-frame + white sheet ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; background: var(--frame); }
.sidebar {
  background: transparent; border-right: 0;
  padding: 6px 12px 20px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; min-height: 48px; margin-bottom: 8px; }
.brand .logo-mark { width: 36px; height: 36px; margin: 0; font-size: 14px; }
.brand strong { font-size: 16px; }
.brand small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius); color: var(--ink-2);
  font-weight: 600; font-size: 14px;
  transition: background-color 200ms ease-out, color 200ms ease-out, transform 200ms ease-out;
}
.nav-link:hover { background: #e2eaf8; text-decoration: none; color: var(--ink); transform: translateX(2px); }
.nav-link.active { background: var(--blue-soft); color: var(--blue-text); }
.nav-link .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }
.nav-link.active .dot { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #dde5f0; font-size: 13px; color: var(--ink-2); }
.sidebar-foot .who { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
/* 48px top bar on the frame tint — no rule between it and the sidebar. */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 16px 0 8px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { display: none; font-size: 16px; }
.top-search {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 548px; max-width: 42vw; height: 32px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 13px;
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}
.top-search:hover { text-decoration: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45, 127, 249, .12); }
.top-search-icon { font-size: 15px; line-height: 1; }
.top-search-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-search kbd {
  margin-left: auto; flex: none;
  font-family: inherit; font-size: 11px; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
}
/* Account button: native <details> menu — no JS behaviour added. */
.account { position: relative; margin-left: auto; }
.account summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { border-color: var(--blue); }
.account-avatar {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 12px;
  border-radius: 50%;
}
.account-email { font-size: 13px; font-weight: 600; color: var(--ink); max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 260px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-float);
}
.account-who { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.account-role { color: var(--muted); font-size: 12px; margin: 2px 0 12px; }

/* The sheet: white, 1px #eaeaea edge, 16px radius, no shadow,
   inset 8px from the window's right and bottom edges. */
.main { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--sheet-radius); margin: 0 8px 8px 0; padding: 24px; min-width: 0; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head > div { min-width: 0; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }

/* ---------- Motion: entrance, live dot, comment → DM motif ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.main > * { animation: rise 320ms ease-out both; }
.main > *:nth-child(2) { animation-delay: 40ms; }
.main > *:nth-child(3) { animation-delay: 80ms; }
.main > *:nth-child(4) { animation-delay: 120ms; }

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex: none;
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, .35); } 50% { box-shadow: 0 0 0 5px rgba(21, 128, 61, 0); } }
.kpi-value .live-dot { margin-right: 7px; vertical-align: 2px; }

/* Dashboard flow strip: the product's own story, comment to auto-reply to DM.
   Every figure is one variable already shown elsewhere (see app.js):
   listening = automation_stats.active, delivered = automations_today,
   live = webhook_health.status. No invented numbers. */
.flow-strip {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto;
  align-items: stretch;
  background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 24px; overflow: hidden;
}
.flow-stage { padding: 16px 18px; min-width: 0; }
.flow-stage-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.flow-stage-value { font-size: 24px; font-weight: 500; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.flow-stage-note { font-size: 12px; color: var(--muted); }
.flow-strip .flow-arrow { align-self: center; color: var(--blue); font-size: 20px; padding: 0 2px; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
.flow-live {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 18px; border-left: 1px solid var(--rule);
  font-size: 13px; font-weight: 600; color: var(--ink);
}
@media (max-width: 640px) {
  .flow-strip { grid-template-columns: 1fr; }
  .flow-strip .flow-arrow { transform: rotate(90deg); animation: none; padding: 0; margin: -4px auto; }
  .flow-live { border-left: 0; border-top: 1px solid var(--rule); }
}

/* Automation flow cells (user detail): trigger → auto-reply → DM, from real data. */
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow-pill {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.flow-pill-soft { background: var(--blue-soft); border-color: transparent; color: var(--blue-text); }
.flow-pill-dm { background: var(--blue-dark); border-color: transparent; color: #fff; }
.flow .flow-arrow { color: var(--muted); font-size: 12px; }

/* Login motif: the comment → DM thread as a living illustration.
   Decorative only (aria-hidden). No numbers, no fake activity. */
.flow-motif { margin: 2px 0 20px; display: flex; flex-direction: column; gap: 4px; }
.flow-motif-bubble {
  border-radius: var(--radius); padding: 9px 12px; font-size: 13px; text-align: left;
  opacity: 0; animation: flowIn 500ms ease-out both;
}
.flow-motif-bubble .flow-tag { display: block; font-size: 11px; color: var(--muted); margin-bottom: 1px; }
.flow-motif-bubble:nth-child(1) { animation-delay: 150ms; background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.flow-motif-bubble:nth-child(3) { animation-delay: 600ms; background: var(--blue-soft); border: 1px solid transparent; align-self: flex-start; }
.flow-motif-bubble:nth-child(5) { animation-delay: 1050ms; background: var(--blue-dark); color: #fff; align-self: flex-end; box-shadow: 0 6px 14px rgba(31, 106, 224, .28); }
.flow-motif-bubble:nth-child(5) .flow-tag { color: rgba(255, 255, 255, .75); }
.flow-motif-arrow { align-self: center; color: var(--muted); font-size: 13px; line-height: 1; opacity: 0; animation: flowIn 500ms ease-out both; }
.flow-motif-arrow:nth-child(2) { animation-delay: 400ms; }
.flow-motif-arrow:nth-child(4) { animation-delay: 850ms; }
@keyframes flowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.flow-motif-caption { font-size: 12px; color: var(--muted); text-align: center; margin: 6px 0 0; }

/* ---------- Overview: KPI strip + 1fr/384px rail ---------- */
.kpi-strip {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 24px;
}
.kpi-cell { padding: 16px 18px; border-left: 1px solid var(--rule); min-width: 0; }
.kpi-cell:first-child { border-left: 0; }
.kpi-label { font-size: 14px; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 500; margin: 4px 0 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-note { font-size: 12px; color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: 24px; align-items: start; }
.rail-heading { font-size: 16px; margin: 0 0 8px; }
.list-heading { font-size: 16px; margin: 0 0 4px; }

/* ---------- Cards (flat at rest; hover glow only) ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  transition: box-shadow 200ms ease-out, transform 200ms ease-out;
}
.card:hover { box-shadow: 0 0 0 1px var(--blue-soft), 0 10px 28px rgba(45, 127, 249, .10); transform: translateY(-1px); }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card .card-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 14px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Tables: on the sheet ground, no card around them ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; padding-top: 0; padding-bottom: 8px; border-bottom: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; } /* taste-skill-ignore — mono is the one sanctioned job: IDs and keys */
/* Figures: monospace, tabular, right-aligned. */
.tbl th.num, .tbl td.num { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; } /* taste-skill-ignore — mono is the one sanctioned job: table figures */
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12px; }

/* One kebab, far right, per row — native <details>, no JS behaviour added. */
.row-kebab { text-align: right; width: 48px; }
.kebab { position: relative; display: inline-block; }
.kebab summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px;
  font-size: 16px; letter-spacing: 2px; color: var(--ink-2); line-height: 1;
}
.kebab summary::-webkit-details-marker { display: none; }
.kebab summary:hover { background: var(--frame); color: var(--ink); }
.kebab[open ] summary { background: var(--blue-soft); color: var(--blue-text); }
.kebab-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
  min-width: 180px; padding: 6px;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-float);
}
.kebab-menu .btn {
  justify-content: flex-start; width: 100%;
  background: transparent; border: 0; color: var(--ink);
  box-shadow: none; padding: 8px 10px; border-radius: 8px; min-height: 0;
}
.kebab-menu .btn:hover { background: var(--frame); }
.kebab-menu .btn::after { display: none; }
.kebab-menu .btn-danger-outline { color: var(--red); }
.kebab-menu .btn-danger-outline:hover { background: var(--red-soft); }

/* ---------- Badges / pills: one status mark per row ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue-text); }
.badge-grey { background: var(--canvas); color: var(--ink-2); }

/* ---------- Toolbar: 22–32px below title, search ~280x34 left ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 0 1 280px; min-width: 220px; position: relative; }
.toolbar .search .input { height: 34px; padding-left: 36px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .toolbar-right { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }

/* ---------- States: skeleton / empty / error ---------- */
.skeleton {
  border-radius: 8px;
  background: #eef1f6;
  animation: pulse 1.2s ease-in-out infinite alternate;
  color: transparent !important;
}
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }
.empty, .error-box { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty .big { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.error-box { background: var(--red-soft); border: 1px solid #f5c6c6; border-radius: var(--radius); color: #7f1d1d; }
.error-box .big { font-weight: 700; margin-bottom: 4px; }
.notice {
  background: var(--amber-soft); border: 1px solid #f3ddb0; color: #7c4a03;
  border-radius: var(--radius); padding: 12px 14px; font-size: 13px; margin-bottom: 16px;
}
.notice.info { background: var(--blue-soft); border-color: #c3d9fb; color: #1e40af; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toasts (floating — shadow allowed) ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 40px)); }
.toast {
  background: var(--ink); color: #fff; padding: 11px 14px;
  border-radius: var(--radius); font-size: 14px; box-shadow: var(--shadow-float);
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ---------- Modal (floating — shadow allowed) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(28, 36, 52, .45);
  display: grid; place-items: center; padding: 20px; z-index: 90;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 440px; box-shadow: var(--shadow-float);
}
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { color: var(--ink-2); font-size: 14px; margin: 0 0 18px; overflow-wrap: anywhere; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Detail / blog editor ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.crumb { display: flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 600; min-width: 0; max-width: 100%; }
.crumb a { color: var(--muted); font-weight: 600; flex: none; }
.crumb .crumb-sep { color: var(--muted); font-weight: 400; flex: none; }
.page-head .crumb h1 { font-size: 16px; margin: 0; min-width: 0; max-width: min(520px, 100%); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.slug-preview { font-size: 13px; color: var(--muted); }
.slug-preview code { color: var(--ink); }
.ai-note { font-size: 13px; color: var(--ink-2); background: var(--blue-soft); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; }
.health-ok { color: var(--green); font-weight: 700; }
.health-bad { color: var(--red); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }

/* ---------- Settings: centred ~1152px, label col ~450px + #fafafa panel ---------- */
.settings-wrap { max-width: 1152px; margin: 0 auto; }
.settings-row { display: grid; grid-template-columns: 450px minmax(0, 1fr); gap: 24px; padding: 32px 0; }
.settings-row + .settings-row { border-top: 1px solid var(--rule); }
.settings-label h2 { font-size: 16px; font-weight: 500; margin: 6px 0 8px; }
.settings-label p { font-size: 14px; color: var(--muted); margin: 0; }
.settings-panel { background: var(--panel); border-radius: 16px; padding: 16px; min-width: 0; }
.settings-panel .tbl tbody tr:hover { background: #f1f4f8; }
@media (max-width: 900px) {
  .settings-row { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .kpi-cell:nth-child(4) { border-left: 0; }
  .kpi-cell:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
@media (max-width: 900px) {
  .top-search { display: none; }
}
@media (max-width: 640px) {
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .kpi-cell { border-left: 0; }
  .kpi-cell:nth-child(even) { border-left: 1px solid var(--rule); }
  .kpi-cell:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .kpi-cell:last-child { grid-column: 1 / -1; }
  .toolbar .search { flex-basis: 100%; }
  .page-head h1 { font-size: 20px; }
  /* Tables keep their columns and scroll inside their wrap instead of
     crushing into unreadable slivers. */
  .table-wrap .tbl { min-width: 620px; }
}

/* ---------- Mobile: frame disappears, sheet becomes the screen ---------- */
.menu-btn { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 80;
    transform: translateX(-100%); transition: transform 200ms ease-out; height: 100dvh;
    background: var(--frame);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-float); }
  .topbar { padding: 0 12px; }
  .topbar-title { display: inline; }
  .account-email { display: none; }
  .menu-btn { display: inline-flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; font-weight: 700; }
  .menu-icon { display: inline-flex; flex-direction: column; gap: 3px; }
  .menu-icon i { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
  .main-col { padding: 0; }
  .main { margin: 0; border: 0; border-radius: 0; padding: 20px 16px 40px; }
  .scrim { position: fixed; inset: 0; background: rgba(28,36,52,.4); z-index: 70; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .skeleton, .spinner, .live-dot, .flow-strip .flow-arrow { animation: none; }
  .btn, .btn::after, .card, .nav-link, .sidebar, .switch, .switch::after, .top-search { transition: none; }
  .btn::after { display: none; }
  .main > *, .auth-card, .flow-motif-bubble, .flow-motif-arrow { animation: none; opacity: 1; }
}
