/* Platform shell (docs/plataforma/modelo-datos.md §1) — RPG skin (F5,
 * docs/plataforma/piel-rpg.md).
 *
 * Every color, font, radius and spacing lives in :root as a token. No literal
 * colors anywhere else (shell/tests.py enforces it on every stylesheet).
 * Fonts are vendored under static/fonts/ (OFL); relative url()s so the
 * manifest storage rewrites them with their hash.
 */
@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/press-start-2p-latin-400-normal.5c7e04d0202b.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-400-normal.79936b18df9f.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-500-normal.b1c8a895f5fd.woff2") format("woff2");
}

:root {
  /* Palette (night purple; --c-gold is coral, kept by name for compatibility) */
  --c-bg: #160f2a;
  --c-panel: #1e1638;
  --c-panel-2: #261c46;
  --c-border: #34265a;
  --c-border-strong: #6e5ca8;
  --c-text: #ece6ff;
  --c-muted: #a596d0;
  --c-gold: #ff8a7a;
  --c-teal: #5ce1e6;
  --c-red: #ff5fa8;
  --c-blue: #c3b5ff;
  --c-warning: #ffc857;
  --c-on-accent: #160f2a;
  --c-gold-soft: rgba(255, 138, 122, 0.14);
  --c-teal-soft: rgba(92, 225, 230, 0.14);
  --c-red-soft: rgba(255, 95, 168, 0.16);
  --c-blue-soft: rgba(195, 181, 255, 0.14);
  --c-warning-soft: rgba(255, 200, 87, 0.12);
  --c-grey-soft: rgba(165, 150, 208, 0.12);
  --c-focus: #5ce1e6;
  --c-shadow: #000;
  --c-none: rgba(0, 0, 0, 0);
  --c-backdrop: rgba(10, 6, 22, 0.78);

  /* Badge / level colors (gamification) */
  --c-bronze: #c8814a;
  --c-silver: #b8c4d6;
  --c-level-gold: #ffc857;
  --c-platinum: #f2f6ff;
  --c-mythic: #ff5fa8;

  /* Typography (vendored fonts; Plex only ships 400/500) */
  --f-display: "Press Start 2P", ui-monospace, monospace;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --f-body: "IBM Plex Sans", system-ui, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-d-sm: 0.6875rem;
  --fs-d-md: 0.75rem;
  --fs-d-lg: 1rem;
  --fw-normal: 400;
  --fw-bold: 500;
  --lh: 1.5;
  --lh-display: 1.6;
  --ls-caps: 0.06em;

  /* Radii: none anywhere (pixel skin) */
  --r-sm: 0;
  --r-md: 0;
  --r-lg: 0;
  --r-pill: 0;

  /* Spacing */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;

  /* Layout */
  --sidebar-w: 232px;
  --content-max: 1280px;
  --bw: 2px;
  --av-size: calc(32px + 2 * var(--bw));
  --av-xl: calc(128px + 2 * var(--bw));
  --badge-size: 64px;
  --bar-h: 0.75rem;
  --tap: 44px;
  --tap-sm: 36px;
  --shadow-hard: 3px 3px 0 var(--c-shadow);
  --shadow-hard-lg: 6px 6px 0 var(--c-shadow);
  --z-popup: 100;
}

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

body.platform {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--fs-md);
  line-height: var(--lh);
}
.platform ::selection { background: var(--c-teal); color: var(--c-bg); }

.platform a { color: var(--c-teal); }
.platform h1, .platform h2, .platform h3 { margin: 0 0 var(--s-3); font-weight: var(--fw-normal); }

/* Display titles: Press Start 2P is very wide — titles only, never long text,
 * tables or buttons. Accented letters go through |display_caps (shell_tags). */
.platform h1, .platform h2, .brand {
  font-family: var(--f-display);
  text-transform: uppercase;
  line-height: var(--lh-display);
  overflow-wrap: anywhere;
}
.platform h1 { font-size: var(--fs-d-lg); color: var(--c-gold); text-shadow: var(--shadow-hard); }
.platform h2 { font-size: var(--fs-d-md); color: var(--c-text); }
.platform h3 { font-family: var(--f-body); font-weight: var(--fw-bold); font-size: var(--fs-md); }
@media (max-width: 860px) {
  .platform h1 { font-size: var(--fs-d-md); }
}

