/* =====================================================================
 *  Panel de Calificaciones — styles.css
 *  ---------------------------------------------------------------------
 *  Every colour is a token. Light is the default (:root); dark is a token
 *  override on [data-theme="dark"], which app.js stamps on <html>. Nothing
 *  below should hardcode a colour — if it does, dark mode breaks there.
 *
 *  Design language: a quiet, dense, enterprise-analytics surface.
 *    - One neutral scale carries the interface; the brand burgundy is kept
 *      for the primary action, the active tab and data accents.
 *    - Semantic colours (green / red / amber) are muted and only appear
 *      where they mean something.
 *    - Flat surfaces: a 1px hairline instead of a drop shadow, 8-10px
 *      radii, one type scale (12 / 13 / 14 / 15 / 22 / 26), weights 400 /
 *      500 / 600 only, tabular figures for every number.
 *  Charts read these same tokens (themeColors() in app.js), so a token
 *  change restyles the charts too.
 * ===================================================================== */

/* Inter (variable, weights 100-900), self-hosted. The unicode-range split means
   the larger latin-ext file is only fetched when a page actually needs it. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations"), url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations"), url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root, [data-theme="light"] {
  --bg: #f6f7f9;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --border: #e4e7ec;
  --border-2: #d0d5dd;
  --ink: #101828;
  --muted: #475467;
  --muted-2: #667085;
  --hover: #f2f4f7;

  --brand: #8a1c3b;
  --brand-rgb: 138, 28, 59;
  --brand-fill: #8a1c3b;
  --brand-700: #6f1530;
  --brand-ink: #6f1530;
  --brand-soft: #fbf3f5;
  --brand-soft-border: #efdde3;
  --brand-sep: #c9a0ad;

  --dark: #101828;
  --dark-hover: #1d2939;

  --green: #12805c;
  --green-soft: #ecf7f2;
  --green-ink: #0b6b4a;
  --red: #c4372f;
  --red-soft: #fdf2f1;
  --red-ink: #a4271f;
  --danger-rgb: 196, 55, 47;
  --amber-ink: #a15c07;

  --info-bg: #eff4fb;
  --info-border: #cfdcf0;
  --info-ink: #1f3e6b;
  --warn-bg: #fff8ec;
  --warn-border: #f3ddb5;
  --warn-ink: #7a4a0a;
  --err-bg: #fdf2f1;
  --err-border: #f5cfcb;
  --err-ink: #8f221b;

  --sim-bg: #eef4f8;
  --sim-border: #d5e3ec;
  --sim-ink: #2c6580;
  --other-bg: #f2f4f7;
  --other-border: #e4e7ec;
  --other-ink: #475467;

  --track: #eaecf0;
  --grid: #eaecf0;
  --axis: #667085;
  --tip-bg: #101828;
  --tip-ink: #ffffff;
  --turn-ink: #344054;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .3);
  --overlay: rgba(16, 24, 40, .5);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --focus: 0 0 0 3px rgba(var(--brand-rgb), .16);
}

[data-theme="dark"] {
  --bg: #0b0f16;
  --bg-2: #0f141d;
  --panel: #121722;
  --panel-2: #171d2a;
  --border: #222a38;
  --border-2: #323c4d;
  --ink: #e8ecf3;
  --muted: #a3adbd;
  --muted-2: #7a8599;
  --hover: #1a2130;

  --brand: #e0708f;
  --brand-rgb: 224, 112, 143;
  --brand-fill: #a02348;
  --brand-700: #8a1c3b;
  --brand-ink: #f0adc0;
  --brand-soft: #241520;
  --brand-soft-border: #43232f;
  --brand-sep: #7a5460;

  --dark: #2b3548;
  --dark-hover: #36425a;

  --green: #3dbb8a;
  --green-soft: #0f2a21;
  --green-ink: #5fd3a5;
  --red: #ef7068;
  --red-soft: #2b1718;
  --red-ink: #f5a09a;
  --danger-rgb: 239, 112, 104;
  --amber-ink: #f0b44c;

  --info-bg: #111e35;
  --info-border: #1f3763;
  --info-ink: #b6d1f5;
  --warn-bg: #2a1d0d;
  --warn-border: #57391a;
  --warn-ink: #f6d9ae;
  --err-bg: #2b1517;
  --err-border: #5a2326;
  --err-ink: #f5a09a;

  --sim-bg: #11222c;
  --sim-border: #21475b;
  --sim-ink: #7ec2e3;
  --other-bg: #1a212d;
  --other-border: #2e3847;
  --other-ink: #a3adbd;

  --track: #283140;
  --grid: #262f3d;
  --axis: #98a2b3;
  --tip-bg: #05070c;
  --tip-ink: #e8ecf3;
  --turn-ink: #c3ccd9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .65);
  --overlay: rgba(3, 6, 12, .7);
  --focus: 0 0 0 3px rgba(var(--brand-rgb), .24);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/*
 *  ⚠ A class that sets `display` BEATS the browser's `[hidden]` rule, so an
 *  element with `hidden` still shows. Every such class needs its own
 *  `[hidden] { display: none }` — there are a dozen below, and the deep-link
 *  notice needed one too (FEEDBACK-27): it rendered on every page load.
 *
 *  A blanket `[hidden] { display: none !important }` looks like the tidy fix
 *  and is NOT: #report-modal is opened by adding `.open` while the `hidden`
 *  attribute stays on the element, so !important stops the report ever
 *  appearing. Tried, measured, reverted. Add the per-class rule instead.
 */
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { letter-spacing: -.01em; }
td, th, .card-value, .nps-value, .nps-seg-value, .topic-count, .topic-pct,
.search-count, .minibar-val, .score-chip, .rate-badge { font-variant-numeric: tabular-nums; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* The top bar is sticky, so anything scrolled into view (tour, anchors, focus)
   must stop below it rather than slide underneath. */
html { scroll-padding-top: 76px; }

/* Keyboard users: the first Tab stop jumps past the header. */
.skip-link {
  position: fixed; left: 12px; top: -48px; z-index: 400;
  padding: 8px 14px; border-radius: var(--r-md);
  background: var(--ink); color: var(--panel); font-weight: 500; font-size: 13px; text-decoration: none;
  transition: top .12s;
}
.skip-link:focus { top: 10px; }

/* ---------- Icons ----------
   Inline SVG from the sprite in index.html, drawn in currentColor, so they
   follow the text colour in both themes. Never an emoji: those render
   differently on every OS and read as decoration, not information. */
.ico { width: 1em; height: 1em; flex: none; vertical-align: -.125em; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-fill { fill: currentColor; stroke: none; }
.thumb-up .ico, .thumb-down .ico { margin-right: 4px; }
/* The same glyphs as masks, for places that only have text to hang them on. */
.search-icon, .btn-ghost[id$="-download"]::before {
  display: inline-block; width: 15px; height: 15px; flex: none; background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.search-icon {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 0; color: var(--muted-2); pointer-events: none;
}
.btn-ghost[id$="-download"] { display: inline-flex; align-items: center; gap: 7px; }
.btn-ghost[id$="-download"]::before {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='m7 11 5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E");
  width: 14px; height: 14px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 56px;
  /* Same left edge as .container's content on wide screens (1280px column with
     32px padding), the plain 28px gutter otherwise. */
  padding: 0 max(28px, calc(50% - 608px));
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.breadcrumb {
  display: flex; align-items: center; color: var(--muted-2); font-weight: 500; font-size: 13px;
  padding-left: 14px; border-left: 1px solid var(--border-2); height: 20px; white-space: nowrap;
}
.breadcrumb .sep { margin: 0 7px; color: var(--border-2); }
.breadcrumb .current { color: var(--ink); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; }

/* The wordmark ships as two transparent PNGs rather than sitting on a white
   plate. They differ only in the "Play" half: black ink for light surfaces,
   lifted to white for dark ones (the supplied *_white.png keeps "Play" black,
   so it would lose half the wordmark in dark mode). */
.brand-mark img { display: block; width: auto; height: 28px; }
.brand-mark .logo-dark { display: none; }
[data-theme="dark"] .brand-mark .logo-light { display: none; }
[data-theme="dark"] .brand-mark .logo-dark { display: block; }

/* One control height and one hover for everything clickable in the header. */
.logout-btn, .btn-ghost, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-2); background: var(--panel); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
/* These set `display`, which beats the browser's [hidden] rule (see the note
   at the top of this file), so each needs its own. */
.btn-ghost[hidden], .icon-btn[hidden], .btn[hidden], .link-btn[hidden], .rate-flag[hidden] { display: none; }
.logout-btn:hover, .btn-ghost:hover, .icon-btn:hover { background: var(--hover); border-color: var(--border-2); color: var(--ink); }
.logout-btn[hidden] { display: none; }
.live-toggle { white-space: nowrap; }
.icon-btn { width: 32px; padding: 0; }
.icon-btn .ico { width: 16px; height: 16px; }
.user-badge {
  font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 0 4px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-badge[hidden] { display: none; }

/* ---------- Layout ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.subtitle { margin: 0; color: var(--muted); font-size: 14px; }

.mock-banner {
  margin: 18px 0 0; padding: 10px 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink);
  border-radius: var(--r-md); font-size: 13px;
}

/* ---------- Summary cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px 15px;
}
.card-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.card-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin-top: 8px; }
.card-value.up { color: var(--green); }
.card-value.down { color: var(--red); }
.card-sub { color: var(--muted-2); font-size: 12.5px; margin-top: 3px; }

/* ---------- Panels & charts ---------- */
.charts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 12px; }
.charts > .panel { margin-bottom: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px 20px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.panel h2 { margin: 0 0 14px; font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.search-box { display: flex; align-items: center; gap: 8px; }
.search-field { position: relative; }
.search-box input[type="search"] {
  width: 240px; max-width: 100%; height: 32px; padding: 0 12px 0 34px;
  border: 1px solid var(--border-2); border-radius: var(--r-md); font-size: 13px; color: var(--ink);
  background: var(--panel); outline: none; font-family: inherit;
}
.search-box input[type="search"]::placeholder { color: var(--muted-2); }
.search-box input[type="search"]:focus { border-color: var(--brand); box-shadow: var(--focus); }
.search-count { color: var(--muted-2); font-size: 12.5px; white-space: nowrap; }
.charts canvas { max-height: 280px; }
.panel > canvas { max-height: 340px; }
.empty-chart[hidden] { display: none; }
canvas[hidden] { display: none; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.data-table th {
  color: var(--muted-2); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; padding-top: 9px; padding-bottom: 9px;
  border-bottom-color: var(--border-2); white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table.clickable tbody tr { cursor: pointer; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; background: var(--hover); }
.data-table tbody tr:hover { background: var(--hover); }
.ref-cell { white-space: nowrap; }
.date-cell { white-space: nowrap; color: var(--muted); }
/* Center the numeric columns of the per-simulator table */
#sim-table th:nth-child(n+5), #sim-table td:nth-child(n+5) { text-align: center; }
.ref-id { font-weight: 600; color: var(--ink); }
.ref-sub { color: var(--muted-2); font-size: 12px; }
.report-refs { margin: 0 0 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.ref-chip {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: var(--r-sm); font-size: 12.5px;
}
.ref-chip strong { color: var(--ink); font-weight: 500; }
.empty-row { text-align: center; color: var(--muted-2); padding: 28px 12px; }
.empty-chart {
  display: flex; align-items: center; justify-content: center;
  height: 140px; color: var(--muted-2); font-size: 13px;
}
.thumb-up { color: var(--green); font-weight: 600; }
.thumb-down { color: var(--red); font-weight: 600; }
.link-view { color: var(--brand); font-weight: 500; white-space: nowrap; }

/* Wide tables scroll inside their panel instead of collapsing their columns */
#sessions-table { min-width: 1120px; }
#sim-table { min-width: 900px; }
#q-table { min-width: 1040px; }
#c-table { min-width: 900px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--panel); border-radius: var(--r-lg); width: min(820px, 100%);
  max-height: 90vh; overflow: auto; position: relative; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: none; border-radius: var(--r-md); background: none;
  font-size: 22px; line-height: 1; color: var(--muted-2); cursor: pointer;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--hover); color: var(--ink); }
.modal-close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#report-content { padding: 28px; }
/* The close × is absolutely positioned over this row, so the header reserves
   room for it — otherwise "Descargar como PDF" runs right up under the × and
   the two read as one control. */
.report-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 0 0 18px; padding-right: 48px;
}
.report-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.dl-icon { display: inline-flex; }
/* The gutter is only needed on screen, where the × floats over this row.
   Browser printing (Ctrl+P) has no ×, so drop it. The html2pdf export takes a
   different path entirely — it clones the node and strips .no-print, so
   downloadReportPdf() clears the gutter on the clone rather than relying on
   this rule, which @media print would never apply to a canvas render. */
@media print { .report-head { padding-right: 0; } }
.report-meta { margin: 0 0 12px; color: var(--muted); }
.report-meta strong { color: var(--ink); font-weight: 500; }

/* Rating box — mirrors the "Valora esta simulación" panel in the app */
.rating-box {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px;
  margin: 8px 0 18px; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.rating-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.rating-title .star { display: none; }
.rating-sub { color: var(--muted-2); font-size: 12.5px; margin-top: 2px; }
.rating-right { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.thumbs { display: flex; gap: 8px; }
.thumb-btn {
  width: 36px; height: 36px; border-radius: var(--r-md); border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  color: var(--muted-2); background: var(--panel);
}
.thumb-btn.active { color: var(--green-ink); border-color: var(--green); background: var(--green-soft); }
#r-thumb-down.active { color: var(--red-ink); border-color: var(--red); background: var(--red-soft); }
.puntaje-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.puntaje-label { font-size: 13px; color: var(--muted); }
.puntaje-label strong { color: var(--ink); font-weight: 600; }
.score-slider { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px;
  background: var(--track); outline: none; }
.score-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ink); cursor: default; }
.score-slider::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: var(--ink); }
.enviada { color: var(--green-ink); font-weight: 500; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.enviada .check { display: inline-flex; }
.report-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.report-tab {
  padding: 8px 12px; border: none; background: none; cursor: pointer;
  color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px;
  font-family: inherit;
}
.report-tab:hover { color: var(--ink); }
.report-tab.active { color: var(--ink); border-bottom-color: var(--brand); }
.interaction { display: none; }
.interaction.active { display: block; }
.turn { margin-bottom: 14px; }
.turn .who { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; color: var(--muted-2); }
.turn .who.avatar { color: var(--brand); }
.turn .text { color: var(--turn-ink); }

.report-comment {
  background: var(--panel-2); border: 1px solid var(--border);
  border-left: 3px solid var(--brand); border-radius: var(--r-md); padding: 12px 15px; margin: 0 0 18px;
}
.report-comment[hidden] { display: none; }
.report-comment-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px;
}
.report-comment-text { color: var(--turn-ink); font-size: 14px; line-height: 1.55; }

.modal-actions { padding: 0 28px 24px; display: flex; justify-content: flex-end; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--r-md); height: 34px; padding: 0 14px;
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: background .12s;
}
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: var(--dark-hover); }

/* =====================================================================
   LOGIN — a full-viewport page of its own: centred brand, one card, legal
   footnote, and the language/theme switchers pinned top-right. Driven by
   the same tokens as the dashboard, so it follows dark/light with no
   second palette.
   ===================================================================== */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  /* NOT justify-content:center — with overflow:auto that clips the top of a
     card taller than the viewport (the register form), and the clipped part
     cannot be scrolled back to. `margin:auto` on the child centres it while
     still yielding to the scroll area. */
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px 40px;
  background: var(--bg);
  background-image: radial-gradient(90% 40% at 50% 0%, rgba(var(--brand-rgb), .07), transparent 70%);
  overflow: auto;
}
.login-overlay[hidden] { display: none; }

.auth-topbar { position: absolute; top: 18px; right: 20px; display: flex; align-items: center; gap: 8px; }
.auth-shell { width: 100%; max-width: 400px; margin: auto; display: flex; flex-direction: column; align-items: center; }

.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; }
.auth-brand-mark img { height: 40px; max-width: 100%; }
.auth-brand-tag { font-size: 12.5px; color: var(--muted-2); letter-spacing: .02em; }

