/* ═══════════════════════════════════════════════════════════════
   Fenris Labs — Companions
   Same design language as fenrislabs.io: gold on near-black, Space
   Grotesk over Inter, 13px radii, uppercase pills. This is a
   subsection of that site and should read as one.
   ─────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;

  /* palette — lifted from fenrislabs.io/assets/css/style.css */
  --ink:       #08090b;
  --ink-2:     #0c0e12;
  --panel:     #12151b;
  --panel-2:   #171b23;
  --panel-3:   #1d222c;
  --line:      #232935;
  --line-2:    #333b4a;
  --line-soft: #1a1f28;

  --text:      #eceef4;
  --muted:     #97a0af;
  --faint:     #6d7684;

  --gold:      #d9a441;
  --gold-soft: #f0c479;
  --gold-dim:  rgba(217,164,65,.12);
  --gold-line: rgba(217,164,65,.32);
  --accent:    var(--gold);

  --ok:        #7fd18f;
  --ok-dim:    rgba(127,209,143,.13);
  --info:      #66c0f4;
  --info-dim:  rgba(102,192,244,.13);
  --warn:      #e0a94f;
  --warn-dim:  rgba(224,169,79,.13);
  --danger:    #ff7a6b;
  --danger-dim: rgba(255,122,107,.13);

  --wrap:      1180px;
  --bar-h:     54px;
  --gap:       13px;
  --r:         13px;
  --r-sm:      9px;

  --ease:      cubic-bezier(.22,.68,.32,1);
  --font-d:    'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-b:    'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:      ui-monospace, 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;

  --shadow:    0 12px 30px -18px rgba(0,0,0,.9);
  --shadow-lg: 0 24px 56px -26px rgba(0,0,0,.95);

  --sidebar:   232px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-d);
  font-weight: 600; line-height: 1.15; letter-spacing: -.01em;
}
h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }

a { color: var(--gold); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--gold-soft); }
img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }

::selection { background: rgba(217,164,65,.3); color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 6px;
  border: 3px solid transparent; background-clip: content-box;
}

.sr, .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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 999;
  background: var(--gold); color: #14110a; font-weight: 600;
  padding: 9px 15px; border-radius: 8px;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 10px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .hero__stars { display: none; }
}

