/* Admin panel: top bar + icon sidebar + card content.
   Uses the tokens style.css defines, so the palette lives in one place. */

body.admin { background: var(--panel); }

/* Icons are stroked, never filled, so one rule covers every svg here. */
.admin svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* -- top bar ------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center;
  justify-content: space-between;
  padding: .6rem 1.25rem;
  background: linear-gradient(180deg, #e8292e, #c81d23);
  color: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar { background: linear-gradient(180deg, #2b1215, #220e11); }
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
/* logo.webp is a 600x133 banner - 4.5:1. It is sized by height with the width
   left to follow; giving it a square box squashed it into an unreadable mark.
   It sits on a white chip because the artwork is red on white. */
.topbar-brand img {
  height: 30px; width: auto; display: block;
  border-radius: 3px; background: #fff; padding: 3px 5px;
}
.topbar-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-brand strong { font-size: .95rem; font-weight: 700; }
.topbar-brand em {
  font-style: normal; font-size: .66rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .72);
}
.topbar-site { display: inline-flex; align-items: center; gap: .4rem; color: #fff; text-decoration: none; font-size: .85rem; }
.topbar-site:hover { text-decoration: underline; }
.topbar-user { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; color: rgba(255, 255, 255, .95); }
.avatar {
  display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 .4rem;
  border-radius: 999px; background: rgba(255, 255, 255, .2);
  font-size: .6rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.topbar-out {
  color: #fff; text-decoration: none; font-size: .82rem; font-weight: 600;
  padding: .32rem .7rem; border: 1px solid rgba(255, 255, 255, .45); border-radius: var(--radius);
}
.topbar-out:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.side-toggle { display: none; background: none; border: 0; color: #fff; cursor: pointer; padding: .2rem; }

/* -- shell and sidebar --------------------------------------------- */

.admin-shell {
  max-width: 1420px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem;
  display: grid; gap: 1.5rem; grid-template-columns: 232px minmax(0, 1fr);
  align-items: start;
}

.sidenav {
  position: sticky; top: 72px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .5rem; display: grid; gap: .15rem;
}
.sidenav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .7rem; border-radius: var(--radius);
  color: var(--ink-soft); text-decoration: none; font-size: .9rem; font-weight: 600;
  border-left: 3px solid transparent;
}
.sidenav-item:hover { background: var(--panel); color: var(--ink); }
.sidenav-item.is-active {
  background: var(--accent-wash); color: var(--red); border-left-color: var(--red);
}
.sidenav-count {
  margin-left: auto; font-size: .7rem; font-weight: 700; color: var(--ink-faint);
  background: var(--panel); border-radius: 999px; padding: .1rem .45rem;
  font-variant-numeric: tabular-nums;
}
.sidenav-item.is-active .sidenav-count { background: #fff; color: var(--red); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidenav-item.is-active .sidenav-count { background: var(--paper); }
}
.sidenav-alert {
  margin-top: .5rem; padding: .7rem; border-radius: var(--radius);
  background: #fdf4e6; border: 1px solid #ecd6ae; text-decoration: none;
  display: grid; gap: .1rem;
}
.sidenav-alert strong { font-size: .82rem; color: #8a5312; }
.sidenav-alert span { font-size: .72rem; color: #a07434; line-height: 1.35; }
.sidenav-alert:hover { border-color: #d9b776; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidenav-alert { background: #2d2112; border-color: #4a3618; }
  :root:not([data-theme="light"]) .sidenav-alert strong { color: #e8b86a; }
  :root:not([data-theme="light"]) .sidenav-alert span { color: #b39055; }
}

.admin-main { min-width: 0; }
.admin-foot {
  max-width: 1420px; margin: 0 auto; padding: 0 1.25rem 2rem;
  color: var(--ink-faint); font-size: .8rem;
}

/* -- page header --------------------------------------------------- */

.page-bar {
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
  align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem;
}
.page-bar-text { min-width: 0; }
.page-bar-eyebrow {
  margin: 0 0 .2rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--red);
}
.page-bar h1 { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.page-bar-sub { margin: .35rem 0 0; font-size: .88rem; color: var(--ink-faint); }
.page-bar-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.group-label {
  margin: 1.6rem 0 .7rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint);
}
.group-label:first-of-type { margin-top: 0; }
.crumb-line { margin: -.75rem 0 1.25rem; font-size: .85rem; color: var(--ink-faint); }
.crumb-line a { font-weight: 600; }

/* -- notices ------------------------------------------------------- */

.notice {
  margin: 0 0 1.25rem; padding: .75rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line); border-left-width: 3px; font-size: .9rem; font-weight: 500;
}
.notice.is-good { background: #edf7ee; border-color: #bfdcc2; border-left-color: #3f8a4b; color: #1f5127; }
.notice.is-bad { background: #fdeeee; border-color: #e7bcbc; border-left-color: #c43b3b; color: #8d2020; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .notice.is-good { background: #16241a; border-color: #2d4a33; color: #a6d9ae; }
  :root:not([data-theme="light"]) .notice.is-bad { background: #2a1618; border-color: #53292c; color: #e8a9a9; }
}

/* -- buttons ------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border: 1px solid transparent; border-radius: var(--radius);
  background: var(--red); color: #fff;
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--red-dark); color: #fff; }
.btn svg { width: 16px; height: 16px; }
.btn.is-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.is-ghost:hover { border-color: var(--red); color: var(--red); background: var(--surface); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn, :root:not([data-theme="light"]) .btn:hover { color: #1a1a1a; }
  :root:not([data-theme="light"]) .btn.is-ghost { color: var(--ink); }
}

.inline-form { display: inline-flex; gap: .35rem; align-items: center; margin: 0; }
.inline-form.is-wide { display: flex; }
.inline-form button {
  font: inherit; font-size: .8rem; padding: .32rem .6rem; cursor: pointer;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.inline-form button:hover { border-color: var(--red); color: var(--red); }
.link-danger { color: #a32727 !important; }
.link-danger:hover { border-color: #a32727 !important; }

/* -- tiles --------------------------------------------------------- */

.tile-row {
  list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.tile > a, .tile > .tile-body {
  display: grid; gap: .1rem; padding: 1.1rem 1.15rem;
  text-decoration: none; color: var(--ink);
}
.tile > a { transition: background-color .12s ease; }
.tile > a:hover { background: var(--accent-wash); }
.tile-icon {
  display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: .55rem;
  border-radius: var(--radius); background: var(--accent-wash); color: var(--red);
}
.tile-icon svg { width: 17px; height: 17px; }
.tile-n {
  font-size: 1.8rem; font-weight: 700; line-height: 1.05;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.tile-l {
  margin-top: .25rem; font-size: .73rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
}
.tile.is-quiet .tile-icon { background: var(--panel); color: var(--ink-faint); }
.tile.is-warn .tile-icon { background: #fdf4e6; color: #b3651b; }
.tile.is-warn .tile-n { color: #b3651b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tile.is-warn .tile-icon { background: #2d2112; color: #e0a95f; }
  :root:not([data-theme="light"]) .tile.is-warn .tile-n { color: #e0a95f; }
}

/* -- panels -------------------------------------------------------- */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-top: 1.5rem; overflow: hidden;
}
.panel-split {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  justify-content: space-between; padding: 1.1rem 1.25rem;
}
.panel-head {
  display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center;
  justify-content: space-between; padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.panel-title { margin: 0; font-size: .98rem; font-weight: 700; color: var(--ink); }
.panel-sub { margin: .25rem 0 0; font-size: .82rem; color: var(--ink-faint); }
.panel-link { font-size: .83rem; font-weight: 600; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }
.panel-body { padding: 1.25rem; }
.panel > .grid { border: 0; border-radius: 0; }

/* -- tables -------------------------------------------------------- */

.grid {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  font-size: .89rem;
}
.grid th, .grid td {
  padding: .6rem .9rem; text-align: left; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.grid th {
  font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); background: var(--panel); font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: var(--accent-wash); }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .dim { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: .8rem; }
.grid-strong { font-weight: 600; text-decoration: none; }
.grid-strong:hover { text-decoration: underline; }
/* A path is reference text, not a call to action: quiet until hovered. */
.path-link {
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
  text-decoration: none; overflow-wrap: anywhere;
}
.path-link:hover { color: var(--red); text-decoration: underline; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; white-space: nowrap; }
.row-actions a { font-size: .82rem; font-weight: 600; text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }
.result-count { margin: 0 0 .75rem; font-size: .82rem; color: var(--ink-faint); }
.code { font: 700 .74rem/1 var(--mono); color: var(--red); margin-right: .4rem; }

.pill {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .71rem;
  font-weight: 600; background: var(--panel); color: var(--ink-soft); border: 1px solid var(--line);
}
.pill.is-live { background: #edf7ee; color: #2f6b3a; border-color: #c6e0ca; }
.pill.is-draft { background: #fdf0dc; color: #7a4a10; border-color: #e8d2ad; }
.pill.is-bad { background: #fdeeee; color: #8d2626; border-color: #e7bcbc; }
.pill.is-type { font-family: var(--mono); font-size: .68rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill.is-live { background: #16241a; color: #a6d9ae; border-color: #2d4a33; }
  :root:not([data-theme="light"]) .pill.is-draft { background: #33240f; color: #e0b375; border-color: #4a3618; }
  :root:not([data-theme="light"]) .pill.is-bad { background: #2f1a1c; color: #e3a2a2; border-color: #4a2a2c; }
}

/* -- forms --------------------------------------------------------- */

.filter {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1rem; padding: .85rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filter input[type="search"] {
  flex: 1 1 240px; min-width: 0; padding: .5rem .7rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.filter input[type="search"]:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.check {
  display: inline-flex; gap: .4rem; align-items: center; font-size: .85rem;
  color: var(--ink-soft); text-transform: none; letter-spacing: 0; font-weight: 500;
}

.card-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem; margin-bottom: 1.5rem;
}
.card-form.is-tight { padding: 1.15rem 1.35rem; margin-top: 1rem; }
.form-h3 {
  margin: 0 0 1rem; font-size: .7rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint);
}
.field { margin-bottom: 1.1rem; flex: 1 1 200px; min-width: 0; max-width: 100%; }
.field.is-shrink { flex: 0 0 auto; }
.field-row { display: flex; flex-wrap: wrap; gap: 0 1.1rem; min-width: 0; }
.field > label {
  display: block; margin-bottom: .35rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
}
.field input, .field select, .field textarea, .inline-form input {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
/* A <select> is otherwise as wide as its widest option, and the page list runs
   to long titles; this keeps it inside its column whatever the options say. */
.field select {
  min-width: 0; max-width: 100%;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.field select option { font-size: .88rem; }
.inline-form input { width: auto; flex: 1 1 120px; font-size: .84rem; padding: .32rem .5rem; }
.inline-form input.is-narrow { flex: 0 0 64px; }
.field textarea { font-family: var(--mono); font-size: .84rem; line-height: 1.55; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--red); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.hint { margin: .35rem 0 0; font-size: .78rem; color: var(--ink-faint); line-height: 1.45; }
.form-actions {
  margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
}

.danger-row {
  display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center;
  justify-content: space-between; margin-bottom: 1.5rem;
  padding: .9rem 1.25rem; border: 1px solid #e7bcbc; border-left: 3px solid #c43b3b;
  border-radius: var(--radius); background: #fdf6f6;
}
.danger-row span { font-size: .84rem; color: #8d2020; }
.btn-danger {
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  padding: .45rem .9rem; border-radius: var(--radius);
  background: var(--surface); color: #a32727; border: 1px solid #d99a9a;
}
.btn-danger:hover { background: #a32727; color: #fff; border-color: #a32727; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .danger-row { background: #241314; border-color: #53292c; }
  :root:not([data-theme="light"]) .danger-row span { color: #e8a9a9; }
  :root:not([data-theme="light"]) .btn-danger { color: #e8a9a9; border-color: #53292c; }
}

/* -- media grid ---------------------------------------------------- */

.media-grid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.media-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem; overflow: hidden;
}
.media-card:hover { border-color: var(--red); }
.media-card img {
  width: 100%; height: 112px; object-fit: cover; border-radius: 2px; display: block;
  background: var(--panel);
}
.media-kind {
  display: grid; place-items: center; height: 112px; border-radius: 2px;
  background: var(--panel); color: var(--ink-faint); font-size: .72rem;
}
.media-id { margin: .5rem 0 .2rem; font-size: .74rem; color: var(--red); font-weight: 700; }
.media-path { margin: 0; font-size: .69rem; color: var(--ink-faint); overflow-wrap: anywhere; line-height: 1.4; }

/* -- upload row ---------------------------------------------------- */

.upload-row {
  display: flex; flex-wrap: wrap; gap: .85rem 1rem; align-items: flex-end;
  margin-bottom: 1rem; padding: 1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--red); border-radius: var(--radius);
}
.upload-field { flex: 1 1 200px; min-width: 0; }
.upload-field label {
  display: block; margin-bottom: .3rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
}
.upload-field input {
  width: 100%; padding: .5rem .65rem; font: inherit; font-size: .88rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.upload-field input[type="file"] { padding: .4rem .5rem; }
.upload-field input:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--accent-wash);
}
.upload-field .hint { margin-top: .3rem; }
.upload-row .btn { flex: none; }

/* Facts the panel shows but does not let you type over, such as where a
   document's file is kept - that changes by uploading, not by editing text. */
.field-static {
  margin: 0; padding: .55rem .7rem; border: 1px solid var(--line-soft);
  border-radius: var(--radius); background: var(--panel); color: var(--ink-soft);
  font-size: .9rem; overflow-wrap: anywhere;
}
.field-static.is-path { font-family: var(--mono); font-size: .82rem; }

/* -- searchable select --------------------------------------------- */

.combo { position: relative; }
/* The native select stays in the form and still submits; it is only hidden
   from view once the search box is standing in for it. */
.combo-native { display: none; }
.combo-input {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.combo-input:focus {
  outline: none; border-color: var(--red); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.combo-list {
  position: absolute; z-index: 20; top: calc(100% + 2px); left: 0; right: 0;
  max-height: 320px; overflow-y: auto; margin: 0; padding: .25rem;
  list-style: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.combo-list [role="option"] {
  padding: .4rem .8rem; border-radius: var(--radius); cursor: pointer;
  font-size: .88rem; line-height: 1.4; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-list [role="option"]:hover,
.combo-list [role="option"].is-active { background: var(--accent-wash); color: var(--red); }
.combo-list [role="option"][aria-selected="true"] { font-weight: 700; color: var(--red); }
.combo-none { padding: .6rem .8rem; font-size: .85rem; color: var(--ink-faint); }

/* -- quick add ----------------------------------------------------- */

.quick-add {
  margin: 1.5rem 0; padding: 1.15rem 1.35rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--red); border-radius: var(--radius);
}
.quick-add-head { margin-bottom: 1rem; }
.quick-add .field { margin-bottom: .75rem; }
.quick-add input[type="file"] { padding: .4rem .5rem; }

/* -- blocks on the page editor ------------------------------------- */

.block-stack { display: grid; gap: .75rem; padding: 1rem 1.25rem 1.25rem; }
.block-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.block-card-head {
  display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center;
  padding: .6rem .85rem; background: var(--panel);
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.block-card-no {
  display: grid; place-items: center; width: 22px; height: 22px; flex: none;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .72rem; font-weight: 700; color: var(--ink-faint);
}
.block-card-title { font-size: .9rem; font-weight: 600; }
.block-card-meta { font-size: .78rem; color: var(--ink-faint); }
.block-card-actions {
  margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
}
.block-card-actions a { font-size: .82rem; font-weight: 600; text-decoration: none; }
.block-card-actions a:hover { text-decoration: underline; }
.block-card-preview {
  margin: 0; padding: .7rem .85rem; font-size: .85rem; color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.block-card-empty {
  margin: 0; padding: .8rem .85rem; font-size: .82rem; color: var(--ink-faint);
}

.item-rows { list-style: none; margin: 0; padding: 0; }
.item-row {
  display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center;
  padding: .45rem .85rem; border-bottom: 1px solid var(--line-soft);
}
.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: var(--accent-wash); }
.item-edit {
  display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center;
  flex: 1 1 auto; min-width: 0; margin: 0;
}
.item-edit input {
  padding: .3rem .5rem; font: inherit; font-size: .85rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.item-edit input:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--accent-wash);
}
.item-order { width: 56px; flex: none; text-align: right; }
/* The label takes the slack so every control after it lines up down the
   column, whatever the label's length. */
.item-label { flex: 1 1 auto; min-width: 8rem; }
.item-kind { flex: none; width: 5.5rem; }
.item-points {
  position: relative; flex: none;
  display: flex; gap: .4rem; align-items: center;
}
.item-points .picker-input { width: 17rem; max-width: 42vw; }
.item-points .picker-list { top: calc(100% + 2px); min-width: 320px; }
.item-change {
  flex: none; font: inherit; font-size: .74rem; font-weight: 600; cursor: pointer;
  padding: .15rem .5rem; border-radius: var(--radius);
  background: var(--surface); color: var(--ink-faint); border: 1px solid var(--line);
}
.item-change:hover { border-color: var(--red); color: var(--red); }
.item-points.is-changed .item-change { border-color: var(--red); color: var(--red); }
.item-kind { text-align: center; }
.item-links { display: flex; gap: .5rem; align-items: center; flex: none; }
/* A fixed width here keeps Remove in one column whether the row says
   "Edit document", "Edit page" or "Find in media". */
.item-links a {
  font-size: .8rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  min-width: 6.8rem;
}
.item-links a:hover { text-decoration: underline; }
.item-save { flex: none; }
.item-edit button {
  flex: none; font: inherit; font-size: .8rem; padding: .3rem .7rem; cursor: pointer;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.item-edit button:hover { border-color: var(--red); color: var(--red); }

/* -- item picker --------------------------------------------------- */

.js-picker { position: relative; }
.picker-list {
  position: absolute; z-index: 20; top: calc(100% - .6rem); left: 0; right: 0;
  max-height: 300px; overflow-y: auto; margin: 0; padding: .25rem;
  list-style: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.picker-list [role="option"] {
  display: grid; gap: .1rem; padding: .45rem .7rem;
  border-radius: var(--radius); cursor: pointer;
}
.picker-list [role="option"]:hover { background: var(--accent-wash); }
.picker-title { font-size: .88rem; font-weight: 600; color: var(--ink); }
.picker-hint {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-list [role="option"]:hover .picker-title { color: var(--red); }
.picker-none { padding: .6rem .8rem; font-size: .85rem; color: var(--ink-faint); }
.picker-chosen { font-weight: 600; }

/* -- pagination ---------------------------------------------------- */

.pager-bar {
  display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center;
  justify-content: space-between; margin: 0 0 1rem;
}
.pager-count { margin: 0; font-size: .82rem; color: var(--ink-faint); }
.pager-pages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.pager-pages a, .pager-pages .is-current {
  display: block; min-width: 34px; padding: .35rem .6rem; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .84rem; font-weight: 600; text-decoration: none;
  background: var(--surface); color: var(--ink-soft);
}
.pager-pages a:hover { border-color: var(--red); color: var(--red); }
.pager-pages .is-current { background: var(--red); border-color: var(--red); color: #fff; }
.pager-gap { display: grid; place-items: center; padding: 0 .2rem; color: var(--ink-faint); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pager-pages .is-current { color: #1a1a1a; }
}

.search-busy { width: 14px; height: 14px; flex: none; }
.search-busy.is-on {
  border: 2px solid var(--line); border-top-color: var(--red); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .search-busy.is-on { animation: none; border-top-color: var(--line); }
}

.media-remove { margin-top: .4rem; }

/* -- empty state --------------------------------------------------- */

.empty {
  padding: 2rem 1.25rem; border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--ink-faint); background: var(--surface); text-align: center; font-size: .9rem;
}

/* -- sign in ------------------------------------------------------- */

.signin-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 2.5rem 16px;
  background:
    radial-gradient(1100px 420px at 50% -8%, var(--accent-wash), transparent 70%),
    var(--panel);
}
.signin-card {
  width: 100%; max-width: 880px; background: var(--surface);
  border: 1px solid var(--line); border-top: 4px solid var(--red);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr 1fr; overflow: hidden;
}
.signin-brand {
  padding: 2.25rem 2rem; background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.5rem; text-align: center;
}
/* The logo is a wide lockup, so it is sized by width and keeps its ratio -
   constraining it to a square crushed it. */
.signin-logo { display: block; width: 100%; max-width: 250px; height: auto; }
.signin-place { margin: -.75rem 0 0; font-size: .85rem; font-weight: 600; color: var(--ink); }
.signin-rank { display: block; width: 100%; max-width: 215px; height: auto; }

.signin-form { padding: 2.25rem 2rem; }
.signin-eyebrow {
  margin: 0 0 .35rem; font-size: .7rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--red);
}
.signin-form h1 { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.signin-sub { margin: .4rem 0 1.75rem; font-size: .88rem; color: var(--ink-faint); }
.signin-field { margin-bottom: 1.1rem; }
.signin-field label {
  display: block; margin-bottom: .35rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
}
.signin-field input {
  width: 100%; padding: .7rem .8rem; font: inherit; font-size: .95rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.signin-field input::placeholder { color: #9b9b9b; }
.signin-field input:focus {
  outline: none; border-color: var(--red); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.signin-form button {
  width: 100%; margin-top: .4rem; padding: .8rem; font: inherit; font-size: .95rem;
  font-weight: 700; letter-spacing: .02em; cursor: pointer;
  border: 0; border-radius: var(--radius); background: var(--red); color: #fff;
}
.signin-form button:hover { background: var(--red-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signin-form button { color: #1a1a1a; }
}
.signin-back { margin: 1.25rem 0 0; font-size: .84rem; }
.signin-back a { text-decoration: none; }
.signin-back a:hover { text-decoration: underline; }

/* -- narrow screens ------------------------------------------------ */

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; display: none; }
  .sidenav.is-open { display: grid; }
  .side-toggle { display: block; }
}

@media (max-width: 720px) {
  .signin-card { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
  .signin-brand {
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 1.75rem 1.5rem; gap: 1rem;
  }
  .signin-rank { display: none; }
  .signin-form { padding: 1.75rem 1.5rem; }
  .topbar-user { display: none; }
}