.auth-card {
  width: 100%; box-sizing: border-box;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 28px 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .12);
  text-align: left;
}
[data-theme="dark"] .auth-card { box-shadow: 0 12px 34px rgba(0, 0, 0, .5); }
.auth-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.auth-sub { margin: 6px 0 22px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }

.auth-field { display: block; margin-bottom: 14px; }
.auth-field > span { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.auth-field input {
  width: 100%; box-sizing: border-box;
  height: 40px; padding: 0 12px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--border-2);
  color: var(--ink); font-size: 14px; font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.auth-field input::placeholder { color: var(--muted-2); }
.auth-field input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: var(--focus);
}

/* Password field + reveal toggle. Padding-right keeps typed text clear of it. */
.auth-pw { position: relative; }
.auth-pw input { padding-right: 42px; }
.auth-eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  display: grid; place-items: center; width: 30px; height: 30px;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--muted-2); cursor: pointer;
}
.auth-eye:hover { color: var(--ink); background: var(--hover); }
.auth-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.auth-error {
  margin-bottom: 14px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--err-bg); border: 1px solid var(--err-border);
  color: var(--err-ink); font-size: 13px; line-height: 1.45;
}
.auth-error[hidden] { display: none; }

.auth-submit {
  width: 100%; box-sizing: border-box;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; font-family: inherit; cursor: pointer;
  background: var(--brand-fill); border: 1px solid var(--brand-fill); color: #fff;
  transition: background .12s, border-color .12s, opacity .12s;
}
.auth-submit:hover:not(:disabled) { background: var(--brand-700); border-color: var(--brand-700); }
.auth-submit:disabled { opacity: .6; cursor: not-allowed; }