/* ═══════════ sticky bar (public) ═══════════ */
.bar {
  position: sticky; top: 0; z-index: 50;
  height: var(--bar-h);
  display: flex; align-items: center;
  background: rgba(8,9,11,.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.bar.is-stuck { background: rgba(8,9,11,.92); border-bottom-color: var(--line); }
.bar__inner {
  width: 100%; max-width: var(--wrap); margin-inline: auto;
  padding-inline: 20px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { width: 30px; height: 30px; transition: transform .5s var(--ease); }
.brand:hover img { transform: rotate(-12deg) scale(1.07); }
.brand span {
  font-family: var(--font-d); font-weight: 700; font-size: 15.5px;
  letter-spacing: .13em; text-transform: uppercase; white-space: nowrap;
}
.brand .dim { color: var(--muted); font-weight: 500; letter-spacing: .13em; }
.bar__links { display: flex; align-items: center; gap: 3px; }
.bar__links a {
  padding: 7px 12px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.bar__links a:hover { color: var(--text); background: rgba(255,255,255,.07); }
.bar__cta {
  padding: 7px 14px !important; margin-left: 6px;
  background: rgba(217,164,65,.12); color: var(--gold-soft) !important;
  border: 1px solid var(--gold-line);
  font-weight: 600 !important;
}
.bar__cta:hover { background: rgba(217,164,65,.2) !important; color: var(--gold-soft) !important; }

/* ═══════════ hero ═══════════ */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(46px, 8vw, 88px) 20px clamp(38px, 6vw, 62px);
  background: radial-gradient(115% 130% at 50% -30%, #1a2130 0%, #0d1016 45%, var(--ink) 76%);
  border-bottom: 1px solid var(--line);
}
.hero__stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__glow {
  position: absolute; top: -110%; left: 50%; transform: translateX(-50%);
  width: min(680px, 120vw); aspect-ratio: 1;
  background: radial-gradient(circle, rgba(159,182,216,.16), transparent 62%);
  pointer-events: none;
}
.hero__inner {
  position: relative; z-index: 1;
  max-width: var(--wrap); margin-inline: auto;
}
.hero__mark {
  width: clamp(54px, 7vw, 70px);
  filter: drop-shadow(0 0 30px rgba(159,182,216,.35));
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(1.9rem, 5.2vw, 3.1rem);
  font-weight: 700; letter-spacing: .03em; line-height: 1.08;
  max-width: 18ch;
  background: linear-gradient(180deg, #fff 20%, #b4becf 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(180deg, var(--gold-soft) 10%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  margin-top: 14px; max-width: 56ch;
  color: var(--muted); font-size: clamp(.95rem, 1.8vw, 1.06rem); line-height: 1.6;
}
.hero .cta { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero.center { text-align: center; }
.hero.center h1, .hero.center p { margin-inline: auto; }
.hero.center .cta { justify-content: center; }

/* ═══════════ layout ═══════════ */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.section { padding: clamp(34px, 6vw, 62px) 0; }
.section-head { margin-bottom: 26px; }
.section-head h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
.section-head p { color: var(--muted); margin-top: 8px; max-width: 62ch; font-size: .95rem; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: var(--ink-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px 11px; color: var(--text);
}
.sidebar-brand:hover { color: var(--text); }
.sidebar-brand img { width: 28px; height: 28px; }
.sidebar-brand b {
  font-family: var(--font-d); font-weight: 700; font-size: 13.5px;
  letter-spacing: .13em; text-transform: uppercase; display: block;
}
.sidebar-brand small {
  display: block; font-size: 10.5px; font-weight: 500; color: var(--gold);
  letter-spacing: .14em; text-transform: uppercase;
}
.nav { padding: 4px 8px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  padding: 14px 8px 6px;
  font-family: var(--font-d);
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover { background: rgba(255,255,255,.055); color: var(--text); }
.nav a.active {
  background: var(--gold-dim); color: var(--gold-soft); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav a .count {
  margin-left: auto; font-size: 10.5px; color: var(--faint);
  background: var(--panel-2); padding: 1px 6px; border-radius: 999px;
}
.sidebar-foot {
  margin-top: auto; padding: 11px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: var(--bar-h); padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(8,9,11,.86);
  backdrop-filter: blur(14px) saturate(140%);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.005em; }
.page { padding: 22px 20px 70px; max-width: var(--wrap); width: 100%; }
.page-head { margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 68ch; font-size: .92rem; }
.menu-btn { display: none; }
.spacer { flex: 1; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 60; inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform .24s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.6);
  }
  .menu-btn { display: grid; place-items: center; }
  .page { padding: 16px 15px 70px; }
  .topbar { padding: 0 15px; }
  .wrap { padding-inline: 15px; }
}

/* ═══════════ primitives ═══════════ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px;
}
.card.pad-0 { padding: 0; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: .97rem; }
.card-body { padding: 15px 16px; }
.card-foot {
  padding: 11px 16px; border-top: 1px solid var(--line);
  background: var(--ink-2);
  border-radius: 0 0 var(--r) var(--r);
  display: flex; gap: 9px; align-items: center;
}

.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); }
.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 5px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack.tight { gap: 7px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .855rem; }
.tiny  { font-size: .745rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* stat tiles */
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px;
}
.stat .k {
  font-family: var(--font-d);
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.stat .v {
  font-family: var(--font-d);
  font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em;
  margin-top: 3px; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat .sub { font-size: .76rem; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.stat.accent .v { color: var(--gold-soft); }
.stat.ok .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.danger .v { color: var(--danger); }

/* ═══════════ buttons ═══════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--panel-2); color: var(--text);
  font-size: .855rem; font-weight: 550;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); color: var(--text); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .42; pointer-events: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border-color: var(--gold); color: #17130a; font-weight: 650;
  box-shadow: 0 8px 22px -12px rgba(217,164,65,.9);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #f6d093, var(--gold-soft));
  color: #17130a; border-color: var(--gold-soft);
}
.btn-danger { color: var(--danger); border-color: rgba(255,122,107,.35); }
.btn-danger:hover { background: var(--danger-dim); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255,255,255,.06); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-lg { padding: 11px 22px; font-size: .97rem; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; max-width: 100%; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn.active {
  background: var(--gold-dim); color: var(--gold-soft);
  border-color: var(--gold-line); z-index: 1;
}
/* a filter row must never widen the page on a phone — scroll it instead */
.btn-group.scrollable {
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.btn-group.scrollable::-webkit-scrollbar { display: none; }
.btn-group.scrollable .btn { flex: 0 0 auto; }

/* ═══════════ pills / badges ═══════════ */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; font-style: normal;
  border: 1px solid rgba(255,255,255,.17);
  background: rgba(10,12,16,.6);
  color: #d3d9e4; white-space: nowrap;
}
.badge.ok, .pill--live   { border-color: rgba(127,209,143,.55); color: var(--ok); }
.badge.info, .pill--good { border-color: rgba(102,192,244,.5);  color: #8ed3f7; }
.badge.warn, .pill--soon { border-color: rgba(224,169,79,.55);  color: var(--gold-soft); }
.badge.danger { border-color: rgba(255,122,107,.5); color: var(--danger); }
.badge.accent { border-color: var(--gold-line); color: var(--gold-soft); background: var(--gold-dim); }

.tag {
  display: inline-block;
  font-size: 10.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  background: rgba(10,12,16,.6); color: var(--muted);
  border: 1px solid rgba(255,255,255,.1);
}
.tag-row { display: flex; gap: 5px; flex-wrap: wrap; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: 0 0 7px; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.dot.live { animation: ping 2.2s var(--ease) infinite; }
@keyframes ping {
  0%       { box-shadow: 0 0 0 0 rgba(126,222,149,.6); }
  70%,100% { box-shadow: 0 0 0 6px rgba(126,222,149,0); }
}

/* ═══════════ forms ═══════════ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label {
  font-size: .855rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.field .help { font-size: .765rem; color: var(--muted); line-height: 1.45; }
.field .err { font-size: .765rem; color: var(--danger); }

input[type=text], input[type=number], input[type=url], input[type=email],
input[type=password], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
input[readonly], input:disabled, select:disabled, textarea[readonly], textarea:disabled {
  background: var(--panel); color: var(--muted); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
textarea.tall { min-height: 250px; }
textarea.mono { font-family: var(--mono); font-size: .82rem; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%2397a0af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input[type=checkbox] {
  width: 16px; height: 16px; margin-top: 3px; flex: 0 0 16px;
  accent-color: var(--gold); cursor: pointer;
}
.check span { font-size: .855rem; }
.check .help { display: block; color: var(--muted); font-size: .765rem; margin-top: 2px; }
.counter {
  margin-left: auto; font-size: .72rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.counter.warn { color: var(--warn); }
.counter.over { color: var(--danger); font-weight: 600; }
fieldset { border: 0; padding: 0; }
legend {
  font-family: var(--font-d);
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint); padding: 0 0 7px;
}

/* ═══════════ tables ═══════════ */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: .855rem; }
thead th {
  text-align: left; padding: 9px 13px;
  font-family: var(--font-d);
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 10px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,.022); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: .8rem; }

/* ═══════════ tabs ═══════════ */
.tabs {
  display: flex; gap: 2px; overflow-x: auto;
  border-bottom: 1px solid var(--line); margin-bottom: 20px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 9px 13px; font-size: .855rem; font-weight: 550;
  color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: color .2s var(--ease), border-color .2s var(--ease);
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--gold-soft); border-bottom-color: var(--gold); }

/* ═══════════ notices ═══════════ */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: .855rem; line-height: 1.5;
  border: 1px solid transparent; margin-bottom: var(--gap);
}
.notice .ico { flex: 0 0 auto; font-weight: 700; }
.notice.info   { background: var(--info-dim);   color: #9ed4fa; border-color: rgba(102,192,244,.25); }
.notice.ok     { background: var(--ok-dim);     color: var(--ok); border-color: rgba(127,209,143,.25); }
.notice.warn   { background: var(--warn-dim);   color: var(--gold-soft); border-color: var(--gold-line); }
.notice.danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(255,122,107,.28); }
.notice strong { font-weight: 650; }
.notice a { color: inherit; text-decoration: underline; }

.toast-wrap {
  position: fixed; bottom: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  padding: 11px 15px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg); font-size: .855rem;
  animation: slidein .24s var(--ease);
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.danger { border-left: 3px solid var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px) } }

.empty {
  text-align: center; padding: 46px 24px; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: var(--r);
}
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 44ch; margin: 0 auto 14px; font-size: .875rem; }

/* ═══════════ diff ═══════════ */
.diff {
  font-family: var(--mono); font-size: .78rem; line-height: 1.55;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); overflow-x: auto; padding: 9px 0;
}
.diff div { padding: 0 13px; white-space: pre-wrap; word-break: break-word; }
.diff .add  { background: var(--ok-dim); color: var(--ok); }
.diff .del  { background: var(--danger-dim); color: var(--danger); }
.diff .hunk { color: #8ed3f7; background: var(--info-dim); }
.diff .meta { color: var(--faint); }
.diff .ctx  { color: var(--muted); }

/* ═══════════ charts ═══════════ */
.chart { width: 100%; height: 170px; display: block; }
.chart-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: .74rem; color: var(--muted); margin-top: 7px;
}
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.bar-track { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: 4px; }
.bar-fill.ok { background: var(--ok); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.danger { background: var(--danger); }

/* ═══════════ storefront: cast tiles ═══════════ */
.cast-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
}
.cast-card {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--ink-2);
  display: flex; flex-direction: column;
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.cast-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--accent) 60%, #000);
}
.cast-art { aspect-ratio: 4 / 5; position: relative; overflow: hidden; background: var(--panel); }
.cast-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.cast-card:hover .cast-art img { transform: scale(1.035); }
.cast-art .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-family: var(--font-d); font-size: 2.6rem; font-weight: 600; color: var(--line-2);
  background: linear-gradient(150deg, #1c2331, #0b0d12 72%);
}
.cast-art .badge {
  position: absolute; top: 11px; right: 11px;
  backdrop-filter: blur(6px);
}
.cast-art::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(6,7,10,.55) 0%, transparent 34%);
}
.cast-body {
  padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1;
  background: var(--panel); border-top: 1px solid var(--line);
}
.cast-body h3 { font-size: 1.28rem; font-weight: 600; letter-spacing: -.01em; }
.cast-body .tagline { font-size: .845rem; color: #c6cdda; line-height: 1.4; flex: 1; }
.cast-body .foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 9px; margin-top: 3px; border-top: 1px solid var(--line);
  font-size: .755rem; color: var(--faint);
}
.cast-body .price {
  margin-left: auto; color: var(--text); font-weight: 600;
  font-family: var(--font-d); font-size: .95rem;
}

