/* ==========================================================================
   Mythiq.net CMS — Admin design system
   Dark skin, mapped onto the public site's palette so the CMS reads as part
   of mythiq.net: #202125 canvas, #181819 panels, #121214 chrome, Catamaran
   type, and Mythiq blue (var(--mythiq-blue) / var(--mythiq-hover-blue)) as the single interactive accent.
   Status hues are functional signals only — never decoration.
   ========================================================================== */

/* Design tokens live in assets/css/ui.css (loaded before this sheet).
   The --a-* names are aliases resolved there — do not re-declare them. */

*, *::before, *::after { box-sizing: border-box; }

body.admin {
  margin: 0;
  font-family: var(--font);
  color: var(--a-ink);
  background: var(--a-bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--a-transition);
}

::selection { background: var(--a-accent); color: var(--a-on-accent); }

h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--a-ink);
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--a-ink);
}

.muted { color: var(--a-muted); }
.ta-right { text-align: right; }
.ta-center { text-align: center; }

/* Text for screen readers only — a bare count badge reads as a loose number
   otherwise. Same technique as .news-sr-only on the public side. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.admin-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--a-sidebar);
  color: #fff;
  padding: 28px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 0 12px;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
}

.admin-brand svg {
  display: block;
  height: 14px;
  width: auto;
  overflow: visible;
}

.admin-brand svg path { fill: currentColor; }

/* The Mythiq wordmark is served as an <img> rather than inlined, so it cannot
   inherit currentColor. It is already a light mark, which is what the dark
   sidebar wants. */
.admin-brand-logo {
  display: block;
  height: 22px;
  width: auto;
}

.admin-brand span {
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a-on-accent);
  background: var(--a-accent);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  line-height: 1.2;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  padding: 18px 14px 6px;
  user-select: none;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--a-radius-sm);
  font-weight: 500;
  font-size: 0.89rem;
  color: rgba(255, 255, 255, 0.62);
  transition: var(--a-transition);
}

.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--a-on-accent);
}

.admin-nav a.is-active {
  background: var(--a-accent);
  color: var(--a-on-accent);
  font-weight: 600;
}

.admin-nav a svg {
  color: rgba(255, 255, 255, 0.45);
  transition: var(--a-transition);
  flex-shrink: 0;
}

/* How much work is waiting behind a nav row. Sits hard right, keeps the danger
   hue on the active row too — the point is to be seen from anywhere in the CMS,
   including the screen it belongs to. */
.nav-count {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 21px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--a-danger);
  color: #2a0d0d;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.admin-nav a:hover svg { color: var(--a-on-accent); }
.admin-nav a.is-active svg { color: var(--a-on-accent); }

.admin-side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
}

.admin-side-bottom a,
.admin-side-bottom .admin-side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--a-radius-sm);
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.86rem;
  transition: var(--a-transition);
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.admin-side-bottom a:hover,
.admin-side-bottom .admin-side-link:hover {
  color: var(--a-on-accent);
  background: rgba(255, 255, 255, 0.08);
}

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

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.admin-topbar {
  height: 64px;
  background: var(--a-panel);
  border-bottom: 1px solid var(--a-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--a-ink);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title .crumb-root {
  color: var(--a-faint);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.admin-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--a-ink);
  background: var(--a-panel);
  padding: 5px 14px 5px 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--a-line);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--a-accent);
  color: var(--a-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.user-role {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a-muted);
  border: 1px solid var(--a-line);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  line-height: 1.2;
}

.admin-content {
  padding: 32px 32px 64px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

/* --------------------------------------------------------------------------
   Buttons — the variants live in assets/css/ui.css (.btn system), which this
   shell loads first. Only admin-specific button helpers remain here.
   -------------------------------------------------------------------------- */
.link-danger {
  color: var(--a-danger);
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.89rem;
  padding: 0;
  transition: var(--a-transition);
}

.link-danger:hover {
  color: var(--a-danger);
  text-decoration: underline;
}

/* Icon-only row actions */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--a-radius-sm);
  border: 1px solid var(--a-line);
  background: var(--a-panel);
  color: var(--a-muted);
  transition: var(--a-transition);
  cursor: pointer;
  padding: 0;
}

