/* ═══════════════════════════════════════════════════════════════
   DRJ Maestros — plataforma para docentes del Perú.
   Warm, calm and legible: white canvas, ink text, teacher green,
   amber highlights. DRJ red appears only in the logo mark.
   ═══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFFFFF;
  --bg-app: #F7F6F2;
  --surface: #FFFFFF;
  --ink: #14201C;
  --ink-2: #3D4A45;
  --muted: #5F6B66;
  --line: #E3E1DA;
  --line-2: #CFCCC2;
  --green: #0E7C66;
  --green-hover: #0B6A57;
  --green-soft: #E3F1EC;
  --green-deep: #0B4F43;
  --amber: #F2A33A;
  --amber-soft: #FDF1DE;
  --red: #E61522;
  --danger: #B42318;

  --font-ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-brand: 'Montserrat', Arial, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --gutter: clamp(1rem, 4.5vw, 4rem);
  --max: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 1px 2px rgba(20, 32, 28, 0.06), 0 8px 24px -12px rgba(20, 32, 28, 0.18);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
ul, ol { list-style: none; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  padding: 0.6rem 1rem; background: var(--green); color: #fff; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

/* ─── Brand lockup ───────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--ink); }
.brand__mark {
  display: inline-grid; place-items: center; height: 36px; padding: 0 0.55rem;
  background: var(--red); color: #fff; border-radius: 6px;
  font-family: var(--font-brand); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em;
}
.brand__rule { width: 2px; height: 36px; background: var(--ink); }
.brand__word { font-family: var(--font-brand); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.brand--sm .brand__mark, .brand--sm .brand__rule { height: 30px; }
.brand--sm .brand__mark { font-size: 0.92rem; }
.brand--sm .brand__word { font-size: 1.15rem; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.6rem 1.15rem;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-hover); }
.btn--ghost { border-color: var(--line-2); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); }
.btn--soft { background: var(--green-soft); color: var(--green-deep); }
.btn--soft:hover { background: #D2E9E1; }
.btn--amber { background: var(--amber); color: #1D1405; }
.btn--amber:hover { background: #E8952A; }
.btn--danger { background: transparent; color: var(--danger); border-color: #F1C6C1; }
.btn--danger:hover { background: #FDECEA; }
.btn--sm { min-height: 36px; padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn--lg { min-height: 52px; padding: 0.8rem 1.5rem; font-size: 1.02rem; }
.btn--block { width: 100%; }

.eyebrow {
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--green);
}
.hint { font-size: 0.85rem; color: var(--muted); }

/* ═══ Landing ════════════════════════════════════════════════ */
.l-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.85rem var(--gutter);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.l-nav { display: flex; gap: 1.5rem; margin-left: auto; }
.l-nav a { text-decoration: none; font-weight: 500; color: var(--ink-2); }
.l-nav a:hover { color: var(--green); }
.l-header__actions { display: flex; gap: 0.5rem; }

.text-link {
  font-weight: 600; color: var(--green-deep); text-decoration: underline;
  text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.text-link:hover { color: var(--green); }

.hero, .nomore, .tools, .how, .closing {
  max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter);
}

/* Hero: the promise on the left, the documents it produces on the right */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2.5rem, 6vw, 5rem); align-items: center;
  padding-top: clamp(3rem, 8vw, 6rem); padding-bottom: clamp(3.5rem, 8vw, 6rem);
}
.hero h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.02; letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal; color: var(--green-deep);
  background: linear-gradient(transparent 62%, var(--amber-soft) 62%, var(--amber-soft) 92%, transparent 92%);
}
.hero__lead { max-width: 50ch; margin-top: 1.5rem; font-size: clamp(1.05rem, 1.35vw, 1.2rem); color: var(--ink-2); }
.hero__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-top: 2.25rem; }