/* character page */
.char-hero {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 34px; align-items: start; padding: 30px 0;
}
@media (max-width: 820px) { .char-hero { grid-template-columns: 1fr; gap: 20px; } }
.gallery { display: grid; gap: 9px; }
.gallery .lead {
  border-radius: var(--r); overflow: hidden; background: var(--panel);
  aspect-ratio: 4/5; border: 1px solid var(--line);
}
.gallery .lead img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.gallery .thumbs img {
  border-radius: var(--r-sm); aspect-ratio: 1; object-fit: cover;
  cursor: pointer; opacity: .62; border: 1px solid var(--line);
  transition: opacity .2s var(--ease), border-color .2s var(--ease);
}
.gallery .thumbs img:hover, .gallery .thumbs img.active {
  opacity: 1; border-color: var(--gold-line);
}

.tier-card {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 16px; background: var(--panel);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.tier-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tier-card.featured {
  border-color: var(--gold-line);
  background: linear-gradient(180deg, var(--gold-dim), transparent 55%), var(--panel);
}
.tier-card.featured:hover {
  border-color: var(--gold);
  box-shadow: 0 18px 40px -24px rgba(217,164,65,.7);
}
.tier-card .price {
  font-family: var(--font-d);
  font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em;
}
.tier-card .price small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.tier-card ul {
  list-style: none; padding: 0; display: flex; flex-direction: column; gap: 5px;
  font-size: .855rem; color: var(--muted);
}
.tier-card li { display: flex; gap: 8px; }
.tier-card li::before { content: "✓"; color: var(--ok); font-weight: 700; flex: 0 0 auto; }

.steps {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); counter-reset: step;
}
.step { position: relative; padding-left: 42px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--gold-dim); color: var(--gold-soft);
  border: 1px solid var(--gold-line);
  display: grid; place-items: center;
  font-family: var(--font-d); font-weight: 700; font-size: .82rem;
}
.step h4 { margin-bottom: 4px; }
.step p { color: var(--muted); font-size: .855rem; }

