/* Brandrail dashboard. No build step, no external assets. Light theme only. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Warm neutrals: white canvas, a slightly dimmer sidebar, hairline borders. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --surface-3: #efefec;
  --side-bg: #f8f8f6;
  --border: #e8e8e4;
  --border-strong: #d5d5cf;
  --ink: #1d1d1b;
  --ink-2: #44443f;
  --muted: #6e6e68;
  --faint: #9b9b94;

  /* One accent, used for links, focus and the primary action. */
  --accent: #1c5fd4;
  --accent-hover: #164eb2;
  --accent-ink: #ffffff;
  --accent-soft: #edf3fd;
  --accent-text: #1a55be;

  --block: #c9302c;
  --block-soft: #fdf0ef;
  --block-text: #a62521;
  --block-mark: rgba(201, 48, 44, .14);
  --warn: #c27803;
  --warn-soft: #fdf6e7;
  --warn-text: #8a5200;
  --warn-mark: rgba(232, 166, 30, .26);
  --pass: #1a7f37;
  --pass-soft: #eef7f0;
  --pass-text: #1a6b32;
  --approve: #1f883d;
  --approve-hover: #1a7535;
  --info: var(--accent-text);
  --info-soft: var(--accent-soft);

  --bar: #8fa9db;
  --track: #efefec;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-lg: 0 10px 30px rgba(20, 20, 18, .10), 0 1px 3px rgba(20, 20, 18, .06);
  --ring: 0 0 0 3px rgba(28, 95, 212, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; }