/* Mono metadata: labels, chips, times, counters, table heads, tabs. */
.lbl, .chip, .nav-sep, .tab, .table th, .platform time, .platform h2.lbl, .platform h3.lbl {
  font-family: var(--f-mono);
  letter-spacing: var(--ls-caps);
}
.lbl, .chip, .nav-sep, .tab, .table th, .platform h2.lbl, .platform h3.lbl {
  text-transform: uppercase;
  text-shadow: none;
}

/* Accents drawn by CSS over the base letter (|display_caps). */
.acc { position: relative; display: inline-block; line-height: 1; }
.acc::after { content: ""; position: absolute; width: .125em; height: .125em; background: currentColor; pointer-events: none; }
.acc-acute::after { left: .5em; top: -.375em; box-shadow: -.125em .125em 0 currentColor; }
.acc-dier::after { left: .125em; top: -.25em; box-shadow: .5em 0 0 currentColor; }
.acc-tilde::after { left: .0625em; top: -.25em; box-shadow: .125em -.125em 0 currentColor, .25em -.125em 0 currentColor, .375em 0 0 currentColor, .5em 0 0 currentColor, .625em -.125em 0 currentColor; }
.platform h1 .acc::after, .brand .acc::after { filter: drop-shadow(.09375em .09375em 0 var(--c-shadow)); }

.platform :focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.muted { color: var(--c-muted); }

/* Pixel art is never smoothed (always shown at whole multiples). */
img.px, .px img, image.px { image-rendering: pixelated; }

@media (prefers-reduced-motion: reduce) {
  .platform *, .platform *::before, .platform *::after {
    transition: none !important;
    animation: none !important;
  }
  .platform .btn:active, .platform button:active { transform: none !important; }
}

/* ── Shell layout: sidebar + main column ──────────────────────────── */
.icon { flex: none; width: 24px; height: 24px; }
.btn .icon, .messages .icon { width: 20px; height: 20px; }
.btn.sm .icon { width: 16px; height: 16px; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  /* The sticky sidebar is one screen tall: paint its column all the way down. */
  background: linear-gradient(90deg,
    var(--c-panel) 0 calc(var(--sidebar-w) - var(--bw)),
    var(--c-border) calc(var(--sidebar-w) - var(--bw)) var(--sidebar-w),
    var(--c-none) var(--sidebar-w));
}
.shell.no-sidebar { background: none; }

.sidebar {
  background: var(--c-panel);
  border-right: var(--bw) solid var(--c-border);
  padding: var(--s-4) var(--s-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.sidebar .nav-toggle { display: none; }

.brand {
  display: block;
  padding: var(--s-2) var(--s-3) var(--s-4);
  color: var(--c-gold);
  font-size: var(--fs-d-md);
  text-shadow: var(--shadow-hard);
  text-decoration: none;
}
.platform a.brand { color: var(--c-gold); }

.nav ul { list-style: none; margin: 0; padding: 0; }

.nav a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--tap);
  padding: var(--s-2) var(--s-3);
  border-left: 4px solid var(--c-none);
  color: var(--c-muted);
  text-decoration: none;
}
.nav a:hover { color: var(--c-text); background: var(--c-panel-2); }
.nav a.active { color: var(--c-gold); background: var(--c-gold-soft); border-left-color: var(--c-gold); }

.nav-sep {
  margin: var(--s-4) var(--s-3) var(--s-2);
  color: var(--c-muted);
  font-size: var(--fs-xs);
}

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

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-bottom: var(--bw) solid var(--c-border);
  background: var(--c-panel);
}

.breadcrumb { color: var(--c-muted); font-family: var(--f-mono); font-size: var(--fs-xs); }
.platform .breadcrumb a { color: var(--c-muted); }

.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }
.edition-picker { display: flex; align-items: center; gap: var(--s-2); }
.user { display: flex; align-items: center; gap: var(--s-2); }
.user form { margin: 0; }

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-5);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.page-head h1 { margin: 0; flex: 1 1 auto; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-left: auto; }
.actions:empty { display: none; }