.foot {
  border-top: 1px solid var(--line);
  padding: 20px 0 30px; margin-top: 40px;
  color: var(--faint); font-size: .8rem;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--gold); }
.foot .links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 7px; }

/* ═══════════ utility ═══════════ */
.hide { display: none !important; }
@media (max-width: 700px) {
  .hide-sm { display: none !important; }
  .brand span { font-size: 13.5px; letter-spacing: .09em; }
  .brand img { width: 26px; height: 26px; }
  .bar__links a { padding: 6px 9px; font-size: 12.5px; }
}
@media (max-width: 460px) {
  .bar__inner { padding-inline: 15px; }
  .hero { padding-inline: 15px; }
}

/* ═══════════════════════════════════════════════════════════════
   Setting rows, wizard, progressive disclosure
   A dense grid of inputs is unreadable. Every setting gets a name,
   a plain-English sentence saying what it does, and enough space
   between it and the next one to tell them apart.
   ─────────────────────────────────────────────────────────────── */

.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 300px);
  gap: 14px 26px; align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.setting:last-child { border-bottom: 0; padding-bottom: 4px; }
.setting:first-child { padding-top: 4px; }
.setting__label { min-width: 0; }
.setting__label b {
  display: block; font-family: var(--font-d); font-weight: 600;
  font-size: .96rem; letter-spacing: -.005em; margin-bottom: 3px;
}
.setting__label p {
  font-size: .84rem; color: var(--muted); line-height: 1.5; max-width: 58ch;
}
.setting__label .hint {
  display: block; margin-top: 6px; font-size: .78rem; color: var(--faint);
}
.setting__label .warn-note {
  display: block; margin-top: 6px; font-size: .78rem; color: var(--gold-soft);
}
.setting__control { min-width: 0; }
.setting__control .field { margin-bottom: 0; }
.setting__control .field + .field { margin-top: 10px; }
.setting.stacked { grid-template-columns: 1fr; gap: 10px; }
@media (max-width: 760px) {
  .setting { grid-template-columns: 1fr; gap: 10px; padding: 14px 0; }
}