.btn-action:hover {
  color: var(--a-accent);
  border-color: var(--a-accent);
  background: var(--a-fill-soft);
}

.btn-action.btn-edit:hover {
  color: var(--a-on-accent);
  border-color: var(--a-accent);
  background: var(--a-accent);
}

.btn-action.btn-delete:hover {
  color: var(--a-danger);
  border-color: var(--a-danger-line);
  background: var(--a-danger-bg);
}

.icon-inline {
  stroke-width: 2.2px;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--a-radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--a-danger-bg);
  color: var(--a-danger);
  border-color: var(--a-danger-line);
}

.alert-success {
  background: var(--a-success-bg);
  color: var(--a-success);
  border-color: var(--a-success-line);
}

.alert-info {
  background: var(--a-info-bg);
  color: var(--a-info);
  border-color: var(--a-info-line);
}

.alert-icon { flex-shrink: 0; margin-top: 1px; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-card {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow-sm);
  overflow: hidden;
  margin-bottom: 32px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  background: var(--a-fill-soft);
  font-weight: 700;
  color: var(--a-muted);
  text-align: left;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 13px 20px;
  border-bottom: 1px solid var(--a-line);
  white-space: nowrap;
}

.data-table th.ta-right { text-align: right; }

.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--a-line);
  font-size: 0.9rem;
  color: var(--a-ink);
  vertical-align: middle;
  transition: background-color 0.12s ease;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background-color: var(--a-fill-soft); }

.data-table a:not(.btn-action) {
  font-weight: 600;
  color: var(--a-ink);
}

.data-table a:not(.btn-action):hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Badges — monochrome. Meaning is carried by fill weight, not hue.
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Live / published */
.badge-success {
  background-color: var(--a-success-bg);
  color: var(--a-success);
  border-color: var(--a-success-line);
}

/* Brand / elevated role — solid black */
.badge-accent {
  background-color: var(--a-accent);
  color: var(--a-on-accent);
  border-color: var(--a-accent);
}

/* Draft / pending */
.badge-warning {
  background-color: var(--a-warning-bg);
  color: var(--a-warning);
  border-color: var(--a-warning-line);
}

/* Destructive / blocked — functional red */
.badge-danger {
  background-color: var(--a-danger-bg);
  color: var(--a-danger);
  border-color: var(--a-danger-line);
}

/* Informational */
.badge-info {
  background-color: var(--a-info-bg);
  color: var(--a-info);
  border-color: var(--a-info-line);
}

/* Neutral tag */
.badge-secondary {
  background-color: var(--a-fill);
  color: var(--a-ink-soft);
  border-color: var(--a-line);
}

/* --------------------------------------------------------------------------
   Settings layout
   -------------------------------------------------------------------------- */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 40px;
}

.settings-card-header {
  padding: 0;
  border-bottom: none;
  background: transparent;
  position: sticky;
  top: 88px;
}

.settings-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--a-ink);
  margin: 0;
  letter-spacing: -0.02em;
}

.settings-card-desc {
  font-size: 0.87rem;
  color: var(--a-muted);
  line-height: 1.5;
  margin: 8px 0 0 0;
}

.settings-card-body {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow-sm);
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  transition: var(--a-transition);
}

.settings-card-body:hover { box-shadow: var(--a-shadow-md); }
/* Any element flagged col-2 spans the card's full row, not just .field ones —
   a bare <p> taking one cell of a two-column grid is what zig-zags a form. */
.settings-card-body .col-2 { grid-column: 1 / -1; }
.settings-card-body .form-actions { grid-column: 1 / -1; margin-top: 0; }

/* Section divider inside a settings form: a quiet uppercase rule that groups
   related fields (e.g. ownership/attribution on the mod editor) without
   pretending to be a field label. */
