/* ==========================================================================
   Global Pulse Daily — newsroom admin
   A dense, keyboard-friendly editorial UI. Shares the publication's type
   and accent, but its own neutral palette so it never competes with the
   article being edited.
   ========================================================================== */

:root {
  --a-accent: #D7263D;
  --a-ink: #16161A;
  --a-text: #3F3F46;
  --a-muted: #71717A;
  --a-faint: #A1A1AA;
  --a-line: #E4E4E7;
  --a-line-soft: #F0F0F2;
  --a-bg: #F7F7F8;
  --a-surface: #FFFFFF;
  --a-rail: #15151A;
  --a-rail-text: #B9B9C2;
  --a-rail-hover: #22222A;
  --a-ok: #0F6B45;
  --a-ok-bg: #E8F6EF;
  --a-warn: #8A5200;
  --a-warn-bg: #FDF3E2;
  --a-bad: #A81B2C;
  --a-bad-bg: #FDECEE;
  --a-info: #1A4FA0;
  --a-info-bg: #EAF1FD;
  --a-font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --a-display: 'Playfair Display', Georgia, serif;
  --a-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --a-rail-w: 248px;
  --a-radius: 6px;
  --a-shadow: 0 1px 2px rgba(16,16,22,.04), 0 8px 24px rgba(16,16,22,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: var(--a-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; border-radius: 3px; }

h1,h2,h3,h4,p,ul,ol,figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ============================== shell ============================== */

.shell { display: flex; min-height: 100vh; }

.rail {
  flex: 0 0 var(--a-rail-w);
  width: var(--a-rail-w);
  background: var(--a-rail);
  color: var(--a-rail-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail__brand {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 20px 18px;
  color: #fff;
  border-bottom: 1px solid #26262E;
}
.rail__mark { color: var(--a-accent); margin-top: 4px; flex: 0 0 auto; }

/* same heartbeat as the public header */
.rail__mark,
.auth__brand .rail__mark {
  transform-origin: center;
  animation: pulse-beat 2.8s cubic-bezier(.4, 0, .25, 1) infinite;
}

@keyframes pulse-beat {
  0%   { transform: scale(1); }
  7%   { transform: scale(1.11); }
  14%  { transform: scale(1); }
  21%  { transform: scale(1.07); }
  30%  { transform: scale(1); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .rail__mark, .auth__brand .rail__mark { animation: none; }
}
.rail__name {
  font-family: var(--a-display);
  font-style: italic;
  font-weight: 900;
  font-size: 24px;
  line-height: 1.05;
  color: #fff;
}
.rail__badge {
  font-size: 8px; font-weight: 700; letter-spacing: .2em;
  background: #fff; color: var(--a-rail); padding: 3px 5px 2px;
  border-radius: 3px; margin-top: 2px;
}

.rail__nav { padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 2px; }
.rail__group {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #6C6C78; padding: 16px 10px 6px;
}
.rail__link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--a-radius);
  font-size: 14px; font-weight: 500; color: var(--a-rail-text);
  min-height: 40px;
}
.rail__link:hover { background: var(--a-rail-hover); color: #fff; }
.rail__link.is-active { background: var(--a-accent); color: #fff; font-weight: 600; }
.rail__link.is-active .rail__count { background: rgba(255,255,255,.22); color: #fff; }
.rail__link svg { flex: 0 0 auto; opacity: .9; }
.rail__count {
  margin-left: auto; background: #2C2C35; color: #CFCFD8;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}

.rail__foot { margin-top: auto; padding: 14px 14px 18px; border-top: 1px solid #26262E; }
.rail__user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rail__avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--a-accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex: 0 0 34px; overflow: hidden;
}
.rail__avatar img { width: 100%; height: 100%; object-fit: cover; }
.rail__who { min-width: 0; }
.rail__who strong { display: block; color: #fff; font-size: 13px; font-weight: 600; }
.rail__who span { font-size: 11px; color: #7C7C88; text-transform: uppercase; letter-spacing: .08em; }
.rail__actions { display: flex; gap: 6px; }
.rail__action {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; border: 1px solid #32323C; border-radius: var(--a-radius);
  background: transparent; color: var(--a-rail-text);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.rail__action:hover { background: var(--a-rail-hover); color: #fff; }

.main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--a-surface);
  border-bottom: 1px solid var(--a-line);
  padding: 0 28px;
  display: flex; align-items: center; gap: 16px;
  min-height: 64px;
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.topbar__meta { font-size: 13px; color: var(--a-muted); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.burger { display: none; }

.content { padding: 24px 28px 64px; flex: 1 1 auto; }
.content--narrow { max-width: 900px; }

/* ============================== buttons ============================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--a-radius);
  background: var(--a-accent); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(.94); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn--ink { background: var(--a-ink); }
.btn--ghost { background: var(--a-surface); border-color: var(--a-line); color: var(--a-ink); }
.btn--ghost:hover { background: var(--a-bg); filter: none; color: var(--a-ink); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--a-muted); }
.btn--quiet:hover { background: var(--a-line-soft); color: var(--a-ink); filter: none; }
.btn--danger { background: var(--a-bad); }
.btn--sm { min-height: 32px; padding: 0 11px; font-size: 12px; }
.btn--lg { min-height: 46px; padding: 0 22px; font-size: 14px; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 36px; min-height: 36px; }

/* ============================== cards ============================== */

.card {
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
}
.card__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--a-line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card__title { font-size: 15px; font-weight: 700; }
.card__hint { font-size: 13px; color: var(--a-muted); }
.card__head .card__hint { width: 100%; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: 14px 20px; border-top: 1px solid var(--a-line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #FCFCFD; border-radius: 0 0 var(--a-radius) var(--a-radius);
}
.card__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(320px,100%), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(260px,100%), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(200px,100%), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--tight { gap: 6px; }
.push { margin-left: auto; }

/* ============================== stats ============================== */

.stat {
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat__label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--a-muted);
  display: flex; align-items: center; gap: 7px;
}
.stat__value { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stat__value small { font-size: 14px; font-weight: 600; color: var(--a-muted); }
.stat__note { font-size: 12px; color: var(--a-muted); }
.stat--accent .stat__value { color: var(--a-accent); }

/* ============================== tables ============================== */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; vertical-align: middle; }
table.data thead th {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--a-muted); background: #FBFBFC;
  border-bottom: 1px solid var(--a-line); white-space: nowrap;
}
table.data tbody tr { border-bottom: 1px solid var(--a-line-soft); }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover { background: #FCFCFD; }
table.data td.shrink { width: 1%; white-space: nowrap; }
table.data .t-title { font-weight: 600; font-size: 14px; }
table.data .t-sub { font-size: 12px; color: var(--a-muted); }
table.data .t-thumb {
  width: 56px; height: 40px; border-radius: 4px; overflow: hidden;
  background: var(--a-line-soft); flex: 0 0 56px;
}
table.data .t-thumb img { width: 100%; height: 100%; object-fit: cover; }
.t-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* ============================== badges ============================== */

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  background: var(--a-line-soft); color: var(--a-text); white-space: nowrap;
}
.tag--ok { background: var(--a-ok-bg); color: var(--a-ok); }
.tag--warn { background: var(--a-warn-bg); color: var(--a-warn); }
.tag--bad { background: var(--a-bad-bg); color: var(--a-bad); }
.tag--info { background: var(--a-info-bg); color: var(--a-info); }
.tag--accent { background: var(--a-accent); color: #fff; }
.tag--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================== forms ============================== */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label {
  font-size: 13px; font-weight: 600; color: var(--a-ink);
  display: flex; align-items: center; gap: 6px;
}
.field__hint { font-size: 12px; color: var(--a-muted); line-height: 1.45; }
.field__error { font-size: 12px; font-weight: 600; color: var(--a-bad); }

input[type="text"], input[type="email"], input[type="url"], input[type="password"],
input[type="number"], input[type="search"], input[type="datetime-local"], input[type="date"],
select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  background: var(--a-surface);
  color: var(--a-ink);
  font: inherit;
  font-size: 14px;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
input::placeholder, textarea::placeholder { color: var(--a-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--a-accent); outline: none; box-shadow: 0 0 0 3px rgba(215,38,61,.12); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--a-bad); }
input:disabled, textarea:disabled, select:disabled { background: var(--a-bg); color: var(--a-muted); }

.mono { font-family: var(--a-mono); font-size: 13px; }

.check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; cursor: pointer; font-size: 14px;
}
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 18px; accent-color: var(--a-accent); cursor: pointer; }
.check__text { display: flex; flex-direction: column; gap: 2px; }
.check__text strong { font-weight: 600; }
.check__text span { font-size: 12px; color: var(--a-muted); line-height: 1.45; }

.switch-list { display: flex; flex-direction: column; }
.switch-list .check { border-bottom: 1px solid var(--a-line-soft); }
.switch-list .check:last-child { border-bottom: 0; }

.counter { font-size: 11px; font-weight: 600; color: var(--a-muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.counter.is-warn { color: var(--a-warn); }
.counter.is-bad { color: var(--a-bad); }
.counter.is-ok { color: var(--a-ok); }

.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] {
  width: 46px; height: 40px; padding: 2px; border: 1px solid var(--a-line);
  border-radius: var(--a-radius); background: var(--a-surface); cursor: pointer; flex: 0 0 46px;
}
.color-field input[type="text"] { font-family: var(--a-mono); text-transform: uppercase; }

/* filter bar */

.filters {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--a-line); background: #FBFBFC;
}
.filters select, .filters input { min-height: 36px; width: auto; min-width: 150px; font-size: 13px; }
.filters input[type="search"] { min-width: 220px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--a-line); border-radius: 999px;
  background: var(--a-surface); font-size: 12.5px; font-weight: 600; color: var(--a-text);
}
.chip:hover { border-color: var(--a-accent); color: var(--a-accent); }
.chip.is-active { background: var(--a-ink); border-color: var(--a-ink); color: #fff; }
.chip__n { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }

/* ============================== notices ============================== */

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--a-radius);
  font-size: 13.5px; line-height: 1.5;
  border: 1px solid transparent;
}
.notice svg { flex: 0 0 auto; margin-top: 1px; }
.notice--ok { background: var(--a-ok-bg); border-color: #BFE3D2; color: #0B5436; }
.notice--warn { background: var(--a-warn-bg); border-color: #EFD9AE; color: #6B4000; }
.notice--bad { background: var(--a-bad-bg); border-color: #F2B8BE; color: #7A1320; }
.notice--info { background: var(--a-info-bg); border-color: #C3D7F7; color: #143E80; }
.notice strong { font-weight: 700; }
.notice ul { margin: 6px 0 0; padding-left: 16px; list-style: disc; }

.flash-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(420px, calc(100vw - 40px));
}
.flash {
  padding: 13px 16px; border-radius: var(--a-radius);
  font-size: 13.5px; font-weight: 600; color: #fff;
  background: var(--a-ink); box-shadow: 0 12px 30px rgba(16,16,22,.2);
}
.flash--success { background: var(--a-ok); }
.flash--error { background: var(--a-bad); }
.flash--warning { background: var(--a-warn); }
.flash--info { background: var(--a-info); }

.empty {
  padding: 48px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty__icon { color: var(--a-faint); }
.empty__title { font-size: 16px; font-weight: 700; }
.empty p { color: var(--a-muted); max-width: 46ch; margin: 0; }

/* ============================== pagination ============================== */

.pager {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--a-line); font-size: 13px; color: var(--a-muted);
}
.pager__links { margin-left: auto; display: flex; gap: 6px; }
.pager__links a, .pager__links span {
  min-width: 36px; height: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--a-line); border-radius: var(--a-radius);
  font-size: 13px; font-weight: 600; background: var(--a-surface);
}
.pager__links .is-disabled { opacity: .45; pointer-events: none; }

/* ============================== login ============================== */

body.admin-auth {
  background: var(--a-rail);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.auth { width: 100%; max-width: 420px; }
.auth__brand {
  display: flex; align-items: flex-start; gap: 8px;
  justify-content: center; margin-bottom: 22px; color: #fff;
}
.auth__brand .rail__name { font-size: 34px; }
.auth__card {
  background: var(--a-surface); border-radius: 10px;
  padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth__title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.auth__sub { font-size: 13.5px; color: var(--a-muted); margin-bottom: 22px; }
.auth__foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: #6C6C78; }
.auth__foot a { color: #9A9AA6; text-decoration: underline; }

/* ============================== editor ============================== */

.editor { display: flex; gap: 20px; align-items: flex-start; }
.editor__main { flex: 1 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.editor__side { flex: 0 0 340px; width: 340px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }

.title-input {
  width: 100%; border: 0; padding: 4px 0 10px;
  font-family: var(--a-display); font-size: 32px; font-weight: 800;
  line-height: 1.15; letter-spacing: -0.02em; color: var(--a-ink);
  background: transparent; border-bottom: 1px solid var(--a-line);
  min-height: auto;
}
.title-input:focus { outline: none; border-bottom-color: var(--a-accent); box-shadow: none; }
.title-input::placeholder { color: #C8C8D0; }

.dek-input {
  width: 100%; border: 0; padding: 10px 0; background: transparent;
  font-size: 17px; line-height: 1.5; color: var(--a-text); resize: vertical; min-height: 56px;
}
.dek-input:focus { outline: none; box-shadow: none; }

.slug-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--a-muted); padding-top: 8px;
}
.slug-row code { font-family: var(--a-mono); }
.slug-row input {
  min-height: 30px; padding: 3px 8px; width: auto; min-width: 200px; flex: 1 1 200px;
  font-family: var(--a-mono); font-size: 12.5px;
}

/* rich text */

.rt { border: 1px solid var(--a-line); border-radius: var(--a-radius); background: var(--a-surface); }
.rt__bar {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  padding: 7px 8px; border-bottom: 1px solid var(--a-line);
  background: #FBFBFC; border-radius: var(--a-radius) var(--a-radius) 0 0;
  position: sticky; top: 64px; z-index: 10;
}
.rt__btn {
  width: 34px; height: 34px; border: 0; border-radius: 5px;
  background: transparent; color: var(--a-text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.rt__btn:hover { background: var(--a-line-soft); color: var(--a-ink); }
.rt__btn.is-on { background: var(--a-ink); color: #fff; }
.rt__btn--wide { width: auto; padding: 0 10px; font-size: 12.5px; font-weight: 600; gap: 6px; }
.rt__sep { width: 1px; height: 22px; background: var(--a-line); margin: 0 5px; }

.rt__area {
  min-height: 520px; padding: 24px 28px;
  font-size: 17px; line-height: 1.7; color: var(--a-ink);
  outline: none; overflow-wrap: break-word;
}
.rt__area:empty::before { content: attr(data-placeholder); color: #C0C0C8; }
.rt__area > * { margin: 0 0 1em; }
.rt__area > *:last-child { margin-bottom: 0; }
.rt__area h2 { font-family: var(--a-display); font-size: 27px; font-weight: 800; line-height: 1.22; margin-top: 1.4em; }
.rt__area h3 { font-family: var(--a-display); font-size: 21px; font-weight: 700; line-height: 1.3; margin-top: 1.2em; }
.rt__area a { color: var(--a-accent); text-decoration: underline; }
.rt__area ul, .rt__area ol { padding-left: 1.4em; list-style: revert; }
.rt__area li { margin-bottom: .4em; }
.rt__area blockquote {
  margin: 1.2em 0; padding: 14px 0 14px 18px;
  border-left: 3px solid var(--a-accent);
  font-family: var(--a-display); font-size: 21px; font-weight: 700; line-height: 1.35;
}
.rt__area img { border-radius: 4px; margin: 0 auto; display: block; width: 100%; height: auto; }
.rt__area figure { margin: 1.4em 0; position: relative; }
.rt__area figcaption { font-size: 13px; color: var(--a-muted); margin-top: 8px; text-align: center; }

/* The editor mirrors the published sizing so what the writer drags is what
   the reader gets. */
.rt__area figure.w-25  { width: 25%; }
.rt__area figure.w-33  { width: 33.333%; }
.rt__area figure.w-50  { width: 50%; }
.rt__area figure.w-75  { width: 75%; }
.rt__area figure.w-100 { width: 100%; }
.rt__area figure.align-center { margin-left: auto; margin-right: auto; }
.rt__area figure.align-left  { float: left;  margin: .3em 1.6em .9em 0; max-width: 50%; }
.rt__area figure.align-right { float: right; margin: .3em 0 .9em 1.6em; max-width: 50%; }
.rt__area > h2, .rt__area > h3 { clear: both; }
.rt__area::after { content: ""; display: block; clear: both; }

.rt__area figure.is-selected { outline: 2px solid var(--a-accent); outline-offset: 3px; }

/* corner grip for free resizing */
.rt__area figure.is-selected .img-grip {
  position: absolute;
  right: -7px; bottom: -7px;
  width: 16px; height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--a-accent);
  cursor: nwse-resize;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(16,16,22,.35);
}
.rt__area figure .img-grip { display: none; }
.rt__area figure.is-selected .img-grip { display: block; }

/* floating toolbar shown while an image is selected */
.img-tools {
  position: absolute;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: var(--a-ink);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,16,22,.3);
}
.img-tools[data-open="true"] { display: flex; }
.img-tools__btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 0; border-radius: 5px;
  background: transparent; color: #CFCFD8;
  font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.img-tools__btn:hover { background: #2C2C35; color: #fff; }
.img-tools__btn.is-on { background: var(--a-accent); color: #fff; }
.img-tools__sep { width: 1px; height: 18px; background: #3A3A44; margin: 0 4px; }
.img-tools__size { font-variant-numeric: tabular-nums; color: #8A8A96; padding: 0 6px; font-size: 11px; }
.rt__area pre {
  background: var(--a-bg); padding: 14px; border-radius: 4px;
  font-family: var(--a-mono); font-size: 13.5px; overflow-x: auto;
}
.rt__area hr { border: 0; border-top: 2px solid var(--a-line); margin: 1.6em 0; }
.rt__area table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rt__area th, .rt__area td { border: 1px solid var(--a-line); padding: 8px 10px; }
.rt__area:focus-visible { outline: none; }

.rt__foot {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 9px 14px; border-top: 1px solid var(--a-line);
  font-size: 12px; color: var(--a-muted); font-variant-numeric: tabular-nums;
  background: #FBFBFC; border-radius: 0 0 var(--a-radius) var(--a-radius);
}

/* featured image */

.media-pick { display: flex; flex-direction: column; gap: 10px; }
.media-pick__frame {
  aspect-ratio: 16 / 9; border-radius: var(--a-radius); overflow: hidden;
  background: var(--a-line-soft); border: 1px dashed var(--a-line);
  display: flex; align-items: center; justify-content: center;
  color: var(--a-faint); font-size: 13px; position: relative;
}
.media-pick__frame img { width: 100%; height: 100%; object-fit: cover; }
.media-pick__frame.has-image { border-style: solid; }
.media-pick__meta { font-size: 12px; color: var(--a-muted); word-break: break-word; }

/* SEO score */

.score { display: flex; align-items: center; gap: 16px; }
.score__dial { position: relative; flex: 0 0 76px; width: 76px; height: 76px; }
.score__dial svg { transform: rotate(-90deg); }
.score__dial-value {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.score__text { min-width: 0; }
.score__grade { font-size: 15px; font-weight: 700; text-transform: capitalize; }
.score__note { font-size: 12.5px; color: var(--a-muted); }

.score-bars { display: flex; flex-direction: column; gap: 10px; }
.score-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.score-bar__label { flex: 0 0 38px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--a-muted); }
.score-bar__track { flex: 1 1 auto; height: 7px; border-radius: 999px; background: var(--a-line-soft); overflow: hidden; }
.score-bar__fill { height: 100%; border-radius: 999px; background: var(--a-ok); transition: width .3s ease; }
.score-bar__fill.is-warn { background: #D99400; }
.score-bar__fill.is-bad { background: var(--a-bad); }
.score-bar__n { flex: 0 0 34px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.checklist { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.checklist__item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid var(--a-line-soft); font-size: 13px;
}
.checklist__item:last-child { border-bottom: 0; }
.checklist__dot { flex: 0 0 16px; margin-top: 2px; }
.checklist__dot.is-good { color: var(--a-ok); }
.checklist__dot.is-warn { color: #D99400; }
.checklist__dot.is-bad { color: var(--a-bad); }
.checklist__body { min-width: 0; }
.checklist__body strong { font-weight: 600; display: block; }
.checklist__body span { font-size: 12px; color: var(--a-muted); line-height: 1.4; }

/* SERP preview */

.serp {
  padding: 14px 16px; border: 1px solid var(--a-line);
  border-radius: var(--a-radius); background: #FCFCFD;
  display: flex; flex-direction: column; gap: 3px;
}
.serp__url { font-size: 12.5px; color: #0B6B2E; word-break: break-all; }
.serp__title { font-size: 17px; color: #1A42A8; line-height: 1.3; font-weight: 500; }
.serp__desc { font-size: 13px; color: #4D5156; line-height: 1.5; }

/* tabs */

.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--a-line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 11px 14px; border: 0; background: transparent;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--a-muted);
  cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--a-ink); }
.tab.is-active { color: var(--a-accent); border-bottom-color: var(--a-accent); }
.tab-panel { padding-top: 18px; }
.tab-panel[hidden] { display: none; }

/* repeatable rows (FAQ, citations) */

.repeat { display: flex; flex-direction: column; gap: 12px; }
.repeat__row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--a-line); border-radius: var(--a-radius); background: #FCFCFD;
}
.repeat__fields { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.repeat__remove {
  flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid var(--a-line);
  border-radius: var(--a-radius); background: var(--a-surface); color: var(--a-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.repeat__remove:hover { color: var(--a-bad); border-color: var(--a-bad); }

/* tag input */

.taginput {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 7px 8px; border: 1px solid var(--a-line); border-radius: var(--a-radius);
  background: var(--a-surface); min-height: 40px; position: relative;
}
.taginput:focus-within { border-color: var(--a-accent); box-shadow: 0 0 0 3px rgba(215,38,61,.12); }
.taginput__tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 9px; border-radius: 999px;
  background: var(--a-line-soft); font-size: 12.5px; font-weight: 600;
}
.taginput__x {
  width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent;
  color: var(--a-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.taginput__x:hover { background: #E0E0E4; color: var(--a-bad); }
.taginput input {
  flex: 1 1 120px; min-width: 120px; border: 0; min-height: 28px; padding: 2px 4px;
  font-size: 13.5px; background: transparent;
}
.taginput input:focus { outline: none; box-shadow: none; }
.taginput__suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--a-surface); border: 1px solid var(--a-line);
  border-radius: var(--a-radius); box-shadow: var(--a-shadow);
  max-height: 220px; overflow-y: auto; display: none;
}
.taginput__suggest[data-open="true"] { display: block; }
.taginput__suggest button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border: 0; background: transparent; font: inherit; font-size: 13.5px; cursor: pointer;
}
.taginput__suggest button:hover, .taginput__suggest button.is-active { background: var(--a-line-soft); }

/* ============================== media library ============================== */

.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.media-item {
  border: 1px solid var(--a-line); border-radius: var(--a-radius);
  overflow: hidden; background: var(--a-surface); position: relative;
  display: flex; flex-direction: column;
}
.media-item__frame { aspect-ratio: 4 / 3; background: var(--a-line-soft); overflow: hidden; }
.media-item__frame img { width: 100%; height: 100%; object-fit: cover; }
.media-item__body { padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; }
.media-item__name {
  font-size: 12.5px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.media-item__meta { font-size: 11px; color: var(--a-muted); }
.media-item__check { position: absolute; top: 8px; left: 8px; z-index: 2; }
.media-item__check input { width: 20px; height: 20px; accent-color: var(--a-accent); cursor: pointer; }
.media-item.is-selected { border-color: var(--a-accent); box-shadow: 0 0 0 2px rgba(215,38,61,.2); }
.media-item__btn {
  position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer;
}

.dropzone {
  border: 2px dashed var(--a-line); border-radius: var(--a-radius);
  padding: 30px 20px; text-align: center; background: #FCFCFD;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dropzone.is-over { border-color: var(--a-accent); background: #FEF4F5; }
.dropzone__title { font-size: 15px; font-weight: 700; }
.dropzone p { font-size: 13px; color: var(--a-muted); margin: 0; }
.dropzone input[type="file"] { display: none; }

.upload-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.upload-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; padding: 8px 10px; border-radius: 4px; background: var(--a-bg);
}
.upload-row__bar { flex: 1 1 auto; height: 5px; border-radius: 999px; background: #DEDEE3; overflow: hidden; }
.upload-row__fill { height: 100%; background: var(--a-accent); width: 0; transition: width .2s ease; }

/* modal */

.modal { position: fixed; inset: 0; z-index: 90; display: none; }
.modal[data-open="true"] { display: block; }
.modal__scrim { position: absolute; inset: 0; background: rgba(16,16,22,.6); border: 0; width: 100%; cursor: pointer; }
.modal__panel {
  position: absolute; inset: 24px; margin: auto;
  max-width: 1000px; max-height: calc(100vh - 48px);
  background: var(--a-surface); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.modal__head {
  padding: 16px 20px; border-bottom: 1px solid var(--a-line);
  display: flex; align-items: center; gap: 12px;
}
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close {
  margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: var(--a-radius);
  background: transparent; cursor: pointer; color: var(--a-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.modal__close:hover { background: var(--a-line-soft); color: var(--a-ink); }
.modal__body { padding: 20px; overflow-y: auto; flex: 1 1 auto; }
.modal__foot {
  padding: 14px 20px; border-top: 1px solid var(--a-line);
  display: flex; gap: 10px; align-items: center; background: #FCFCFD;
}

/* ============================== misc ============================== */

.spark { display: flex; align-items: flex-end; gap: 3px; height: 54px; }
.spark__bar { flex: 1 1 0; background: var(--a-line); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.spark__bar.is-peak { background: var(--a-accent); }

.kv { display: flex; flex-direction: column; }
.kv__row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--a-line-soft); font-size: 13.5px;
}
.kv__row:last-child { border-bottom: 0; }
.kv__key { color: var(--a-muted); flex: 1 1 auto; }
.kv__val { font-weight: 600; text-align: right; }

.code-block {
  background: #15151A; color: #D8D8E0; border-radius: var(--a-radius);
  padding: 16px; overflow-x: auto;
  font-family: var(--a-mono); font-size: 12.5px; line-height: 1.6;
  max-height: 460px; overflow-y: auto; white-space: pre;
}
.log-block {
  background: #15151A; color: #C8C8D2; border-radius: var(--a-radius);
  padding: 14px; font-family: var(--a-mono); font-size: 12px; line-height: 1.65;
  max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

.sortable__row { cursor: grab; }
.sortable__row.is-dragging { opacity: .4; }
.sortable__row.is-over td { border-top: 2px solid var(--a-accent); }
.handle { color: var(--a-faint); cursor: grab; }

.inline-form { display: inline; }

.help-link { font-size: 12.5px; color: var(--a-muted); display: inline-flex; align-items: center; gap: 5px; }
.help-link:hover { color: var(--a-accent); }

/* ============================== responsive ============================== */

/* ============================ XML import ============================ */

/* The form on the left, the prompt and the field reference on the right. */
.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 20px;
  align-items: start;
}

.paste-xml > summary {
  cursor: pointer; font-size: 13px; font-weight: 600; padding: 4px 0;
  color: var(--a-muted);
}
.paste-xml > summary:hover { color: var(--a-accent); }
.paste-xml textarea { margin-top: 8px; min-height: 150px; font-size: 12.5px; }

.tick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.tick-list li {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 13px; line-height: 1.5; color: var(--a-text);
}
.tick-list li svg { flex: 0 0 14px; margin-top: 3px; color: var(--a-ok); }

.import-grid .code-block { overflow: auto; }

/* The field reference: element, whether it is needed, what it does. */
table.data.field-ref td { padding-top: 9px; padding-bottom: 9px; vertical-align: top; }
table.data.field-ref code {
  font-family: var(--a-mono); font-size: 12.5px;
  background: var(--a-line-soft); padding: 2px 6px; border-radius: 4px;
}

@media (max-width: 1100px) {
  .import-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1240px) {
  .editor { flex-direction: column; }
  .editor__side { flex: 1 1 auto; width: 100%; position: static; }
}

@media (max-width: 1000px) {
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 70;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.rail-open .rail { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.4); }
  body.rail-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(16,16,22,.5); z-index: 60;
  }
  .burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--a-line);
    border-radius: var(--a-radius); background: var(--a-surface); cursor: pointer;
  }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 56px; }
}

@media (max-width: 680px) {
  .topbar { min-height: 58px; flex-wrap: wrap; padding-bottom: 10px; padding-top: 10px; }
  .topbar__title { font-size: 17px; }
  .topbar__actions { width: 100%; }
  .title-input { font-size: 25px; }
  .rt__area { padding: 16px 16px; font-size: 16px; }
  .rt__bar { position: static; }
  .filters { padding: 12px 14px; }
  .filters select, .filters input { min-width: 0; width: 100%; }
  .card__body { padding: 16px; }
  .modal__panel { inset: 10px; max-height: calc(100vh - 20px); }
  .flash-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