.auth-alt {
  width: 100%; box-sizing: border-box;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; font-family: inherit; cursor: pointer;
  background: transparent; border: 1px solid var(--border-2); color: var(--ink);
  transition: background .12s;
}
.auth-alt:hover { background: var(--hover); }

/* Centred label over a hairline rule. */
.auth-divider { position: relative; text-align: center; margin: 18px 0 14px; }
.auth-divider::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border);
}
.auth-divider span {
  position: relative; padding: 0 12px; background: var(--panel);
  font-size: 12px; color: var(--muted-2);
}

.auth-hint { margin: -6px 0 14px; font-size: 12px; color: var(--muted-2); line-height: 1.45; }
.auth-hint[hidden] { display: none; }
.auth-field[hidden] { display: none; }
.auth-remember {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 16px;
  cursor: pointer; font-size: 13px; color: var(--muted);
}
.auth-remember input {
  width: 15px; height: 15px; accent-color: var(--brand-fill); cursor: pointer; flex: 0 0 auto;
}

.auth-legal { margin: 22px 0 0; text-align: center; font-size: 12px; color: var(--muted-2); line-height: 1.6; max-width: 380px; }
.auth-legal a { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 2px; }
.auth-legal a:hover { text-decoration-color: var(--ink); }

/* ---------- Switchers (language + theme) ---------- */
.switcher {
  display: inline-flex; background: var(--panel);
  border: 1px solid var(--border-2); border-radius: var(--r-md); overflow: hidden; height: 32px;
}
.switcher button {
  background: transparent; border: 0; color: var(--muted-2);
  padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .02em; cursor: pointer; font-family: inherit;
}
.switcher button + button { border-left: 1px solid var(--border); }
.switcher button:hover { color: var(--ink); background: var(--hover); }
.switcher button.active { background: var(--ink); color: var(--panel); }
[data-theme="dark"] .switcher button.active { background: var(--ink); color: var(--bg); }

/* ================================================================
   Global filter bar — applies to every tab
   ================================================================ */
.filters {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px 16px; margin: 20px 0 16px;
}
.filter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter label {
  font-size: 12px; font-weight: 500; color: var(--muted);
}
/*
 *  ⚠ A <select> SIZES ITSELF TO ITS LONGEST OPTION, and the exercise
 *  filter's options are built from live data — "#3236 · Coach Adium
 *  Ecuador …". As exercises are added they get longer, so without a cap
 *  the control silently grows past the viewport and the whole page
 *  scrolls sideways on a phone. It measured 367px inside a 356px column.
 *
 *  Two things are needed, and one alone does not work:
 *    max-width  — stops the select exceeding its column;
 *    min-width:0 on .filter — a flex item defaults to min-width:auto,
 *                 which refuses to shrink below its content, so the
 *                 column itself would still be pushed wide.
 */
.filter select, .filter input[type="date"] {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--r-md);
  font-size: 13.5px; color: var(--ink); background: var(--panel); outline: none;
  font-family: inherit; min-width: 168px;
  max-width: 100%;
}
.filter select:focus, .filter input[type="date"]:focus {
  border-color: var(--brand); box-shadow: var(--focus);
}
/* The native date picker icon is black and disappears on the dark surface. */
[data-theme="dark"] .filter input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); }
.filter-status {
  margin-left: auto; color: var(--muted-2); font-size: 12.5px;
  align-self: center; text-align: right;
}
.filter-status.filtered { color: var(--ink); font-weight: 500; }

/* ================================================================
   Main tabs
   ================================================================ */
.tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.tab {
  padding: 10px 14px; border: none; background: none; cursor: pointer;
  color: var(--muted-2); font-weight: 500; font-size: 13.5px; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .12s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ================================================================
   Inline messages
   ================================================================ */
.load-error {
  background: var(--err-bg); border: 1px solid var(--err-border); color: var(--err-ink);
  border-radius: var(--r-md); padding: 12px 16px; font-size: 13.5px; margin-bottom: 16px;
}
.load-error[hidden] { display: none; }
.panel-sub { margin: -8px 0 14px; color: var(--muted-2); font-size: 13px; }

/* ================================================================
   Product comparison cards (Coach vs Simulador)
   ================================================================ */
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.product-card .card-value { font-size: 28px; }
.product-card .of-ten { font-size: 15px; font-weight: 500; color: var(--muted-2); }
.product-stat-row {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.card-value-sm { font-size: 16px; line-height: 1.35; margin-top: 8px; font-weight: 600; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }

/* ================================================================
   Table cell decorations
   ================================================================ */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill-coach { background: var(--brand-soft); color: var(--brand-ink); border: 1px solid var(--brand-soft-border); }
.pill-sim   { background: var(--sim-bg); color: var(--sim-ink); border: 1px solid var(--sim-border); }
.pill-other { background: var(--other-bg); color: var(--other-ink); border: 1px solid var(--other-border); }

.score-chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.score-high { background: var(--green-soft); color: var(--green-ink); }
.score-low  { background: var(--red-soft); color: var(--red-ink); }

.minibar {
  display: inline-block; vertical-align: middle;
  width: 72px; height: 6px; border-radius: 4px; background: var(--track); overflow: hidden;
}
.minibar-fill { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.minibar-val { margin-left: 8px; font-size: 13px; }

.comment-cell { max-width: 220px; }
.missing-comment {
  color: var(--amber-ink); font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
}
.q-text { max-width: 300px; color: var(--ink); vertical-align: top; }
.a-text { max-width: 380px; color: var(--muted); font-size: 13px; vertical-align: top; }
/* The clamp lives on an inner div — -webkit-box on a <td> drops it out of the row. */
.clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5;
  line-clamp: 5; overflow: hidden;
}
.check-inline {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap;
}
.check-inline input { accent-color: var(--brand); cursor: pointer; }

/* ================================================================
   Discreet "i" markers + their shared tooltip
   ================================================================ */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex: none;
  margin-left: 6px; vertical-align: middle;
  border: 1px solid var(--border-2); border-radius: 50%;
  background: transparent; color: var(--muted-2);
  font-family: inherit; font-size: 9.5px; font-weight: 600; font-style: normal;
  line-height: 1; text-transform: none; letter-spacing: 0;
  cursor: help; user-select: none;
}
.info:hover, .info:focus-visible {
  border-color: var(--ink); color: var(--ink); background: var(--hover); outline: none;
}
.panel h2, .card-label, .filter label, .nps-headline-label { display: flex; align-items: center; }
th .info { margin-left: 5px; }

.tip {
  position: fixed; z-index: 200; top: 0; left: 0;
  max-width: 320px;
  padding: 9px 12px; border-radius: var(--r-md);
  background: var(--tip-bg); color: var(--tip-ink);
  font-size: 12.5px; font-weight: 400; line-height: 1.5;
  text-transform: none; letter-spacing: normal; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .12s ease;
}
.tip.visible { opacity: 1; visibility: visible; }

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 880px) {
  .cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .charts { grid-template-columns: 1fr; }
  .cards-2 { grid-template-columns: 1fr; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
  .filter { min-width: 0; }
  .filter select, .filter input[type="date"] { min-width: 0; width: 100%; }
  .filters > .btn-ghost { justify-self: start; }
  .filter-status { grid-column: 1 / -1; margin-left: 0; text-align: left; width: 100%; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
  .topbar { padding: 0 16px; }
  .container { padding: 20px 16px 48px; }
  .auth-topbar { top: 12px; right: 12px; }
}

/* ================================================================
   ROBIN AI — floating button + chat drawer
   ================================================================ */
/* Icon only — the name lives in aria-label and on the drawer header. */
.ai-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 120;
  display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border: none; border-radius: 50%;
  background: var(--ink); color: var(--panel); cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 24, 40, .28);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.ai-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(16, 24, 40, .34); }
.ai-fab[hidden] { display: none; }

.ai-overlay {
  position: fixed; inset: 0; z-index: 118;
  background: var(--overlay);
}
.ai-overlay[hidden] { display: none; }

.ai-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 119;
  width: min(430px, 100%);
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.18);
}
[data-theme="dark"] .ai-drawer { box-shadow: -12px 0 40px rgba(0,0,0,.55); }
.ai-drawer[hidden] { display: none; }

.ai-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); flex: none;
}
.ai-drawer-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ai-drawer-avatar {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 11px; background: var(--brand-soft); color: var(--brand-ink);
  border: 1px solid var(--brand-soft-border);
}
.ai-drawer-name { display: flex; flex-direction: column; min-width: 0; }
.ai-drawer-name b { font-size: 15px; letter-spacing: .2px; }
.ai-tagline { font-size: 11.5px; color: var(--muted-2); letter-spacing: .2px; }
.ai-drawer-actions { display: flex; gap: 7px; flex: none; }
.ai-drawer-actions .icon-btn { width: 32px; height: 30px; font-size: 13px; }

.ai-messages {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Empty state */
.ai-intro { text-align: center; padding: 20px 8px; }
.ai-intro b { display: block; font-size: 17px; margin-bottom: 6px; }
.ai-intro-sub { display: block; color: var(--muted); font-size: 13px; line-height: 1.55; }
.ai-verified {
  display: inline-block; margin-top: 12px;
  font-size: 11.5px; font-weight: 600; color: var(--green);
}
.ai-suggestions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.ai-suggestions button {
  padding: 10px 13px; border-radius: 10px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--ink);
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.ai-suggestions button:hover { border-color: var(--brand); color: var(--brand); }

/* Messages */
.ai-msg { display: flex; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 86%; padding: 11px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.ai-msg.user .ai-bubble {
  background: var(--dark); color: #fff; border-bottom-right-radius: 5px;
}
.ai-msg.ai .ai-bubble {
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--border); border-bottom-left-radius: 5px;
}
.ai-bubble.ai-thinking { color: var(--muted); font-style: italic; }
.ai-bubble.ai-error { border-color: var(--err-border); color: var(--err-ink); background: var(--err-bg); }
.ai-msg-img { display: block; max-width: 100%; border-radius: 9px; margin-bottom: 8px; }
.ai-note {
  margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted-2); font-style: italic;
}

/* Attachment preview */
.ai-attachment {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 10px 18px; border-top: 1px solid var(--border); background: var(--panel-2);
}
.ai-attachment[hidden] { display: none; }
.ai-attachment img { width: 38px; height: 38px; object-fit: cover; border-radius: 7px; }
.ai-attachment-name {
  flex: 1; font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-attachment-x {
  border: none; background: none; color: var(--muted); cursor: pointer; font-size: 14px;
}

/* Composer */
.ai-input {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 14px 16px; border-top: 1px solid var(--border);
}
.ai-input input[type="text"] {
  flex: 1; min-width: 0; padding: 11px 13px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--ink); font-size: 13.5px; font-family: inherit; outline: none;
}
.ai-input input[type="text"]:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .18);
}
.ai-attach-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 9px; background: transparent; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
}
.ai-attach-btn:hover { border-color: var(--brand); color: var(--brand); }
.ai-attach-btn[hidden] { display: none; }
.ai-send {
  display: grid; place-items: center; width: 38px; height: 36px; flex: none;
  border-radius: var(--r-md); border: none; background: var(--dark); color: #fff;
  font-size: 14px; cursor: pointer;
}
.ai-send:hover:not(:disabled) { background: var(--dark-hover); }
.ai-send:disabled { opacity: .55; cursor: default; }