.settings-card-subhead {
  grid-column: 1 / -1;
  margin: 8px 0 -6px;
  padding-top: 18px;
  border-top: 1px solid var(--a-line);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a-muted);
}

/* --------------------------------------------------------------------------
   Stats / dashboard primitives
   -------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.stat {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  padding: 20px 22px;
  box-shadow: var(--a-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--a-shadow-md);
}

.stat-num {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--a-muted);
  font-size: 0.84rem;
  font-weight: 500;
}

/* Generic dashboard panel */
.grid-cell {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  padding: 24px;
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow-sm);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  padding: 24px;
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--a-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field.col-2 { grid-column: 1/-1; }

.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--a-ink);
  text-transform: none;
  letter-spacing: normal;
}

.field input,
.field textarea,
.field select {
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--a-ink);
  border: 1px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
  padding: 10px 14px;
  font-weight: 400;
  background: var(--a-fill);
  width: 100%;
  text-transform: none;
  letter-spacing: normal;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--a-accent);
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--a-faint);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--mythiq-hover-blue);
}

.field textarea {
  resize: vertical;
  min-height: 70px;
}

.field textarea.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  background-color: var(--a-fill-soft);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Login — split screen
   -------------------------------------------------------------------------- */
.admin-login-body {
  margin: 0;
  min-height: 100vh;
  background: var(--a-bg);
  display: block;
}

.login-split-container {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
  width: 100%;
}

/* Branded half of the auth split. The artwork is the outermost (deepest)
   background of mythiq.net's live login screen — the comet-streak field that
   sits behind the whole login card, mirrored here from
   wp-content/uploads/2020/06/starstrike_bg_2.jpg.

   The source is 2560x1440 landscape while this panel is a tall portrait strip,
   so `cover` crops the sides hard. Anchoring to the centre keeps the densest
   run of streaks in frame instead of landing on an empty corner.

   The image is already near-black, so it needs only a slight scrim to stop a
   bright streak from cutting through the wordmark. The flat colour underneath
   means a slow or failed image load never shows white. */
.login-visual-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  background-color: var(--a-sidebar);
  background-image:
    linear-gradient(rgba(18, 18, 20, 0.12), rgba(18, 18, 20, 0.32)),
    url('../img/uploads/2020/06/starstrike_bg_2.jpg');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  color: var(--a-on-accent);
  overflow: hidden;
  text-align: center;
}

.login-visual-panel::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 85% 85%, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  animation: visualGlowShift 10s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 2;
}

@keyframes visualGlowShift {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.12) translate(3%, 3%); }
}

.login-globe-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 1.5s var(--ease, ease), transform 1.5s var(--ease, ease);
}

.login-globe-container.is-ready {
  opacity: 0.15;
  transform: scale(1);
}

.login-globe {
  width: 100%;
  height: 100%;
  position: relative;
  outline: none;
}

.visual-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: radial-gradient(rgba(255, 255, 255, 1) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 3;
}

.visual-content {
  position: relative;
  z-index: 4;
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: visualFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes visualFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.visual-logo {
  width: 100%;
  max-width: 320px;
  color: var(--a-on-accent);
  display: flex;
  justify-content: center;
  align-items: center;
}

.visual-logo svg,
/* The wordmark is served as an <img> (already white-on-transparent), so it
   sizes like the inline SVG did but cannot take currentColor. */
.visual-logo img {
  width: 100%;
  height: auto;
  fill: currentColor;
}

.login-form-panel {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 96px 48px;
  background: var(--a-bg);
}

.form-container {
  max-width: 380px;
  width: 100%;
  animation: formFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
  opacity: 0;
}

@keyframes formFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-logo-header {
  display: none;
  justify-content: center;
  margin-bottom: 32px;
  color: var(--a-ink);
}

.mobile-logo-header svg,
.mobile-logo-header img {
  max-width: 180px;
  height: auto;
  fill: currentColor;
}

.form-header { margin-bottom: 32px; }

.form-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--a-ink);
  margin: 0 0 8px 0;
  letter-spacing: -0.025em;
}