h2 { font-size: 14px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
code, .mono, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.tight { gap: 4px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.section-title { font-size: 15px; font-weight: 600; }

/* ---------------------------------------------------------------- layout */

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px;
}
.brandmark { display: flex; align-items: center; gap: 9px; padding: 4px 10px 16px; color: var(--ink); }
.brandmark .logo { display: inline-flex; }
.brandmark-text { flex: 1; font-size: 15px; }
.brandmark-text strong { font-weight: 650; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { color: var(--faint); font-size: 12px; font-weight: 500; padding: 16px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none;
}
.nav a svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { background: #e9e9e5; color: var(--ink); font-weight: 550; }
.nav a.active svg { color: var(--ink); }
.nav .badge { margin-left: auto; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px;
  padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-text); font-variant-numeric: tabular-nums;
}
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.zero { display: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 2px; display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border); }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.whoami { background: none; border: 0; padding: 0; text-align: left; color: var(--muted); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; }
.whoami svg { width: 14px; height: 14px; }
.whoami b { color: var(--ink); font-weight: 550; }
.whoami:hover b { text-decoration: underline; }

.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live.on .live-dot { background: var(--pass); }
.live.off .live-dot { background: var(--warn); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.topbar p { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.view { padding: 24px 32px 64px; max-width: 1280px; width: 100%; outline: none; }
.icon-btn.nav-open, .icon-btn.nav-close { display: none; }
.scrim { display: none; }

/* ---------------------------------------------------------------- primitives */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head a { font-size: 13px; }
.card-body { padding: 16px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.section-gap { margin-top: 16px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .1s, border-color .1s;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.approve { background: var(--approve); border-color: var(--approve); color: #fff; }
.btn.approve:hover:not(:disabled) { background: var(--approve-hover); border-color: var(--approve-hover); }
.btn.danger { color: var(--block-text); }
.btn.danger:hover:not(:disabled) { background: var(--block-soft); border-color: #e9b9b6; }
.btn.danger.solid { background: var(--block); border-color: var(--block); color: #fff; }
.btn.danger.solid:hover:not(:disabled) { background: var(--block-text); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--muted); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.primary.busy::after, .btn.approve.busy::after, .btn.solid.busy::after { border-color: #fff; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 6px 10px; outline: none; min-height: 32px;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.textarea { resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236e6e68' stroke-width='1.4'/%3E%3C/svg%3E");
  background-position: right 8px center; background-size: 12px; background-repeat: no-repeat; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; }
.input.invalid, .textarea.invalid { border-color: var(--block); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 4px;
  font-size: 12.5px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip.mono { font-family: var(--mono); font-size: 12px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip svg { width: 12px; height: 12px; flex: none; }
a.chip:hover { text-decoration: none; border-color: var(--border-strong); }

/* Status labels: sentence case, square-ish, colour carries the meaning. */
.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px;
  font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--surface-3); color: var(--ink-2);
}
.pill.block, .pill.rejected, .pill.failed, .pill.refused { background: var(--block-soft); color: var(--block-text); }
.pill.warn, .pill.flagged { background: var(--warn-soft); color: var(--warn-text); }
.pill.pass, .pill.published, .pill.approved, .pill.ok { background: var(--pass-soft); color: var(--pass-text); }
.pill.pending, .pill.open { background: var(--accent-soft); color: var(--accent-text); }
.pill.neutral, .pill.info { background: var(--surface-3); color: var(--ink-2); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }

.tabs { display: flex; gap: 2px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
  color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button svg { width: 14px; height: 14px; }
.tabs button:hover { color: var(--ink); background: var(--surface-2); }
.tabs button.active { background: var(--surface-3); color: var(--ink); font-weight: 550; }
.tabs .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tabs button.active .count { color: var(--muted); }

.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-weight: 550; margin-bottom: 2px; }
.empty p { font-size: 13px; max-width: 460px; margin: 0 auto; }
.loading { padding: 24px 0; color: var(--faint); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted);
  padding: 8px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfbfa; }
.table tr.clickable { cursor: pointer; }
.table tr.selected td { background: var(--accent-soft) !important; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px;
  border: 1px solid transparent; }
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.banner.block { background: var(--block-soft); color: var(--block-text); border-color: #f2d0ce; }
.banner.warn { background: var(--warn-soft); color: var(--warn-text); border-color: #f2dfb5; }
.banner.pass { background: var(--pass-soft); color: var(--pass-text); border-color: #cfe7d6; }
.banner.info { background: var(--accent-soft); color: var(--accent-text); border-color: #d3e1f8; }
.banner b { font-weight: 600; }

/* ---------------------------------------------------------------- home */

.todo { margin-bottom: 16px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.todo-row:last-child { border-bottom: 0; }
.todo-row .n { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 22px; }
.todo-row .n.warn { color: var(--warn-text); }
.todo-row .n.block { color: var(--block-text); }
.todo-row .what { flex: 1; min-width: 0; }
.todo-row .what span { color: var(--muted); font-size: 13px; }
.todo-done { padding: 14px 16px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.todo-done svg { width: 16px; height: 16px; color: var(--pass); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.stat { display: block; padding: 14px 16px; color: inherit; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
a.stat:hover { background: var(--surface-2); text-decoration: none; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat .hint { font-size: 12px; color: var(--faint); }
.stat.flash { animation: flash 1s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

.campaign { padding: 16px 0; border-bottom: 1px solid var(--border); }
.campaign:first-child { padding-top: 0; }
.campaign:last-child { border-bottom: 0; padding-bottom: 0; }
.progress { height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; margin: 12px 0 6px; }
.progress > i { display: block; height: 100%; background: var(--ink-2); border-radius: 2px; }
.daysleft { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr 30px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.bar-track { height: 12px; display: flex; align-items: center; }
.bar-track > i { display: block; height: 8px; min-width: 3px; background: var(--bar); border-radius: 0 2px 2px 0; }
.bar-row .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.kvlist { display: flex; flex-direction: column; }
.kvlist > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.kvlist > div:last-child { border-bottom: 0; }
.kvlist span { color: var(--ink-2); }
.kvlist b { font-weight: 600; font-variant-numeric: tabular-nums; }

.status-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.status-row:first-child { padding-top: 0; }
.status-row:last-child { border-bottom: 0; padding-bottom: 0; }
.status-row .what { flex: 1; min-width: 0; }
.status-row .what b { font-weight: 550; }
.status-row .what p { font-size: 13px; color: var(--muted); margin-top: 1px; }

.status-line { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.status-line:last-child { border-bottom: 0; padding-bottom: 0; }
.status-line:first-child { padding-top: 0; }
.status-line b { font-weight: 550; }
.status-icon { min-width: 28px; height: 24px; padding: 0 6px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  flex: none; background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.status-icon b { font-weight: 600; font-size: 13px; }

.activity { display: flex; flex-direction: column; }
.activity-item { display: grid; grid-template-columns: 16px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border);
  align-items: start; font-size: 13.5px; color: inherit; }
.activity-item:hover { text-decoration: none; }
.activity-item:hover .grow { text-decoration: underline; text-decoration-color: var(--border-strong); }
.activity-item:first-child { padding-top: 0; }
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-item svg { width: 14px; height: 14px; margin-top: 3px; color: var(--faint); }
.activity-item.block svg { color: var(--block); }
.activity-item.warn svg { color: var(--warn); }
.activity-item.pass svg { color: var(--pass); }
.activity-item .when { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.activity-item.new { animation: flash 1.2s ease-out; }

.lint-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; align-items: baseline; }
.lint-item:first-child { padding-top: 0; }
.lint-item:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------------------------------------------------------------- highlighted copy */

.copy { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
mark.hl { color: inherit; border-radius: 2px; padding: 0 1px; margin: 0 -1px; cursor: help; }
mark.hl.block { background: var(--block-mark); box-shadow: inset 0 -2px 0 var(--block); }
mark.hl.warn { background: var(--warn-mark); box-shadow: inset 0 -2px 0 var(--warn); }
mark.hl.active { outline: 2px solid var(--accent); outline-offset: 1px; }

.violations { display: flex; flex-direction: column; gap: 8px; }
.violation { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.violation[data-clickable] { cursor: pointer; }
.violation[data-clickable]:hover { border-color: var(--border-strong); }
.violation .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.violation .rule { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.violation .layer { font-size: 12px; color: var(--faint); }
.violation .quote { font-weight: 550; margin-top: 6px; }
.violation .reason { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.violation .suggest { margin-top: 6px; font-size: 13.5px; }
.violation .suggest b { font-weight: 550; color: var(--pass-text); }
.violation .source { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.violation .source svg { width: 12px; height: 12px; }

.facts { display: flex; flex-direction: column; }
.fact { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.fact:first-child { padding-top: 0; }
.fact:last-child { border-bottom: 0; padding-bottom: 0; }
.fact .q { font-weight: 600; color: var(--pass-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fact .src { color: var(--muted); font-size: 12.5px; }
.fact.off .q { color: var(--muted); }

.meter { display: flex; align-items: center; gap: 10px; }
.meter .track { flex: 1; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.meter .track > i { display: block; height: 100%; border-radius: 3px; background: var(--pass); }
.meter.mid .track > i { background: var(--warn); }
.meter.low .track > i { background: var(--block); }
.meter b { font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; font-weight: 600; }

/* ---------------------------------------------------------------- queue */

.post { scroll-margin-top: 90px; }
.post.focus { animation: focusring 2.2s ease-out; }
@keyframes focusring { 0%, 40% { border-color: var(--accent); box-shadow: var(--ring); } 100% { box-shadow: none; } }
.post.enter { animation: enter .3s ease-out; }
@keyframes enter { from { opacity: 0; } to { opacity: 1; } }
.post-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.post-id { font-weight: 600; font-variant-numeric: tabular-nums; }
.post-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); }
.post-copy { padding: 16px; border-right: 1px solid var(--border); }
.post-copy h3 { margin-bottom: 8px; font-size: 15px; }
.post-side { padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 16px; }
.post-side h4 { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.post-actions { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.post-actions .textarea { min-height: 60px; }
.revalidate { font-size: 13px; color: var(--warn-text); display: flex; gap: 6px; align-items: center; }
.revalidate svg { width: 14px; height: 14px; }
.queue-list { display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------------- check a draft */

.pg { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.pg-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hl-editor { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.hl-editor:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.hl-editor .backdrop, .hl-editor textarea {
  margin: 0; padding: 12px 14px; font: 15px/1.6 var(--font); letter-spacing: normal; white-space: pre-wrap;
  word-wrap: break-word; overflow-wrap: break-word; word-break: normal; tab-size: 4; border: 0;
}
.hl-editor .backdrop { position: absolute; inset: 0; color: transparent; pointer-events: none; overflow: hidden; }
.hl-editor .backdrop mark { color: transparent; border-radius: 2px; padding: 0; margin: 0; }
.hl-editor .backdrop mark.block { background: var(--block-mark); box-shadow: inset 0 -2px 0 var(--block); }
.hl-editor .backdrop mark.warn { background: var(--warn-mark); box-shadow: inset 0 -2px 0 var(--warn); }
.hl-editor textarea { position: relative; display: block; width: 100%; min-height: 240px; background: transparent; color: var(--ink);
  resize: none; outline: none; overflow: hidden; caret-color: var(--ink); }
.editor-bar { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.counter { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--block-text); font-weight: 600; }
.verdict { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid transparent; }
.verdict .big { font-size: 15px; font-weight: 600; }
.verdict .icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex: none; }
.verdict .icon svg { width: 20px; height: 20px; }
.verdict.pass { background: var(--pass-soft); color: var(--pass-text); border-color: #cfe7d6; }
.verdict.warn { background: var(--warn-soft); color: var(--warn-text); border-color: #f2dfb5; }
.verdict.block { background: var(--block-soft); color: var(--block-text); border-color: #f2d0ce; }
.verdict.idle { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.verdict .summary { color: var(--ink-2); font-size: 13.5px; }
.verdict .score { text-align: right; color: var(--ink); }
.verdict .score span { display: block; font-size: 12px; color: var(--muted); }
.verdict .score b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timings { display: flex; flex-direction: column; gap: 6px; }
.timing { display: grid; grid-template-columns: 72px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.timing .t-track { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.timing .t-track > i { display: block; height: 100%; background: var(--bar); min-width: 2px; }
.timing .ms { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.timing.off .ms { color: var(--faint); }
.timing.off .t-track > i { display: none; }
details.more { border: 1px solid var(--border); border-radius: var(--radius); }
details.more > summary { cursor: pointer; padding: 10px 16px; font-size: 13.5px; color: var(--ink-2); list-style: none;
  display: flex; justify-content: space-between; gap: 10px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "Show"; color: var(--accent-text); font-size: 13px; }
details.more[open] > summary::after { content: "Hide"; }
details.more[open] > summary { border-bottom: 1px solid var(--border); }
details.more > div { padding: 14px 16px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; }
.toggle input { appearance: none; width: 30px; height: 18px; border-radius: 9px; background: var(--border-strong); position: relative;
  cursor: pointer; transition: background-color .15s; margin: 0; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(12px); }
.toggle input:disabled { opacity: .5; cursor: not-allowed; }
.rewrite { border: 1px solid #cfe7d6; border-radius: var(--radius); padding: 12px 14px; background: var(--pass-soft); }

/* ---------------------------------------------------------------- brand memory */

.editor-wrap { display: grid; grid-template-columns: auto 1fr; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface); height: min(64vh, 680px); }
.editor-wrap:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.gutter { background: var(--surface-2); color: var(--faint); text-align: right; padding: 12px 8px 12px 12px; font: 12.5px/1.6 var(--mono);
  user-select: none; overflow: hidden; border-right: 1px solid var(--border); min-width: 46px; white-space: pre; }
.gutter .err { color: #fff; background: var(--block); border-radius: 2px; padding: 0 3px; }
.code-area { border: 0; outline: none; resize: none; padding: 12px 14px; font: 12.5px/1.6 var(--mono); background: transparent;
  color: var(--ink); white-space: pre; overflow: auto; tab-size: 2; width: 100%; height: 100%; }
.validation { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 8px 12px; border-radius: var(--radius-sm); }
.validation.ok { color: var(--pass-text); background: var(--pass-soft); }
.validation.bad { color: var(--block-text); background: var(--block-soft); }
.validation.idle { color: var(--muted); background: var(--surface-2); }
.validation pre { font-size: 12.5px; }
.validation svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.dirty-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); display: inline-block; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.bullets.do li::marker { color: var(--pass); }
.bullets.dont li::marker { color: var(--block); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.strike { text-decoration: line-through; text-decoration-color: var(--block); }
.tagline-big { font-size: 20px; font-weight: 600; line-height: 1.35; }
.label-sm { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.pattern { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px;
  border-radius: 4px; word-break: break-all; }
.product-card .facts-table td:first-child { font-family: var(--mono); font-size: 12px; white-space: nowrap; color: var(--ink-2); }
.channel-card .limits { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 12px; overflow: hidden; }
.channel-card .limits div { padding: 8px 10px; border-right: 1px solid var(--border); }
.channel-card .limits div:last-child { border-right: 0; }
.channel-card .limits b { display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.channel-card .limits span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- json / diff */

.json { font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; padding: 14px 16px; overflow: auto; }
.json .k { color: #7a3e9d; }
.json .s { color: #2b6a30; }
.json .n { color: #a3480c; }
.json .b { color: var(--accent-text); }
.json .p { color: var(--faint); }
.diff { font: 12.5px/1.55 var(--mono); overflow-x: auto; }
.diff div { white-space: pre; padding: 0 14px; min-height: 1.55em; }
.diff .add { background: #e9f6ec; color: #1a5c2c; }
.diff .del { background: #fcecea; color: #8f201c; }
.diff .hunk { color: var(--muted); background: var(--surface-2); margin-top: 6px; }
.diff-section { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.diff-section > header { padding: 7px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 500;
  font-size: 13px; display: flex; gap: 8px; align-items: center; font-family: var(--mono); }
.diff-section > header svg { width: 14px; height: 14px; color: var(--muted); }
.versions-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.vlist .vrow { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.vlist .vrow:hover { background: var(--surface-2); }
.vlist .vrow.selected { background: var(--accent-soft); }
.vlist .vrow:last-child { border-bottom: 0; }
.vline { width: 8px; display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.vline i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); }
.vrow.current .vline i { border-color: var(--pass); background: var(--pass); }

/* ---------------------------------------------------------------- published */

.feed-grid { columns: 2 360px; column-gap: 16px; }
.feed-grid > * { break-inside: avoid; margin-bottom: 16px; }
.social { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.social .s-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  font-weight: 650; color: #fff; background: #9c4a24; font-size: 15px; }
.avatar.sq { border-radius: 4px; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.s-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.s-meta { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.s-meta svg { width: 11px; height: 11px; }
.s-body { padding: 0 14px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.5; }
.s-body .hashtag { color: var(--accent-text); }
.s-actions { display: flex; justify-content: space-around; border-top: 1px solid var(--border); padding: 8px 6px; color: var(--muted);
  font-size: 13px; }
.s-actions span { display: inline-flex; gap: 6px; align-items: center; }
.s-actions svg { width: 16px; height: 16px; }
.s-head svg { color: var(--ink-2); }
.s-foot { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.social.x .s-body { padding-left: 62px; margin-top: -22px; }
.social.x .s-actions { border-top: 0; padding-left: 56px; justify-content: space-between; padding-right: 30px; }
.ig-media { aspect-ratio: 1 / 1; display: flex; align-items: flex-end; padding: 22px; color: #3a2416; background: #efe4d8; }
.ig-media b { font-size: 21px; line-height: 1.25; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ad-media { aspect-ratio: 1.91 / 1; background: #f2e9df; display: flex; align-items: center; padding: 0 24px;
  justify-content: center; text-align: center; color: #5e2f17; font-weight: 650; font-size: 24px; }
.ad-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); }
.ad-bar .grow b { display: block; font-size: 14px; }
.ad-bar .grow span { font-size: 12px; color: var(--muted); }
.sponsored { font-size: 12px; color: var(--muted); }
.slack { padding: 12px 14px; display: flex; gap: 10px; }
.slack .s-body { padding: 0; }
.landing-frame { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.browser-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.browser-bar .url { flex: 1; font: 12.5px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.landing-frame iframe { width: 100%; height: 420px; border: 0; display: block; background: #fff; }

/* ---------------------------------------------------------------- documents */

.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 32px 20px; text-align: center; cursor: pointer;
  background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone > svg { width: 24px; height: 24px; color: var(--muted); margin-bottom: 6px; }
.dropzone h3 { font-size: 15px; font-weight: 550; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin: 12px 0; overflow: hidden; }
.result-stats div { padding: 8px 12px; border-right: 1px solid var(--border); }
.result-stats div:last-child { border-right: 0; }
.result-stats b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 12px; color: var(--muted); }
.guidance-hit { padding: 12px 0; border-bottom: 1px solid var(--border); }
.guidance-hit:last-child { border-bottom: 0; }
.guidance-hit mark { background: var(--warn-mark); color: inherit; border-radius: 2px; }

/* ---------------------------------------------------------------- activity log */

.audit-table td { font-size: 13px; }
.action { font-family: var(--mono); font-size: 12px; white-space: nowrap; color: var(--ink-2); }
.action.refused, .action.rejected, .action.failed { color: var(--block-text); }
.action.approved { color: var(--pass-text); }
.details { font-family: var(--mono); font-size: 12px; color: var(--ink-2); max-width: 460px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: pointer; }
.details.open { white-space: pre-wrap; word-break: break-word; overflow: visible; }
.hashpair { font-family: var(--mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; }

/* ---------------------------------------------------------------- suggested changes */

.proposal .payload { min-height: 140px; font: 12.5px/1.55 var(--mono); white-space: pre; tab-size: 2; }
.proposal .meta { display: grid; grid-template-columns: 100px 1fr; gap: 6px 12px; font-size: 13.5px; margin: 0; }
.proposal .meta dt { color: var(--muted); }
.proposal .meta dd { margin: 0; }
.op { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 550;
  border: 1px solid var(--border-strong); color: var(--ink-2); }
.op.remove { color: var(--block-text); border-color: #ecc4c1; }

/* ---------------------------------------------------------------- toasts & modals */

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: toastin .18s ease-out; font-size: 13.5px; cursor: pointer; }
.toast.leaving { animation: toastout .15s ease-in forwards; }
.toast .t-icon { flex: none; display: flex; margin-top: 1px; color: var(--muted); }
.toast .t-icon svg { width: 16px; height: 16px; }
.toast.pass .t-icon { color: var(--pass); }
.toast.warn .t-icon { color: var(--warn); }
.toast.block .t-icon { color: var(--block); }
.toast.info .t-icon { color: var(--accent); }
.toast b { display: block; font-weight: 550; }
.toast span { color: var(--muted); font-size: 13px; }
@keyframes toastin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(20, 20, 18, .28); z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); width: min(460px, 100%); border: 1px solid var(--border);
  animation: toastin .15s ease-out; }
.modal header { padding: 18px 20px 4px; }
.modal header h2 { font-size: 16px; }
.modal .m-body { padding: 8px 20px 16px; color: var(--ink-2); display: flex; flex-direction: column; gap: 12px; }
.modal footer { padding: 12px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 10px 10px; }
@keyframes fade { from { opacity: 0; } }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--border); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-shown .sidebar { transform: none; }
  .app.nav-shown .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 20, 18, .28); z-index: 30; }
  .icon-btn.nav-open, .icon-btn.nav-close { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px 16px 56px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .post-grid { grid-template-columns: 1fr; }
  .post-copy { border-right: 0; border-bottom: 1px solid var(--border); }
  .versions-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 1px solid var(--border); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .stat .value { font-size: 20px; }
  .pg-controls { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .channel-card .limits { grid-template-columns: repeat(3, 1fr); }
  .topbar-actions .btn span.lbl { display: none; }
  .card-head, .card-body, .post-head, .post-copy, .post-actions, .todo-row { padding-left: 14px; padding-right: 14px; }
  .proposal .meta { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(90px, 40%) 1fr 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