.hero__papers { justify-self: center; width: 100%; max-width: 430px; }
.papers { position: relative; padding: 4% 11% 6% 0; }
.paper {
  --s: 0.5;
  position: relative; width: 100%;
  height: calc(var(--ph, 1123) * var(--s) * 1px);
  overflow: hidden; background: #fff; border-radius: 2px;
  box-shadow: 0 1px 1px rgba(20, 32, 28, 0.06), 0 2px 6px rgba(20, 32, 28, 0.06), 0 24px 48px -24px rgba(20, 32, 28, 0.35);
}
.paper__sheet {
  width: calc(var(--pw, 794) * 1px); height: calc(var(--ph, 1123) * 1px);
  padding: 60px 64px; transform: scale(var(--s)); transform-origin: 0 0;
  pointer-events: none; user-select: none; text-rendering: geometricPrecision;
}
.paper--front { z-index: 2; transform: rotate(-1.5deg); }
.paper--back { position: absolute; z-index: 1; top: -5%; left: 12%; width: 86%; transform: rotate(4deg); }
.papers.is-settling .paper--front { animation: settle-front 0.9s var(--ease) both; }
.papers.is-settling .paper--back { animation: settle-back 0.9s var(--ease) 0.12s both; }
@keyframes settle-front { from { opacity: 0; transform: translateY(18px) rotate(-4deg); } }
@keyframes settle-back { from { opacity: 0; transform: translateY(26px) rotate(7deg); } }

/* Shared section headings */
.nomore h2, .tools h2, .cneb h2, .how h2 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.75rem, 3.2vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em;
  max-width: 24ch; text-wrap: balance;
}

/* What teachers stop doing: a before/after ledger, no icons */
.nomore { padding-top: clamp(3rem, 7vw, 5rem); padding-bottom: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--line); }
.nomore__list { margin-top: 2.25rem; counter-reset: nomore; }
.nomore__list li {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem 3rem;
  padding: 1.35rem 0; border-top: 1px solid var(--line);
}
.nomore__list li:last-child { border-bottom: 1px solid var(--line); }
.nomore__before { color: var(--muted); font-size: 1.05rem; }
.nomore__after { font-size: 1.05rem; font-weight: 600; color: var(--ink); }

/* Tools: tabbed tour of real documents */
.tools { padding-top: clamp(3rem, 7vw, 5rem); padding-bottom: clamp(3rem, 7vw, 5rem); }
.tools__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 3rem; }
.tools__head p { max-width: 34ch; color: var(--muted); }
.tabs {
  display: flex; gap: 0.25rem; margin-top: 2rem; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"] {
  flex-shrink: 0; min-height: 48px; padding: 0.6rem 1rem; border: 0; border-bottom: 3px solid transparent;
  margin-bottom: -1px; background: none; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); }
.tabs [role="tab"]:focus-visible { outline: 3px solid rgba(14, 124, 102, 0.35); outline-offset: -3px; }
.tabpanel {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(2rem, 5vw, 4rem);
  align-items: start; padding: clamp(2rem, 4vw, 3rem) 0 0;
}
.tabpanel:focus-visible { outline: 3px solid rgba(14, 124, 102, 0.35); outline-offset: 6px; border-radius: 4px; }
.tabpanel__copy { position: sticky; top: 96px; }
.tabpanel__copy h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; margin-bottom: 0.6rem; }
.tabpanel__copy p { color: var(--ink-2); font-size: 1.05rem; max-width: 42ch; }
.tabpanel .paper {
  max-width: 560px; justify-self: end;
  max-height: min(620px, calc(var(--ph, 1123) * var(--s) * 1px));
  -webkit-mask-image: linear-gradient(#000 82%, transparent);
  mask-image: linear-gradient(#000 82%, transparent);
}
.files { display: grid; width: 100%; max-width: 560px; justify-self: end; }
.files li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.15rem 0.9rem; align-items: baseline;
  padding: 1rem 0; border-top: 1px solid var(--line);
}
.files li:last-child { border-bottom: 1px solid var(--line); }
.files__type {
  grid-row: span 2; align-self: center; min-width: 3rem; padding: 0.25rem 0.4rem; border-radius: 4px;
  background: var(--amber-soft); color: #7A4A08; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; text-align: center;
}
.files__name { font-weight: 600; }
.files__meta { font-size: 0.9rem; color: var(--muted); }

/* CNEB strip: real counts from the curriculum data */
.cneb {
  background: var(--bg-app);
  padding: clamp(3rem, 7vw, 5rem) max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
}
.cneb__stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.5rem;
  margin-top: 2.25rem; padding-top: 1.5rem; border-top: 2px solid var(--ink);
}
.cneb__stats dt { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 4vw, 3.25rem); line-height: 1; color: var(--green-deep); }
.cneb__stats dd { margin-top: 0.4rem; color: var(--ink-2); max-width: 18ch; }
.cneb__note { margin-top: 2rem; font-size: 0.9rem; color: var(--muted); max-width: 70ch; }