.form-subheader {
  font-size: 0.95rem;
  color: var(--a-muted);
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--a-ink-soft);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper input {
  width: 100%;
  border: 1px solid var(--a-field-line);
  border-radius: var(--a-radius-sm);
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--a-ink);
  background: var(--a-field);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input::placeholder { color: var(--a-faint); }

.input-wrapper input:focus {
  outline: none;
  border-color: var(--mythiq-hover-blue);
}

/* Chrome paints autofilled fields with its own near-white background, which
   would undo the dark well and leave light-on-light text. The inset shadow is
   the only way to override it. */
.input-wrapper input:-webkit-autofill,
.input-wrapper input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--a-ink);
  caret-color: var(--a-ink);
  box-shadow: 0 0 0 1000px var(--a-field) inset;
}

.input-wrapper input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--a-ink);
  border-color: var(--mythiq-hover-blue);
  box-shadow: 0 0 0 1000px var(--a-field) inset;
}

.password-input-wrapper input { padding-right: 48px; }

.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a-muted);
  border-radius: var(--radius-md);
  transition: color 0.15s, background-color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.password-toggle-btn:hover {
  color: var(--a-accent);
  background-color: var(--a-fill);
}

.caps-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--a-danger);
  background: var(--a-danger-bg);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-weight: 600;
  margin-top: -8px;
  animation: shakeWarning 0.3s ease;
}

@keyframes shakeWarning {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--a-radius-sm);
  margin-top: 10px;
  position: relative;
  overflow: hidden;
  background: var(--a-accent);
  color: var(--a-on-accent);
  border: 1px solid var(--a-accent);
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.1s ease;
}

.login-btn:hover {
  background: var(--a-accent-hover);
  border-color: var(--a-accent-hover);
  color: var(--a-on-accent);
}

.login-btn:active {
  background: var(--a-accent);
  border-color: var(--a-accent);
  transform: scale(0.98);
}

.btn-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.spinner {
  animation: rotateSpinner 1.2s linear infinite;
  width: 18px;
  height: 18px;
}

.spinner .path {
  stroke: currentColor;
  stroke-linecap: round;
  animation: dashSpinner 1.5s ease-in-out infinite;
}

@keyframes rotateSpinner {
  100% { transform: rotate(360deg); }
}

@keyframes dashSpinner {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Honeypot field: moved off-screen rather than display:none so simple bots still see it. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.alert-shake {
  animation: shakeWarning 0.35s ease;
}

.input-wrapper input:disabled {
  background: var(--a-field-disabled);
  border-color: var(--a-line);
  color: var(--a-muted);
  cursor: not-allowed;
}

.login-btn:disabled {
  background: var(--a-fill);
  border-color: var(--a-line-strong);
  color: var(--a-muted);
  cursor: not-allowed;
  transform: none;
}

.form-footer {
  margin-top: 40px;
  text-align: center;
}

.login-hint {
  font-size: 0.82rem;
  color: var(--a-faint);
  margin: 0 0 12px 0;
}

.back-to-home {
  position: absolute;
  top: 28px;
  left: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--a-muted);
  background: var(--a-panel);
  border: 1px solid var(--a-line-strong);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.back-to-home-icon {
  transition: transform 0.2s ease;
}

.back-to-home:hover {
  color: var(--a-on-accent);
  background: var(--a-accent);
  border-color: var(--a-accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  text-decoration: none;
}

.back-to-home:hover .back-to-home-icon {
  transform: translateX(-3px);
}

.back-to-home:active {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .settings-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .settings-card-header { position: static; }
  .login-split-container { grid-template-columns: 1fr; }
  .login-visual-panel { display: none; }
  .login-form-panel {
    padding: 72px 24px 40px;
    min-height: 100vh;
  }
  .mobile-logo-header { display: flex; }
  .back-to-home { top: 20px; left: 20px; }
}

@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 16px 14px;
  }
  .admin-brand { margin-bottom: 0; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-section-label { display: none; }
  .admin-side-bottom {
    flex-direction: row;
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
    margin-left: auto;
  }
  .admin-topbar { padding: 0 20px; }
  .admin-content { padding: 24px 20px 48px; }
  .form-grid, .stat-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Member management
   ========================================================================== */

.member-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 20px 0;
  padding: 14px 16px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow-sm);
}
.member-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 200px;
}
.member-search svg {
  position: absolute;
  left: 10px;
  color: var(--a-faint);
  pointer-events: none;
}
.member-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
  font: inherit;
  background: var(--a-fill-soft);
}
.member-search input:focus {
  outline: none;
  border-color: var(--mythiq-hover-blue);
  background: var(--a-panel);
}
.member-filter-select { margin: 0; min-width: 130px; }
.member-filter-select select {
  padding: 8px 10px;
  border: 1px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
  background: var(--a-fill-soft);
  font: inherit;
}
.member-filter-select select:focus {
  outline: none;
  border-color: var(--mythiq-hover-blue);
}
.btn-link-muted {
  color: var(--a-muted);
  font-size: 0.88rem;
  text-decoration: none;
  padding: 8px 4px;
}
.btn-link-muted:hover { color: var(--a-ink); }