/* Narrow screens: the sidebar becomes a header with a "Menú" button. The menu
 * only folds when shell.js has run (html.js); without JS it stays open. */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: static;
    height: auto;
    padding: var(--s-2) var(--s-3);
    border-right: 0;
    border-bottom: var(--bw) solid var(--c-border);
  }
  .brand { padding: var(--s-2); }
  .sidebar .nav-toggle { display: inline-flex; }
  html:not(.js) .sidebar .nav-toggle { display: none; }
  .js .nav:not(.is-open) { display: none; }
  .nav { margin-top: var(--s-2); }
  .nav-sep { margin: var(--s-3) var(--s-3) var(--s-1); }
  .topbar, .content { padding-left: var(--s-3); padding-right: var(--s-3); }
  /* Compact top bar: edition picker and user share one row that may wrap. */
  .topbar { gap: var(--s-2); padding-top: var(--s-2); padding-bottom: var(--s-2); }
  .topbar-right { gap: var(--s-2) var(--s-3); width: 100%; }
  .edition-picker .lbl {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .edition-picker select, .platform .edition-picker select { min-height: var(--tap-sm); padding-top: var(--s-1); padding-bottom: var(--s-1); }
  .user .btn { min-height: var(--tap-sm); }
  .user-name .chip { display: none; }
}
/* Wide screens: one-line top bar; a long breadcrumb is cut with "…" (the page title repeats it). */
@media (min-width: 861px) {
  .topbar { flex-wrap: nowrap; }
  .breadcrumb { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar-right { flex: 0 0 auto; flex-wrap: nowrap; }
}

/* ── Components ───────────────────────────────────────────────────── */
.card {
  background: var(--c-panel);
  border: var(--bw) solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
}
.card > h2:first-child { font-size: var(--fs-d-sm); }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: var(--bw) solid var(--c-border);
}
.row:last-child { border-bottom: 0; }

.lbl {
  display: block;
  color: var(--c-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0 var(--s-2);
  border: var(--bw) solid var(--c-border-strong);
  border-radius: var(--r-pill);
  background: var(--c-grey-soft);
  color: var(--c-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.8;
  white-space: nowrap;
}
.chip.c-gold { background: var(--c-gold-soft); border-color: var(--c-gold); color: var(--c-gold); }
.chip.c-teal { background: var(--c-teal-soft); border-color: var(--c-teal); color: var(--c-teal); }
.chip.c-grey { background: var(--c-grey-soft); border-color: var(--c-border-strong); color: var(--c-muted); }
.chip.c-red { background: var(--c-red-soft); border-color: var(--c-red); color: var(--c-red); }
.chip.c-blue { background: var(--c-blue-soft); border-color: var(--c-blue); color: var(--c-blue); }
.chip.c-warning { background: var(--c-warning-soft); border-color: var(--c-warning); color: var(--c-warning); }

/* Buttons: hard shadow that "sinks" when pressed. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap);
  padding: var(--s-2) var(--s-4);
  border: var(--bw) solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-none);
  box-shadow: var(--shadow-hard);
  color: var(--c-text);
  font: inherit;
  font-family: var(--f-body);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 60ms steps(1), box-shadow 60ms steps(1);
}
.platform a.btn { color: var(--c-text); }
.btn:hover { background: var(--c-panel-2); border-color: var(--c-text); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.gold, .platform a.btn.gold { background: var(--c-teal); border-color: var(--c-teal); color: var(--c-on-accent); }
.btn.gold:hover { background: color-mix(in srgb, var(--c-teal) 85%, var(--c-text)); }
.btn.red, .platform a.btn.red { background: var(--c-red); border-color: var(--c-red); color: var(--c-on-accent); }
.btn.red:hover { background: color-mix(in srgb, var(--c-red) 85%, var(--c-text)); }
.btn.ghost, .platform a.btn.ghost { background: var(--c-none); border-color: var(--c-none); box-shadow: none; color: var(--c-muted); }
.btn.ghost:hover { color: var(--c-text); background: var(--c-panel-2); }
.btn.ghost:active { transform: none; }
.btn.sm { min-height: var(--tap-sm); padding: var(--s-1) var(--s-3); font-size: var(--fs-sm); }
.btn:disabled, .btn[aria-disabled="true"], .btn.gold:disabled, .btn.red:disabled {
  background: var(--c-panel-2);
  border-color: var(--c-border);
  box-shadow: none;
  color: var(--c-muted);
  cursor: not-allowed;
  transform: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-height: var(--tap);
  padding: var(--s-2) var(--s-3);
  border-bottom: 3px solid var(--c-none);
  color: var(--c-muted);
  font-size: var(--fs-xs);
  text-decoration: none;
}
.platform a.tab { color: var(--c-muted); }
.platform a.tab:hover { color: var(--c-text); background: var(--c-panel-2); }
.tab.active, .tab[aria-current="page"], .platform a.tab.active, .platform a.tab[aria-current="page"] { color: var(--c-gold); border-bottom-color: var(--c-gold); }

/* Avatars: square 2px frame around a pixel-art image (avatar_src). */
.av {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--av-size);
  height: var(--av-size);
  border: var(--bw) solid var(--c-border-strong);
  border-radius: var(--r-pill);
  background: var(--c-panel-2);
  color: var(--c-gold);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  overflow: hidden;
}
.av img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.person { display: inline-flex; align-items: center; gap: var(--s-2); }
.person-nick { white-space: nowrap; }

/* Forms: also the bare browser controls inside the platform. */
.in,
.platform input[type="text"], .platform input[type="search"], .platform input[type="email"],
.platform input[type="password"], .platform input[type="number"], .platform input[type="url"],
.platform input[type="date"], .platform input[type="datetime-local"], .platform input[type="time"],
.platform input:not([type]), .platform select, .platform textarea {
  min-height: var(--tap);
  padding: var(--s-2) var(--s-3);
  border: var(--bw) solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-bg);
  color: var(--c-text);
  font: inherit;
  font-family: var(--f-body);
}
.in { width: 100%; }
.platform textarea { min-height: calc(var(--tap) * 2); }
.platform ::placeholder { color: var(--c-muted); opacity: 1; }
select.in { width: auto; }
.in:disabled, .platform select:disabled, .platform input:disabled, .platform textarea:disabled {
  color: var(--c-muted);
  border-color: var(--c-border);
  cursor: not-allowed;
}
.in[aria-invalid="true"], .platform .field.has-error .in, .platform [aria-invalid="true"] { border-color: var(--c-red); }
.platform input[type="date"], .platform input[type="datetime-local"], .platform input[type="time"] { color-scheme: dark; }