/* How it works: one line, three moves */
.how { padding-top: clamp(3rem, 7vw, 5rem); padding-bottom: clamp(2rem, 5vw, 3rem); }
.how__flow {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem 2.5rem;
  margin-top: 2rem; counter-reset: step;
}
.how__flow li { counter-increment: step; font-size: 1.1rem; color: var(--ink-2); }
.how__flow li::before {
  content: counter(step); display: block; margin-bottom: 0.5rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--green);
}
.how__flow strong { color: var(--ink); }

/* Closing: a plain, confident line */
.closing { padding-top: clamp(3rem, 7vw, 5rem); padding-bottom: clamp(4rem, 9vw, 6.5rem); }
.closing h2 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.3rem, 6vw, 4.5rem); line-height: 1.02; letter-spacing: -0.03em;
}
.closing p { margin: 1rem 0 2rem; font-size: 1.1rem; color: var(--ink-2); }

.l-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem;
  padding: 2rem var(--gutter); border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--muted);
}
.l-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.l-footer nav a { text-decoration: none; }
.l-footer nav a:hover { color: var(--green); text-decoration: underline; }

/* ═══ Auth dialog ════════════════════════════════════════════ */
.auth {
  width: min(440px, calc(100vw - 2rem)); margin: auto; padding: 2rem;
  border: 0; border-radius: 20px; box-shadow: 0 30px 80px -20px rgba(20, 32, 28, 0.45);
  color: var(--ink);
}
.auth::backdrop { background: rgba(20, 32, 28, 0.55); backdrop-filter: blur(3px); }
.auth__close-form { position: absolute; top: 0.75rem; right: 0.75rem; }
.auth__close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg-app); }
.auth h2 { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.2; margin: 1.25rem 0 1rem; }
.auth__tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 1.25rem; border-radius: 999px; background: var(--bg-app); }
.auth__tabs button { min-height: 40px; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.auth__tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.auth__form { display: grid; gap: 0.9rem; }
.auth__form label, .form label { display: grid; gap: 0.3rem; font-size: 0.88rem; font-weight: 600; }
.auth__form input, .form input {
  min-height: 46px; padding: 0.6rem 0.8rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; font-weight: 400;
}
.auth__form input:focus, .form input:focus { border-color: var(--green); outline: 3px solid rgba(14, 124, 102, 0.18); }
.auth__form small { font-weight: 400; color: var(--muted); }
.auth__error { min-height: 1.2em; color: var(--danger); font-size: 0.88rem; }

/* ═══ App shell ══════════════════════════════════════════════ */
#app { min-height: 100vh; background: var(--bg-app); }
.a-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem var(--gutter); background: #fff; border-bottom: 1px solid var(--line);
}
.a-top__user { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.a-nav {
  position: sticky; top: 58px; align-self: start;
  display: flex; flex-direction: column; gap: 2px;
  height: calc(100vh - 58px); padding: 1rem 0.75rem; border-right: 1px solid var(--line); background: #fff;
}
.a-nav a, .a-nav button {
  display: flex; align-items: center; gap: 0.7rem; min-height: 44px; padding: 0.5rem 0.8rem;
  border: 0; border-radius: 10px; background: transparent; text-decoration: none; text-align: left;
  font-weight: 500; color: var(--ink-2);
}
.a-nav a:hover, .a-nav button:hover { background: var(--bg-app); color: var(--ink); }
.a-nav a[aria-current="page"] { background: var(--green-soft); color: var(--green-deep); font-weight: 700; }
.a-nav .ico { width: 1.3rem; text-align: center; font-size: 1.05rem; }
.a-nav__logout { margin-top: auto; }
.a-view { padding: clamp(1.25rem, 3vw, 2.25rem) var(--gutter) 4rem; outline: none; min-width: 0; }

.v-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.v-head h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -0.02em; line-height: 1.1; }
.v-sub { color: var(--muted); margin-top: 0.25rem; }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.quick__btn {
  display: flex; align-items: center; gap: 0.6rem; min-height: 56px; padding: 0.75rem 1rem;
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: #fff; font-weight: 600; text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.quick__btn span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; flex-shrink: 0; }
.quick__btn:hover { border-color: var(--green); background: var(--green-soft); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.stat { display: flex; flex-direction: column; gap: 0.1rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); text-decoration: none; transition: border-color 0.2s; }
.stat:hover { border-color: var(--green); }
.stat__n { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1.1; }
.stat__l { font-size: 0.85rem; color: var(--muted); }
.stat--amber { background: var(--amber-soft); border-color: #F5D8A8; }

.panel { padding: clamp(1rem, 2.5vw, 1.5rem); border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.panel h2, .panel__head h2 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 0.75rem; }

.doc-list { display: grid; gap: 0.5rem; }
.doc-item { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.8rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.doc-item__main { display: grid; flex: 1 1 260px; min-width: 0; text-decoration: none; }
.doc-item__kind { font-family: var(--font-mono); font-size: 0.72rem; color: var(--green); text-transform: uppercase; letter-spacing: 0.06em; }
.doc-item__title { font-weight: 700; overflow-wrap: anywhere; }
.doc-item__main:hover .doc-item__title { color: var(--green); text-decoration: underline; }
.doc-item__meta { font-size: 0.85rem; color: var(--muted); }
.doc-item__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.25rem; }
.filters input, .filters select {
  min-height: 44px; padding: 0.5rem 0.75rem; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; max-width: 100%;
}
.filters__search { flex: 1 1 240px; }
.filters__search input { width: 100%; }

.state { display: grid; justify-items: center; gap: 0.75rem; padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.state h2 { font-family: var(--font-display); color: var(--ink); font-size: 1.2rem; }
.state--empty { border: 1px dashed var(--line-2); border-radius: var(--radius); background: #fff; }
.state--error { border: 1px solid #F1C6C1; border-radius: var(--radius); background: #FFF8F7; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--green-soft); border-top-color: var(--green); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Materials */
.materials { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 1rem; }
.materials > .state { grid-column: 1 / -1; }
.material { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.material__cover { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--amber-soft); }
.material__cover img { width: 100%; height: 100%; object-fit: cover; }
.material__cover span { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: #7A4A08; }
.material__body { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; flex: 1; padding: 1rem; }
.material__body h3 { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.25; }
.material__body p { font-size: 0.9rem; color: var(--ink-2); }
.material__kind { font-family: var(--font-mono); font-size: 0.72rem; color: var(--green); text-transform: uppercase; letter-spacing: 0.06em; }
.material__meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.5rem; }
.material .btn { margin-top: auto; }

/* Profile */
.profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1rem; align-items: start; }
.form { display: grid; gap: 0.9rem; }
.form .btn { justify-self: start; }

/* ═══ Editor ═════════════════════════════════════════════════ */
.ed-bar {
  position: sticky; top: 58px; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem;
  margin: calc(-1 * clamp(1.25rem, 3vw, 2.25rem)) calc(-1 * var(--gutter)) 1.5rem;
  padding: 0.75rem var(--gutter); background: rgba(247, 246, 242, 0.95);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.ed-bar__title { display: grid; flex: 1 1 200px; min-width: 0; }
.ed-bar__title strong { font-family: var(--font-display); font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-bar__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.save-state { font-size: 0.82rem; font-weight: 600; color: var(--green); white-space: nowrap; }
.save-state[data-state="dirty"], .save-state[data-state="saving"] { color: var(--muted); }
.save-state[data-state="error"] { color: var(--danger); cursor: pointer; text-decoration: underline; }

.editor { display: grid; gap: 1rem; max-width: 980px; }
.ed-sec { padding: clamp(1rem, 2.5vw, 1.5rem); border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.ed-sec > header { margin-bottom: 1rem; }
.ed-sec h2 { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -0.01em; }
.ed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1rem; }
.fld { display: grid; gap: 0.3rem; min-width: 0; }
.fld--wide { grid-column: 1 / -1; }
.fld label, .fld legend, .fld__label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.fld input, .fld select, .fld textarea {
  width: 100%; min-height: 44px; padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; font-size: 0.95rem;
}
.fld textarea { resize: vertical; line-height: 1.5; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--green); outline: 3px solid rgba(14, 124, 102, 0.18); }

.checks { border: 0; display: grid; gap: 0.35rem; }
.checks legend { margin-bottom: 0.35rem; }
.check { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer; font-size: 0.92rem; }
.check:hover { background: var(--bg-app); }
.fld .check input { width: 18px; height: 18px; min-height: 0; padding: 0; margin-top: 0.2rem; border-radius: 4px; accent-color: var(--green); flex-shrink: 0; }

.seg { border: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg legend { width: 100%; margin-bottom: 0.35rem; }
.fld .seg__opt input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
.seg__opt span { display: inline-flex; align-items: center; min-height: 40px; padding: 0.4rem 0.9rem; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.seg__opt input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.seg__opt input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }

.row-card { grid-column: 1 / -1; padding: 1rem; border-radius: 10px; background: var(--bg-app); border: 1px solid var(--line); }
.row-card .fld input, .row-card .fld select, .row-card .fld textarea { background: #fff; }
.row-card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.row-card__num { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; color: var(--green); text-transform: uppercase; letter-spacing: 0.08em; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line-2); border-radius: 50%; background: #fff; color: var(--muted); }
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }
.add-row { grid-column: 1 / -1; justify-self: start; }

.momento { grid-column: 1 / -1; padding: 1rem; border-radius: 10px; background: var(--bg-app); border: 1px solid var(--line); }
.momento__head h3::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 0.5rem; border-radius: 50%; background: var(--amber); vertical-align: middle; }
.momento__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; }
.momento__head h3 { font-family: var(--font-display); font-size: 1.05rem; }
.momento__head .fld { max-width: 130px; }

.show-xs { display: none; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 200; max-width: calc(100vw - 2rem);
  padding: 0.75rem 1.1rem; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; font-size: 0.92rem;
  transform: translate(-50%, 150%); opacity: 0; transition: transform 0.35s var(--ease), opacity 0.35s;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast[data-kind="error"] { background: var(--danger); }

.print-root { display: none; }

/* ═══ Responsive ═════════════════════════════════════════════ */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero__papers { max-width: 380px; }
  .tabpanel { grid-template-columns: minmax(0, 1fr); }
  .tabpanel__copy { position: static; }
  .tabpanel .paper, .files { justify-self: start; }
  .cneb__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .a-shell { grid-template-columns: 1fr; }
  .a-nav {
    position: sticky; top: 58px; z-index: 15; flex-direction: row; height: auto;
    padding: 0.5rem var(--gutter); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .a-nav::-webkit-scrollbar { display: none; }
  .a-nav a, .a-nav button { flex-shrink: 0; white-space: nowrap; min-height: 40px; padding: 0.4rem 0.75rem; }
  .a-nav__logout { margin-top: 0; }
  .ed-bar { top: 114px; }
}

@media (max-width: 720px) {
  .l-nav { display: none; }
  .l-header { gap: 0.75rem; }
  .l-header__actions { margin-left: auto; }
  .l-header__actions .btn--ghost { display: none; }
  .ed-grid { grid-template-columns: 1fr; }
  .ed-bar { position: static; margin-top: 0; }
  .ed-bar__actions .btn { flex: 1 1 auto; }
  .nomore__list li { grid-template-columns: 1fr; }
  .how__flow { grid-template-columns: 1fr; }
  .cneb__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a-top__user { max-width: 45vw; }
}

@media (max-width: 400px) {
  .hide-xs { display: none; }
  .show-xs { display: inline; }
}

@media (max-width: 380px) {
  .brand__word { font-size: 1.1rem; }
  .l-header__actions .btn { padding: 0.5rem 0.8rem; font-size: 0.85rem; }
  .hero__cta .btn { width: 100%; }
  .cneb__stats { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .papers.is-settling .paper { animation: none; }
}

/* ═══ Print: only the document ═══════════════════════════════ */
@media print {
  body.is-printing > *:not(#print-root) { display: none !important; }
  body.is-printing #print-root { display: block; }
  body.is-printing { background: #fff; }
}