/* Member row cell: avatar + name/email stack */
.member-cell { display: flex; align-items: center; gap: 12px; }
.member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--a-ink);
  color: var(--a-panel);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  user-select: none;
}
.member-avatar-lg { width: 52px; height: 52px; font-size: 1.2rem; }
.member-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.member-display { font-weight: 600; }
.member-email { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.pagination a {
  padding: 7px 14px;
  border: 1px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
  text-decoration: none;
  color: var(--a-ink);
  font-weight: 600;
  background: var(--a-panel);
  transition: var(--a-transition);
}
.pagination a:hover { border-color: var(--a-ink); background: var(--a-fill); }
.pagination-disabled { color: var(--a-faint); padding: 7px 14px; }
.pagination-info { color: var(--a-muted); font-size: 0.88rem; }

/* Member detail page */
.member-view-head { display: flex; align-items: center; gap: 16px; }
.member-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
}
.member-facts { display: flex; flex-direction: column; gap: 14px; }
.member-fact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--a-line);
}
.member-fact:last-child { border-bottom: 0; padding-bottom: 0; }
.member-fact > span:first-child {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  flex-shrink: 0;
}
.member-inline-form { display: inline; margin: 0; }

/* A fact whose control is too wide to sit beside its label — the author
   standing form is a select, a free-text note and a button. Stacking it keeps
   the note field usable instead of squeezing three controls into the right-hand
   half of the row. */
.member-fact-stack { flex-direction: column; align-items: stretch; gap: 10px; }
.member-tier-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.member-tier-form select { flex: 0 0 auto; }
/* The note is the field that actually needs the room, so it takes whatever is
   left rather than sharing the row equally. */
.member-tier-form input[type="text"] { flex: 1 1 260px; min-width: 0; }

/* A settings-card body holding a single full-width child (facts list,
   connection list, action row) — collapses the default 2-col grid. */
.settings-card-body.single {
  grid-template-columns: 1fr;
}

/* Connection list */
.connection-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.connection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--a-line);
}
.connection-item:last-child { border-bottom: 0; }
.connection-info { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.connection-provider { font-weight: 600; }
.connection-meta { font-size: 0.83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-empty { padding: 8px 0; }

/* Action row on the edit form — overrides .settings-card-body (a grid)
   with a flex row of buttons. */
.member-action-row {
  display: flex !important;
  grid-template-columns: none;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.member-action-row form { display: inline; margin: 0; }

@media (max-width: 760px) {
  .member-view-head { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   Email template editor — preview dialog
   -------------------------------------------------------------------------- */
.etpl-tokens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.etpl-tokens code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--a-fill);
  border: 1px solid var(--a-line);
  padding: 3px 8px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.etpl-preview-status {
  font-weight: 400;
  font-size: 12px;
}

dialog.etpl-dialog {
  width: min(620px, 94vw);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow-md);
  background: var(--a-panel);
  color: var(--a-ink);
  overflow: hidden;
}
dialog.etpl-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}
.etpl-dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--a-line);
  font-size: 13px;
  font-weight: 600;
}
.etpl-dialog-head > span:first-child { margin-right: auto; }
.etpl-dialog-close { padding: 6px 14px; }
/* Matches the email's dark canvas (#202125): this iframe renders the actual
   transactional email, so the frame must not imply a light document. */