/* Select arrow: Pixelarticons chevron-down redrawn square by square with
 * token gradients (a mask needs a wrapper or pseudo-element, and Django's
 * widgets render bare <select>s). 2px squares on the icon's 24px grid. */
.platform select:not([multiple]) {
  --chev: linear-gradient(var(--c-muted), var(--c-muted));
  appearance: none;
  -webkit-appearance: none;
  padding-right: calc(var(--s-3) + 28px);
  background-color: var(--c-bg);
  background-image: var(--chev), var(--chev), var(--chev), var(--chev), var(--chev), var(--chev), var(--chev);
  background-repeat: no-repeat;
  background-size: 2px 2px;
  background-position:
    right 27px top calc(50% - 4px), right 15px top calc(50% - 4px),
    right 25px top calc(50% - 2px), right 17px top calc(50% - 2px),
    right 23px top 50%, right 19px top 50%,
    right 21px top calc(50% + 2px);
}

/* Checkbox and radio: 20px squares; checked = teal fill with a 3px gap. */
.platform input[type="checkbox"], .platform input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: var(--bw) solid var(--c-border-strong);
  border-radius: 0;
  background: var(--c-bg);
  vertical-align: middle;
  cursor: pointer;
}
.platform input[type="checkbox"]:checked { background: var(--c-teal); border-color: var(--c-teal); box-shadow: inset 0 0 0 3px var(--c-bg); }
.platform input[type="radio"]:checked { background: var(--c-teal); border-color: var(--c-teal); box-shadow: inset 0 0 0 5px var(--c-bg); }
.platform input[type="checkbox"]:disabled, .platform input[type="radio"]:disabled { border-color: var(--c-border); cursor: not-allowed; }