@media (max-width: 880px) {
  .ai-drawer { width: 100%; }
  .ai-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
}

/* ================================================================
   NPS — Net Promoter Score
   ================================================================ */
/* Five KPI cards now fit on the Resumen row; auto-fit keeps the
   four-card sections looking the same as before. */

.nps-hero {
  display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px; margin: 16px 0 12px;
}
.nps-headline {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.nps-headline-label {
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  display: flex; align-items: center;
}
.nps-value { font-size: 56px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 4px; }
.nps-formula { font-size: 12px; color: var(--muted-2); }
.nps-band {
  margin-top: 12px; padding: 3px 10px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600;
}
.nps-band.excellent { background: var(--green-soft); color: var(--green-ink); }
.nps-band.great     { background: var(--green-soft); color: var(--green-ink); }
.nps-band.ok        { background: var(--warn-bg); color: var(--warn-ink); }
.nps-band.poor      { background: var(--red-soft); color: var(--red-ink); }

/* -100 .. +100 scale with a marker at the current score */
.nps-gauge { position: relative; width: 100%; margin-top: 22px; height: 34px; }
.nps-gauge-track {
  position: absolute; top: 6px; left: 0; right: 0; height: 6px; border-radius: 4px;
  background: linear-gradient(90deg, var(--red) 0%, var(--muted-2) 50%, var(--green) 100%);
}
.nps-gauge-marker {
  position: absolute; top: 0; width: 3px; height: 18px; border-radius: 2px;
  background: var(--ink); transform: translateX(-50%);
  transition: left .25s ease;
}
.nps-gauge-min, .nps-gauge-zero, .nps-gauge-max {
  position: absolute; top: 20px; font-size: 11px; color: var(--muted-2);
}
.nps-gauge-min { left: 0; }
.nps-gauge-zero { left: 50%; transform: translateX(-50%); }
.nps-gauge-max { right: 0; }

/* The three segment cards */
.nps-segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nps-seg {
  position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 18px 16px 22px; text-align: left;
}
/* A colour edge says which group it is; the emoji faces this replaces said
   the same thing less precisely and rendered differently on every OS. */
.nps-seg::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--border-2);
}
.nps-seg.promoters::before  { background: var(--green); }
.nps-seg.passives::before   { background: var(--muted-2); }
.nps-seg.detractors::before { background: var(--red); }
.nps-seg-face { display: none; }
.nps-seg { display: flex; flex-direction: column; justify-content: center; }
.nps-seg-name { font-size: 13px; font-weight: 600; }
.nps-seg-range { font-size: 12px; color: var(--muted-2); }
.nps-seg-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 10px; }
.nps-seg.promoters  .nps-seg-value { color: var(--green); }
.nps-seg.detractors .nps-seg-value { color: var(--red); }
.nps-seg-sub { font-size: 12px; color: var(--muted); }

/* Stacked share bar */
.nps-bar {
  display: flex; height: 30px; border-radius: var(--r-md); overflow: hidden;
  background: var(--track); margin-bottom: 18px;
}
.nps-bar-part {
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap;
  transition: width .25s ease;
}
.nps-bar-part.promoters  { background: var(--green); }
.nps-bar-part.passives   { background: var(--muted-2); }
.nps-bar-part.detractors { background: var(--red); }

/* 0-10 strip, coloured by band */
.nps-scale { display: flex; gap: 6px; align-items: flex-end; }
.nps-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nps-step-bar {
  width: 100%; height: 70px; display: flex; align-items: flex-end;
  background: var(--panel-2); border-radius: 5px; overflow: hidden;
}
.nps-step-fill { width: 100%; border-radius: 5px 5px 0 0; transition: height .25s ease; }
.nps-step.promoters  .nps-step-fill { background: var(--green); }
.nps-step.passives   .nps-step-fill { background: var(--muted-2); }
.nps-step.detractors .nps-step-fill { background: var(--red); }
.nps-step-n { font-size: 11.5px; font-weight: 700; color: var(--ink); }
.nps-step-label { font-size: 11.5px; color: var(--muted-2); }

.nps-chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.nps-chip.excellent, .nps-chip.great { background: var(--green-soft); color: var(--green-ink); }
.nps-chip.ok   { background: var(--warn-bg); color: var(--warn-ink); }
.nps-chip.poor { background: var(--red-soft); color: var(--red-ink); }

@media (max-width: 880px) {
  .nps-hero { grid-template-columns: 1fr; }
  .nps-segments { grid-template-columns: 1fr; }
  .nps-value { font-size: 52px; }
}

/* Production / non-production marker on the per-simulator table. Muted on
   purpose: it is context for the row, not a status to alarm anyone. */