.etpl-preview-frame {
  width: 100%;
  height: 70vh;
  min-height: 440px;
  border: 0;
  background: #202125;
  display: block;
}

/* --------------------------------------------------------------------------
   Support desk
   Inbox, conversation thread and help-article screens. Built on the existing
   tokens only — the three voices in a thread (requester, staff reply, internal
   note) are separated by the accent and the warning hue that already carry
   those meanings elsewhere in the CMS, not by new colours.
   -------------------------------------------------------------------------- */
.support-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--a-line);
  margin-bottom: 24px;
}
.support-tab {
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--a-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--a-transition);
}
.support-tab:hover { color: var(--a-ink); }
.support-tab.is-active {
  color: var(--a-ink);
  border-bottom-color: var(--a-accent);
}

/* Two-line table cell: primary link over a muted secondary line. */
.support-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.support-cell-subject { font-weight: 600; color: var(--a-ink); text-decoration: none; }
.support-cell-subject:hover { color: var(--a-accent2); }
.support-cell .muted { font-size: 0.82rem; }

/* Inline status/priority setter inside a member-fact row. */
.support-inline-control { display: flex; align-items: center; gap: 8px; }
.support-inline-control select {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--a-ink);
  background: var(--a-fill);
  border: 1px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
  padding: 7px 10px;
}
.support-inline-control .btn-ghost { padding: 7px 14px; font-size: 0.85rem; }

/* Conversation */
.support-thread-admin {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.support-msg-admin {
  border: 1px solid var(--a-line);
  border-left: 3px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
  background: var(--a-fill-soft);
  padding: 16px 18px;
}
.support-msg-admin.is-staff {
  border-left-color: var(--a-accent);
  background: var(--a-info-bg);
}
/* An internal note must never be mistaken for something the requester can see,
   so it takes the warning hue the CMS already uses for "careful". */
.support-msg-admin.is-note {
  border-left-color: var(--a-warning);
  background: var(--a-warning-bg);
}
.support-msg-admin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.support-msg-admin-who { font-weight: 600; font-size: 0.9rem; color: var(--a-ink); }
.support-msg-admin.is-note .support-msg-admin-who { color: var(--a-warning); }
.support-msg-admin-time { font-size: 0.8rem; color: var(--a-muted); white-space: nowrap; }
.support-msg-admin-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--a-ink-soft);
  overflow-wrap: anywhere;
}