/* Progress: segmented "health bar" (native <progress>; 0 of N reads empty). */
.platform progress {
  appearance: none;
  -webkit-appearance: none;
  height: var(--bar-h);
  border: var(--bw) solid var(--c-border-strong);
  border-radius: 0;
  background: var(--c-panel-2);
  color: var(--c-teal);
  overflow: hidden;
}
.platform progress::-webkit-progress-bar { background: var(--c-panel-2); }
.platform progress::-webkit-progress-value {
  background: repeating-linear-gradient(90deg, var(--c-teal) 0 8px, var(--c-panel) 8px 10px);
}
.platform progress::-moz-progress-bar {
  background: repeating-linear-gradient(90deg, var(--c-teal) 0 8px, var(--c-panel) 8px 10px);
}

/* ── Patterns ─────────────────────────────────────────────────────── */
.empty, .empty-state p { color: var(--c-muted); }
.empty-state .chip { margin-bottom: var(--s-2); }
.form-error { color: var(--c-red); font-size: var(--fs-sm); margin: var(--s-1) 0; }

/* Illustrated empty states (shell/_empty.html). */
.empty-art { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-4) var(--s-2); text-align: center; }
.empty-art img { width: 240px; max-width: 100%; height: auto; image-rendering: pixelated; }
.empty-art h2 { margin: var(--s-2) 0 0; font-size: var(--fs-d-sm); }
.empty-art p { margin: 0; max-width: 40rem; color: var(--c-muted); }

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-3);
}
@media (min-width: 1100px) {
  .section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.section-grid .card { margin: 0; }
.section-grid h2 { display: flex; align-items: center; gap: var(--s-2); }

/* Comments (activity/_comments.html) */
.comment-list { list-style: none; margin: 0 0 var(--s-4); padding: 0; }
.comment { display: flex; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: var(--bw) solid var(--c-border); }
.comment p { margin: 0; }
.comment-meta { font-size: var(--fs-sm); }
.comment-meta time { color: var(--c-muted); margin-left: var(--s-2); font-size: var(--fs-xs); }
.comments form { display: grid; gap: var(--s-2); justify-items: start; }

/* ── Forms, tables, messages (F1) ─────────────────────────────────── */
.shell.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.shell.no-sidebar .content { margin: 0 auto; max-width: calc(var(--content-max) / 2); }

/* Auth pages (login, invitation, reset): centered ~420px card with the mascot
 * and the platform name above it. */
.auth-page .shell.no-sidebar .content { max-width: calc(420px + 2 * var(--s-5)); }
.auth-page .no-sidebar .topbar { display: none; }
.auth-head { display: grid; justify-items: center; gap: var(--s-3); margin: var(--s-5) 0 var(--s-4); text-align: center; }
.auth-head img { width: 128px; height: 128px; image-rendering: pixelated; }
.auth-head .brand { margin: 0; padding: 0; font-size: var(--fs-d-md); }
.auth-page .page-head { justify-content: center; }
.auth-page .page-head h1 { flex: none; font-size: var(--fs-d-sm); color: var(--c-text); }

.messages { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: grid; gap: var(--s-2); }
.messages li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border: var(--bw) solid var(--c-teal);
  border-radius: var(--r-md);
  background: var(--c-teal-soft);
}
.messages li .icon { color: var(--c-teal); margin-top: 1px; }
.messages li.warning { border-color: var(--c-warning); background: var(--c-warning-soft); }
.messages li.warning .icon { color: var(--c-warning); }
.messages li.error { border-color: var(--c-red); background: var(--c-red-soft); }
.messages li.error .icon { color: var(--c-red); }

.form { display: grid; gap: var(--s-3); align-content: start; }
.form .field { display: grid; gap: var(--s-1); }
.form .field .help { color: var(--c-muted); font-size: var(--fs-sm); margin: 0; }
.form-inline { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-3); }
.form-inline .field { display: grid; gap: var(--s-1); }
.form-inline .in { width: auto; }
.inline { display: inline; margin: 0; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.checks label { display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap-sm); }

/* Choice buttons: radios rendered as a row of buttons (state transitions). */
.seg { display: flex; flex-wrap: wrap; gap: var(--s-2); border: 0; margin: 0; padding: 0; }
.platform .seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { cursor: pointer; }
.seg input:checked + .btn { background: var(--c-teal); border-color: var(--c-teal); color: var(--c-on-accent); }
.seg input:focus-visible + .btn { outline: 2px solid var(--c-focus); outline-offset: 2px; }

