/* ==========================================================================
   Inkwire newsroom — admin panel styles
   ========================================================================== */

/* The skip link must stay off screen until it takes the focus. The offset is
   vertical on purpose: a horizontal one overflows to the left in RTL and
   grows the scroll width of the whole page. */
.skip-link {
  position: absolute; inset-inline-start: 0; top: 0; z-index: 90;
  transform: translateY(-200%);
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-end-end-radius: 8px;
  text-decoration: none; font-size: .9rem;
}
.skip-link:focus { transform: translateY(0); }

:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --paper: #ffffff;
  --paper-2: #f8fafc;
  --paper-3: #f1f5f9;
  --brand: #c8102e;
  --brand-dark: #9f0c24;
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --side: 250px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --head: "Space Grotesk", var(--font);
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-2: 0 8px 24px rgba(15, 23, 42, .1);
  --t: 170ms cubic-bezier(.4, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
body.admin-body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--paper-2); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--head); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.015em; }
p { margin: 0 0 .8em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0 0 .8em; padding-left: 1.1em; }
code { background: var(--paper-3); padding: .1rem .3rem; border-radius: 4px; font-size: .82em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.admin-shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.admin-side { background: var(--ink); color: #cbd5e1; padding: 1rem .8rem 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side__brand { padding: .4rem .6rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: .8rem; }
.admin-side__brand a { color: #fff; font-family: var(--head); font-size: 1.1rem; }
.admin-side__brand span { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #94a3b8; }
.admin-nav__group { font-size: .62rem; text-transform: uppercase; letter-spacing: .13em; color: #64748b; margin: 1.1rem .6rem .35rem; }
.admin-nav__item { display: block; padding: .42rem .6rem; border-radius: 7px; font-size: .875rem; color: #cbd5e1; transition: background var(--t), color var(--t); }
.admin-nav__item:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav__item--out { margin-top: .8rem; border: 1px solid rgba(255,255,255,.18); text-align: center; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-top {
  display: flex; align-items: center; gap: 1rem; padding: .7rem 1.4rem;
  background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.admin-top__crumb { margin: 0; font-size: .8125rem; color: var(--muted); }
.admin-top__actions { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.admin-user { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; font-weight: 600; }
.admin-user img { border-radius: 50%; }
.admin-burger { display: none; background: none; border: 0; cursor: pointer; padding: .4rem; }
.burger { display: grid; gap: 4px; }
.burger i { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
.admin-content { padding: 1.6rem 1.4rem 3rem; }

.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.admin-head__title { font-size: 1.6rem; margin: 0; }
.admin-head__lede { color: var(--muted); margin: 0; font-size: .875rem; }
.admin-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 600 .85rem/1 var(--font); padding: .6rem 1rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; background: transparent; color: var(--ink);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); color: #fff; }
.btn--ghost { border-color: var(--line); background: var(--paper); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--quiet { background: var(--paper-3); color: var(--ink-2); }
.btn--quiet:hover { background: var(--line); }
.btn--danger { color: var(--bad); }
.btn--danger:hover { background: rgba(185,28,28,.1); }
.btn--sm { padding: .45rem .8rem; font-size: .8rem; }
.btn--xs { padding: .28rem .55rem; font-size: .74rem; }
.btn--block { width: 100%; }
.inline-form { display: inline-flex; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: grid; gap: .15rem; }
.stat:hover { border-color: var(--brand); }
.stat__value { font-family: var(--head); font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.stat__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat--accent { background: var(--brand); color: #fff; border-color: var(--brand); }
.stat--accent .stat__label { color: rgba(255,255,255,.8); }

.admin-grid { gap: 1.2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--center { text-align: center; }
.panel__title { font-size: 1.05rem; margin: 0 0 .5rem; }
.panel__lead { font-family: var(--head); font-size: 1.2rem; font-weight: 700; margin: 0 0 .2rem; }
.panel__note { font-size: .8125rem; color: var(--muted); }
.panel__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: .875rem; }
.panel__list--rows li { display: flex; justify-content: space-between; gap: .8rem; border-bottom: 1px solid var(--line-soft); padding-bottom: .35rem; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.panel__head .panel__title { margin: 0; }
.panel__more { font-size: .78rem; font-weight: 600; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.table td { padding: .65rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--paper-2); }
.table__id { width: 56px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table__title { font-weight: 600; margin: 0; }
.table__sub { display: block; font-size: .75rem; color: var(--muted); }
.table__actions { white-space: nowrap; text-align: right; }
.table__actions .btn { margin-left: .2rem; }
.table__empty { text-align: center; color: var(--muted); padding: 1.6rem; }
.table--compact td, .table--compact th { padding: .45rem .6rem; font-size: .8125rem; }

.status { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .16rem .45rem; border-radius: 4px; background: var(--paper-3); color: var(--ink-2); }
.status--published, .status--paid, .status--approved, .status--active { background: rgba(4,120,87,.12); color: var(--ok); }
.status--draft, .status--pending { background: rgba(180,83,9,.12); color: var(--warn); }
.status--failed, .status--spam, .status--blocked, .status--cancelled { background: rgba(185,28,28,.12); color: var(--bad); }
.pill { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .16rem .45rem; border-radius: 4px; background: var(--paper-3); color: var(--ink-2); }
.pill--on { background: rgba(4,120,87,.12); color: var(--ok); }
.pill--role { background: rgba(15,23,42,.07); }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; }
.tab { padding: .5rem .8rem; font-size: .85rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab--active { color: var(--brand); border-color: var(--brand); }
.tab span { background: var(--paper-3); border-radius: 999px; padding: .05rem .4rem; font-size: .72rem; margin-left: .25rem; }

.admin-toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-toolbar input[type=search] { border: 1px solid var(--line); border-radius: 999px; padding: .45rem .9rem; font: inherit; font-size: .85rem; background: var(--paper); min-width: 240px; }
.admin-toolbar select { border: 1px solid var(--line); border-radius: 999px; padding: .45rem .8rem; font: inherit; font-size: .82rem; background: var(--paper); }

.form { display: grid; gap: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: .9rem 1.2rem; }
.form__row { display: grid; gap: .25rem; }
.form__row--half { grid-column: span 1; }
.form__row--split { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form__label { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.form__input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; font: inherit; font-size: .9rem; background: var(--paper); color: var(--ink); }
.form__input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.form__input--title { font-family: var(--head); font-size: 1.25rem; font-weight: 700; }
.form__input--code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; line-height: 1.6; }
.form__input--color { padding: .15rem; height: 38px; }
.form__input--sm { width: auto; }
.form__hint { font-size: .72rem; color: var(--muted); margin: 0; }
.form__check { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--ink-2); cursor: pointer; }
.form__actions { display: flex; gap: .6rem; margin-top: 1rem; }
.form--inline { grid-auto-flow: column; grid-auto-columns: max-content; align-items: center; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .3rem .8rem; margin-bottom: .8rem; }
.form-admin .form__row--half { grid-column: span 1; }

.notice { padding: .7rem .95rem; border-radius: 9px; font-weight: 500; border: 1px solid; margin-bottom: 1rem; font-size: .875rem; }
.notice--success { background: rgba(4,120,87,.1); border-color: rgba(4,120,87,.3); color: var(--ok); }
.notice--error { background: rgba(185,28,28,.1); border-color: rgba(185,28,28,.3); color: var(--bad); }
.notice--info { background: rgba(2,132,199,.1); border-color: rgba(2,132,199,.3); color: #0369a1; }

.admin-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.admin-feed li { border-bottom: 1px solid var(--line-soft); padding-bottom: .6rem; }
.admin-feed__text { margin: 0 0 .2rem; font-size: .875rem; }
.admin-feed__meta { margin: 0; font-size: .75rem; color: var(--muted); }
.admin-feed__empty { color: var(--muted); }
.ranked { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; counter-reset: r; }
.ranked li { display: grid; grid-template-columns: 34px 1fr; gap: .6rem; align-items: start; font-size: .875rem; }
.ranked .rank { font-family: var(--head); font-weight: 800; color: var(--brand); }

.post-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
@media (max-width: 1099px) { .post-editor { grid-template-columns: minmax(0, 1fr); } }
.post-editor__main { display: grid; gap: 1.2rem; }
.post-editor__side { display: grid; gap: 1rem; position: sticky; top: 4rem; }
.post-editor__actions { display: flex; gap: .6rem; }
.faq-row { border-top: 1px solid var(--line-soft); padding-top: .7rem; margin-top: .7rem; display: grid; gap: .3rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: .7rem; margin-top: .6rem; }
.media-grid--large { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); margin-top: 1rem; }
.media-item { margin: 0; background: var(--paper-2); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.media-item img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.media-item figcaption { padding: .5rem .6rem; font-size: .75rem; }
.media-item__name { display: block; font-weight: 600; }
.media-item__type { display: block; color: var(--muted); }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: .8rem 0; }
.chart__bar { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 3px; position: relative; opacity: .85; }
.chart__bar:hover { opacity: 1; }
.chart__label { position: absolute; top: -1.1rem; left: 50%; transform: translateX(-50%); font-size: .65rem; color: var(--muted); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.2rem 0; }
.pagination__link { font-weight: 600; font-size: .85rem; }
.pagination__status { font-size: .8rem; color: var(--muted); }

.code-block { background: var(--ink); color: #e2e8f0; border-radius: 9px; padding: 1rem; font-size: .72rem; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.6; }
.wrap { width: min(100% - 2.5rem, 1240px); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, 520px); }
.auth-panel { padding: 2rem 1.8rem; }

@media (max-width: 899px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: var(--side); transform: translateX(-100%); transition: transform var(--t); z-index: 50; }
  body.nav-open .admin-side { transform: translateX(0); }
  .admin-burger { display: block; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; } }