.support-attachments-admin {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.support-attachments-admin a {
  display: block;
  width: 130px;
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius-sm);
  overflow: hidden;
  text-decoration: none;
  transition: var(--a-transition);
}
.support-attachments-admin a:hover { border-color: var(--a-accent); }
.support-attachments-admin img { width: 100%; height: 84px; object-fit: cover; display: block; }
.support-attachments-admin span {
  display: block;
  padding: 6px 8px;
  font-size: 0.72rem;
  color: var(--a-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Reply and internal-note submit sit side by side on the same form. */
.support-respond-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 720px) {
  .support-tabs { overflow-x: auto; scrollbar-width: none; }
  .support-tabs::-webkit-scrollbar { display: none; }
  .support-tab { flex: 0 0 auto; }
}

/* --------------------------------------------------------------------------
   Mods desk
   Review queue, one-mod screen, games and comment moderation. Built on the
   existing tokens and on the classes the Support desk already established
   (.support-tabs, .support-cell, .table-card, .badge-*) — a second feature is
   not a reason for a second visual language.
   -------------------------------------------------------------------------- */

/* The one-mod screen is built out of .settings-card, so everything below is
   about living inside that component: its body is a two-column grid, which is
   right for the metadata form and wrong for everything else on the screen —
   those cards pass `single` and use these helpers.

   A release table carries more columns than fit in the ~770px left beside the
   280px header rail, and hiding its Downloads and Actions columns behind a
   scrollbar is no good on a screen whose whole purpose is acting on them, so
   the two table cards stack instead: header above, body across the full width.
   The scroll wrapper stays as the fallback for narrow windows. */
.settings-card.is-wide { grid-template-columns: 1fr; gap: 14px; }
.settings-card.is-wide .settings-card-header { position: static; }
.settings-card.is-wide .settings-card-desc { max-width: 70ch; }
.mods-table-scroll { overflow-x: auto; }

/* A moderation list is wrapped so the whole list is one grid row and its own
   row margins keep doing the spacing inside it. */
.mods-moderation-list > *:last-child { margin-bottom: 0; }

/* Status badge below the title in a card's header column. */
.settings-card-header .badge { margin-top: 12px; }

/* Facts panel on the one-mod screen. Auto-fit so it reflows without a query. */
.mods-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px 24px;
  margin: 0;
}
.mods-facts div { min-width: 0; }
.mods-facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--a-muted);
  margin-bottom: 4px;
}
.mods-facts dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--a-ink);
  overflow-wrap: anywhere;
}
.mods-facts dd .muted { display: block; font-size: 0.82rem; }

/* Approve / unpublish sit together; reject carries its reason field inline,
   because a rejection without one is refused by the controller. Both sit
   directly in a .settings-card-body.single, so the card's own grid gap does
   the vertical spacing — no margins of their own. */
.mods-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mods-reject-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--a-line);
}
.mods-reject-form .field { flex: 1 1 320px; margin: 0; }

/* Games table: box art beside the name, with a lettered tile standing in when a
   game has no art yet. Portrait, because the art itself is: the public shelf
   shows a 2:3 box, and a 16:9 thumbnail here cropped it to a band across its
   middle — so the one place staff check the artwork showed a different picture
   from the one readers get. */
.mods-game-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mods-game-thumb {
  flex: 0 0 auto;
  width: 34px;
  height: 51px;
  border-radius: var(--a-radius-sm);
  object-fit: cover;
  display: block;
  border: 1px solid var(--a-line);
}
.mods-game-thumb-empty {
  display: grid;
  place-items: center;
  background: var(--a-fill);
  color: var(--a-muted);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Moderation rows. A hidden comment stays legible to staff but is visibly
   demoted, so "hidden" never has to be inferred from the badge alone. */
.mods-comment-admin {
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--a-fill-soft);
  border: 1px solid var(--a-line);
  border-left: 3px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
}
.mods-comment-admin.is-hidden {
  border-left-color: var(--a-warning);
  background: var(--a-warning-bg);
  opacity: 0.75;
}
.mods-comment-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.mods-comment-admin-head .row-actions { margin-left: auto; }
.mods-comment-admin p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--a-ink-soft);
  overflow-wrap: anywhere;
}

/* Community reports. Same shape as the comment rows above, with the status
   carried on the left border so an open one is obvious while scanning. */
.mods-report-admin {
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--a-fill-soft);
  border: 1px solid var(--a-line);
  border-left: 3px solid var(--a-line-strong);
  border-radius: var(--a-radius-sm);
}
.mods-report-admin.is-open      { border-left-color: var(--a-danger);  background: var(--a-danger-bg); }
.mods-report-admin.is-reviewed  { border-left-color: var(--a-success); }
.mods-report-admin.is-dismissed { opacity: 0.7; }
.mods-report-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.mods-report-admin-head .row-actions { margin-left: auto; }
.mods-report-admin p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--a-ink-soft);
  overflow-wrap: anywhere;
}