.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td {
  padding: var(--s-2) var(--s-3);
  border-bottom: var(--bw) solid var(--c-border);
  text-align: left;
  vertical-align: middle;
}
.table th { color: var(--c-muted); font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.table tbody tr:hover > td { background: var(--c-panel-2); }
.table td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.table .in { width: auto; }

.swatch {
  display: inline-block;
  width: var(--s-4);
  height: var(--s-4);
  border: var(--bw) solid var(--c-border-strong);
  border-radius: var(--r-sm);
  vertical-align: middle;
}

.copy { display: flex; flex: 1; min-width: 240px; gap: var(--s-2); }
.copy .in { font-family: var(--f-mono); font-size: var(--fs-xs); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}
.card-grid .card { margin: 0; }
/* Item titles (user text) stay in the body font: the display font is too wide. */
.card-grid .card h2 { font-family: var(--f-body); font-size: var(--fs-lg); font-weight: var(--fw-bold); text-transform: none; line-height: 1.3; }
.card h2 a { color: var(--c-text); text-decoration: none; }
.card h2 a:hover { color: var(--c-teal); }
.card .meta { color: var(--c-muted); font-size: var(--fs-sm); margin: var(--s-1) 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.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;
}
.platform .in[type="color"] { width: calc(var(--s-6) * 1.5); height: calc(var(--s-6) + var(--s-2)); padding: var(--s-1); }
label.checks { display: flex; justify-self: start; }
.checks input, .field > input[type="checkbox"] { justify-self: start; }

/* Votes (proposals, petitions): thumb icon + mono count; own vote highlighted. */
.btn.vote { font-family: var(--f-mono); }
.btn.vote-up.is-mine { background: var(--c-teal-soft); border-color: var(--c-teal); color: var(--c-teal); }
.btn.vote-down.is-mine { background: var(--c-red-soft); border-color: var(--c-red); color: var(--c-red); }

/* Conflict chips (schedule/_conflict.html, also on the dashboard): solid
 * background so they read over zone colors; "Sin solapamientos" dashed. */
.chip.sch-conflict, .chip.sch-conflict-kind { background: var(--c-bg); border-color: var(--c-red); color: var(--c-red); }
.sch-kind-no_overlap .chip { border-style: dashed; }

/* Achievement / level-up popup (shell/_popup.html). Fixed and centered, also
 * without JS; shell.js turns it modal so the backdrop shows. */
dialog.pop {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: var(--z-popup);
  width: min(26rem, calc(100vw - 2 * var(--s-4)));
  height: fit-content;
  max-height: calc(100vh - 2 * var(--s-4));
  overflow: auto;
  padding: var(--s-5);
  border: 3px solid var(--c-gold);
  background: var(--c-panel);
  color: var(--c-text);
  box-shadow: var(--shadow-hard-lg);
}
dialog.pop::backdrop { background: var(--c-backdrop); }
.pop-title { text-align: center; color: var(--c-gold); }
.pop-list { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: grid; gap: var(--s-3); }
.pop-row { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.pop-row > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.pop-level {
  margin: 0 0 var(--s-4);
  text-align: center;
  font-family: var(--f-display);
  font-size: var(--fs-d-md);
  line-height: var(--lh-display);
  color: var(--c-gold);
}
.pop-line { margin: 0 0 var(--s-3); text-align: center; overflow-wrap: anywhere; }
.pop-foot { display: flex; justify-content: center; margin: 0; }

/* ── Help page (shell/help.html) ──────────────────────────────────── */
.help ul, .help ol { margin: 0; padding-left: var(--s-5); }
.help li { margin-bottom: var(--s-2); overflow-wrap: anywhere; }
.help li > ul { margin-top: var(--s-2); }
.help h2 { scroll-margin-top: var(--s-6); }
.help ol + ul { margin-top: var(--s-4); }
.help-trial { padding: var(--s-3); border-left: var(--bw) solid var(--c-warning); background: var(--c-warning-soft); }
.help-toc ul { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); list-style: none; padding: 0; }
.help-toc li { margin: 0; }
.help-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-4) 0 0; }
