/* =========================================================
   TYPE SYSTEM — exactly two self-hosted font families, no CDN.
   Caslon (headings/display) + Nunito (everything else). Nunito is
   shipped as a variable font (one file covers the whole 200–1000
   weight axis), so a single @font-face per style/subset covers
   every weight we use (400/500/600/700/800).
   ========================================================= */
@font-face{
  font-family:"Nunito";
  font-style:normal;
  font-weight:200 1000;
  font-display:swap;
  src:url("../fonts/nunito-variable-normal-latin.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Nunito";
  font-style:normal;
  font-weight:200 1000;
  font-display:swap;
  src:url("../fonts/nunito-variable-normal-latin-ext.woff2") format("woff2");
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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;
}
@font-face{
  font-family:"Nunito";
  font-style:italic;
  font-weight:200 1000;
  font-display:swap;
  src:url("../fonts/nunito-variable-italic-latin.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Nunito";
  font-style:italic;
  font-weight:200 1000;
  font-display:swap;
  src:url("../fonts/nunito-variable-italic-latin-ext.woff2") format("woff2");
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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;
}
@font-face{
  font-family:"Libre Caslon Text";
  font-style:normal;
  font-weight:400;
  font-display:swap;
  src:url("../fonts/caslon-400-normal-latin.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Libre Caslon Text";
  font-style:normal;
  font-weight:400;
  font-display:swap;
  src:url("../fonts/caslon-400-normal-latin-ext.woff2") format("woff2");
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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;
}
@font-face{
  font-family:"Libre Caslon Text";
  font-style:italic;
  font-weight:400;
  font-display:swap;
  src:url("../fonts/caslon-400-italic-latin.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Libre Caslon Text";
  font-style:italic;
  font-weight:400;
  font-display:swap;
  src:url("../fonts/caslon-400-italic-latin-ext.woff2") format("woff2");
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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;
}
@font-face{
  font-family:"Libre Caslon Text";
  font-style:normal;
  font-weight:700;
  font-display:swap;
  src:url("../fonts/caslon-700-normal-latin.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Libre Caslon Text";
  font-style:normal;
  font-weight:700;
  font-display:swap;
  src:url("../fonts/caslon-700-normal-latin-ext.woff2") format("woff2");
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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{
  --ink:#2B2E33;
  --teal:#587B7F;
  --teal-dark:#3F5A5D;
  --gold:#E2C044;
  --bg:#F7F9FA;
  --muted:#5b5f66;
  --border:#ececec;
  /* Surface + soft-divider variables — introduced alongside dark mode so
     every card/panel/table background and hairline divider routes through
     a variable instead of a hardcoded #fff/#f0f0f0/etc. Consolidates what
     used to be ~10 near-identical light grays scattered through this file. */
  --surface:#fff;
  --surface-alt:#fafbfb;
  --border-soft:#f0f0f0;
  --input-border:#d8d8d8;
  --font-body:"Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading:"Libre Caslon Text", Georgia, serif;
  /* Type scale — the two-font system stays consistent by routing every
     heading/body size declaration through these, rather than ad hoc
     one-off pixel values. */
  --fs-xs:12px;
  --fs-sm:13px;
  --fs-base:15px;
  --fs-md:16px;
  --fs-lg:19px;
  --fs-h3:17.5px;
  --fs-h2:21px;
  --fs-h1:26px;
  /* Real rendered header height (10px+10px padding + 56px logo + 1px
     border ≈ 77px, rounded up). Used to offset sticky elements below the
     header so they don't tuck under it. */
  --header-h:78px;
}

/* =========================================================
   DARK MODE — self-coded, no theming library. Toggled by
   static/js/theme_toggle.js, which sets data-theme="dark" on <html>
   and persists the choice in localStorage (falls back to the OS-level
   prefers-color-scheme when the person has never toggled it). An inline
   snippet in templates/base.html's <head> applies the saved/system
   preference before first paint, so there's no flash of the wrong theme.

   Brand colors (--teal/--teal-dark/--gold) stay the same values in both
   themes so button/badge contrast ratios validated in light mode aren't
   quietly changed — only the neutral surface/text/border scale flips.
   A handful of components use a translucent brand-color wash as a
   background (badges, chips, status pills) which reads fine on a light
   --bg but goes muddy on a dark one, so those get explicit overrides
   below rather than relying on the neutral variables alone. */
html[data-theme="dark"]{
  --ink:#E7EAEC;
  --bg:#12171A;
  --muted:#A7ADB3;
  --border:#2B3234;
  --surface:#1B2123;
  --surface-alt:#20272A;
  --border-soft:#262D2F;
  --input-border:#3A4245;
}
html[data-theme="dark"] .badge-pinned{background:rgba(226,192,68,0.22); color:#f0d878;}
html[data-theme="dark"] .badge-locked{background:rgba(230,90,80,0.2); color:#f2a8a1;}
html[data-theme="dark"] .badge-review{background:rgba(230,126,34,0.22); color:#f0b877;}
html[data-theme="dark"] .status-open{background:rgba(226,192,68,0.22); color:#f0d878;}
html[data-theme="dark"] .status-answered,
html[data-theme="dark"] .status-delivered,
html[data-theme="dark"] .level-pill,
html[data-theme="dark"] .admin-stat-num{background:rgba(121,166,170,0.22); color:#9cc8cc;}
html[data-theme="dark"] .status-sending,
html[data-theme="dark"] .status-opened{background:rgba(226,192,68,0.22); color:#f0d878;}
html[data-theme="dark"] .status-failed,
html[data-theme="dark"] .status-bounced,
html[data-theme="dark"] .status-blocked{background:rgba(230,90,80,0.2); color:#f2a8a1;}
html[data-theme="dark"] .quiz-result.passed{background:rgba(90,180,120,0.18); color:#8fd6a8;}
html[data-theme="dark"] .quiz-result.failed{background:rgba(230,90,80,0.18); color:#f2a8a1;}
html[data-theme="dark"] .points-badge{background:rgba(226,192,68,0.22); color:#f0d878;}
html[data-theme="dark"] .chip{background:rgba(121,166,170,0.22); color:#9cc8cc;}
html[data-theme="dark"] .chip button{color:#9cc8cc;}
html[data-theme="dark"] .lang-option.active{background:rgba(121,166,170,0.18); color:#9cc8cc;}
html[data-theme="dark"] .messages li{background:rgba(121,166,170,0.16); color:#9cc8cc;}
html[data-theme="dark"] .dm-message.own .dm-message-text{background:rgba(121,166,170,0.2);}
html[data-theme="dark"] .dm-list-item.active{background:rgba(121,166,170,0.16);}
html[data-theme="dark"] .notif-item.notif-unread{background:rgba(121,166,170,0.1);}
html[data-theme="dark"] .ticket-reply-staff{background:rgba(121,166,170,0.12);}
html[data-theme="dark"] .admin-stat-card.is-alert{background:rgba(230,90,80,0.12);}
html[data-theme="dark"] .lesson-locked,
html[data-theme="dark"] .fpost-review-placeholder{background:rgba(230,150,60,0.14); color:#e8bd88; border-color:rgba(230,150,60,0.4);}
html[data-theme="dark"] .newsletter-preview-frame{background:#1f2325;}
html[data-theme="dark"] .newsletter-preview-frame iframe{background:var(--surface);}
html[data-theme="dark"] input, html[data-theme="dark"] textarea, html[data-theme="dark"] select{
  background:var(--surface); color:var(--ink);
}
html[data-theme="dark"] .wysiwyg-editor:empty:before{color:#7d8388;}

*{box-sizing:border-box;}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:var(--fs-base);
  line-height:1.55;
}
h1,h2,h3,h4{
  font-family:var(--font-heading);
  font-weight:700;
  line-height:1.25;
  margin:0 0 16px;
}
h1{font-size:var(--fs-h1);}
h2{font-size:var(--fs-h2);}
h3,h4{font-size:var(--fs-h3);}
a{color:var(--teal); text-decoration:none;}
a:hover{text-decoration:underline;}
.wrap{max-width:720px; margin:0 auto; padding:0 24px;}
.wrap-wide{max-width:1180px;}

.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;
}

header{
  background:var(--surface);
  border-bottom:1px solid var(--border);
  padding:10px 0;
  position:sticky;
  top:0;
  z-index:100;
  transition:transform .25s ease, box-shadow .25s ease;
}
header.nav-hidden{transform:translateY(-100%);}
header.nav-scrolled{box-shadow:0 4px 16px rgba(43,46,51,0.08);}
header .wrap{display:flex; align-items:center; justify-content:space-between; max-width:1180px; gap:16px;}
header .brand{display:flex; align-items:center; text-decoration:none; flex:none;}
.brand-logo{height:56px; width:auto; display:block;}

/* ---------- hamburger toggle (mobile only — see breakpoint below) ---------- */
.nav-toggle{
  display:none; flex-direction:column; justify-content:center; align-items:center; gap:4px;
  width:38px; height:38px; background:none; border:1.5px solid var(--border); border-radius:8px; cursor:pointer;
  flex:none;
}
.nav-toggle-bar{display:block; width:18px; height:2px; background:var(--ink); border-radius:2px; transition:transform .15s ease, opacity .15s ease;}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1){transform:translateY(6px) rotate(45deg);}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2){opacity:0;}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3){transform:translateY(-6px) rotate(-45deg);}
.nav-scrim{display:none;}

header nav{display:flex; gap:2px; align-items:center; font-size:14px; font-weight:600; flex-wrap:wrap; justify-content:flex-end;}
header nav > a{
  color:var(--ink); padding:8px 10px; border-radius:999px;
  text-decoration:none; text-decoration-color:transparent; text-underline-offset:4px;
  transition:color .12s ease, background .12s ease, text-decoration-color .12s ease;
}
/* Hover: underline only (no fill), so it reads distinctly from the active
   "bubble" state below and doesn't compete with it. */
header nav > a:hover{color:var(--teal); text-decoration:underline; text-decoration-color:var(--teal); background:none;}
/* Active: a filled yellow pill/bubble — deliberately a different color from
   the teal buttons/hover states elsewhere, so "this is where you are" reads
   distinctly from "this is something you can click". Dark ink text (not
   white) for contrast against the gold. */
header nav > a.active{
  color:var(--ink); background:var(--gold); font-weight:700;
  text-decoration:none !important;
}
header nav > a.active:hover{background:#caa632; color:var(--ink);}
.nav-icon-link{display:inline-flex; align-items:center; padding:9px 11px;}
.nav-icon{width:20px; height:20px; display:block; flex:none;}
.nav-icon-link .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;}
.nav-badge{
  display:inline-flex; align-items:center; justify-content:center; min-width:16px; height:16px; padding:0 4px;
  background:var(--gold); color:#fff; font-size:10px; font-weight:700; border-radius:999px; margin-left:3px; vertical-align:3px;
}
.nav-icon-link.active .nav-badge{background:var(--surface); color:var(--teal-dark);}

/* ---------- dark/light mode toggle (static/js/theme_toggle.js) ---------- */
.theme-toggle-btn{
  background:none; border:none; cursor:pointer; color:var(--ink); font:inherit;
}
.theme-toggle-btn:hover{color:var(--teal);}
.theme-icon-moon{display:none;}
html[data-theme="dark"] .theme-icon-sun{display:none;}
html[data-theme="dark"] .theme-icon-moon{display:block;}

/* ---------- mobile nav collapse ---------- */
@media (max-width:860px){
  .nav-toggle{display:flex;}
  header nav{
    display:flex; flex-direction:column; align-items:stretch; gap:2px;
    position:fixed; top:0; right:0; height:100vh; width:min(300px, 84vw);
    background:var(--surface); padding:70px 18px 24px; box-shadow:-8px 0 24px rgba(43,46,51,0.14);
    transform:translateX(100%); transition:transform .2s ease; overflow-y:auto; z-index:110;
  }
  header nav.open{transform:translateX(0);}
  header nav > a{padding:12px 10px; border-radius:8px; border-left:3px solid transparent;}
  header nav > a:hover{text-decoration:none; background:var(--bg); border-left-color:var(--teal);}
  header nav > a.active{border-left-color:var(--teal); background:var(--gold); color:var(--ink);}
  .nav-icon-link{width:100%; font-size:15px; gap:8px;}
  .nav-icon{width:18px; height:18px;}
  .nav-icon-link .sr-only{
    position:static; width:auto; height:auto; padding:0; margin:0; overflow:visible; clip:auto; white-space:normal;
  }
  header nav .nav-dropdown,
  header nav .lang-switch{width:100%;}
  header nav .user-menu-btn,
  header nav .lang-current{width:100%; justify-content:space-between;}
  header nav .nav-dropdown-menu,
  header nav .lang-menu{position:static; box-shadow:none; border:1px solid var(--border); margin-top:4px; width:100%;}
  header nav .btn-gestion{justify-content:center;}
  body.nav-open-lock{overflow:hidden;}
  .nav-scrim{
    display:none; position:fixed; inset:0; background:rgba(43,46,51,0.35); z-index:105;
  }
  body.nav-open-lock .nav-scrim{display:block;}
}

/* ---------- user menu dropdown ---------- */
.nav-dropdown{position:relative;}
.user-menu-btn{
  display:flex; align-items:center; gap:7px; background:var(--teal); border:1.5px solid var(--teal); border-radius:999px;
  padding:7px 16px; font-size:14px; font-weight:600; color:#fff; cursor:pointer; font-family:inherit;
  box-shadow:0 1px 3px rgba(43,46,51,0.12);
}
.user-menu-btn:hover{background:var(--teal-dark); border-color:var(--teal-dark);}
.user-menu-btn .lang-caret{color:#fff; opacity:0.85;}
.nav-dropdown-menu{
  list-style:none; margin:0; padding:6px; position:absolute; top:calc(100% + 8px); right:0;
  background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:0 12px 28px rgba(43,46,51,0.12);
  min-width:170px; display:none; z-index:50;
}
.nav-dropdown-menu.open{display:block;}
/* Desktop: also open on hover/focus, not just click — a small invisible
   bridge (::before) keeps the gap between button and menu hoverable so it
   doesn't close the instant the cursor leaves the button. */
@media (min-width:861px){
  .nav-dropdown{padding-bottom:8px; margin-bottom:-8px;}
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu{display:block;}
}
.nav-dropdown-menu li{margin:0;}
.nav-dropdown-menu a, .nav-dropdown-menu button.nav-dropdown-btn{
  display:block; width:100%; padding:8px 10px; border-radius:7px; font-size:13.5px; font-weight:500;
  color:var(--ink); text-align:left; background:none; border:none; cursor:pointer; font-family:inherit;
}
.nav-dropdown-menu a:hover, .nav-dropdown-menu button.nav-dropdown-btn:hover{background:var(--bg); text-decoration:none; color:var(--teal);}

/* ---------- "Comunidad"/"Aprendizaje" group dropdowns — look like plain
   nav links (not the filled user-menu pill), since they're content
   sections, not account controls. Reuses .nav-dropdown/.nav-dropdown-menu
   open/close mechanics (click + hover-bridge + Escape) as-is. ---------- */
.nav-group-btn{
  display:inline-flex; align-items:center; gap:4px; background:none; border:none; cursor:pointer; font:inherit;
  color:var(--ink); padding:8px 10px; border-radius:999px; font-size:14px; font-weight:600;
  text-decoration:none; transition:color .12s ease, background .12s ease;
}
.nav-group-btn:hover{color:var(--teal); text-decoration:underline; text-decoration-color:var(--teal);}
.nav-group-btn .lang-caret{font-size:11px; opacity:0.7;}
.nav-group-btn.active{color:var(--ink); background:var(--gold); font-weight:700; text-decoration:none !important;}
.nav-group-btn.active:hover{background:#caa632; color:var(--ink);}
@media (max-width:860px){
  header nav .nav-group-btn{width:100%; justify-content:space-between; padding:12px 10px; border-radius:8px;}
  header nav .nav-group-btn.active{border-left:3px solid var(--teal);}
}

/* ---------- "Gestión" admin-panel entry point — deliberately distinct ---------- */
.btn-gestion{
  display:inline-flex; align-items:center; gap:5px; background:var(--ink); color:#fff !important;
  font-weight:700; font-size:13px; padding:8px 16px; border-radius:999px; text-decoration:none;
}
.btn-gestion::before{content:"⚙"; font-size:12px;}
.btn-gestion:hover{background:var(--teal-dark); text-decoration:none;}

/* ---------- language switcher (placeholder, not yet functional) ---------- */
.lang-flag{
  display:inline-block; width:18px; height:13px; border-radius:2px; flex:none;
  border:1px solid rgba(0,0,0,0.15); background-size:cover; background-position:center;
}
.lang-flag-es{background:linear-gradient(to bottom, #AA151B 25%, #F1BF00 25%, #F1BF00 75%, #AA151B 75%);}
.lang-flag-cat{background:repeating-linear-gradient(to bottom, #FCDD09 0, #FCDD09 11.11%, #DA121A 11.11%, #DA121A 22.22%);}
.lang-flag-val{background:repeating-linear-gradient(to bottom, #FCDD09 0, #FCDD09 11.11%, #DA121A 11.11%, #DA121A 22.22%), linear-gradient(to right, #00389B 30%, transparent 30%); background-blend-mode:normal;}
.lang-flag-eus{background:#D52B1E; background-image:linear-gradient(45deg, transparent 46%, #FFF 46%, #FFF 54%, transparent 54%), linear-gradient(-45deg, transparent 46%, #009B48 46%, #009B48 54%, transparent 54%);}
.lang-flag-ast{background:#0038A8; background-image:linear-gradient(to bottom, transparent 42%, #FFF 42%, #FFF 58%, transparent 58%);}
.lang-flag-gal{background:#FFFFFF; background-image:linear-gradient(135deg, transparent 46%, #0090D2 46%, #0090D2 54%, transparent 54%); border-color:#ddd;}
.lang-flag-en{
  /* Union Jack: navy field, white St Andrew's/St Patrick's saltire behind a
     white St George's cross, with the red crosses layered on top of each. */
  background-color:#012169;
  background-image:
    linear-gradient(to bottom, transparent 44%, #C8102E 44%, #C8102E 56%, transparent 56%),
    linear-gradient(to right, transparent 44%, #C8102E 44%, #C8102E 56%, transparent 56%),
    linear-gradient(to bottom, transparent 38%, #fff 38%, #fff 62%, transparent 62%),
    linear-gradient(to right, transparent 38%, #fff 38%, #fff 62%, transparent 62%),
    linear-gradient(45deg, transparent 47%, #C8102E 47%, #C8102E 53%, transparent 53%),
    linear-gradient(-45deg, transparent 47%, #C8102E 47%, #C8102E 53%, transparent 53%),
    linear-gradient(45deg, transparent 42%, #fff 42%, #fff 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, #fff 42%, #fff 58%, transparent 58%);
}

.lang-switch{position:relative;}
.lang-switch form{margin:0;}
.lang-current{
  display:flex; align-items:center; gap:6px; background:none; border:1.5px solid var(--border); border-radius:999px;
  padding:6px 12px; font-size:13px; font-weight:600; color:var(--ink); cursor:pointer; font-family:inherit;
}
.lang-current:hover{border-color:var(--teal);}
.lang-caret{font-size:10px; color:var(--muted);}
.lang-menu{
  list-style:none; margin:0; padding:6px; position:absolute; top:calc(100% + 8px); right:0;
  background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:0 12px 28px rgba(43,46,51,0.12);
  min-width:170px; display:none; z-index:50;
}
.lang-menu.open{display:block;}
.lang-menu li{margin:0;}
.lang-option{
  display:flex; align-items:center; gap:8px; width:100%; background:none; border:none; text-align:left;
  padding:8px 10px; border-radius:7px; font-size:13.5px; font-weight:500; color:var(--ink); cursor:pointer; font-family:inherit;
}
.lang-option:hover{background:var(--bg);}
.lang-option.active{background:rgba(88,123,127,0.1); color:var(--teal-dark); font-weight:700;}
.lang-abbr{margin-left:auto; font-size:11px; color:var(--muted); font-weight:700;}

main{padding:28px 0;}

.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:28px;
  margin-top:20px;
}

.btn{
  display:inline-block;
  background:var(--teal);
  color:#fff;
  font-weight:600;
  font-size:14px;
  padding:12px 24px;
  border-radius:999px;
  border:none;
  cursor:pointer;
  text-decoration:none;
}
.btn:hover{background:var(--teal-dark); text-decoration:none;}
.btn-outline{
  background:transparent;
  color:var(--teal);
  border:1.5px solid var(--teal);
}
.btn-sm{
  padding:7px 14px;
  font-size:12.5px;
}
.btn-danger{
  background:#b3261e;
}
.link-danger{
  background:none; border:none; color:#b3261e; cursor:pointer; padding:0; font-size:12.5px; font-family:inherit;
}
.link-danger:hover{text-decoration:underline;}

form p{margin:0 0 16px;}
label{display:block; font-weight:600; font-size:13px; margin-bottom:6px;}
input, textarea, select{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--input-border);
  border-radius:8px;
  font-size:14px;
  font-family:inherit;
}
.newsletter-signup-form{display:flex; gap:10px; max-width:420px; margin:18px auto 0; flex-wrap:wrap; justify-content:center;}
.newsletter-signup-form input{width:auto; flex:1; min-width:220px;}
.helptext{font-size:12px; color:var(--muted); margin-top:4px; display:block;}
.field-notice{
  display:flex; align-items:flex-start; gap:8px; font-size:13px; line-height:1.4; color:var(--ink);
  background:var(--bg); border:1px solid var(--border); border-left:3px solid var(--teal);
  border-radius:8px; padding:10px 12px; margin:0 0 8px;
}
.field-notice svg{flex:none; width:16px; height:16px; color:var(--teal); margin-top:1px;}
ul.errorlist{color:#b3261e; font-size:13px; padding-left:18px; margin:4px 0;}
.form-error{color:#b3261e; font-size:13px; margin:-8px 0 12px;}

.messages{list-style:none; padding:0; margin:0 0 20px;}
.messages li{
  background:rgba(88,123,127,0.09);
  color:var(--teal-dark);
  padding:10px 16px;
  border-radius:8px;
  font-size:14px;
  margin-bottom:8px;
}

footer{
  text-align:center;
  padding:32px 0;
  color:var(--muted);
  font-size:13px;
}

/* =========================================================
   FORUM — MyBB-style layout: persistent left sidebar +
   category bars / board tables / thread tables / post panels
   ========================================================= */

.breadcrumb{font-size:12.5px; color:var(--muted); margin-bottom:10px;}
.breadcrumb a{color:var(--muted);}
.breadcrumb a:hover{color:var(--teal);}

.toolbar{display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; flex-wrap:wrap; gap:10px;}

/* ---------- layout: sidebar + main ---------- */
.forum-layout{
  display:grid;
  grid-template-columns:230px 1fr;
  gap:26px;
  align-items:start;
}
.forum-sidebar{
  position:sticky; top:calc(var(--header-h) + 16px);
  max-height:calc(100vh - var(--header-h) - 32px);
  overflow-y:auto;
  scrollbar-width:thin;
}
.fsidebar-block{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px 18px;
  margin-bottom:16px;
}
.fsidebar-block h3{
  font-family:var(--font-body);
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--teal);
  margin:0 0 10px;
}
.fsidebar-tree{list-style:none; margin:0; padding:0; font-size:13.5px;}
.fsidebar-tree > li{margin-bottom:10px;}
.fsidebar-tree > li:last-child{margin-bottom:0;}
.fsidebar-cat{font-weight:700; color:var(--ink);}
.fsidebar-tree ul{list-style:none; margin:6px 0 0; padding-left:14px; font-weight:400;}
.fsidebar-tree ul li{margin-bottom:6px;}
.fsidebar-tree a{color:var(--muted);}
.fsidebar-tree a:hover{color:var(--teal);}

.fsidebar-stats{list-style:none; margin:0; padding:0; font-size:13px;}
.fsidebar-stats li{display:flex; justify-content:space-between; padding:5px 0; border-bottom:1px solid var(--border-soft);}
.fsidebar-stats li:last-child{border-bottom:none;}
.fsidebar-stats span{color:var(--muted);}
.fsidebar-stats strong{color:var(--ink);}

.fsidebar-links{list-style:none; margin:0; padding:0; font-size:13.5px;}
.fsidebar-links li{margin-bottom:8px;}
.fsidebar-links li:last-child{margin-bottom:0;}

.fsidebar-search{display:flex; gap:6px;}
.fsidebar-search input{padding:8px 10px; font-size:13px;}

@media (max-width:900px){
  .forum-layout{grid-template-columns:1fr;}
  .forum-sidebar{position:static; display:grid; grid-template-columns:1fr 1fr; gap:12px;}
  .fsidebar-search{grid-column:1 / -1;}
}
@media (max-width:560px){
  .forum-sidebar{grid-template-columns:1fr;}
}

/* ---------- category bar ---------- */
.fcategory{margin-bottom:18px;}
.fcategory-bar{
  background:var(--teal);
  color:#fff;
  font-weight:700;
  font-size:13.5px;
  letter-spacing:0.01em;
  padding:7px 14px;
  border-radius:10px 10px 0 0;
}

/* ---------- board table (forum index: forums within a category) ---------- */
.fboard-table, .fthread-table{
  background:var(--surface);
  border:1px solid var(--border);
  border-top:none;
  border-radius:0 0 10px 10px;
  overflow:hidden;
}
.fboard-header, .fthread-header{
  display:grid;
  grid-template-columns:auto 1fr 90px 90px 220px;
  gap:12px;
  padding:6px 14px;
  background:var(--bg);
  border-bottom:1px solid var(--border);
  font-size:10.5px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.05em;
  color:var(--muted);
}
.fboard-header{grid-template-columns:40px 1fr 90px 90px 220px;}
.fboard-header > div:nth-child(1){grid-column:2;}
.fthread-header{grid-template-columns:40px 1fr 90px 90px 140px 190px;}
.fthread-header > div:nth-child(1){grid-column:2;}

.fboard-row{
  display:grid;
  grid-template-columns:40px 1fr 90px 90px 220px;
  gap:12px;
  align-items:center;
  padding:10px 14px;
  border-bottom:1px solid var(--border-soft);
}
.fboard-row:last-child{border-bottom:none;}
.fboard-row:hover{background:var(--bg);}
.fboard-row-empty{padding:18px; color:var(--muted); font-size:13.5px;}
.fboard-icon{font-size:17px; text-align:center;}
.fboard-name{font-weight:700; font-family:"Libre Caslon Text", serif; font-size:14.5px;}
.fboard-desc{color:var(--muted); font-size:13px; margin-top:2px;}
.fboard-subforums{font-size:12px; color:var(--muted); margin-top:3px;}
.fboard-subforums a{color:var(--teal);}
.fboard-stat{text-align:center; font-size:13.5px; color:var(--muted);}
.fboard-last{font-size:12.5px; color:var(--muted); line-height:1.5;}
.fboard-last a{color:var(--ink); font-weight:600;}

@media (max-width:700px){
  .fboard-header{display:none;}
  .fboard-row, .fthread-row{grid-template-columns:32px 1fr; grid-template-areas:"icon title" ". stats"; row-gap:4px;}
  .fboard-stat, .fboard-last, .fthread-last-author, .fthread-last-date{grid-column:2;}
}

/* ---------- thread table (topic list within a forum) ---------- */
.fthread-groupname{
  padding:8px 18px;
  background:var(--surface-alt);
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.05em;
  color:var(--muted);
  border-bottom:1px solid var(--border-soft);
}
.fthread-row{
  display:grid;
  grid-template-columns:40px 1fr 90px 90px 140px 190px;
  gap:12px;
  align-items:center;
  padding:10px 14px;
  border-bottom:1px solid var(--border-soft);
  font-size:13.5px;
}
.fthread-row:last-child{border-bottom:none;}
.fthread-row:hover{background:var(--bg);}
.fthread-icon{font-size:17px; text-align:center;}
.ftopic-title{font-weight:600;}
.fthread-last-author{font-size:13px;}
.fthread-last-date{font-size:12.5px; line-height:1.5;}
.fthread-last-date a{color:inherit; text-decoration:none;}
.fthread-last-date a:hover{text-decoration:underline;}
.smart-time-relative{display:block; font-weight:600; color:var(--ink);}
.smart-time-absolute{display:block;}
.badge{
  display:inline-block;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.04em;
  padding:1px 7px;
  line-height:1.6;
  border-radius:999px;
  margin-right:6px;
}
.badge-pinned{background:rgba(226,192,68,0.18); color:#8a6d10;}
.badge-locked{background:rgba(179,38,30,0.1); color:#b3261e;}
.badge-collab{background:var(--teal); color:#fff;}
.badge-open{background:rgba(46,139,87,0.15); color:#1f6b45;}
html[data-theme="dark"] .badge-open{background:rgba(46,139,87,0.25); color:#7fd7a8;}
.fmeta{font-size:12.5px; color:var(--muted);}

/* ---------- poll result bars (polls app) ---------- */
.poll-bar{background:var(--bg); border:1px solid var(--border); border-radius:999px; height:10px; overflow:hidden;}
.poll-bar-fill{background:var(--teal); height:100%; border-radius:999px; transition:width .3s ease;}

@media (max-width:700px){
  .fthread-header{display:none;}
}

/* ---------- posts (topic detail) ---------- */
.fpost{
  display:grid;
  grid-template-columns:170px 1fr;
  gap:0;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  margin-bottom:16px;
  overflow:hidden;
}
.fpost-userpanel{
  background:var(--bg);
  padding:20px 16px;
  text-align:center;
  border-right:1px solid var(--border);
}
.fpost-avatar{
  width:64px; height:64px;
  border-radius:50%;
  object-fit:cover;
  background:var(--surface);
  margin:0 auto 8px;
  display:block;
}
.fpost-avatar-placeholder{
  width:64px; height:64px;
  border-radius:50%;
  background:var(--teal);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-family:"Libre Caslon Text", serif;
  font-size:22px;
  margin:0 auto 8px;
}
.fpost-name{font-weight:700; font-size:14.5px;}
.fpost-stats{
  list-style:none; margin:14px 0 0; padding:10px 0 0;
  border-top:1px solid var(--border-soft);
  font-size:11.5px;
  text-align:left;
}
.fpost-stats li{display:flex; justify-content:space-between; padding:2px 0; color:var(--muted);}
.fpost-stats strong{color:var(--ink);}

.fpost-body-col{padding:18px 22px;}
.fpost-meta{
  font-size:12px; color:var(--muted);
  margin:-18px -22px 14px;
  padding:10px 22px;
  background:var(--surface-alt);
  border-bottom:1px solid var(--border-soft);
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px;
}
.fpost-body{font-size:14.5px; line-height:1.7; white-space:pre-wrap;}
.fpost-quote{
  background:var(--bg); border-left:3px solid var(--teal); border-radius:6px;
  padding:10px 14px; margin-bottom:12px; font-size:13.5px;
}
.fpost-quote-head{display:flex; justify-content:space-between; gap:10px; margin-bottom:6px; font-size:12.5px;}
.fpost-quote-date{color:var(--muted); font-weight:500; white-space:nowrap;}
.fpost-quote-body{color:var(--muted); white-space:pre-wrap; line-height:1.6;}
.link-action{
  background:none; border:none; color:var(--teal); cursor:pointer; padding:0; font-size:12.5px; font-family:inherit;
}
.link-action:hover{text-decoration:underline;}
.fpost-signature{margin-top:14px; border-top:1px solid var(--border-soft); padding-top:10px; font-style:italic;}
.fpost-actions{display:flex; gap:14px; margin-top:16px; padding-top:12px; border-top:1px solid var(--border-soft); font-size:12.5px;}
.fpost-attachments{margin-top:16px; display:flex; flex-wrap:wrap; gap:10px;}
.fpost-attachments img{max-width:180px; border-radius:8px; border:1px solid var(--border); display:block;}
.fpost-attachments .file-chip{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--bg); border:1px solid var(--border);
  border-radius:8px; padding:8px 12px; font-size:12.5px;
}

@media (max-width:700px){
  .fpost{grid-template-columns:1fr;}
  .fpost-userpanel{
    border-right:none; border-bottom:1px solid var(--border);
    display:flex; align-items:center; gap:12px; text-align:left; padding:14px 18px;
  }
  .fpost-avatar, .fpost-avatar-placeholder{margin:0;}
  .fpost-stats{display:none;}
}

/* ---------- pagination ---------- */
.pagination{display:flex; gap:8px; justify-content:center; margin:20px 0; font-size:13px;}
.pagination a, .pagination span{
  padding:6px 12px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface);
}
.pagination .current{background:var(--teal); color:#fff; border-color:var(--teal);}

/* ---------- profile ---------- */
.profile-header{display:flex; gap:24px; align-items:center; margin-bottom:24px; flex-wrap:wrap;}
.profile-header .fpost-avatar, .profile-header .fpost-avatar-placeholder{width:96px; height:96px; font-size:32px; margin:0;}
.profile-role{font-size:13px; font-weight:600; color:var(--teal-dark); text-transform:uppercase; letter-spacing:0.03em; margin-bottom:8px;}
.profile-stats{display:flex; gap:24px; margin-top:10px; font-size:13px; color:var(--muted); flex-wrap:wrap;}
.profile-stats strong{color:var(--ink); font-size:16px; display:block; font-family:"Libre Caslon Text", serif;}
@media (max-width:560px){
  .profile-header{gap:14px;}
  .profile-header .fpost-avatar, .profile-header .fpost-avatar-placeholder{width:64px; height:64px; font-size:22px;}
  .profile-header > div[style*="margin-left"]{margin-left:0 !important; width:100%;}
}

/* ---------- moderation queue ---------- */
.report-row{
  background:var(--surface); border:1px solid var(--border); border-radius:14px;
  padding:20px; margin-bottom:14px;
}
.report-row .reason{font-style:italic; color:var(--muted); margin:8px 0;}

/* ---------- post under-review ---------- */
.badge-review{background:rgba(230,126,34,0.15); color:#b3600b;}
.fpost-review-highlight{border-left:3px solid #e67e22;}
.fpost-review-placeholder{
  background:#fff7ee; border:1px dashed #e6b980; border-radius:10px;
  padding:16px; color:#8a5a1f; font-size:13.5px; font-style:italic;
}

/* ---------- multi-select chip picker (self-coded, no external lib) ---------- */
.multiselect-native{
  position:absolute;
  width:1px; height:1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
}
.multiselect-wrapper{margin-bottom:6px;}
.multiselect-presets{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px;}
.multiselect-preset{
  background:var(--surface); border:1.5px solid var(--teal); color:var(--teal);
  border-radius:999px; padding:5px 13px; font-size:12.5px; font-weight:600;
  cursor:pointer; font-family:inherit;
}
.multiselect-preset:hover{background:rgba(88,123,127,0.08);}
.multiselect-preset.active{background:var(--teal); color:#fff;}
.multiselect-chips{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px;}
.multiselect-chips:empty{margin-bottom:0;}
.chip{
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(88,123,127,0.12); color:var(--teal-dark);
  border-radius:999px; padding:5px 6px 5px 12px; font-size:13px; font-weight:600;
}
.chip button{
  background:none; border:none; color:var(--teal-dark); cursor:pointer;
  font-size:15px; line-height:1; padding:2px 4px; border-radius:50%;
}
.chip button:hover{background:rgba(88,123,127,0.2);}
.multiselect-inputwrap{position:relative;}
.multiselect-input{width:100%;}
.multiselect-suggestions{
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:20;
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  box-shadow:0 12px 24px rgba(43,46,51,0.1);
  max-height:220px; overflow-y:auto;
}
.multiselect-suggestion{padding:9px 14px; font-size:13.5px; cursor:pointer;}
.multiselect-suggestion:hover{background:var(--bg); color:var(--teal);}

/* ---------- profile form sections ---------- */
.form-section{margin-bottom:28px;}
.form-section h2{font-size:16px; margin-bottom:14px; padding-bottom:8px; border-bottom:1px solid var(--border-soft);}
.form-row-2{display:grid; grid-template-columns:1fr 1fr; gap:0 20px;}
@media (max-width:600px){.form-row-2{grid-template-columns:1fr;}}
.avatar-preview{
  width:80px; height:80px; border-radius:50%; object-fit:cover;
  border:1px solid var(--border); margin-bottom:10px; display:block;
}

/* ---------- approval queue ---------- */
.approval-card{
  background:var(--surface); border:1px solid var(--border); border-radius:14px;
  padding:22px; margin-bottom:16px; display:grid; grid-template-columns:80px 1fr; gap:18px;
}
.approval-card .fpost-avatar, .approval-card .fpost-avatar-placeholder{width:72px; height:72px; font-size:26px;}
.approval-meta{display:grid; grid-template-columns:1fr 1fr; gap:6px 20px; font-size:13px; color:var(--muted); margin:10px 0;}
.approval-meta strong{color:var(--ink);}
.approval-actions{display:flex; gap:10px; margin-top:14px; align-items:flex-start; flex-wrap:wrap;}
.approval-actions textarea{width:220px; height:38px; font-size:12.5px;}

/* ---------- user directory ---------- */
.directory-toolbar{display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-wrap:wrap; gap:12px;}
.view-switch{display:flex; gap:6px;}
.view-switch a{
  padding:8px 16px; border-radius:999px; border:1.5px solid var(--border); font-size:13px; font-weight:600; color:var(--muted);
}
.view-switch a.active{background:var(--teal); border-color:var(--teal); color:#fff;}
.directory-filters{
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px; margin-bottom:24px;
  display:grid; grid-template-columns:repeat(4,1fr); gap:14px; align-items:end;
}
.directory-filters .field{display:flex; flex-direction:column;}
.directory-filters label{font-size:11.5px;}
@media (max-width:900px){.directory-filters{grid-template-columns:1fr 1fr;}}
@media (max-width:560px){.directory-filters{grid-template-columns:1fr;}}

.directory-list-row{
  display:grid; grid-template-columns:56px 1fr auto; gap:16px; align-items:center;
  background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 18px; margin-bottom:10px;
}
.directory-list-row .fpost-avatar, .directory-list-row .fpost-avatar-placeholder{width:48px; height:48px; font-size:18px; margin:0;}

.directory-gallery{display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:18px;}
.gallery-card{
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:18px; text-align:center;
  transition:transform .2s ease, box-shadow .2s ease;
}
.gallery-card:hover{transform:translateY(-3px); box-shadow:0 12px 24px rgba(43,46,51,0.08);}
.gallery-card .fpost-avatar, .gallery-card .fpost-avatar-placeholder{width:80px; height:80px; font-size:28px; margin:0 auto 10px;}
.gallery-card .g-name{font-weight:700;}
.gallery-card .g-meta{font-size:12px; color:var(--muted); margin-top:4px;}

.swipe-stage{max-width:380px; margin:0 auto;}
.swipe-card{
  background:var(--surface); border:1px solid var(--border); border-radius:20px; overflow:hidden;
  box-shadow:0 20px 40px rgba(43,46,51,0.1); text-align:center; padding:32px 24px;
}
.swipe-card .fpost-avatar, .swipe-card .fpost-avatar-placeholder{width:120px; height:120px; font-size:42px; margin:0 auto 16px;}
.swipe-card h2{margin-bottom:6px;}
.swipe-card .g-meta{color:var(--muted); font-size:13.5px; margin-bottom:14px;}
.swipe-card .tag-list{display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin-top:14px;}
.swipe-actions{display:flex; justify-content:center; gap:16px; margin-top:22px;}
.swipe-actions button, .swipe-actions a{
  width:56px; height:56px; border-radius:50%; border:1.5px solid var(--border); background:var(--surface);
  font-size:22px; cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.swipe-actions .swipe-next{border-color:var(--teal); color:var(--teal);}
.swipe-actions .swipe-profile{border-color:var(--gold); color:var(--gold);}
.tag-pill{
  background:var(--bg); border:1px solid var(--border); border-radius:999px; padding:2px 10px; font-size:11.5px; color:var(--muted);
  display:inline-block; margin:2px 4px 2px 0;
}
.username-link{font-weight:600;}
.username-link:hover{text-decoration:underline;}

/* =========================================================
   LMS — course library, builder, lesson viewer, dashboard
   ========================================================= */

.lms-toolbar{display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px;}
.lms-toolbar .view-toggle{margin-left:auto;}
.lms-search{display:flex; gap:10px; flex-wrap:wrap;}
.lms-search input[type="text"]{min-width:220px;}
.lms-search select{width:auto;}

.lms-section-title{
  display:flex; justify-content:space-between; align-items:baseline; margin:26px 0 12px;
  padding-bottom:6px; border-bottom:2px solid var(--border);
}
.lms-section-title h2{margin:0; font-size:var(--fs-h2);}

/* ---------- clear, reusable separators (used between major page sections) ---------- */
hr.divider{border:none; border-top:1px solid var(--border); margin:28px 0;}
.section-gap{margin-top:40px;}

/* ---------- collapsible sections — native <details>/<summary>, no JS needed ---------- */
details.collapsible{
  background:var(--surface); border:1px solid var(--border); border-radius:12px; margin-bottom:14px; overflow:hidden;
}
details.collapsible > summary{
  list-style:none; cursor:pointer; padding:14px 18px; font-weight:700; font-family:var(--font-heading);
  font-size:var(--fs-h3); display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--bg);
}
details.collapsible > summary::-webkit-details-marker{display:none;}
details.collapsible > summary::after{
  content:"▾"; font-family:var(--font-body); font-size:13px; color:var(--muted); transition:transform .15s ease; flex:none;
}
details.collapsible[open] > summary::after{transform:rotate(180deg);}
details.collapsible > summary:hover{background:var(--border-soft);}
details.collapsible .collapsible-body{padding:16px 18px;}
details.collapsible + details.collapsible{margin-top:-2px;}

.course-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px;}
.course-card{
  background:var(--surface); border:1px solid var(--border); border-radius:16px; overflow:hidden;
  transition:transform .2s ease, box-shadow .2s ease; display:flex; flex-direction:column;
}
.course-card:hover{transform:translateY(-3px); box-shadow:0 14px 28px rgba(43,46,51,0.09);}
.course-card-cover{
  height:96px; background:linear-gradient(135deg, var(--teal), var(--teal-dark));
  display:flex; align-items:center; justify-content:center; color:#fff; font-size:28px; gap:8px;
  background-size:cover; background-position:center;
}
.course-card-body{padding:14px 16px; flex:1; display:flex; flex-direction:column;}
.course-card-title{font-family:"Libre Caslon Text", serif; font-weight:700; font-size:15.5px; margin-bottom:4px; line-height:1.3;}
.course-card-summary{font-size:12.5px; color:var(--muted); flex:1; margin-bottom:8px; line-height:1.45;}
.course-card-meta{display:flex; justify-content:space-between; align-items:center; font-size:12px; color:var(--muted);}
.level-pill{
  background:rgba(88,123,127,0.12); color:var(--teal-dark); border-radius:999px;
  padding:2px 8px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.03em;
}
.course-card-progress{margin-top:10px;}

.status-pill{
  border-radius:999px; padding:3px 10px; font-size:11px; font-weight:700;
  text-transform:uppercase; letter-spacing:0.03em; display:inline-block;
}
.status-open{background:rgba(226,192,68,0.22); color:#8a6d10;}
.status-answered{background:rgba(88,123,127,0.12); color:var(--teal-dark);}
.status-closed{background:var(--border-soft); color:var(--muted);}
.status-draft{background:var(--border-soft); color:var(--muted);}
.status-sending{background:rgba(226,192,68,0.22); color:#8a6d10;}
.status-sent{background:rgba(88,123,127,0.12); color:var(--teal-dark);}
.status-failed{background:#fbe2df; color:#b3261e;}
.status-queued{background:var(--border-soft); color:var(--muted);}
.status-delivered{background:rgba(88,123,127,0.12); color:var(--teal-dark);}
.status-opened{background:rgba(226,192,68,0.22); color:#8a6d10;}
.status-bounced{background:#fbe2df; color:#b3261e;}
.status-blocked{background:#fbe2df; color:#b3261e;}

.newsletter-preview-frame{
  background:#F0EEE8; border:1px solid var(--border); border-radius:14px; padding:24px; display:flex; justify-content:center;
}
.newsletter-preview-frame iframe{width:100%; max-width:600px; height:640px; border:none; background:var(--surface); border-radius:10px;}
.ticket-row{transition:box-shadow .15s ease;}
.ticket-row:hover{box-shadow:0 2px 10px rgba(0,0,0,0.06);}
.ticket-reply-staff{border-left:3px solid var(--teal); background:#f5fbfa;}

.progress-track{background:var(--bg); border-radius:999px; height:8px; overflow:hidden;}
.progress-fill{background:var(--gold); height:100%; border-radius:999px;}
.progress-label{font-size:11.5px; color:var(--muted); margin-top:4px; display:block;}

.course-header{display:grid; grid-template-columns:1fr 300px; gap:28px; margin-bottom:30px;}
@media (max-width:800px){.course-header{grid-template-columns:1fr;}}
.course-header-cover{
  border-radius:16px; height:180px; background:linear-gradient(135deg, var(--teal), var(--teal-dark));
  background-size:cover; background-position:center; margin-bottom:16px;
}
.course-header-meta{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px;}
.course-side-card{background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:22px;}
.course-side-card .btn{width:100%; text-align:center; margin-bottom:10px;}
.course-side-stats{list-style:none; margin:14px 0 0; padding:14px 0 0; border-top:1px solid var(--border-soft); font-size:13px;}
.course-side-stats li{display:flex; justify-content:space-between; padding:4px 0; color:var(--muted);}
.course-side-stats strong{color:var(--ink);}
.instructor-chip{display:flex; align-items:center; gap:8px; margin-top:6px; font-size:13px;}

.module-block{background:var(--surface); border:1px solid var(--border); border-radius:14px; margin-bottom:16px; overflow:hidden;}
.module-block-head{
  padding:14px 20px; background:var(--bg); border-bottom:1px solid var(--border);
  display:flex; justify-content:space-between; align-items:center; font-weight:700; cursor:grab;
}
.module-block-head .drag-handle{color:var(--muted); margin-right:8px; cursor:grab;}
.lesson-row{
  display:flex; align-items:center; gap:12px; padding:13px 20px; border-bottom:1px solid var(--border-soft); font-size:14px;
}
.lesson-row:last-child{border-bottom:none;}
.lesson-row:hover{background:var(--bg);}
.lesson-row .drag-handle{color:var(--muted); cursor:grab; font-size:13px;}
.lesson-icon{width:22px; text-align:center; color:var(--teal);}
.lesson-row-title{flex:1;}
.lesson-row-title a{color:var(--ink); font-weight:600;}
.lesson-row.locked .lesson-row-title a{color:var(--muted); pointer-events:none;}
.lesson-row-lock{color:var(--muted); font-size:12px;}
.lesson-row-check{color:#3f8f5c; font-size:15px;}
.lesson-row-edit{font-size:12px; display:flex; gap:10px;}

.lesson-viewer{background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:32px; margin-bottom:20px;}
.lesson-viewer video{width:100%; border-radius:12px; background:#000;}
.lesson-viewer iframe{width:100%; aspect-ratio:16/9; border:none; border-radius:12px;}

.webinar-video-wrap{margin-top:14px;}
video.webinar-video{width:100%; max-height:520px; border-radius:12px; background:#000; display:block;}
iframe.webinar-video{width:100%; aspect-ratio:16/9; border:none; border-radius:12px; display:block;}
.lesson-body-text{font-size:15px; line-height:1.75; white-space:pre-wrap; margin-top:16px;}
.lesson-locked{
  background:#fff7ee; border:1px dashed #e6b980; border-radius:14px; padding:28px; text-align:center; color:#8a5a1f;
}
.lesson-nav{display:flex; justify-content:space-between; margin:20px 0; font-size:14px; gap:12px; flex-wrap:wrap;}
.lesson-progressbar{margin-bottom:24px;}
.lesson-actions-bar{display:flex; justify-content:space-between; align-items:center; margin-top:22px; flex-wrap:wrap; gap:12px;}

.quiz-question{background:var(--bg); border-radius:12px; padding:18px 20px; margin-bottom:14px;}
.quiz-question h4{margin:0 0 10px; font-size:14.5px;}
.quiz-choice{display:flex; align-items:center; gap:10px; padding:6px 0; font-size:14px;}
.quiz-choice input{width:auto;}
.quiz-result{
  border-radius:12px; padding:16px 20px; margin-bottom:18px; font-size:14.5px;
}
.quiz-result.passed{background:rgba(63,143,92,0.12); color:#2b6b41;}
.quiz-result.failed{background:rgba(179,38,30,0.08); color:#b3261e;}

.submission-box{background:var(--bg); border-radius:12px; padding:18px 20px; margin-bottom:18px; font-size:13.5px;}
.submission-status{font-weight:700; text-transform:uppercase; font-size:11px; letter-spacing:0.04em;}

.dash-grid{display:grid; grid-template-columns:2fr 1fr; gap:24px;}
@media (max-width:900px){.dash-grid{grid-template-columns:1fr;}}
.dash-course-row{
  display:grid; grid-template-columns:64px 1fr auto; gap:16px; align-items:center;
  background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 18px; margin-bottom:10px;
}
.dash-course-icon{
  width:56px; height:56px; border-radius:10px; background:linear-gradient(135deg, var(--teal), var(--teal-dark));
  display:flex; align-items:center; justify-content:center; color:#fff; font-size:20px; background-size:cover; background-position:center;
}
.cert-row{display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 16px; margin-bottom:10px; font-size:13.5px;}
.cert-icon{color:var(--gold); font-size:20px;}
.points-badge{
  background:rgba(226,192,68,0.18); color:#8a6d10; border-radius:999px; padding:4px 12px; font-size:12.5px; font-weight:700;
}

.certificate-wrap{max-width:720px; margin:0 auto;}
.certificate-card{
  background:var(--surface); border:2px solid var(--gold); border-radius:20px; padding:56px 40px; text-align:center;
}
.certificate-card h1{font-size:26px; margin-bottom:6px;}
.certificate-card .cert-course{font-size:20px; color:var(--teal-dark); margin:18px 0;}
.certificate-code{font-size:12px; color:var(--muted); margin-top:24px; letter-spacing:0.05em;}

.announcement-card{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px 20px; margin-bottom:12px;}
.announcement-card h4{margin:0 0 4px; font-size:14.5px;}

.students-table{width:100%; border-collapse:collapse; background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden;}
.students-table th, .students-table td{padding:11px 16px; text-align:left; font-size:13.5px; border-bottom:1px solid var(--border-soft);}
.students-table th{background:var(--bg); font-size:11px; text-transform:uppercase; letter-spacing:0.04em; color:var(--muted);}
.students-table tr:last-child td{border-bottom:none;}
/* Wide data tables (admin lists, student rosters, etc.) scroll horizontally
   on narrow screens instead of squashing columns unreadably. Works directly
   on the <table> element (no wrapper div needed in ~15 templates) since
   browsers keep the internal thead/tbody/tr/td table layout even once the
   table itself is a block-level scroll container. */
@media (max-width:700px){
  .students-table{display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:10px;}
  .students-table th, .students-table td{white-space:nowrap;}
}

.formset-row{border:1px solid var(--border); border-radius:10px; padding:14px; margin-bottom:10px; background:var(--bg);}
.formset-row.deleted-row{opacity:0.5;}

@media (max-width:700px){
  .course-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));}
  .lesson-viewer{padding:20px;}
  .lesson-nav{flex-direction:column;}
  .module-block-head{padding:12px 16px;}
  .lesson-row{padding:12px 16px; flex-wrap:wrap;}
}

/* =========================================================
   WEBINARS — list/detail cards, live badge, Jitsi embed
   ========================================================= */

.webinar-card-cover{
  background:linear-gradient(135deg, var(--gold), #b3892a);
  position:relative;
}
.webinar-card-when{font-size:12.5px; color:var(--muted); margin-bottom:8px;}
.badge-live{
  position:absolute; top:10px; right:10px;
  background:#b3261e; color:#fff; animation:pulse-live 2s infinite;
}
@keyframes pulse-live{
  0%, 100%{opacity:1;}
  50%{opacity:0.65;}
}

.jitsi-embed{
  width:100%; height:75vh; min-height:420px;
  background:#111; border-radius:16px; overflow:hidden;
}

@media (max-width:700px){
  .jitsi-embed{height:60vh; min-height:320px; border-radius:10px;}
}

/* =========================================================
   GESTIÓN — admin panel hub, stat cards
   ========================================================= */

.admin-stat-grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:16px; margin:20px 0 32px;
}
.admin-stat-card{
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px 18px;
  transition:transform .2s ease, box-shadow .2s ease; display:block;
}
.admin-stat-card:hover{transform:translateY(-3px); box-shadow:0 12px 24px rgba(43,46,51,0.08);}
.admin-stat-card.is-alert{border-color:rgba(179,38,30,0.35); background:rgba(179,38,30,0.04);}
.admin-stat-num{
  font-family:"Libre Caslon Text", serif; font-size:32px; font-weight:700; color:var(--teal-dark); display:block; line-height:1.1;
}
.admin-stat-card.is-alert .admin-stat-num{color:#b3261e;}
.admin-stat-label{font-size:12.5px; color:var(--muted); margin-top:6px; display:block;}

.admin-quick-links{display:flex; flex-wrap:wrap; gap:10px; margin-bottom:12px;}

/* =========================================================
   MENSAJES — private messaging (1:1 + group DMs)
   ========================================================= */

.dm-layout{
  display:grid; grid-template-columns:300px 1fr; gap:0;
  background:var(--surface); border:1px solid var(--border); border-radius:16px; overflow:hidden;
  height:calc(100vh - var(--header-h) - 64px); min-height:480px;
}
.dm-sidebar{border-right:1px solid var(--border); display:flex; flex-direction:column; min-height:0;}
.dm-sidebar-head{
  display:flex; justify-content:space-between; align-items:center; padding:14px 16px;
  border-bottom:1px solid var(--border); background:var(--surface); flex-shrink:0;
}
.dm-sidebar-head h3{margin:0; font-size:15px;}
.dm-list{display:flex; flex-direction:column; overflow-y:auto; flex:1; min-height:0;}
.dm-list-item{
  display:grid; grid-template-columns:38px 1fr auto; gap:10px; align-items:center;
  padding:10px 14px; border-bottom:1px solid var(--border-soft); color:var(--ink); position:relative;
}
.dm-list-item:hover{background:var(--bg); text-decoration:none;}
.dm-list-item.active{background:rgba(88,123,127,0.1);}
.dm-list-avatar{width:38px; height:38px; display:flex; align-items:center; justify-content:center; font-size:20px;}
.dm-list-avatar .fpost-avatar, .dm-list-avatar .fpost-avatar-placeholder{width:38px; height:38px; font-size:14px;}
.dm-list-text{display:flex; flex-direction:column; gap:1px; min-width:0;}
.dm-list-top{display:flex; justify-content:space-between; align-items:baseline; gap:8px;}
.dm-list-name{font-weight:700; font-size:13.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.dm-list-time{font-size:11px; color:var(--muted); flex-shrink:0;}
.dm-list-preview{font-size:12.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.dm-list-item.has-unread .dm-list-preview{color:var(--ink); font-weight:600;}
.dm-unread-dot{
  background:var(--gold); color:#fff; font-size:11px; font-weight:700;
  min-width:18px; height:18px; border-radius:999px; display:flex; align-items:center; justify-content:center; padding:0 5px;
}

.dm-main{display:flex; flex-direction:column; min-height:0;}
.dm-empty-state{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  color:var(--muted); text-align:center; padding:40px;
}
.dm-new{padding:22px 26px; max-width:640px;}
.dm-new h1{font-size:var(--fs-h2); margin-bottom:4px;}

.dm-thread-head{
  display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 20px;
  border-bottom:1px solid var(--border); flex-shrink:0;
}
.dm-thread-title{min-width:0;}
.dm-thread-head h2{margin:0 0 2px; font-size:16px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.dm-thread-head .fmeta{margin:0; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.dm-thread-head .fmeta a{color:inherit;}
.dm-group-icon{margin-right:6px;}
.dm-thread-actions{display:flex; gap:10px; align-items:center; flex-shrink:0;}
.dm-thread-actions form{display:inline;}
.dm-add-panel{padding:12px 20px; border-bottom:1px solid var(--border); background:var(--surface-alt);}
.dm-add-panel label{font-size:13px; font-weight:600; display:block; margin-bottom:6px;}
.dm-add-panel .btn{margin-top:6px;}

.dm-thread{flex:1; overflow-y:auto; padding:16px 20px; display:flex; flex-direction:column; gap:10px; min-height:0;}
.dm-empty-thread{margin:auto; text-align:center;}
.dm-message{display:flex; gap:10px; align-items:flex-end; max-width:78%;}
.dm-message .fpost-avatar, .dm-message .fpost-avatar-placeholder{width:30px; height:30px; font-size:12px; flex-shrink:0;}
.dm-message.own{align-self:flex-end; flex-direction:row-reverse;}
.dm-message-body{display:flex; flex-direction:column; min-width:0;}
.dm-message.own .dm-message-body{align-items:flex-end;}
.dm-message-meta{display:flex; gap:8px; align-items:baseline; font-size:11.5px; margin:0 6px 2px; color:var(--muted);}
.dm-message-author{font-weight:700; color:var(--ink);}
.dm-bubble{position:relative;}
.dm-message-text{
  margin:0; background:var(--bg); border-radius:16px 16px 16px 4px; padding:8px 13px; font-size:14px; line-height:1.45;
  display:inline-block; overflow-wrap:anywhere;
}
.dm-message.own .dm-message-text{background:rgba(88,123,127,0.16); border-radius:16px 16px 4px 16px;}
.dm-message-text.deleted-text{color:var(--muted); font-style:italic; background:transparent; padding:0 6px;}
.dm-message-actions{display:flex; gap:10px; margin:2px 6px 0; opacity:0; transition:opacity .12s;}
.dm-message.own .dm-message-actions{justify-content:flex-end;}
.dm-message:hover .dm-message-actions, .dm-message:focus-within .dm-message-actions{opacity:1;}
.dm-message-actions form{display:inline;}
.dm-action-btn{background:none; border:none; color:var(--muted); cursor:pointer; padding:0; font-size:11.5px; font-family:inherit;}
.dm-action-btn:hover{color:var(--teal); text-decoration:underline;}
.dm-message.editing .dm-bubble{display:none;}
.dm-edit-form{display:flex; flex-direction:column; gap:6px; width:min(480px, 78vw);}
.dm-edit-form[hidden], .dm-add-panel[hidden]{display:none;}
.dm-edit-form textarea{font-size:13.5px; width:100%;}
.dm-edit-buttons{display:flex; gap:8px; justify-content:flex-end;}

.dm-composer{display:flex; gap:10px; padding:12px 20px; border-top:1px solid var(--border); align-items:flex-end; flex-shrink:0; background:var(--surface);}
.dm-composer textarea{resize:none; font-size:14px; flex:1; min-height:42px; max-height:160px; line-height:1.4;}
.dm-composer .btn{flex-shrink:0;}

.user-picker-row{display:flex; gap:10px; align-items:center;}
.user-picker-avatar{width:28px; height:28px; border-radius:50%; background:var(--teal); color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; overflow:hidden; flex-shrink:0;}
.user-picker-avatar img{width:100%; height:100%; object-fit:cover;}
.user-picker-row small{color:var(--muted); font-size:12px;}

@media (max-width:800px){
  .dm-layout{grid-template-columns:1fr; height:auto; min-height:auto;}
  .dm-sidebar{max-height:240px;}
  .dm-main{min-height:60vh;}
  .dm-thread{max-height:48vh;}
  .dm-message{max-width:92%;}
  .dm-message-actions{opacity:1;}
}

/* =========================================================
   BIENVENIDA — mandatory onboarding wizard (welcome + T&C / privacy / guidelines)
   ========================================================= */

.onboard-wrap{max-width:640px; margin:0 auto;}
.onboard-progress{margin-bottom:18px;}
.onboard-progress span{font-size:12.5px; color:var(--muted); display:block; margin-bottom:6px;}
.onboard-card h1{font-size:21px;}
.onboard-legal-text, .onboard-info-text{
  font-size:14px; line-height:1.7; max-height:360px; overflow-y:auto; margin:18px 0 22px;
  padding:16px 20px; background:var(--bg); border-radius:12px;
}
.onboard-checkbox{
  display:flex; align-items:flex-start; gap:10px; font-weight:500; font-size:14px; margin-bottom:16px; cursor:pointer;
}
.onboard-checkbox input{width:auto; margin-top:3px;}

.legal-wrap{max-width:760px; margin:0 auto;}
.legal-card h1{font-size:24px;}
.legal-updated{font-size:13px; color:var(--muted); margin:-6px 0 22px;}
.legal-text{font-size:14.5px; line-height:1.75;}
.legal-text strong{color:var(--ink);}

footer{
  display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap;
}
footer a{color:inherit; text-decoration:underline;}
footer .app-version{opacity:0.55; font-size:12px;}

.changelog-entry{padding:16px 20px; margin-bottom:14px;}
.changelog-version{margin:0 0 8px; font-size:17px;}
.changelog-date{font-weight:400; color:var(--muted); font-size:14px;}
.changelog-items{margin:0; padding-left:20px;}
.changelog-items li{margin-bottom:5px; line-height:1.55;}

.faq-list{margin-top:20px;}
.faq-item{border:1px solid var(--border); border-radius:12px; margin-bottom:10px; overflow:hidden; background:var(--surface);}
.faq-question{
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:16px 20px; background:none; border:none; text-align:left; cursor:pointer;
  font-family:inherit; font-size:15px; font-weight:600; color:var(--ink);
}
.faq-question:hover{color:var(--teal);}
.faq-caret{transition:transform .15s ease; color:var(--muted); flex-shrink:0;}
.faq-open .faq-caret{transform:rotate(180deg);}
.faq-answer{max-height:0; overflow:hidden; transition:max-height .2s ease;}
.faq-open .faq-answer{max-height:2000px;}
.faq-answer .legal-text{padding:0 20px 18px; font-size:14.5px; line-height:1.7;}
.faq-answer .legal-text :first-child{margin-top:0;}
.faq-answer .legal-text pre{background:var(--bg); padding:10px 14px; border-radius:8px; overflow-x:auto;}
.faq-answer .legal-text code{background:var(--bg); padding:1px 5px; border-radius:4px; font-size:13px;}
.faq-answer .legal-text pre code{background:none; padding:0;}
.faq-answer .legal-text blockquote{border-left:3px solid var(--teal); margin:0; padding:2px 14px; color:var(--muted);}
.faq-answer .legal-text table{border-collapse:collapse; width:100%; margin:10px 0;}
.faq-answer .legal-text th, .faq-answer .legal-text td{border:1px solid var(--border); padding:6px 10px; text-align:left;}

.project-card-cover{background:linear-gradient(135deg, var(--gold), #c9a230);}

.blog-card-cover{background:linear-gradient(135deg, #6a7fdb, #8f6ad1); font-size:34px; display:flex; align-items:center; justify-content:center; position:relative;}
.blog-card-cover .badge{position:absolute; top:8px; right:8px;}
.blog-body pre{background:var(--bg); padding:10px 14px; border-radius:8px; overflow-x:auto;}
.blog-body code{background:var(--bg); padding:1px 5px; border-radius:4px; font-size:13px;}
.blog-body pre code{background:none; padding:0;}
.blog-body blockquote{border-left:3px solid var(--teal); margin:0; padding:2px 14px; color:var(--muted);}
.blog-body table{border-collapse:collapse; width:100%; margin:10px 0;}
.blog-body th, .blog-body td{border:1px solid var(--border); padding:6px 10px; text-align:left;}
.blog-body img{max-width:100%; border-radius:8px;}

.notif-list{display:flex; flex-direction:column; gap:14px;}
.notif-item{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px 20px;}
.notif-item.notif-unread{border-color:var(--teal); background:#f5fbfa;}
.notif-item-head{display:flex; align-items:center; gap:10px; margin-bottom:6px; font-size:15.5px;}

.dash-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:18px;}
.dash-col{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px 18px;}
.dash-col h2{font-size:14px; margin:0 0 12px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted);}
.dash-activity-row{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; padding:9px 0; border-bottom:1px solid #f1f1f1; font-size:13.5px; color:var(--ink); text-decoration:none;}
.dash-activity-row:last-of-type{border-bottom:none;}
.dash-activity-row:hover strong{text-decoration:underline;}

.landing-hero{text-align:center; max-width:680px; margin:20px auto 40px; padding:0 12px;}
.landing-hero h1{font-size:32px; margin-bottom:14px;}
.landing-hero p{font-size:15.5px; line-height:1.7; color:var(--muted); margin-bottom:22px;}
.landing-features{display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:18px; margin-bottom:36px;}
.landing-feature{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:22px 18px; text-align:center;}
.landing-feature-icon{font-size:28px; margin-bottom:8px;}
.landing-feature h3{font-size:15.5px; margin:0 0 6px;}
.landing-feature p{font-size:13px; color:var(--muted); line-height:1.6; margin:0;}

/* --- WYSIWYG editor (static/js/wysiwyg.js) --- */
.wysiwyg-wrap{border:1px solid var(--input-border); border-radius:8px; overflow:hidden; background:var(--surface);}
.wysiwyg-toolbar{
  display:flex; flex-wrap:wrap; align-items:center; gap:3px;
  background:var(--bg); border-bottom:1px solid var(--border); padding:6px 8px;
}
.wysiwyg-btn{
  background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:5px 9px;
  font-size:12.5px; font-weight:600; color:var(--ink); cursor:pointer; font-family:inherit;
}
.wysiwyg-btn:hover{border-color:var(--teal); color:var(--teal-dark);}
.wysiwyg-sep{width:1px; align-self:stretch; background:var(--border-soft); margin:2px 4px;}
.wysiwyg-editor{
  min-height:140px; padding:12px 14px; font-size:14.5px; line-height:1.6; color:var(--ink);
  outline:none; overflow-y:auto;
}
.wysiwyg-editor:empty:before{content:attr(data-placeholder); color:var(--muted);}
.wysiwyg-editor p{margin:0 0 10px;}
.wysiwyg-editor h2{font-size:19px; margin:14px 0 8px;}
.wysiwyg-editor h3{font-size:16.5px; margin:12px 0 6px;}
.wysiwyg-editor blockquote{
  margin:8px 0; padding:6px 14px; border-left:3px solid var(--teal); color:var(--muted); background:var(--bg);
}
.wysiwyg-editor ul, .wysiwyg-editor ol{margin:0 0 10px; padding-left:24px;}
.wysiwyg-editor a{color:var(--teal); text-decoration:underline;}
.wysiwyg-link-dialog{
  display:flex; gap:6px; align-items:center; padding:8px; background:var(--bg); border-bottom:1px solid var(--border);
}
.wysiwyg-link-input{
  flex:1; padding:6px 9px; border:1px solid var(--input-border); border-radius:6px; font-size:13.5px; font-family:inherit;
}

/* --- Postcode autofill hint (static/js/postal_autofill.js) --- */
.postal-autofill-hint{font-size:12.5px;}
.postal-autofill-hint:hover{text-decoration:underline;}

/* --- Crosslink picker (static/js/crosslink_picker.js) --- */
.crosslink-dialog{
  position:absolute; z-index:200; background:var(--surface); border:1px solid var(--border); border-radius:10px;
  box-shadow:0 12px 28px rgba(43,46,51,0.18); padding:10px; width:min(420px, 90vw);
}
.crosslink-search-input{
  width:100%; padding:8px 10px; border:1px solid var(--input-border); border-radius:6px; font-size:13.5px; font-family:inherit; margin-bottom:8px;
}
.crosslink-results{max-height:260px; overflow-y:auto;}
.crosslink-result{
  display:flex; align-items:center; gap:8px; padding:7px 8px; border-radius:6px; cursor:pointer; font-size:13px;
}
.crosslink-result:hover{background:var(--bg);}
.crosslink-result-type{
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.02em; color:#fff;
  background:var(--teal); border-radius:4px; padding:2px 6px; flex-shrink:0;
}
.crosslink-result-title{color:var(--ink);}
.crosslink-empty{padding:10px; color:var(--muted); font-size:13px; text-align:center;}
.crosslink-dialog-actions{display:flex; justify-content:flex-end; gap:6px; margin-top:8px;}

/* ---------- calendar (events app) — self-coded month grid, no JS library ---------- */
.cal-nav{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px;}
.cal-nav h2{margin:0; font-size:19px;}
.cal-grid-wrap{overflow-x:auto; margin-bottom:28px;}
.cal-grid{display:grid; grid-template-columns:repeat(7,minmax(110px,1fr)); gap:1px; background:var(--border); border:1px solid var(--border); border-radius:10px; overflow:hidden; min-width:780px;}
.cal-weekday{
  background:var(--surface-alt); color:var(--muted); font-size:11.5px; font-weight:700;
  text-transform:uppercase; letter-spacing:.03em; padding:8px 10px;
}
.cal-day{background:var(--surface); min-height:104px; padding:8px; display:flex; flex-direction:column; gap:4px;}
.cal-day.is-other-month{background:var(--bg); color:var(--muted);}
.cal-day.is-today .cal-day-num{
  background:var(--teal); color:#fff; border-radius:50%; width:22px; height:22px;
  display:inline-flex; align-items:center; justify-content:center;
}
.cal-day-num{font-size:12.5px; font-weight:700; color:var(--ink);}
.cal-day.is-other-month .cal-day-num{color:var(--muted); font-weight:500;}
.cal-event-pill{
  display:block; background:var(--teal); color:#fff; font-size:11px; font-weight:600;
  border-radius:5px; padding:2px 6px; text-decoration:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.cal-event-pill:hover{background:var(--teal-dark); text-decoration:none;}
.cal-event-pill.is-pending{background:var(--gold); color:var(--ink);}
@media (max-width:700px){
  .cal-grid{min-width:640px;}
  .cal-day{min-height:84px;}
}

/* =========================================================
   v1.20.0 — passwordless login + cookie notice + pronouns
   ========================================================= */
.otp-input{font-size:28px; letter-spacing:10px; text-align:center; font-variant-numeric:tabular-nums; max-width:260px;}
.profile-pronouns{font-family:var(--font-body); font-size:var(--fs-md); font-weight:400; color:var(--muted);}
.cookie-notice{
  position:fixed; left:16px; right:16px; bottom:16px; z-index:60;
  display:flex; gap:14px; align-items:center; justify-content:space-between;
  max-width:760px; margin:0 auto; padding:12px 16px;
  background:var(--surface); color:var(--ink); border:1px solid var(--border);
  border-radius:12px; box-shadow:0 8px 28px rgba(0,0,0,0.12); font-size:var(--fs-sm);
}
.cookie-notice[hidden]{display:none;}
.cookie-notice p{margin:0;}
.cookie-notice a{color:var(--teal); text-decoration:underline;}
@media (max-width:560px){ .cookie-notice{flex-direction:column; align-items:stretch; text-align:center;} }

/* v1.21.0 — newsletter archive, delivery preference, digest toolbar */
.list-row{display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 16px; margin-bottom:8px; background:var(--surface); border:1px solid var(--border); border-radius:10px; color:inherit; text-decoration:none;}
.list-row:hover{border-color:var(--teal);}
.list-row-main{display:flex; flex-direction:column; gap:2px; min-width:0;}
.list-row-main strong{font-family:var(--font-heading); color:var(--teal-dark); font-size:var(--fs-md);}
.delivery-options label{display:flex; gap:8px; align-items:center; margin:6px 0;}
.digest-toolbar{display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:10px 12px; margin-bottom:14px; background:var(--surface-alt); border:1px dashed var(--border); border-radius:10px;}
.digest-toolbar select{padding:6px 8px;}

/* v1.21.2 — text typeahead (municipios / organizaciones) */
.typeahead-wrap{position:relative;}
.typeahead-list{top:100%;}
.typeahead-row small{color:var(--muted); font-size:12px;}
.typeahead-row.is-active{background:var(--bg); color:var(--teal);}


/* =========================================================
   v1.22.0 — LIST / CARDS VIEW for content listings.
   `.course-grid.view-grid` is the opt-in container used by the six
   listing pages (projects, skills market, courses, webinars, blog, KB).
   Without <html data-view="cards"> it renders as a compact list; with it,
   the classic card grid. Other .course-grid users (hub, KB categories,
   calendar) keep the grid unconditionally. See static/js/view_toggle.js.
   ========================================================= */
.view-toggle{display:inline-flex; border:1px solid var(--border); border-radius:999px; padding:2px; background:var(--surface);}
.view-toggle-btn{
  display:inline-flex; align-items:center; justify-content:center; width:30px; height:26px;
  border:none; border-radius:999px; background:transparent; color:var(--muted); cursor:pointer; padding:0;
}
.view-toggle-btn:hover{color:var(--teal-dark); background:var(--bg);}
.view-toggle-btn[aria-pressed="true"]{background:var(--teal); color:#fff;}
.view-toggle-btn svg{display:block;}

.view-grid{display:flex; flex-direction:column; gap:6px;}
.view-grid .course-card{flex-direction:row; align-items:center; gap:14px; padding:8px 14px 8px 8px; border-radius:10px;}
.view-grid .course-card:hover{transform:none; box-shadow:0 3px 12px rgba(43,46,51,0.07);}
.view-grid .course-card-cover{
  /* Icon tile. A status badge (BUSCA COLABORADORES, EN DIRECTO, BORRADOR…)
     stacks under the icon and wraps inside a narrow column instead of
     stretching the tile across the row. */
  flex-direction:column; gap:2px; height:auto; min-height:44px; min-width:44px; max-width:132px; width:auto;
  padding:4px 8px; border-radius:8px; font-size:18px; line-height:1; flex:none;
}
.view-grid .course-card-cover .badge{
  margin:0; font-size:8.5px; padding:0 5px; line-height:1.3; white-space:normal; text-align:center; letter-spacing:0.02em;
}
.view-grid .course-card-body{padding:0; flex-direction:row; align-items:center; flex-wrap:wrap; gap:4px 16px; min-width:0;}
.view-grid .course-card-title{flex:1 1 220px; margin:0; font-size:15px; min-width:0;}
.view-grid .course-card-summary{
  flex:2 1 260px; margin:0; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.view-grid .course-card-meta{flex:0 0 auto; justify-content:flex-start; gap:10px; margin-left:auto;}
.view-grid .course-card-meta + .course-card-meta{margin-left:0;}
.view-grid .webinar-card-when{margin:0; flex:0 0 auto;}
.view-grid .course-card-progress{flex-basis:100%; margin-top:2px;}
@media (max-width:760px){
  .view-grid .course-card-body{flex-direction:column; align-items:flex-start; gap:3px;}
  .view-grid .course-card-title, .view-grid .course-card-summary{flex:none; width:100%;}
  .view-grid .course-card-summary{white-space:normal; display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical;}
  .view-grid .course-card{gap:10px; padding:8px 10px 8px 8px;}
  .view-grid .course-card-meta{margin-left:0;}
}

html[data-view="cards"] .view-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px;}
html[data-view="cards"] .view-grid .course-card{flex-direction:column; align-items:stretch; gap:0; padding:0; border-radius:16px;}
html[data-view="cards"] .view-grid .course-card:hover{transform:translateY(-3px); box-shadow:0 14px 28px rgba(43,46,51,0.09);}
html[data-view="cards"] .view-grid .course-card-cover{
  flex-direction:row; gap:8px; height:96px; min-height:0; width:auto; min-width:0; max-width:none; padding:0; border-radius:0; font-size:28px; line-height:normal;
}
html[data-view="cards"] .view-grid .course-card-cover .badge{
  margin-right:6px; font-size:10px; padding:1px 7px; line-height:1.6; white-space:nowrap; letter-spacing:0.04em;
}
html[data-view="cards"] .view-grid .course-card-body{padding:14px 16px; flex-direction:column; align-items:stretch; flex-wrap:nowrap; gap:0;}
html[data-view="cards"] .view-grid .course-card-title{flex:none; margin-bottom:4px; font-size:15.5px;}
html[data-view="cards"] .view-grid .course-card-summary{flex:1; margin-bottom:8px; white-space:normal; overflow:visible; display:block;}
html[data-view="cards"] .view-grid .course-card-meta{flex:none; justify-content:space-between; margin-left:0;}
html[data-view="cards"] .view-grid .webinar-card-when{margin-bottom:8px;}

/* =========================================================
   v1.23.0 — DESARROLLO (project-development workspace)
   ========================================================= */
.dev-list{display:flex; flex-direction:column; gap:6px;}
.dev-row{
  display:flex; align-items:center; gap:16px; padding:10px 14px; background:var(--surface);
  border:1px solid var(--border); border-radius:10px; color:var(--ink); text-decoration:none;
}
.dev-row:hover{box-shadow:0 3px 12px rgba(43,46,51,0.07); text-decoration:none;}
.dev-row-main{flex:1 1 320px; min-width:0;}
.dev-row-title{font-family:var(--font-heading); font-weight:700; font-size:15px; display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.dev-row-main .fmeta{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.dev-row-meta{display:flex; align-items:center; gap:12px; font-size:12.5px; color:var(--muted); flex:none;}
.dev-mini-progress{display:inline-block; width:60px; height:6px; background:var(--bg); border-radius:999px; overflow:hidden;}
.dev-mini-progress i{display:block; height:100%; background:var(--gold);}
.dev-status-idea,.dev-status-design{background:var(--bg); color:var(--muted);}
.dev-status-funding{background:rgba(226,192,68,0.22); color:#8a6d10;}
.dev-status-active{background:rgba(46,139,87,0.15); color:#1f6b45;}
.dev-status-paused,.dev-status-archived{background:var(--border-soft); color:var(--muted);}
.dev-status-completed{background:var(--teal); color:#fff;}

.dev-head{display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; margin-bottom:12px;}
.dev-head-actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap;}
.dev-tabs{display:flex; gap:2px; border-bottom:2px solid var(--border); margin-bottom:16px; overflow-x:auto; scrollbar-width:none;}
.dev-tabs a{
  padding:8px 12px; font-size:13.5px; font-weight:600; color:var(--muted); border-bottom:2px solid transparent; margin-bottom:-2px;
  white-space:nowrap; text-decoration:none;
}
.dev-tabs a small{font-weight:700; font-size:10.5px; background:var(--bg); border-radius:999px; padding:1px 6px; margin-left:2px; color:var(--muted);}
.dev-tabs a:hover{color:var(--teal-dark); text-decoration:none;}
.dev-tabs a.is-active{color:var(--teal-dark); border-bottom-color:var(--teal);}
.dev-panel[hidden]{display:none;}
.dev-panel-toolbar{display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px;}
.dev-grid-2{display:grid; grid-template-columns:2fr 1fr; gap:16px;}
@media (max-width:860px){.dev-grid-2{grid-template-columns:1fr;}}
.dev-card{margin-top:0; padding:20px 22px; margin-bottom:14px;}
.dev-card h2{font-size:var(--fs-h3); margin-bottom:10px;}
.dev-card h3{font-size:15.5px; margin:14px 0 6px;}
.dev-card h4{font-size:14px; margin:12px 0 6px;}
.dev-table{width:100%; border-collapse:collapse; font-size:13.5px;}
.dev-table td,.dev-table th{padding:6px 8px; vertical-align:middle; text-align:left;}
.dev-table-bordered{background:var(--surface); border:1px solid var(--border); border-radius:10px; overflow:hidden;}
.dev-table-bordered th{background:var(--bg); font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--muted);}
.dev-table-bordered td{border-top:1px solid var(--border-soft);}
.dev-table-bordered tfoot th{font-size:13px; text-transform:none; letter-spacing:0;}
.dev-table tr.is-muted td{color:var(--muted); opacity:0.7;}
.text-danger{color:#b3261e;}

/* theory of change */
.toc-board{display:grid; grid-template-columns:repeat(6,minmax(150px,1fr)); gap:10px; overflow-x:auto;}
@media (max-width:1000px){.toc-board{grid-template-columns:repeat(3,minmax(160px,1fr));}}
@media (max-width:600px){.toc-board{grid-template-columns:1fr;}}
.toc-col{background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:8px; min-height:120px;}
.toc-col-head{font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:var(--muted); display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; padding:0 2px;}
.toc-add{display:inline-flex; width:20px; height:20px; align-items:center; justify-content:center; border-radius:50%; background:var(--surface); border:1px solid var(--border); color:var(--teal); font-weight:700; text-decoration:none;}
.toc-add:hover{background:var(--teal); color:#fff; text-decoration:none;}
.toc-item{background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:8px 10px; margin-bottom:6px; font-size:13px;}
.toc-item-title{font-weight:600; margin-bottom:2px;}
.toc-sub{font-size:11.5px; color:var(--muted); margin-top:4px;}
.toc-empty{color:var(--muted); text-align:center; font-size:12px; padding:10px 0;}

/* OKR */
.okr-head{display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap;}
.okr-progress{display:flex; align-items:center; gap:8px; min-width:180px; font-size:12.5px; font-weight:700; color:var(--muted);}
.okr-progress .progress-track{flex:1;}
.kr-title{width:40%;}
.kr-bar{width:22%;}
.kr-bar .progress-track{height:6px;}
.kr-num{white-space:nowrap; font-size:12.5px; color:var(--muted);}
.kr-form{display:inline-flex; align-items:center; gap:4px;}
.kr-form input{width:70px; padding:3px 6px; font-size:12.5px;}
.kr-form .btn-sm{padding:3px 8px; font-size:11px;}
.kr-date{white-space:nowrap;}

/* timeline */
.timeline{list-style:none; margin:0; padding:0 0 0 14px; border-left:2px solid var(--border);}
.tl-item{position:relative; padding:0 0 14px 18px;}
.tl-item::before{content:""; position:absolute; left:-21px; top:4px; width:12px; height:12px; border-radius:50%; background:var(--surface); border:2px solid var(--teal);}
.tl-item.is-done::before{background:var(--teal);}
.tl-item.is-overdue::before{border-color:#b3261e;}
.tl-item.is-today::before{border-color:var(--gold); background:var(--gold);}
.tl-deadline::before{border-radius:2px;}
.tl-date{font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.03em;}
.tl-title{display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-weight:600; font-size:14px;}
.tl-item.is-done .tl-title a{text-decoration:line-through; color:var(--muted);}
.tl-toggle{display:inline;}
.tl-toggle button{background:none; border:none; cursor:pointer; font-size:16px; padding:0; line-height:1; color:var(--teal);}

/* kanban */
.kanban{display:grid; grid-template-columns:repeat(4,1fr); gap:10px;}
@media (max-width:900px){.kanban{grid-template-columns:repeat(2,1fr);}}
@media (max-width:520px){.kanban{grid-template-columns:1fr;}}
.kanban-col{background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:8px; min-height:140px;}
.kanban-head{font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:var(--muted); display:flex; align-items:center; gap:6px; margin-bottom:6px; padding:0 2px;}
.kanban-head small{background:var(--surface); border-radius:999px; padding:1px 6px;}
.kanban-head .toc-add{margin-left:auto;}
.kanban-done .kanban-card{opacity:0.75;}
.kanban-card{background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--border); border-radius:8px; padding:8px 10px; margin-bottom:6px; font-size:13px;}
.kanban-card.prio-high{border-left-color:#b3261e;}
.kanban-card.prio-normal{border-left-color:var(--teal);}
.kanban-card.prio-low{border-left-color:var(--border);}
.kanban-card.is-overdue .kanban-meta{color:#b3261e;}
.kanban-title{font-weight:600; margin-bottom:3px;}
.kanban-meta{display:flex; gap:8px; flex-wrap:wrap; align-items:center;}
.kanban-actions{display:flex; gap:4px; margin-top:6px;}
.kanban-actions form{display:inline;}
.kanban-actions button{background:var(--bg); border:1px solid var(--border); border-radius:6px; cursor:pointer; font-size:11px; padding:2px 7px; color:var(--muted);}
.kanban-actions button:hover{color:var(--teal-dark); border-color:var(--teal);}

/* grants + risks */
.grant-identified,.grant-preparing{background:var(--bg); color:var(--muted);}
.grant-submitted{background:rgba(226,192,68,0.22); color:#8a6d10;}
.grant-awarded{background:rgba(46,139,87,0.15); color:#1f6b45;}
.grant-rejected,.grant-closed{background:var(--border-soft); color:var(--muted);}
.risk-score{display:inline-block; min-width:26px; text-align:center; border-radius:6px; padding:1px 6px; font-weight:700; font-size:12px; background:var(--bg);}
.risk-6,.risk-9{background:rgba(179,38,30,0.12); color:#b3261e;}
.risk-3,.risk-4{background:rgba(226,192,68,0.22); color:#8a6d10;}

/* AI analysis */
.analysis-wait{font-weight:600; color:var(--teal-dark);}
.suggestions{display:flex; flex-direction:column; gap:8px;}
.suggestion{display:flex; gap:14px; align-items:flex-start; justify-content:space-between; background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:10px 12px;}
.suggestion-main{flex:1; min-width:0; font-size:13.5px;}
.suggestion-title{font-weight:600; display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:2px;}
.suggestion-preview{font-size:12.5px; color:var(--ink); background:var(--surface); border-left:3px solid var(--teal); padding:6px 10px; margin-top:6px; border-radius:6px; white-space:pre-wrap;}
.suggestion-actions{display:flex; gap:6px; flex:none; align-items:center;}
.suggestion-actions form{display:inline;}
.suggestion-applied{opacity:0.7;}
.suggestion-dismissed{opacity:0.5;}
@media (max-width:640px){.suggestion{flex-direction:column;} .suggestion-actions{align-self:flex-end;}}

/* dossier print */
.dossier{max-width:820px; margin:0 auto;}
@media print{
  header, footer, .no-print, .cookie-notice, .breadcrumb{display:none !important;}
  main{padding:0;}
  .dossier{border:none; box-shadow:none; padding:0; max-width:none;}
  body{background:#fff; color:#000;}
}