.prod-yes, .prod-no {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.prod-yes { background: var(--ok-bg, rgba(34,160,90,.13)); color: var(--ok-fg, #17794a); }
.prod-no  { background: var(--muted-bg, rgba(120,130,145,.15)); color: var(--muted-fg, #6b7480); }
[data-theme="dark"] .prod-yes { background: rgba(52,199,123,.16); color: #56d195; }
[data-theme="dark"] .prod-no  { background: rgba(150,160,175,.16); color: #a2acbb; }

/* Comment taxonomy (INNOVATION-731). Four fixed categories — the ticket
   says not to invent a fifth, so there are exactly four tokens here. */
.cat-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.cat-technical { background: rgba(220,38,38,.12); color: #b91c1c; }
.cat-content   { background: rgba(138,28,59,.12); color: var(--brand); }
.cat-score     { background: rgba(176,125,43,.14); color: #8a6220; }
.cat-other     { background: rgba(120,130,145,.15); color: var(--muted); }
.cat-technical-ink { color: #b91c1c; }
.cat-content-ink   { color: var(--brand); }
.cat-score-ink     { color: #8a6220; }
.cat-other-ink     { color: var(--muted); }
[data-theme="dark"] .cat-technical { background: rgba(248,113,113,.16); color: #f87171; }
[data-theme="dark"] .cat-content   { background: rgba(244,114,182,.14); color: #f0a6c0; }
[data-theme="dark"] .cat-score     { background: rgba(217,164,74,.16); color: #d9a44a; }
[data-theme="dark"] .cat-other     { background: rgba(150,160,175,.16); color: #a2acbb; }
[data-theme="dark"] .cat-technical-ink { color: #f87171; }
[data-theme="dark"] .cat-score-ink     { color: #d9a44a; }

/* The NPS denominator line — deliberately quiet, but always present, so a
   score computed from a small sample can never be read as speaking for all
   simulations (INNOVATION-731). */
.nps-denominator {
  margin-top: 10px; font-size: 13px; color: var(--muted); max-width: 46ch;
}

/* ---------- Unanswered-question topics (clustered view) ----------
   One row per topic: name, a frequency bar, count, share, the products the
   gap is about, and an expandable list of the questions behind it. */
.topic-list { display: flex; flex-direction: column; gap: 6px; }
.topic-row { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); }
.topic-row.open { border-color: var(--border-2); }
.topic-head {
  width: 100%; display: grid; align-items: center; gap: 12px;
  grid-template-columns: 16px minmax(160px, 1.3fr) minmax(80px, 2fr) 48px 44px;
  padding: 10px 14px; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--ink); text-align: left; border-radius: var(--r-md);
}
.topic-head:hover { background: var(--hover); }
.topic-head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.topic-caret { color: var(--muted); font-size: 12px; }
.topic-name { font-weight: 600; }
.topic-bar { height: 8px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.topic-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--ink); opacity: .78; }
.topic-other .topic-bar > span { background: var(--muted-2); }
.topic-other .topic-name { color: var(--muted); font-weight: 500; }
.topic-count { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.topic-pct { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.topic-products { padding: 0 14px 10px 42px; font-size: 12.5px; color: var(--muted); }
.topic-body { padding: 4px 14px 14px 42px; }
.topic-questions { list-style: none; margin: 0 0 10px; padding: 0; max-height: 420px; overflow-y: auto; }
.topic-questions li { padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.topic-q { color: var(--ink); }
.topic-meta { font-size: 12px; color: var(--muted); }
.topic-more { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.topic-chip {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: rgba(138,28,59,.10); color: var(--brand);
}
[data-theme="dark"] .topic-chip { background: rgba(244,114,182,.14); color: #f0a6c0; }
#q-topic { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel); color: var(--ink); font: inherit; max-width: 240px; }

/* Narrow screens: the bar and share drop out, name and count stay. */
@media (max-width: 640px) {
  .topic-head { grid-template-columns: 16px 1fr 44px; }
  .topic-bar, .topic-pct { display: none; }
  .topic-products, .topic-body { padding-left: 14px; }
}

/* Short explanatory line under a panel title (Ejercicios, Temas). It was used
   in markup before it existed here, so it rendered as a bare <p>. */
.panel-note { margin: 0 0 14px; font-size: 13.5px; line-height: 1.5; color: var(--muted); max-width: 90ch; }

/* ---------- Response-rate target (FEEDBACK-15) ----------
   Below target must be obvious at a glance: red value, red card edge, a
   filled badge with the gap. On target is quieter — a green badge. */
.rate-card { position: relative; }
/* The edit action sits in the card's corner instead of adding a row to the
   one card in the strip that has it, which made every neighbour taller. */
.rate-card .link-btn { position: absolute; top: 14px; right: 16px; margin: 0; font-size: 12px; }
.rate-card.is-below { border-color: var(--err-border); box-shadow: inset 3px 0 0 var(--red); }
.card-value.rate-below { color: var(--red-ink); }
.card-value.rate-met { color: var(--green-ink); }
.rate-flag {
  display: inline-block; margin-top: 8px; padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.rate-flag.below { background: var(--red-soft); color: var(--red-ink); }
.rate-flag.met { background: var(--green-soft); color: var(--green-ink); }
.link-btn {
  display: block; margin-top: 8px; padding: 0; border: 0; background: none;
  color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: var(--ink); }
.link-btn:hover { opacity: .8; }
.link-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

.rate-badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-sm);
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rate-badge.below { background: var(--red-soft); color: var(--red-ink); }
.rate-badge.met { background: var(--green-soft); color: var(--green-ink); }
.rate-badge.none { color: var(--ink); padding-left: 0; }
.rate-target { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
tr.row-below td:first-child { box-shadow: inset 3px 0 0 var(--red); }

.target-modal { width: min(560px, 100%); }
.target-body { padding: 28px; }
.target-body h2 { margin: 0 0 6px; padding-right: 48px; }
.target-body h3 { margin: 22px 0 2px; font-size: 15px; }
.target-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 600; }
.target-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.target-input input {
  width: 96px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--ink); font: inherit; text-align: right;
}
.target-input input:focus-visible, .target-client:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.target-hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.target-clients { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.target-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.target-client {
  min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--ink); font: inherit;
}
.target-error { margin: 14px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--red-soft); color: var(--red-ink); font-size: 13.5px; }
.target-meta { margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.target-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 520px) {
  .target-row { grid-template-columns: 1fr auto; }
  .target-row .target-remove { grid-column: 1 / -1; justify-self: start; }
}

/* Seven KPI cards on Resumen since the simulations + response-rate cards
   arrived; at 190px minimum only six fit and NPS dropped onto a row of its
   own. Scoped to the summary row — the other card rows hold four. */
/* Nine figures in two rows that each fill the width: four for volume, five
   for the ratings. auto-fit left two orphans on a second row. */
#summary-cards { grid-template-columns: repeat(20, 1fr); }
#summary-cards > .card { grid-column: span 4; }
#summary-cards > .card:nth-child(-n+4) { grid-column: span 5; }
@media (max-width: 900px) {
  #summary-cards { grid-template-columns: repeat(6, 1fr); }
  #summary-cards > .card, #summary-cards > .card:nth-child(-n+4) { grid-column: span 2; }
}
@media (max-width: 560px) {
  #summary-cards { grid-template-columns: repeat(2, 1fr); }
  #summary-cards > .card, #summary-cards > .card:nth-child(-n+4) { grid-column: auto; }
  #summary-cards > .card:last-child { grid-column: 1 / -1; }
}
.rate-flag { white-space: normal; line-height: 1.35; }

/* Top bar on phones. Language switch + theme + wordmark + user name +
   "Cerrar sesión" measured 496px wide, so on a 420px screen EVERY tab
   scrolled sideways. Let it wrap under the breadcrumb, and let the name
   truncate rather than push the sign-out button off screen. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; height: auto; padding: 10px 16px; }
  .breadcrumb { display: none; }
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 0; max-width: 100%; margin-left: auto; }
  .user-badge { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- Live toggle, top right ----------
   The period bar that used to hold it was removed on request; it now sits
   with the language and theme switchers, which is where the other
   always-available controls are. */
.topbar-right .live-toggle { margin-right: 2px; }

/* Category cards double as filter buttons (FEEDBACK-17). They must still
   look like the other KPI cards, so only the affordances are added. */
.cat-card { display: block; width: 100%; text-align: left; font: inherit; cursor: pointer; border: 1px solid var(--border); }
.cat-card:hover { border-color: var(--border-2); }
.cat-card.is-active { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.cat-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#c-category {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--ink); font: inherit; max-width: 230px;
}

/* ---------- Review queue (FEEDBACK-18 / B14) ----------
   The box sits at the top of the report, above the session itself: the
   reviewer's first question is "has anyone looked at this?". It carries
   .no-print, so nothing here reaches the PDF a client receives. */
.review-box {
  margin: 0 0 18px; padding: 14px 16px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.review-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.review-head strong { font-size: 14px; }
.review-fields { display: flex; align-items: start; flex-wrap: wrap; gap: 10px 12px; }
.review-fields label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.review-fields label.review-action { flex: 2 1 260px; }
.review-fields label > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.review-fields select,
.review-fields input[type="text"] {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--ink); font: inherit; width: 100%;
  /* One height for both, or the row never lines up: a select and a text
     input do not size identically on their own, and border-box is what
     stops the padding adding to it. */
  height: 38px; box-sizing: border-box;
}
.review-fields select:focus,
.review-fields input[type="text"]:focus {
  border-color: var(--brand); outline: none;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .18);
}
.review-fields .btn { flex: 0 0 auto; align-self: end; height: 38px; }
.review-error { margin: 10px 0 0; color: var(--err-ink); font-size: 13px; }

/* The state line in the box and the badge in the Sesiones column share the
   rv-* colours, so "reviewed" reads the same in both places. */
.review-state { font-size: 12.5px; color: var(--muted); }
.review-badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--other-border); background: var(--other-bg); color: var(--other-ink);
}
.review-badge.rv-reviewed { border-color: var(--info-border); background: var(--info-bg); color: var(--info-ink); }
.review-badge.rv-acted    { border-color: var(--green);       background: var(--green-soft); color: var(--green-ink); }
.review-state.rv-reviewed { color: var(--info-ink); }
.review-state.rv-acted    { color: var(--green-ink); }

#f-review {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--ink); font: inherit; max-width: 190px;
}
@media (max-width: 640px) {
  .review-fields label, .review-fields label.review-action { flex: 1 1 100%; }
  .review-fields .btn { width: 100%; }
}

/* ---------- Tenancy scope badge (FEEDBACK-24) ----------
   Says which clients the signed-in account may see. A label, not a
   control: rows outside the scope never reach the browser. */
.scope-badge {
  padding: 3px 9px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500;
  white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-ink);
}
.scope-badge.scope-empty {
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink);
}
@media (max-width: 640px) {
  .scope-badge { max-width: 120px; }
}

/* ---------- Live refresh (FEEDBACK-28) ----------
   The indicator IS the toggle: one control, and its state is the answer
   to "is this page still updating?". */
.live-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px; border-radius: var(--r-md); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 500;
  background: var(--panel); border: 1px solid var(--border-2); color: var(--muted);
}
.live-toggle:hover { background: var(--hover); }
.live-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: 0 0 auto;
}
.live-toggle[aria-pressed="true"] { color: var(--ink); }
.live-toggle[aria-pressed="true"] .live-dot { background: var(--green); animation: live-pulse 2.4s ease-in-out infinite; }
.live-toggle.is-stale { color: var(--warn-ink); border-color: var(--warn-border); background: var(--warn-bg); }
.live-toggle.is-stale .live-dot { background: var(--amber-ink); animation: none; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
/* A blinking dot next to a table of numbers is a distraction, and for some
   readers worse than that. Respect the OS setting. */
@media (prefers-reduced-motion: reduce) {
  .live-toggle[aria-pressed="true"] .live-dot { animation: none; }
}

/* ---------- Deep-link notice (FEEDBACK-27) ----------
   Only ever shown when a /feedback/<id> link could not be opened. */
.deep-link-notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px 0 0; padding: 12px 16px; border-radius: 10px;
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  color: var(--warn-ink); font-size: 14px;
}
.deep-link-notice .btn-ghost { margin-left: auto; color: inherit; }
.deep-link-notice[hidden] { display: none; }

/* A disabled "Limpiar": there is nothing to restore, and saying so visually
   is what stops it reading as a dead button. */
.btn-ghost:disabled {
  opacity: .45;
  cursor: default;
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:disabled:hover { border-color: var(--border); background: transparent; }

/* =====================================================================
   Responsive refinements. Kept LAST on purpose: these narrow-screen rules have
   the same specificity as the base rules they adjust, so order decides.
   ===================================================================== */
/* The breadcrumb is a luxury: below laptop width it is what collides with the
   controls, so it goes before anything useful does. */
@media (max-width: 1100px) {
  .breadcrumb { display: none; }
  /* The edit link would crowd the card's label here: let it take its own line. */
  .rate-card .link-btn { position: static; margin-top: 6px; }
}
@media (max-width: 640px) {
  .user-badge { display: none; }
}
@media (max-width: 520px) {
  .filters { grid-template-columns: 1fr; }
  .filter-status { font-size: 12.5px; }
  .card { padding: 14px 15px 13px; }
  .card-value { font-size: 24px; }
}

/* ---------- Loading ----------
   Until the first data lands the figures read "—", which looks like missing
   data. Shimmering placeholders say "on its way" instead. */
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.is-loading .card-value, .is-loading .card-sub, .is-loading .filter-status {
  color: transparent; border-radius: 4px; width: fit-content; min-width: 56px; max-width: 60%;
  background: linear-gradient(90deg, var(--track) 25%, var(--hover) 50%, var(--track) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.is-loading .card-sub { min-width: 90px; }
@media (prefers-reduced-motion: reduce) {
  .tour-pop.is-speaking .tour-mascot { animation: none; }
  .is-loading .card-value, .is-loading .card-sub, .is-loading .filter-status { animation: none; }
  .tab, .data-table tbody tr, .skip-link { transition: none; }
}

/* =====================================================================
 *  Guided tour (tour.js)
 *  The spotlight is one element whose giant box-shadow dims everything
 *  else, so the highlighted area stays crisp. z-index sits above the report
 *  modal (100) and the assistant (118-120) because the tour opens both.
 * ===================================================================== */
.tour-root[hidden] { display: none; }
.tour-shield { position: fixed; inset: 0; z-index: 300; background: transparent; }
.tour-centered .tour-shield { background: rgba(10, 12, 18, .62); }
.tour-spot {
  position: fixed; z-index: 301; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 12, 18, .62), 0 0 0 2px var(--brand);
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.tour-pop {
  position: fixed; z-index: 302; width: min(440px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); display: flex; flex-direction: column;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--border-2); border-top: 3px solid var(--brand);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 14px 18px 14px;
}
.tour-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.tour-head-text { flex: 1; min-width: 0; }
/* The mascot video has a black background and no alpha channel, so it sits in
   a dark rounded tile - that reads as an avatar chip in both themes. */
.tour-mascot {
  flex: none; width: 64px; height: 64px; border-radius: 16px; overflow: hidden;
  background: #000; border: 1px solid var(--border-2);
  transition: box-shadow .2s;
}
.tour-mascot video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tour-pop.is-speaking .tour-mascot { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .35); animation: tour-voice-pulse 1.4s ease-in-out infinite; }
@keyframes tour-voice-pulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .45); } 50% { box-shadow: 0 0 0 5px rgba(var(--brand-rgb), .12); } }
.tour-voice {
  flex: none; display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  height: 28px; padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--border-2); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.tour-voice[hidden] { display: none; }
.tour-voice:hover { background: var(--hover); color: var(--ink); }
.tour-voice.on { color: var(--ink); border-color: var(--ink); }
.tour-voice:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tour-progress { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted-2); }
.tour-title { margin: 0; font-size: 16px; line-height: 1.3; }
.tour-body {
  margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--ink);
  overflow-y: auto; max-height: 42vh; padding-right: 4px; white-space: pre-line;
}
.tour-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-nav { margin-top: 10px; }
.tour-spacer { flex: 1; }
.tour-jump-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tour-jump {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--border-2); border-radius: 6px; padding: 4px 6px; max-width: 190px;
}
.tour-skip { margin-left: auto; color: var(--muted); }
.tour-next {
  background: var(--brand-fill); color: #fff; border: 1px solid var(--brand-fill);
  border-radius: 8px; padding: 7px 18px; font: inherit; font-weight: 600; cursor: pointer;
}
.tour-next:hover { background: var(--brand-700); border-color: var(--brand-700); }
.tour-next:focus-visible, .tour-actions .btn-ghost:focus-visible, .tour-jump:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
body.tour-active { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }

/* ROBIN answers rendered from markdown (renderMarkdown in app.js). Last, and
   scoped to .ai-bubble.md, so nothing else in the panel is affected. */
.ai-bubble.md { white-space: normal; max-width: 100%; }
.ai-bubble.md > :first-child { margin-top: 0; }
.ai-bubble.md > :last-child { margin-bottom: 0; }
.ai-bubble.md p { margin: 0 0 8px; }
.ai-bubble.md ul, .ai-bubble.md ol { margin: 0 0 8px; padding-left: 20px; }
.ai-bubble.md li { margin: 2px 0; }
.ai-bubble.md li.md-sub { margin-left: 16px; list-style-type: circle; }
.ai-bubble.md strong { font-weight: 650; }
.ai-bubble.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  background: var(--hover); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
}
.ai-bubble.md hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.ai-bubble.md .md-h { font-weight: 650; color: var(--ink); margin: 12px 0 5px; line-height: 1.3; }
.ai-bubble.md .md-h1 { font-size: 15px; }
.ai-bubble.md .md-h2 { font-size: 14.5px; }
.ai-bubble.md .md-h3 { font-size: 13.5px; }
.ai-bubble.md .md-h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ai-bubble.md .md-table { overflow-x: auto; margin: 4px 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.ai-bubble.md table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.ai-bubble.md th, .ai-bubble.md td { padding: 6px 7px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ai-bubble.md th { white-space: normal; word-break: keep-all; overflow-wrap: normal; line-height: 1.25; vertical-align: bottom; text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.ai-bubble.md th { background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.ai-bubble.md tbody tr:last-child td { border-bottom: 0; }
.ai-bubble.md .md-right { text-align: right; }
.ai-bubble.md .md-center { text-align: center; }

/* Charts v2 */
.panel canvas { max-width: 100%; }

/* ---- Comentarios tab, v2 ---- */
/* Thin meter under a figure: a share at a glance, coloured by how healthy it is. */
.meter { height: 6px; border-radius: 999px; background: var(--hover); margin-top: 12px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--muted-2); transition: width .35s ease; }
.meter.ok > span { background: var(--green); }
.meter.mid > span { background: #b07d2b; }
.meter.bad > span { background: var(--red); }
@media (prefers-reduced-motion: reduce) { .meter > span { transition: none; } }

/* Category cards: a coloured accent and the share of all comments. */
.cat-card { position: relative; overflow: hidden; }
.cat-card .meter { margin-top: 10px; height: 4px; }
.cat-card.cat-technical-card .meter > span { background: var(--red); }
.cat-card.cat-content-card .meter > span { background: var(--brand); }
.cat-card.cat-score-card .meter > span { background: #b07d2b; }
.cat-card.cat-other-card .meter > span { background: var(--muted-2); }

/* Comments table: the comment is the point, so it gets room and a quiet row
   accent for the ones that need attention (score <= 7). */
#c-table .q-text { min-width: 340px; max-width: 560px; }
#c-table .clamp { -webkit-line-clamp: 3; line-clamp: 3; line-height: 1.5; }
#c-table tbody tr.row-low td:first-child { box-shadow: inset 3px 0 0 var(--red); }
#c-table tbody tr.row-ok td:first-child { box-shadow: inset 3px 0 0 var(--green); }
#c-table tbody td { vertical-align: top; }
mark.hit { background: rgba(var(--brand-rgb), .16); color: inherit; padding: 0 2px; border-radius: 3px; }
.search-box select { min-height: 32px; }
@media (max-width: 760px) {
  .search-box { flex-wrap: wrap; }
  .search-box input[type="search"] { width: 100%; }
  #c-table .q-text { min-width: 220px; }
}

/* ---- Admin tab, team and invitations (FEEDBACK-38) ---- */
.admin-btn.active { border-color: var(--brand); color: var(--brand); }
body.admin-open #filter-bar { display: none; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }
.admin-head h2 { margin: 0; font-size: 20px; }
.admin-add { display: grid; grid-template-columns: 1.1fr 1.4fr .8fr auto; gap: 10px 12px; align-items: end; margin-bottom: 14px; }
.admin-add label { display: flex; flex-direction: column; gap: 4px; }
.admin-add label > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.admin-add input, .admin-add select, #admin-users select {
  height: 38px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--r-md);
  background: var(--panel); color: var(--ink); font: inherit; font-size: 13.5px;
}
#admin-users select { height: 32px; }
.admin-add input:focus, .admin-add select:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.admin-add .btn { height: 38px; }
.admin-result { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); font-size: 13.5px; }
.admin-result p { margin: 0 0 8px; }
.admin-result p:last-child { margin-bottom: 0; }
.admin-result.ok { background: var(--green-soft); border-color: rgba(18,128,92,.25); }
.admin-result.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.admin-result.err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-ink); }
.invite-link { display: flex; gap: 8px; margin: 8px 0; }
.invite-link input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--panel); color: var(--ink); font: inherit; font-size: 12.5px; }
.admin-actions { white-space: nowrap; text-align: right; }
.btn-ghost.danger { color: var(--red-ink); }
.small { font-size: 12px; }
.pill-ok { background: var(--green-soft); color: var(--green-ink); border: 1px solid rgba(18,128,92,.2); }
.pill-wait { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-border); }
.review-note { margin: 10px 0 0; font-size: 13px; }
.review-note.ok { color: var(--green-ink); }
.review-note.warn { color: var(--warn-ink); }
@media (max-width: 760px) {
  .admin-add { grid-template-columns: 1fr; }
  #admin-users { display: block; overflow-x: auto; }
}