/* a group of settings with a heading that explains the whole group */
.settings-group { margin-bottom: 22px; }
.settings-group > header { margin-bottom: 4px; }
.settings-group > header h3 {
  font-size: 1.12rem; letter-spacing: -.015em;
  display: flex; align-items: center; gap: 9px;
}
.settings-group > header p {
  color: var(--muted); font-size: .875rem; margin-top: 5px; max-width: 70ch;
}
.settings-group > .card { margin-top: 13px; }

/* progressive disclosure: the 90% case is visible, the rest is one click */
details.advanced {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--ink-2); margin-top: 13px;
}
details.advanced > summary {
  cursor: pointer; padding: 12px 16px; list-style: none;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-d); font-weight: 600; font-size: .9rem;
  color: var(--muted); transition: color .2s var(--ease);
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before {
  content: "▸"; color: var(--gold); font-size: .8rem;
  transition: transform .2s var(--ease); display: inline-block;
}
details.advanced[open] > summary::before { transform: rotate(90deg); }
details.advanced > summary:hover { color: var(--text); }
details.advanced > summary small {
  margin-left: auto; font-weight: 400; font-size: .78rem; color: var(--faint);
}
details.advanced > .inner { padding: 4px 16px 16px; border-top: 1px solid var(--line); }

/* ---- wizard ------------------------------------------------------------ */
.wizard { max-width: 720px; margin: 0 auto; }
.wizard__steps {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 26px; justify-content: center; flex-wrap: wrap;
}
.wizard__steps i {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-style: normal;
  font-family: var(--font-d); font-size: .76rem; font-weight: 700;
  background: var(--panel-2); color: var(--faint);
  border: 1px solid var(--line);
}
.wizard__steps i.done { background: var(--gold-dim); color: var(--gold-soft); border-color: var(--gold-line); }
.wizard__steps i.now {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #17130a; border-color: var(--gold);
  box-shadow: 0 6px 18px -8px rgba(217,164,65,.8);
}
.wizard__steps span { width: 22px; height: 1px; background: var(--line); }
.wizard__head { text-align: center; margin-bottom: 26px; }
.wizard__head h2 { font-size: clamp(1.4rem, 3.4vw, 1.95rem); letter-spacing: -.025em; }
.wizard__head p { color: var(--muted); margin-top: 8px; font-size: .95rem; max-width: 52ch; margin-inline: auto; }
.wizard__nav { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.wizard__nav .spacer { flex: 1; }

/* big friendly picker cards, for choices a wizard asks about */
.pick { display: grid; gap: 10px; }
.pick.cols-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pick label {
  position: relative; display: block; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); padding: 14px 16px;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .12s var(--ease);
}
.pick label:hover { border-color: var(--line-2); transform: translateY(-1px); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick input:checked + .pick__body {
  color: var(--text);
}
.pick label:has(input:checked) {
  border-color: var(--gold); background: linear-gradient(180deg, var(--gold-dim), transparent 70%), var(--panel);
}
.pick label:has(input:checked)::after {
  content: "✓"; position: absolute; top: 12px; right: 14px;
  color: var(--gold); font-weight: 700;
}
.pick__body b {
  display: block; font-family: var(--font-d); font-weight: 600;
  font-size: .97rem; margin-bottom: 4px;
}
.pick__body p { font-size: .83rem; color: var(--muted); line-height: 1.45; }
.pick__body .price {
  display: block; margin-top: 7px; font-family: var(--font-d);
  font-weight: 600; color: var(--gold-soft);
}

/* a plain-English status line: green tick / amber warning / grey neutral */
.checkline {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 0; font-size: .875rem; line-height: 1.5;
  border-bottom: 1px solid var(--line-soft);
}
.checkline:last-child { border-bottom: 0; }
.checkline .mark { flex: 0 0 18px; font-weight: 700; text-align: center; }
.checkline.ok .mark { color: var(--ok); }
.checkline.warn .mark { color: var(--warn); }
.checkline.no .mark { color: var(--danger); }
.checkline.pending .mark { color: var(--faint); }
.checkline span small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }

/* compact storefront hero: a blurb, not a billboard */
.hero.compact { padding: clamp(26px, 4vw, 44px) 20px clamp(20px, 3vw, 30px); }
.hero.compact h1 {
  font-size: clamp(1.5rem, 3.6vw, 2.25rem); max-width: none; letter-spacing: .01em;
}
.hero.compact p { margin-top: 9px; font-size: clamp(.9rem, 1.6vw, 1rem); max-width: 64ch; }
.hero.compact .hero__mark { width: clamp(40px, 5vw, 52px); margin-bottom: 11px; }
.hero__facts {
  display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px;
  font-size: .83rem; color: var(--muted);
}
.hero__facts b { color: var(--text); font-weight: 600; }

/* ---- bulk edit --------------------------------------------------------- */
/* A row is a tick plus the value it would write. Dimmed until ticked, so
   what will actually change is obvious at a glance rather than something you
   work out by reading every input. */
.bulk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
  gap: .6rem 1rem;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--hairline, rgba(255,255,255,.06));
}
.bulk-row:last-child { border-bottom: 0; }
.bulk-row .bulk-apply { margin: 0; opacity: .65; transition: opacity .12s; }
.bulk-row.is-on .bulk-apply { opacity: 1; font-weight: 600; }
.bulk-row .bulk-value { opacity: .4; transition: opacity .12s; }
.bulk-row.is-on .bulk-value { opacity: 1; }
.bulk-row .bulk-value > * { width: 100%; }
.bulk-row .hint {
  grid-column: 1 / -1;
  margin-top: -.15rem;
  color: var(--muted);
  font-size: .755rem;
  line-height: 1.45;
  max-width: 68ch;
}

@media (max-width: 640px) {
  .bulk-row { grid-template-columns: 1fr; }
}

/* Hints inside a plain .field (defaults page, and anywhere else that wants
   one). .setting__label .hint already covers the settings page's own layout;
   this is the same treatment for the simpler field wrapper. */
.field > .hint {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .755rem;
  line-height: 1.45;
  max-width: 68ch;
}

