/* ==========================================================================
   Anagrammatic · Game Admin — Design system
   Nordisk, minimalistisk produktionspanel. Skarpe linjer, rolig farveskala,
   én tydelig accentfarve. Fonte hentes via <link> i admin_header()/login.php.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- Canvas & surfaces --------------------------------------------- */
  --paper:          #F5F5F1;
  --paper-2:        #EFEFEA;
  --surface:        #FFFFFF;
  --surface-2:      #FAFAF8;
  --surface-hover:  #F1F1EC;

  /* ---- Ink (text) ------------------------------------------------------ */
  --ink:            #14181A;
  --ink-2:          #454E4A;
  --ink-3:          #7B837D;
  --ink-4:          #ACB2AC;

  /* ---- Hairlines --------------------------------------------------------*/
  --line:           #E1E3DC;
  --line-2:         #EAEBE5;
  --line-strong:    #C9CCC3;

  /* ---- Control rail (sidebar) ------------------------------------------*/
  --rail:           #14181A;
  --rail-2:         #1D2224;
  --rail-3:         #262C2E;
  --on-rail:        #F3F4EF;
  --on-rail-soft:   rgba(243,244,239,.60);
  --on-rail-line:   rgba(243,244,239,.10);

  /* ---- Brand accent — pine ---------------------------------------------*/
  --pine:           #1C5E44;
  --pine-600:       #164C38;
  --pine-700:       #103A2A;
  --pine-100:       #E1EDE6;
  --pine-50:        #F0F6F2;
  --pine-bright:    #55B08A; /* til brug oven på den mørke rail */

  /* ---- Semantik ----------------------------------------------------- */
  --success:        #1C5E44;
  --success-bg:     #E1EDE6;
  --warning:        #8A5A0F;
  --warning-bg:     #FBF0D9;
  --danger:         #9C3A33;
  --danger-bg:      #F9E6E3;
  --info:           #2E5578;
  --info-bg:        #E6EDF4;
  --neutral:        #565F5A;
  --neutral-bg:     #E9EAE4;

  /* ---- Typografi ------------------------------------------------------ */
  --font-display: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ---- Radius: skarp, men ikke brutal ----------------------------------*/
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* ---- Skygge: bruges sparsomt, linjer bærer det meste af strukturen ---*/
  --shadow-xs: 0 1px 2px rgba(20,24,26,.05);
  --shadow-sm: 0 3px 10px rgba(20,24,26,.07);
  --shadow-md: 0 16px 40px rgba(20,24,26,.16);

  --ease: cubic-bezier(.22,.7,.32,1);
  --fast: 120ms;
  --base: 180ms;

  --sidebar-width: 264px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* , *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.015em;
  margin: 0;
  color: var(--ink);
}
p { margin: 0 0 .6em; }
p:last-child { margin-bottom: 0; }
a { color: var(--pine); text-decoration: none; }
a:hover { color: var(--pine-600); text-decoration: underline; text-underline-offset: 2px; }
strong { font-weight: 700; }
small, .muted { color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code {
  font-family: var(--font-mono);
  font-size: .84em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: .16em .42em;
  color: var(--ink-2);
}
::selection { background: var(--pine-100); color: var(--pine-700); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid var(--paper); }
.sidebar ::-webkit-scrollbar-thumb { background: var(--rail-3); border-color: var(--rail); }

:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.rail :focus-visible, .sidebar :focus-visible { outline-color: var(--pine-bright); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

.skip-link {
  position: fixed; top: -48px; left: 12px; z-index: 1000;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-sm);
  font-weight: 700; font-size: 13px; transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: 12px; }
.flash-region:empty { display: none; }

/* ==========================================================================
   Shell: sidebar + content
   ========================================================================== */
.admin-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--rail);
  border-right: 1px solid var(--rail);
}
.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 18px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 6px 15px;
  color: var(--on-rail);
  border-bottom: 1px solid var(--on-rail-line);
  margin-bottom: 2px;
}
.brand-mark {
  flex: none;
  width: 33px;
  height: 33px;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--r-xs);
}
.brand-mark::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 3px;
  height: 3px;
  border-radius: 1px;
  background: var(--pine);
}
.brand strong { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand em { display: block; font-style: normal; font-size: 11.5px; color: var(--on-rail-soft); margin-top: 2px; font-family: var(--font-body); }

.nav { display: grid; gap: 18px; }
.nav-section { display: grid; gap: 2px; }
.nav-group {
  color: var(--on-rail-soft);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 0 10px 4px;
  font-family: var(--font-body);
}
.nav-links { display: grid; gap: 1px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 33px;
  padding: 7px 10px 7px 12px;
  border-radius: var(--r-sm);
  color: var(--on-rail-soft);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav a:hover { background: var(--on-rail-line); color: var(--on-rail); text-decoration: none; }
.nav a.active { background: var(--on-rail-line); color: var(--on-rail); font-weight: 650; }
.nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--pine-bright);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--on-rail-line);
}
.admin-user {
  padding: 11px 12px;
  border-radius: var(--r-sm);
  background: var(--rail-2);
}
.admin-user strong { display: block; margin-bottom: 2px; color: var(--on-rail); font-size: 13px; font-family: var(--font-body); font-weight: 650; }
.admin-user span, .admin-user small { display: block; color: var(--on-rail-soft); font-size: 12px; line-height: 1.45; }
.mini-link { display: inline-flex; width: fit-content; color: var(--on-rail-soft); font-size: 12.5px; font-weight: 600; padding: 2px 2px; }
.mini-link:hover { color: var(--on-rail); }
.logout { display: inline-flex; width: fit-content; color: #E3A79F; font-size: 12.5px; font-weight: 700; padding: 2px 2px; }
.logout:hover { color: #F0BDB6; }

.content { min-width: 0; padding: 26px clamp(18px, 2.4vw, 36px) 48px; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--pine); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-body); }
.topbar h1 { font-size: clamp(1.5rem, 2.4vw, 2.05rem); line-height: 1.08; }
.topbar-actions, .hero-actions, .actions, .small-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.subnav a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 7px 13px;
  border-radius: var(--r-pill); color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); font-size: 13px; font-weight: 600;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.subnav a:hover { color: var(--pine-600); border-color: var(--pine); text-decoration: none; }