/* ---- MCP tokens (FEEDBACK-39) ---- */
.mcp-add { grid-template-columns: minmax(0, 1fr) auto; max-width: 560px; }
#mcp-tokens tr.is-revoked td { color: var(--muted-2); }
#mcp-tokens code, .mcp-help code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.mcp-config { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--border); font-size: 12px; overflow-x: auto; white-space: pre; color: var(--ink); }
.mcp-help { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.mcp-help summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.mcp-help p { margin: 8px 0 0; }

/* ---- Supabase warehouse (FEEDBACK-40) ---- */
.wh-status p { margin: 0 0 6px; font-size: 13.5px; }
.wh-status .wh-err { color: var(--err-ink); }

.pill-off { background: var(--hover); color: var(--muted); border: 1px solid var(--border-2); }

/* ---- FEEDBACK-42: clients column, row menu, clients dialog, forgot password ---- */
.clients-cell { max-width: 260px; }
.clients-warn { color: var(--warn-ink); }
.btn-xs { padding: 2px 8px; font-size: 12px; min-height: 0; }
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; cursor: pointer; padding: 4px 10px; border: 1px solid var(--border-2); border-radius: var(--r-md); font-size: 13px; background: var(--panel); color: var(--ink); }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { border-color: var(--brand); }
.row-menu-list { position: fixed; z-index: 60; min-width: 200px; display: flex; flex-direction: column; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(16,24,40,.12); }
.row-menu-list button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.row-menu-list button:hover, .row-menu-list button:focus-visible { background: var(--hover); outline: none; }
.row-menu-list button.danger { color: var(--red-ink); }
.clients-dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; background: var(--panel); color: var(--ink); }
.clients-dialog::backdrop { background: rgba(16,24,40,.45); }
.clients-dialog h2 { margin: 0 0 6px; font-size: 17px; }
.clients-dialog input[type="search"] { width: 100%; height: 36px; margin: 10px 0; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--panel); color: var(--ink); font: inherit; }
.clients-list { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px; }
.clients-option { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.clients-option:hover { background: var(--hover); }
.clients-option[hidden], #clients-all-row[hidden] { display: none; }
.clients-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.clients-actions .spacer { flex: 1; }
.auth-link { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--brand); font: inherit; font-size: 13.5px; cursor: pointer; text-decoration: underline; }
.auth-error.is-ok { background: var(--green-soft); color: var(--green-ink); border-color: rgba(18,128,92,.25); }