/* ---- help pages -------------------------------------------------------- */
.settings-body ul.tight, .settings-body ol.tight {
  margin: .3rem 0 .3rem 1.15rem;
  padding: 0;
}
.settings-body ul.tight > li, .settings-body ol.tight > li {
  margin-bottom: .55rem;
  line-height: 1.55;
}
.settings-body ul.tight > li:last-child,
.settings-body ol.tight > li:last-child { margin-bottom: 0; }
.settings-body pre.code {
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--hairline, rgba(255, 255, 255, .07));
  border-radius: 6px;
  padding: .6rem .75rem;
  overflow-x: auto;
  font-size: .78rem;
  margin: .5rem 0;
}

/* ---- logs -------------------------------------------------------------- */
.logbox {
  background: rgba(0, 0, 0, .34);
  border: 1px solid var(--hairline, rgba(255, 255, 255, .07));
  border-radius: 6px;
  padding: .7rem .85rem;
  overflow-x: auto;
  max-height: 32rem;
  overflow-y: auto;
  font-size: .74rem;
  line-height: 1.5;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.logbox.crash {
  border-color: rgba(220, 80, 80, .45);
  background: rgba(120, 20, 20, .16);
  color: #ffc9c9;
}

/* ---- charts ------------------------------------------------------------ */
svg.chart { width: 100%; height: 160px; display: block; color: var(--muted); }
svg.chart.accent { color: var(--accent, #e0803c); }
.chart-axis {
  display: flex; justify-content: space-between;
  font-size: .7rem; color: var(--muted); margin-top: .25rem;
}
.stat-row { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.stat-row .stat {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--hairline, rgba(255, 255, 255, .07));
  border-radius: 8px; padding: .7rem 1rem; min-width: 8rem;
}
.stat-row .stat b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat-row .stat span { font-size: .72rem; color: var(--muted); }

/* ---- media library ----------------------------------------------------- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .8rem;
}
.media-item {
  margin: 0;
  border: 1px solid var(--hairline, rgba(255, 255, 255, .07));
  border-radius: 8px; overflow: hidden;
  background: rgba(0, 0, 0, .2);
}
.media-item img {
  display: block; width: 100%; height: 150px;
  object-fit: cover; background: rgba(0, 0, 0, .35);
}
.media-item figcaption {
  display: flex; align-items: center; gap: .35rem;
  padding: .4rem .5rem; flex-wrap: wrap;
}
.media-item figcaption .tiny { margin-left: auto; }

/* five stat cards now that month-to-date sits beside the 24h figure */
.grid.cols-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- pop-out editor ---------------------------------------------------- */
.expand-btn { margin-top: .35rem; }
body.modal-open { overflow: hidden; }
.editor-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .62);
  display: flex; align-items: center; justify-content: center;
  padding: 2.5vh 2vw;
}
.editor-panel {
  background: var(--panel, #12151c);
  border: 1px solid var(--hairline, rgba(255, 255, 255, .1));
  border-radius: 10px;
  width: min(1100px, 100%); height: 95vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.editor-panel > header {
  padding: .85rem 1.1rem; font-weight: 600;
  border-bottom: 1px solid var(--hairline, rgba(255, 255, 255, .08));
}
.editor-panel > textarea {
  flex: 1; width: 100%; resize: none; border: 0; outline: 0;
  background: transparent; color: inherit;
  padding: 1rem 1.1rem;
  font: .875rem/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.editor-panel > footer {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1.1rem;
  border-top: 1px solid var(--hairline, rgba(255, 255, 255, .08));
}
.editor-panel > footer .tiny { margin-right: auto; }
.editor-panel > footer .over { color: var(--danger, #e06c6c); font-weight: 600; }

/* ---- view-as-renter bar ------------------------------------------------ */
/* Loud on purpose. Forgetting the flag is set and then wondering why the
   console 404s is exactly the confusion this is meant to prevent. */
.renter-view-bar {
  position: sticky; top: 0; z-index: 150;
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  padding: .5rem .9rem;
  background: repeating-linear-gradient(45deg,
    rgba(224,128,60,.16) 0 12px, rgba(224,128,60,.09) 12px 24px);
  border-bottom: 1px solid rgba(224,128,60,.5);
  font-size: .8rem;
}
.renter-view-bar span { color: var(--muted); }
.renter-view-bar a {
  margin-left: auto; font-weight: 600;
  white-space: nowrap;
}
body.as-renter { --renter-testing: 1; }