/* ==========================================================================
   Grid utilities
   ========================================================================== */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }

/* ==========================================================================
   User support cockpit
   ========================================================================== */
.user-support-hero {
  background: linear-gradient(135deg, var(--pine-50), var(--surface) 58%);
  border-color: var(--pine-100);
}
.user-support-hero h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
.user-support-hero .pill-list { margin-top: 12px; }
.user-support-metrics { margin-bottom: 16px; }
.user-support-nav {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
}
.user-support-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}
.user-support-nav a:hover {
  border-color: var(--pine);
  color: var(--pine);
  text-decoration: none;
}
.support-action-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.support-action-card h3 { font-size: .95rem; }
.support-timeline { display: grid; }
.support-timeline article {
  display: grid;
  grid-template-columns: 135px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.support-timeline article:last-child { border-bottom: 0; }
.support-timeline time {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.support-timeline strong { display: inline; margin-left: 7px; }
.support-timeline p { margin: 4px 0 0; color: var(--ink-3); font-size: 12.5px; }
.input-small { width: 88px; }
.text-danger { color: var(--danger); font-weight: 650; }
.support-details { margin-top: 6px; }
.support-details summary { cursor: pointer; color: var(--pine); font-size: 11.5px; font-weight: 700; }
.support-details code {
  display: block;
  max-width: 360px;
  margin-top: 5px;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Attempt support view
   ========================================================================== */
.attempt-hero {
  background: linear-gradient(135deg, var(--info-bg), var(--surface) 58%);
  border-color: #CFDCE7;
}
.attempt-hero .pill-list { margin-top: 12px; }
.integrity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.integrity-grid article {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.integrity-grid article > span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}
.integrity-grid article strong { display: block; font-size: 12.5px; }
.integrity-grid article p { margin: 3px 0 0; font-size: 11.5px; line-height: 1.4; }
.integrity-grid .is-ok { border-color: #C9DFCF; background: var(--success-bg); }
.integrity-grid .is-ok > span { background: var(--success); color: white; }
.integrity-grid .is-ok p { color: var(--success); }
.integrity-grid .is-warning { border-color: #E9D7A9; background: var(--warning-bg); }
.integrity-grid .is-warning > span { background: var(--warning); color: white; }
.integrity-grid .is-warning p { color: var(--warning); }
.attempt-meter,
.attempt-inline-meter {
  overflow: hidden;
  height: 8px;
  margin-top: 12px;
  border-radius: var(--r-pill);
  background: var(--line-2);
}
.attempt-meter span,
.attempt-inline-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pine);
}
.attempt-inline-meter {
  display: inline-block;
  width: 90px;
  margin: 3px 8px 0 0;
  vertical-align: top;
}
.word-cloud-detailed a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.word-cloud-detailed a small {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: rgba(20,24,26,.07);
  color: currentColor;
  font-family: var(--font-mono);
  font-size: 9px;
}
.word-cloud a.missing { color: var(--ink-3); background: var(--surface-2); }
.word-cloud a.invalid { color: var(--danger); background: var(--danger-bg); border-color: #E8C7C2; }
.grant-event-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}
.grant-event-list article {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.grant-event-list strong { display: block; font-size: 12.5px; }
.grant-event-list p { margin: 3px 0 0; color: var(--ink-3); font-size: 11.5px; }
.raw-data-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.raw-data-panel summary {
  cursor: pointer;
  padding: 11px 13px;
  color: var(--ink-2);
  font-weight: 700;
}
.raw-data-panel pre {
  max-height: 430px;
  overflow: auto;
  margin: 0;
  padding: 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Multiplayer match support view
   ========================================================================== */
.match-support-hero {
  background: linear-gradient(135deg, #EEF3F8, var(--surface) 58%);
  border-color: #C9D7E4;
}
.match-support-hero .pill-list { margin-top: 12px; }
.duel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
.duel-player {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.duel-player.is-winner,
.round-player-card.is-winner {
  border-color: #D7B766;
  background: linear-gradient(145deg, #FFF9E8, var(--surface));
  box-shadow: inset 0 3px 0 #D7B766;
}
.duel-player-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.duel-player-head > div > span {
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.duel-player-head h3 { margin: 3px 0 0; font-size: 18px; }
.duel-score {
  display: block;
  margin-top: 18px;
  color: var(--pine);
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 50px);
  line-height: .95;
}
.duel-versus {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}
.duel-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}
.duel-metrics > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.65);
}
.duel-metrics span,
.round-summary-grid span {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.25;
  text-transform: uppercase;
}
.duel-metrics strong,
.round-summary-grid strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.duel-history {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
}
.duel-result {
  display: inline-flex;
  margin-top: 12px;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  background: #E6C96F;
  color: #4D3A09;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}
.round-anchor-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.round-anchor-nav a {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
}
.round-anchor-nav a:hover { border-color: var(--pine); color: var(--pine); }
.match-round-panel { scroll-margin-top: 18px; }
.round-support-head { align-items: flex-start; }
.round-support-head .pill-list { justify-content: flex-end; }
.round-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.round-summary-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.round-integrity { margin-bottom: 14px; }
.round-player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.round-player-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.round-scoreline {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 13px;
}
.round-scoreline strong {
  color: var(--pine);
  font-family: var(--font-display);
  font-size: 29px;
}
.round-scoreline span { color: var(--ink-3); font-size: 11px; }
.round-player-card .word-cloud { margin-top: 13px; }
.match-word-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.match-word-columns > article {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.match-word-columns .panel-head { margin-bottom: 8px; }
.match-word-columns h3 { margin: 0; font-size: 13px; }
.round-diagnostics {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.round-diagnostics > summary {
  cursor: pointer;
  padding: 11px 13px;
  color: var(--pine);
  font-size: 12px;
  font-weight: 750;
}
.round-diagnostics[open] > summary { border-bottom: 1px solid var(--line); }
.round-diagnostics > :not(summary) { margin: 13px; }
.round-raw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.raw-word-cloud { padding: 12px; }
.chat-admin-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}
.chat-admin-list article {
  padding: 11px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.chat-admin-list article > div {
  display: flex;
  gap: 5px;
  align-items: baseline;
  color: var(--ink-3);
  font-size: 11px;
}
.chat-admin-list time { margin-left: auto; font-family: var(--font-mono); }
.chat-admin-list p { margin: 6px 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.chat-admin-list small { color: var(--ink-3); }
.event-payload {
  max-height: 260px;
  overflow: auto;
  margin: 7px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Panels / cards
   ========================================================================== */
.panel, .stat-card, .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.panel { padding: 20px 22px; margin-bottom: 16px; }
.panel h2, .panel-head h2, .panel-header h2 { font-size: 1.05rem; letter-spacing: -.01em; }
.panel-head, .panel-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px;
}
.panel-head p, .panel-header p { margin: 5px 0 0; }
.note-panel { border-color: #CFDCE7; background: linear-gradient(180deg, var(--info-bg) 0%, var(--surface) 130px); }
.danger-panel { border-color: #E8C7C2; background: linear-gradient(180deg, var(--danger-bg) 0%, var(--surface) 130px); }
.hero-panel { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.save-panel { position: sticky; bottom: 14px; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); }

.stat-card { min-height: 108px; padding: 16px 18px; animation: card-in var(--base) var(--ease) backwards; }
.cards .stat-card:nth-child(1) { animation-delay: 0ms; }
.cards .stat-card:nth-child(2) { animation-delay: 40ms; }
.cards .stat-card:nth-child(3) { animation-delay: 80ms; }
.cards .stat-card:nth-child(4) { animation-delay: 120ms; }
.cards .stat-card:nth-child(n+5) { animation-delay: 120ms; }
@keyframes card-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.stat-card span { display: block; color: var(--ink-3); font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.stat-card strong {
  display: block; font-family: var(--font-display); font-size: 1.65rem; font-weight: 700;
  line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.stat-card em { display: block; color: var(--ink-3); font-style: normal; margin-top: 10px; font-size: 12px; }

/* ==========================================================================
   Tabeller
   ========================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.data-table { min-width: 0; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; font-size: 13.5px; }
th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--ink-3);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
  font-family: var(--font-body);
}
td { color: var(--ink); }
tr:last-child td { border-bottom: 0; }
tbody > tr:nth-child(even) > td { background: var(--surface-2); }
tr.is-linked-row { cursor: pointer; }
td code { white-space: nowrap; }

/* ==========================================================================
   Badges — status-farver holdes rolige og lavmælte
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 10px;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--neutral); background: var(--neutral-bg);
  font-family: var(--font-body);
}
/* positivt / kører */
.badge-active, .badge-finished, .badge-completed, .badge-accepted, .badge-super-admin, .badge-klar, .badge-ready {
  color: var(--success); background: var(--success-bg);
}
/* informativt / afventer */
.badge-waiting, .badge-pending, .badge-playing, .badge-moderator, .badge-altid {
  color: var(--info); background: var(--info-bg);
}
/* kræver opmærksomhed */
.badge-expired, .badge-cancelled, .badge-forfeited, .badge-left, .badge-declined, .badge-shop-warning, .badge-disabled {
  color: var(--warning); background: var(--warning-bg);
}
/* negativt / lukket */
.badge-deleted, .badge-blocked { color: var(--danger); background: var(--danger-bg); }
.badge-viewer, .badge-inactive { color: var(--ink-3); background: var(--line-2); }
.badge-new, .badge-reviewed, .badge-dismissed { color: var(--ink-3); background: var(--line-2); }
.badge-needs-followup { color: var(--warning); background: var(--warning-bg); }
.badge-telemetry {
  color: var(--info); background: var(--info-bg); text-transform: none;
  letter-spacing: 0; white-space: normal; line-height: 1.25;
}

/* ==========================================================================
   Knapper
   ========================================================================== */
.btn, button.btn, input.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--r-sm); padding: 0 14px; font-family: var(--font-display); font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; text-decoration: none;
  transition: transform var(--fast) ease, border-color var(--fast) var(--ease), color var(--fast) var(--ease),
    background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover, button.btn:hover, input.btn:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary, .btn.primary {
  border-color: var(--ink); color: var(--paper); background: var(--ink); box-shadow: var(--shadow-xs);
}
.btn-primary:hover, .btn.primary:hover { background: var(--rail-2); border-color: var(--rail-2); color: var(--paper); }

.btn-ghost, .btn.secondary { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover, .btn.secondary:hover { border-color: var(--pine); color: var(--pine-600); background: var(--pine-50); }

.btn-small, .small-actions .btn { min-height: 30px; padding: 0 10px; border-radius: var(--r-xs); font-size: 12px; }

.btn-danger, .btn.danger { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.btn-danger:hover, .btn.danger:hover { background: #F3D5CF; border-color: transparent; color: var(--danger); }

.btn-warning { color: var(--warning); background: var(--warning-bg); border-color: transparent; }
.btn-warning:hover { background: #F5E3B8; border-color: transparent; color: var(--warning); }

.btn .spinner { display: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading .spinner {
  display: block; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px;
  border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; color: inherit;
  animation: spin .6s linear infinite;
}
.btn-primary.is-loading .spinner, .btn.primary.is-loading .spinner { color: var(--paper); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Formularer
   ========================================================================== */
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.form-grid, .compact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.word-add-form { align-items: end; }
.form-stack, .stacked-form { display: grid; gap: 15px; }
.compact-form, .mini-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.word-add-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wide, .span-2 { grid-column: span 2; }
.full { grid-column: 1 / -1; }
.form-span-full { grid-column: 1 / -1; }
.filter-actions, .form-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* Redigerings-paneler der åbnes via <details> inde i en tabelcelle (fx Score
   rules, "Redigér"): panelet skal IKKE presse tabellens kolonnebredde ud af
   form. Det folder i stedet ud som et forankret, kontaineret panel under
   knappen — samme princip som en dropdown/popover. */
.actions-cell { white-space: nowrap; position: relative; }
.actions-cell details { position: relative; display: inline-block; text-align: left; }
.actions-cell details > summary {
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  color: var(--ink-2); font-size: 12.5px; font-weight: 650; background: var(--surface);
  list-style: none; transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.actions-cell details > summary::-webkit-details-marker { display: none; }
.actions-cell details > summary::marker { content: ''; font-size: 0; }
.actions-cell details > summary:hover { border-color: var(--ink-3); color: var(--ink); }
.actions-cell details > summary::after { content: '\2304'; transition: transform var(--base) var(--ease); }
.actions-cell details[open] > summary::after { transform: rotate(180deg); }
.actions-cell details[open] > summary { border-color: var(--ink); color: var(--ink); }
.mini-editor {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 45;
  width: calc(100vw - 64px); max-width: 560px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); padding: 16px; display: grid; gap: 14px;
  white-space: normal; text-align: left;
  animation: step-in var(--base) var(--ease);
}
.mini-editor-delete { display: flex; justify-content: flex-end; margin: 0; padding-top: 12px; border-top: 1px solid var(--line-2); }
/* Når et panel er åbent, skal tabellens egen scroll-beholder ikke klippe det af. */
.table-wrap.has-open-popover { overflow: visible; }
@media (max-width: 720px) {
  .mini-editor { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 82vh; overflow-y: auto; border-radius: var(--r-md) var(--r-md) 0 0; }
}

label {
  color: var(--ink-2); font-size: 12.5px; font-weight: 650; display: grid; gap: 6px;
}
input, select, textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--r-sm); padding: 9px 11px; outline: none; font: inherit; font-size: 13.5px;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-100); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; background: var(--surface-2); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--ink-4); }

.table-input { min-width: 124px; padding: 7px 9px; border-radius: var(--r-xs); font-size: 13px; }
.table-input.small, .small { min-width: 72px; }
.field-hint { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 1px; line-height: 1.3; font-weight: 500; }

.check-row, .check-label, .checkbox-label {
  display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 600; font-size: 13.5px;
}
.check-row input, .check-label input, .checkbox-label input { width: auto; margin: 0; accent-color: var(--pine); }
.inline-form { display: inline-flex; margin: 0; }
.mt { margin-top: 14px; }

.switch { display: inline-flex; align-items: center; justify-content: center; }
.switch input { display: none; }
.switch span {
  width: 36px; height: 21px; border-radius: var(--r-pill); background: var(--line-strong); position: relative;
  display: inline-block; transition: background var(--fast) var(--ease);
}
.switch span::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(20,24,26,.25); transition: transform var(--fast) var(--ease);
}
.switch input:checked + span { background: var(--pine); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:disabled + span { opacity: .5; }
.switch.is-busy span { opacity: .6; }

/* ==========================================================================
   Flash / statusmeddelelser
   ========================================================================== */
.flash {
  padding: 12px 14px; margin: 0 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-xs); font-size: 13.5px; font-weight: 600;
}
.flash-success { border-color: #C9DFCF; background: var(--success-bg); color: var(--success); }
.flash-error { border-color: #E8C7C2; background: var(--danger-bg); color: var(--danger); }
.flash-warning { border-color: #E9D7A9; background: var(--warning-bg); color: var(--warning); }

.semantic-warning, .semantic-ok {
  padding: 11px 13px; border-radius: var(--r-sm); margin-bottom: 12px; font-size: 13px; border: 1px solid var(--line);
  font-weight: 550;
}
.semantic-warning { color: var(--warning); background: var(--warning-bg); border-color: #E9D7A9; }
.semantic-ok { color: var(--success); background: var(--success-bg); border-color: #C9DFCF; }

/* ==========================================================================
   Diverse mini-komponenter
   ========================================================================== */
.status-list { display: grid; gap: 9px; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line-2); padding: 9px 0; }
.status-row:last-child { border-bottom: 0; }
.status-row strong { font-family: var(--font-display); font-size: 1.15rem; }

.stats-mini, .detail-grid, .stat-grid { display: grid; gap: 10px; }
.stats-mini { grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; }
.detail-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-mini div, .meta-box, .detail-grid div, .stat-grid div {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm); padding: 11px 12px;
}
.stats-mini span, .meta-box span, .detail-grid span, .stat-grid span { display: block; color: var(--ink-3); font-size: 11.5px; margin-bottom: 4px; font-weight: 600; }
.stats-mini strong, .meta-box strong, .detail-grid strong, .stat-grid strong { display: block; font-family: var(--font-display); }
.details-box { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 13px; }

.play-billing-operations > .panel { min-width: 0; height: 100%; margin-bottom: 0; }
.play-billing-operations .detail-grid { margin-bottom: 12px; }
.play-billing-metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--line-2);
}
.play-billing-metrics div { min-width: 0; }
.play-billing-metrics span {
  display: block; color: var(--ink-3); font-size: 10.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.play-billing-metrics strong {
  display: block; margin-top: 3px; font-family: var(--font-display); font-size: 1rem;
  overflow-wrap: anywhere;
}
.play-billing-empty, .play-billing-error { margin-top: 12px; }

.pill-list { display: flex; gap: 7px; flex-wrap: wrap; }
.pill-list span, .pill-list a {
  display: inline-flex; align-items: center; min-height: 28px; padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; font-weight: 600;
}

.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.pagination a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px; padding: 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 650; font-size: 13px;
}
.pagination a:hover { border-color: var(--ink-3); text-decoration: none; }
.pagination a.active { color: var(--paper); border-color: var(--ink); background: var(--ink); }

/* Anti-cheat telemetry review --------------------------------------------- */
.telemetry-badges { display: flex; flex-wrap: wrap; gap: 5px; min-width: 180px; }
.telemetry-observation-note { border-left: 4px solid var(--info); }
.telemetry-observation-note p { margin: 5px 0 0; }
.telemetry-detail-grid code { white-space: normal; overflow-wrap: anywhere; }
.telemetry-admin-note { margin-top: 14px; }
.telemetry-admin-note span { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.telemetry-admin-note p { margin: 7px 0 0; white-space: normal; overflow-wrap: anywhere; }
.telemetry-review-form { margin-top: 16px; }
.telemetry-reason-list { display: grid; gap: 10px; }
.telemetry-reason-list .panel-head { margin-bottom: 6px; }
.telemetry-reason-list p { margin: 0; }
.telemetry-timeline code { display: block; margin-top: 5px; white-space: normal; overflow-wrap: anywhere; }
.telemetry-summary-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Bogstaver / word-cloud — spilspecifikke visninger ------------------------*/
.letters {
  display: inline-flex; font-family: var(--font-mono); font-weight: 600; text-transform: uppercase;
  letter-spacing: .18em; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-xs);
  padding: 3px 9px 3px 11px; color: var(--ink);
}
.letters.big { font-size: 1.5rem; letter-spacing: .22em; padding: 8px 16px 8px 20px; border-radius: var(--r-sm); margin-top: 6px; }
.word-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.word-cloud a {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; font-weight: 600;
  font-family: var(--font-mono);
}
.word-cloud a:hover { border-color: var(--ink-3); text-decoration: none; }
.word-cloud a.hit { background: var(--success-bg); border-color: #C9DFCF; color: var(--success); }

/* ==========================================================================
   Login
   ========================================================================== */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--paper); }
.login-card { width: min(100%, 420px); padding: 30px; }
.wide-login-card { width: min(100%, 540px); }
.brand-login { padding: 0 0 20px; }
.brand-login .brand-mark { background: var(--ink); color: var(--paper); }
.brand-login .brand-mark::after { background: var(--pine-bright); }
.brand-login strong, .brand-login em { color: var(--ink); }
.brand-login em { color: var(--ink-3); }
.login-card h1 { margin: 0 0 6px; font-size: 1.5rem; letter-spacing: -.02em; }
.login-card p { color: var(--ink-3); margin-bottom: 4px; }
.login-intro { margin-bottom: 20px; }
.login-card .flash { margin-bottom: 16px; }
.login-card .btn-primary { width: 100%; margin-top: 6px; min-height: 40px; }

/* ==========================================================================
   Rules — produktions-cockpit
   ========================================================================== */
.rules-page { max-width: 1360px; }
.rules-stats .stat-card { min-height: 100px; }
.rules-ux-note { margin-bottom: 16px; }

.rules-wizard { position: relative; }
.wizard-progress { display: flex; align-items: center; gap: 0; margin: 4px 0 22px; }
.wizard-progress span {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 0 4px 0 0;
  color: var(--ink-3); font-size: 12.5px; font-weight: 650; font-family: var(--font-display);
}
.wizard-progress span::before {
  content: attr(data-progress); display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--ink-3); font-size: 11.5px; background: var(--surface);
  transition: all var(--base) var(--ease);
}
.wizard-progress span:not(:last-child) { flex: 1; }
.wizard-progress span:not(:last-child)::after {
  content: ''; flex: 1; height: 1.5px; background: var(--line-strong); margin: 0 8px; transition: background var(--base) var(--ease);
}
.wizard-progress span.is-active { color: var(--ink); }
.wizard-progress span.is-active::before { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.wizard-progress span.is-done { color: var(--ink-2); }
.wizard-progress span.is-done::before { border-color: var(--pine); background: var(--pine); color: var(--paper); content: '✓'; font-size: 12px; }
.wizard-progress span.is-done::after { background: var(--pine); }

.wizard-step {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; margin: 0 0 12px; background: var(--surface-2);
  animation: step-in var(--base) var(--ease);
}
.wizard-step.is-hidden { display: none; }
@keyframes step-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.wizard-step h3 { margin: 0 0 4px; font-size: 1rem; }
.wizard-step > p.muted { margin-bottom: 14px; }
.wizard-summary { display: none; color: var(--pine-600); font-size: 12.5px; font-weight: 650; margin-top: -2px; margin-bottom: 12px; }
.wizard-step.is-complete .wizard-summary { display: block; }
.wizard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; align-items: start; margin-top: 14px; }
.wizard-grid .wide { grid-column: span 2; }
.wizard-grid .full { grid-column: 1 / -1; }

.trigger-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.trigger-card { position: relative; display: block; }
.trigger-card input { position: absolute; opacity: 0; pointer-events: none; }
.trigger-card span {
  display: block; min-height: 120px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px;
  background: var(--surface); cursor: pointer; transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.trigger-card span:hover { border-color: var(--ink-3); }
.trigger-card strong { display: block; margin-bottom: 6px; font-family: var(--font-display); font-size: 13px; }
.trigger-card em { display: block; font-style: normal; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.trigger-card input:checked + span { border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-100); background: var(--pine-50); }
.trigger-card input:checked + span strong { color: var(--pine-700); }
.trigger-card input:focus-visible + span { outline: 2px solid var(--pine); outline-offset: 2px; }

.wizard-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }

.rules-toolbar {
  position: sticky; top: 0; z-index: 15; display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(150px, .7fr)) auto; gap: 10px; align-items: end;
  padding: 13px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
}
.rules-count { min-height: 40px; display: grid; place-items: center; padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.rules-count strong { line-height: 1; font-size: 1.05rem; font-family: var(--font-display); }
.rules-count span { color: var(--ink-3); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }

.empty-state {
  text-align: center; padding: 34px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2);
}
.empty-state p { margin-bottom: 6px; }
.empty-state .btn { margin-top: 10px; }
.empty-state.is-hidden { display: none; }

.rule-list { display: grid; gap: 12px; }
.rules-page .panel, .rules-page .rule-details { overflow: hidden; }
.rule-details {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md);
  transition: opacity var(--base) var(--ease), border-color var(--fast) var(--ease);
}
.rule-details:hover { border-color: var(--line-strong); }
.rule-details[open] { border-color: var(--line-strong); }

/* Selve klik-fladen er <summary> (uden class) — det er DEN der skal være
   flex-rækken med "Åbn" til højre, ikke den indre .rule-title-div. */
.rule-details > summary {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px;
  cursor: pointer; list-style: none; background: transparent;
}
.rule-details > summary::-webkit-details-marker { display: none; }
.rule-details > summary::marker { content: ''; font-size: 0; }
.rule-details > summary::-moz-list-bullet { list-style-type: none; }
.rule-details > summary > div:first-child { min-width: 0; }
.rule-details > summary > .muted {
  flex: none; display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  padding-top: 3px; white-space: nowrap;
}
.rule-details > summary > .muted::after {
  content: '\2304'; font-size: 16px; line-height: 1; text-transform: none;
  transition: transform var(--base) var(--ease);
}
.rule-details[open] > summary > .muted::after { transform: rotate(180deg); }

/* .rule-title er bare titel-linjen (navn + status-badge) inde i summary. */
.rule-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rule-title h2 { font-size: .98rem; font-weight: 700; }
.rule-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.rule-meta .badge { text-transform: none; letter-spacing: 0; }
.rule-preview { color: var(--ink-3); font-size: 12.5px; margin-top: 9px; line-height: 1.5; }
.rule-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.rule-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.rule-section:first-of-type { margin-top: 12px; padding-top: 12px; }
.rule-section h3 { font-size: .92rem; margin-bottom: 10px; }
.rule-section details { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 11px 13px; }
.rule-section details > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); font-size: 13px; list-style: revert; }
.rule-section details[open] > summary { margin-bottom: 12px; }
.rule-quick-actions { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 16px 14px; }

.rule-details.is-hidden-by-filter { display: none; }
.rule-details.is-saving { position: relative; pointer-events: none; }
.rule-details.is-saving::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.55); border-radius: inherit;
}
.rule-details.is-saving::before {
  content: ''; position: absolute; top: 12px; right: 16px; width: 15px; height: 15px; z-index: 2;
  border-radius: 50%; border: 2px solid var(--ink-3); border-top-color: transparent; animation: spin .6s linear infinite;
}

.grant-ref-field.is-hidden, .grant-quantity-field.is-hidden, .grant-calculation-field.is-hidden, .quantity-metric-field.is-hidden { display: none; }
.json-cell { max-width: 320px; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 12px; }
.ajax-status { color: var(--ink-3); font-size: 12px; }
.ref-box { margin-top: 9px; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid #E9D7A9; background: var(--warning-bg); font-size: 12.5px; }
.ref-box code { margin-right: 3px; }

.rule-toast { position: fixed; right: 18px; bottom: 18px; z-index: 999; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.rule-toast-message {
  display: flex; align-items: center; gap: 9px; border-radius: var(--r-sm); padding: 12px 14px; border: 1px solid var(--line);
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-md); font-weight: 650; font-size: 13px;
  animation: toast-in .22s var(--ease);
}
.rule-toast-message::before { content: '✓'; flex: none; width: 17px; height: 17px; border-radius: 50%; background: var(--pine-bright); color: var(--rail); display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.rule-toast-message.error { background: var(--danger); border-color: var(--danger); }
.rule-toast-message.error::before { content: '!'; background: var(--paper); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Skeleton / loading state til AJAX-genopfriskede tabeller ---------------- */
.is-refreshing { position: relative; min-height: 80px; }
.is-refreshing > * { opacity: .35; filter: saturate(.4); transition: opacity var(--base) var(--ease); pointer-events: none; }
.is-refreshing::after {
  content: ''; position: absolute; top: 14px; right: 14px; width: 16px; height: 16px; z-index: 2;
  border-radius: 50%; border: 2px solid var(--ink-3); border-top-color: var(--ink); animation: spin .6s linear infinite;
}
.list-toolbar { position: relative; }

/* ==========================================================================
   Responsivt
   ========================================================================== */
@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters, .form-grid, .compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-add-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trigger-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rules-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 940px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rail); }
  .sidebar-scroll { height: auto; }
  .content { padding-top: 20px; }
  .cards, .two-col, .three-col, .detail-grid, .stat-grid, .trigger-cards, .stats-mini, .wizard-grid { grid-template-columns: 1fr; }
  .wizard-grid .wide { grid-column: span 1; }
  .support-timeline article { grid-template-columns: 110px minmax(0, 1fr); }
  .support-timeline article > .btn { grid-column: 2; justify-self: start; }
  .integrity-grid, .grant-event-list { grid-template-columns: 1fr 1fr; }
  .duel-grid { grid-template-columns: 1fr; }
  .duel-versus { min-height: 30px; }
  .round-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .match-word-columns { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .content { padding: 16px 14px 34px; }
  .panel, .login-card { padding: 15px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .filters, .form-grid, .compact-grid, .compact-form, .mini-form, .word-add-form { grid-template-columns: 1fr; }
  .wide, .span-2, .full { grid-column: auto; }
  .table-wrap { border-radius: var(--r-sm); }
  table { min-width: 620px; }
  .rules-toolbar { position: static; grid-template-columns: 1fr; }
  .wizard-progress span { font-size: 11.5px; }
  .user-support-nav { position: static; }
  .support-timeline article { grid-template-columns: 1fr; }
  .support-timeline article > .btn { grid-column: auto; }
  .integrity-grid, .grant-event-list { grid-template-columns: 1fr; }
  .round-player-grid, .match-word-columns, .round-raw-grid { grid-template-columns: 1fr; }
  .round-summary-grid, .duel-metrics { grid-template-columns: 1fr 1fr; }
  .round-support-head .pill-list { justify-content: flex-start; }
}

/* ========================================================================== 
   Shop admin — product/content cockpit
   ========================================================================== */
.shop-intro-panel {
  background: linear-gradient(180deg, var(--pine-50), var(--surface) 150px);
}
.shop-metrics { margin-bottom: 16px; }
.shop-create-panel details, .shop-product-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.shop-create-panel details[open] { box-shadow: var(--shadow-xs); }
.shop-section-summary, .shop-product-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  background: var(--surface-2);
  border-bottom: 1px solid transparent;
}
.shop-section-summary::-webkit-details-marker,
.shop-product-summary::-webkit-details-marker { display: none; }
.shop-create-panel details[open] .shop-section-summary,
.shop-product-card[open] .shop-product-summary { border-bottom-color: var(--line); }
.shop-section-summary strong { display: block; font-family: var(--font-display); font-size: 1rem; }
.shop-section-summary span, .shop-open-label { color: var(--ink-3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.shop-open-label::after { content: '⌄'; display: inline-block; margin-left: 6px; transition: transform var(--base) var(--ease); }
.shop-product-card[open] .shop-open-label::after { transform: rotate(180deg); }
.shop-editor-form { display: grid; gap: 16px; padding: 17px; }
.shop-editor-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.shop-editor-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shop-editor-grid .wide { grid-column: span 2; }
.shop-editor-grid label small { display: block; margin-top: 5px; line-height: 1.35; }
.shop-form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-content-composer { border: 1px dashed var(--line-strong); background: var(--surface-2); border-radius: var(--r-sm); padding: 14px; }
.shop-content-composer-head, .shop-content-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.shop-toolbar-panel { position: sticky; top: 0; z-index: 8; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); }
.shop-filters { grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(140px, .7fr)) auto; }
.shop-product-list { display: grid; gap: 12px; }
.shop-product-card { transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease); }
.shop-product-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.shop-product-card.has-warning { border-color: #E9D7A9; }
.shop-product-summary {
  border-left: 4px solid var(--neutral);
  background: linear-gradient(90deg, var(--surface-2), var(--surface));
}
.shop-product-card.category-avatars .shop-product-summary { border-left-color: var(--pine); }
.shop-product-card.category-frames .shop-product-summary { border-left-color: var(--info); }
.shop-product-card.category-badges_titles .shop-product-summary { border-left-color: var(--danger); }
.shop-product-card.category-themes .shop-product-summary { border-left-color: #6D4A8B; }
.shop-product-card.category-stats .shop-product-summary,
.shop-product-card.category-analysis .shop-product-summary { border-left-color: #2E5578; }
.shop-product-card.category-boosts .shop-product-summary,
.shop-product-card.category-consumables .shop-product-summary { border-left-color: var(--warning); }
.shop-product-card.category-coin_packs .shop-product-summary { border-left-color: #B8860B; }
.shop-product-card.category-bundles .shop-product-summary,
.shop-product-card.category-premium .shop-product-summary { border-left-color: var(--ink); }
.shop-product-main { min-width: 0; display: grid; gap: 8px; }
.shop-product-titleline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.shop-product-titleline strong { font-family: var(--font-display); font-size: 1.02rem; }
.shop-product-meta, .shop-content-pills { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--ink-3); font-size: 12px; }
.shop-product-meta span, .shop-content-pills span {
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface);
}
.shop-content-pills span { color: var(--ink-2); background: var(--pine-50); border-color: var(--pine-100); }
.shop-product-body { padding: 0; background: var(--surface); }
.shop-warning-box { margin: 16px 17px 0; border: 1px solid #E9D7A9; background: var(--warning-bg); border-radius: var(--r-sm); padding: 10px 12px; color: var(--warning); font-size: 12.5px; }
.shop-warning-box p { margin: 0 0 4px; }
.shop-warning-box p:last-child { margin-bottom: 0; }
.shop-content-list { border-top: 1px solid var(--line); padding: 17px; display: grid; gap: 10px; }
.shop-content-list h3 { font-size: .95rem; }
.shop-content-card { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 13px; }
.shop-content-card.is-new { border-style: dashed; background: var(--pine-50); }
.shop-content-form { display: grid; gap: 12px; }
.shop-delete-form { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.shop-product-card .badge-shop-warning { color: var(--warning); background: var(--warning-bg); }
.shop-product-card input[hidden], .shop-product-card label[hidden], .shop-create-panel label[hidden] { display: none !important; }
.shop-editor-grid label[hidden] { display: none !important; }
.shop-editor-form.is-saving, .shop-content-form.is-saving { opacity: .65; pointer-events: none; }

@media (max-width: 1180px) {
  .shop-editor-grid, .shop-editor-grid.compact, .shop-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-editor-grid .wide { grid-column: span 2; }
}
@media (max-width: 720px) {
  .shop-editor-grid, .shop-editor-grid.compact, .shop-filters { grid-template-columns: 1fr; }
  .shop-editor-grid .wide { grid-column: auto; }
  .shop-product-summary { flex-direction: column; }
}
