/* Status: The Game — estilos. Mid-century luminoso: teal, coral, mostaza y papel crema. */
:root {
  --ink: #1f2a37;
  --ink-soft: #4b5563;
  --paper: #fbf5e6;
  --paper-2: #f3e9d2;
  --paper-line: #e6d8b8;
  --teal: #2a9d8f;
  --teal-dark: #1d6f66;
  --navy: #264653;
  --coral: #e76f51;
  --coral-dark: #c4502f;
  --mustard: #e9c46a;
  --mustard-dark: #c99a2e;
  --sand: #f4a261;
  --sky: #bfe3df;
  --wall: #f6d7c3;
  --desk: #d9b27c;
  --desk-dark: #b88b52;
  --ok: #2a9d8f;
  --bad: #e76f51;
  --shadow: 0 2px 0 rgba(31, 42, 55, 0.08), 0 8px 24px rgba(31, 42, 55, 0.12);
  --radius: 14px;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'DM Serif Display', Georgia, serif;
  --font-doc: 'Courier Prime', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--navy);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
sub, sup { line-height: 0; }
.hidden { display: none !important; }

/* ---------------- app ---------------- */
#app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }

/* ---------------- barra superior ---------------- */
#topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 8px 18px;
  background: var(--navy);
  color: var(--paper);
  border-bottom: 4px solid var(--mustard);
  z-index: 5;
}
.logo { font-family: var(--font-title); font-size: 24px; letter-spacing: 0.5px; white-space: nowrap; }
.logo b { color: var(--mustard); font-weight: 400; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 4px 12px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.chip .lbl { opacity: 0.7; font-weight: 600; }
#clock { font-family: var(--font-doc); font-size: 18px; min-width: 64px; }
#clock.late { color: var(--coral); }
.credbar { width: 140px; height: 10px; background: rgba(255, 255, 255, 0.15); border-radius: 99px; overflow: hidden; }
.credbar > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width 0.5s, background 0.5s; }
.credbar.low > i { background: var(--coral); }
.spacer { flex: 1; }
.iconbtn {
  background: rgba(255, 255, 255, 0.1); color: var(--paper); border: 0; border-radius: 10px;
  padding: 6px 10px; font-weight: 700; font-size: 14px;
}
.iconbtn:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------------- oficina ---------------- */
#office { display: grid; grid-template-rows: minmax(220px, 34vh) 1fr; min-height: 0; position: relative; }

/* ventanilla */
#booth { position: relative; background: var(--wall); overflow: hidden; border-bottom: 10px solid var(--desk-dark); }
#booth .window {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: 16px; bottom: 34px; width: min(760px, 70%);
  border: 10px solid var(--paper); border-radius: 18px 18px 6px 6px;
  overflow: hidden; background: var(--sky);
  box-shadow: inset 0 0 0 3px rgba(31, 42, 55, 0.15), var(--shadow);
}
#booth .window .sky { position: absolute; inset: 0; }
#booth .window .sky svg { width: 100%; height: 100%; display: block; }
#booth .window::after { /* reflejo del vidrio */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.35) 0 12%, transparent 12% 18%, rgba(255, 255, 255, 0.18) 18% 22%, transparent 22%);
  pointer-events: none;
}
#booth .sign {
  position: absolute; left: 18px; top: 18px; width: 150px;
  background: var(--teal-dark); color: var(--paper); border-radius: 10px; padding: 10px 12px;
  font-family: var(--font-title); font-size: 18px; line-height: 1.1; box-shadow: var(--shadow);
  border: 3px solid var(--mustard);
}
#booth .sign small { display: block; font-family: var(--font-ui); font-size: 11px; opacity: 0.85; margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; }
#booth .counter {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34px;
  background: repeating-linear-gradient(90deg, var(--desk) 0 60px, #d3aa72 60px 62px);
  border-top: 4px solid var(--desk-dark);
}
#petitioner {
  position: absolute; left: 50%; bottom: 30px; height: calc(100% - 40px); aspect-ratio: 5 / 6;
  transform: translateX(-50%); transition: transform 0.7s cubic-bezier(.3, .7, .3, 1), opacity 0.5s;
}
#petitioner svg { width: 100%; height: 100%; display: block; }
#petitioner.out-left { transform: translateX(-260%); opacity: 0; }
#petitioner.out-right { transform: translateX(160%); opacity: 0; }
#nameplate {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 1px 10px;
  font-size: 12px; font-weight: 800; white-space: nowrap; z-index: 2;
}
#bubble {
  position: absolute; left: calc(50% + min(150px, 14vh)); top: 22px; max-width: 280px;
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow); z-index: 3;
  transition: opacity 0.3s, transform 0.3s; transform-origin: bottom left;
}
#bubble::before {
  content: ''; position: absolute; left: -14px; bottom: 16px; border: 8px solid transparent;
  border-right: 10px solid var(--ink);
}
#bubble.hide { opacity: 0; transform: scale(0.8); }
#queue { position: absolute; right: 18px; top: 18px; text-align: right; font-weight: 800; font-size: 13px; color: var(--ink-soft); }
#queue .dots { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }
#queue .dots i { width: 14px; height: 18px; border-radius: 7px 7px 3px 3px; background: var(--ink-soft); opacity: 0.55; }
#bell {
  position: absolute; right: 26px; bottom: 34px; width: 74px; height: 58px; border: 0; background: none; padding: 0;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.15));
}
#bell svg { width: 100%; height: 100%; }
#bell.ring { animation: ring 1s ease-in-out infinite; }
#bell .bell-label {
  position: absolute; right: 0; bottom: -2px; width: 120px; text-align: right;
  font-size: 11px; font-weight: 800; color: var(--ink); transform: translateY(100%);
}
@keyframes ring { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(-10deg); } 20% { transform: rotate(9deg); } 30% { transform: rotate(-6deg); } 40% { transform: rotate(0); } }

/* escritorio */
#desk {
  display: grid; grid-template-columns: minmax(360px, 1.1fr) minmax(360px, 1.2fr) 160px; gap: 18px;
  padding: 18px; min-height: 0; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.03) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, var(--desk), #cfa46c);
  transition: margin-right 0.3s;
}
body.drawer-open #desk { margin-right: min(430px, 40vw); grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.2fr) 140px; }

.paper {
  background: var(--paper); border-radius: 6px; box-shadow: var(--shadow);
  padding: 18px 20px; overflow-y: auto; min-height: 0; position: relative;
}
.paper::-webkit-scrollbar { width: 8px; }
.paper::-webkit-scrollbar-thumb { background: var(--paper-line); border-radius: 8px; }

/* expediente */
#dossier { font-family: var(--font-doc); transform: rotate(-0.4deg); }
#dossier.empty, #form.empty { display: grid; place-items: center; color: var(--ink-soft); font-family: var(--font-ui); font-weight: 700; text-align: center; }
.doc-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px dashed var(--paper-line); padding-bottom: 8px; margin-bottom: 10px; gap: 10px; }
.doc-head .num { font-weight: 700; letter-spacing: 1px; color: var(--teal-dark); }
.doc-head .org { font-size: 13px; color: var(--ink-soft); text-align: right; }
.doc-title { font-family: var(--font-title); font-size: 21px; margin: 2px 0 8px; line-height: 1.15; }
.claim {
  background: #fff; border-left: 5px solid var(--coral); padding: 10px 12px; margin: 10px 0; font-size: 15px;
  border-radius: 0 6px 6px 0;
}
.claim .lbl, .doc-sec .lbl { display: block; font-family: var(--font-ui); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-soft); margin-bottom: 4px; }
.doc-sec { margin: 12px 0; }
.request { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { display: inline-block; background: var(--navy); color: var(--paper); border-radius: 6px; padding: 2px 8px; font-family: var(--font-ui); font-weight: 800; font-size: 13px; }
.tag.alt { background: var(--mustard); color: var(--ink); }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { border-bottom: 1px solid var(--paper-line); padding: 4px 8px; text-align: left; }
table.data th { font-family: var(--font-ui); font-size: 12px; color: var(--ink-soft); font-weight: 800; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total td, table.data td.total { font-weight: 700; background: var(--paper-2); }
.raw { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.raw span { background: #fff; border: 1px solid var(--paper-line); border-radius: 5px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.mini-btn {
  border: 2px solid var(--ink); background: #fff; border-radius: 8px; font-weight: 800; font-size: 12px; padding: 2px 8px; margin-top: 4px;
}
.mini-btn:hover { background: var(--mustard); }
.notes { margin: 0; padding-left: 18px; font-size: 13.5px; }
.context { font-size: 13.5px; background: var(--paper-2); padding: 8px 10px; border-radius: 6px; }

/* marca de sello sobre el expediente */
.stamp-mark {
  position: absolute; right: 22px; top: 70px; z-index: 4; pointer-events: none;
  font-family: var(--font-ui); font-weight: 900; font-size: 30px; letter-spacing: 3px;
  padding: 6px 18px; border: 5px solid currentColor; border-radius: 10px; transform: rotate(-12deg);
  opacity: 0.85; mix-blend-mode: multiply; animation: stampIn 0.35s cubic-bezier(.2, 1.6, .4, 1);
}
.stamp-mark.APROBAR { color: var(--teal); }
.stamp-mark.DENEGAR { color: var(--coral); }
.stamp-mark.DEVOLVER { color: var(--mustard-dark); }
@keyframes stampIn { from { transform: rotate(-12deg) scale(2.2); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: 0.85; } }

/* formulario */
#form { transform: rotate(0.3deg); background: #fffdf6; border-top: 8px solid var(--teal); }
.form-title { font-family: var(--font-title); font-size: 20px; margin: 0; }
.form-sub { font-size: 12px; color: var(--ink-soft); margin: 0 0 12px; }
.field { margin: 12px 0; }
.field label { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); margin-bottom: 4px; }
.field select, .field input {
  width: 100%; font-family: var(--font-doc); font-size: 16px; padding: 8px 10px;
  border: 2px solid var(--ink); border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 3px solid var(--mustard); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle button {
  border: 2px solid var(--ink); background: #fff; border-radius: 8px; padding: 8px; font-weight: 800; font-size: 14px;
}
.toggle button.on { background: var(--navy); color: var(--paper); }
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }

/* sellos */
#stamps { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-bottom: 4px; }
.stamp {
  position: relative; border: 0; background: none; padding: 0; height: 84px; display: grid; justify-items: center;
  transition: transform 0.12s;
}
.stamp .handle { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); box-shadow: inset -4px -4px 0 rgba(255, 255, 255, 0.15); }
.stamp .neck { width: 14px; height: 10px; background: var(--ink-soft); }
.stamp .base {
  width: 100%; height: 36px; border-radius: 8px; display: grid; place-items: center;
  font-weight: 900; letter-spacing: 2px; font-size: 14px; color: #fff; border: 3px solid var(--ink);
}
.stamp.APROBAR .base { background: var(--teal); }
.stamp.DENEGAR .base { background: var(--coral); }
.stamp.DEVOLVER .base { background: var(--mustard); color: var(--ink); }
.stamp:hover:not(:disabled) { transform: translateY(-3px); }
.stamp:active:not(:disabled) { transform: translateY(4px) scale(0.98); }
.tools { display: grid; gap: 8px; margin-top: auto; }
.tool-btn {
  border: 3px solid var(--ink); background: var(--paper); border-radius: 10px; padding: 8px 10px;
  font-weight: 900; font-size: 14px; text-align: left; display: flex; align-items: center; gap: 8px;
}
.tool-btn:hover, .tool-btn.on { background: var(--mustard); }
.tool-btn .ico { font-size: 18px; width: 22px; text-align: center; }

/* ---------------- cajón de herramientas ---------------- */
#drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(430px, 40vw); z-index: 20;
  background: var(--paper); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  transform: translateX(105%); transition: transform 0.3s; display: grid; grid-template-rows: auto auto 1fr;
  border-left: 6px solid var(--teal-dark);
}
body.drawer-open #drawer { transform: none; }
#drawer header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 0; }
#drawer header h3 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 22px; }
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; border-bottom: 3px solid var(--paper-line); }
.tabs button {
  border: 0; background: var(--paper-2); border-radius: 10px 10px 0 0; padding: 8px 12px; font-weight: 800; font-size: 14px; color: var(--ink-soft);
}
.tabs button.on { background: var(--teal-dark); color: var(--paper); }
.drawer-body { overflow-y: auto; padding: 14px 16px 24px; }
.closebtn { border: 0; background: var(--paper-2); border-radius: 8px; font-weight: 900; font-size: 16px; width: 32px; height: 32px; }

/* manual */
.man-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.man-nav button { border: 2px solid var(--ink); background: #fff; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 800; }
.man-nav button.on { background: var(--navy); color: var(--paper); }
.man-nav button .new { color: var(--coral); }
.manual h4 { font-family: var(--font-title); font-weight: 400; font-size: 21px; margin: 4px 0 8px; }
.manual p, .manual li { font-size: 14px; }
.manual table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 8px 0; }
.manual th, .manual td { border: 1px solid var(--paper-line); padding: 4px 6px; text-align: left; vertical-align: top; }
.manual th { background: var(--paper-2); }
.formula { font-family: var(--font-doc); background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 15px; overflow-x: auto; }
.tip { background: #e3f3f0; border-left: 4px solid var(--teal); padding: 8px 10px; border-radius: 0 6px 6px 0; margin: 8px 0; font-size: 13.5px; }
.warn { background: #fdebe4; border-left: 4px solid var(--coral); padding: 8px 10px; border-radius: 0 6px 6px 0; margin: 8px 0; font-size: 13.5px; }
.manual code, .calc code { background: var(--paper-2); padding: 0 4px; border-radius: 4px; font-family: var(--font-doc); }

/* tablas */
.tbl-form { display: grid; gap: 10px; }
.tbl-form .seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tbl-form .seg button { border: 2px solid var(--ink); background: #fff; border-radius: 8px; padding: 6px; font-weight: 900; }
.tbl-form .seg button.on { background: var(--navy); color: var(--paper); }
.tbl-form .inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tbl-form input, .calc input {
  width: 100%; font-family: var(--font-doc); font-size: 16px; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 8px;
}
.tbl-form label { font-size: 12px; font-weight: 800; color: var(--ink-soft); display: block; margin-bottom: 2px; }
.tbl-out { background: var(--navy); color: var(--paper); border-radius: 10px; padding: 10px 12px; font-family: var(--font-doc); font-size: 16px; }
.tbl-out b { color: var(--mustard); font-size: 20px; }
.tbl-plot svg { width: 100%; height: auto; display: block; background: #fff; border-radius: 10px; border: 2px solid var(--paper-line); }

/* calculadora */
.calc .screen { background: var(--navy); color: var(--paper); border-radius: 10px; padding: 10px 12px; font-family: var(--font-doc); min-height: 64px; }
.calc .screen .res { font-size: 24px; color: var(--mustard); word-break: break-all; }
.calc .screen .err { color: #ffb4a0; font-size: 14px; }
.calc .keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.calc .keys button { border: 2px solid var(--ink); background: #fff; border-radius: 8px; padding: 6px 0; font-weight: 800; font-family: var(--font-doc); font-size: 14px; }
.calc .keys button:hover { background: var(--mustard); }
.calc .keys button.eq { background: var(--teal); color: #fff; }
.calc .hist { list-style: none; margin: 10px 0 0; padding: 0; font-family: var(--font-doc); font-size: 13px; }
.calc .hist li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 6px; border-bottom: 1px dashed var(--paper-line); cursor: pointer; }
.calc .hist li:hover { background: var(--paper-2); }
.calc .hist li b { color: var(--teal-dark); }

/* ---------------- capas: pantallas y nota de revisión ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px;
  background: rgba(31, 42, 55, 0.55); backdrop-filter: blur(2px); overflow-y: auto;
}
.sheet {
  background: var(--paper); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px 28px; position: relative;
  animation: rise 0.35s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { font-family: var(--font-title); font-weight: 400; font-size: 30px; margin: 0 0 6px; }
.sheet .kicker { font-size: 12px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--teal-dark); }
.btn {
  border: 3px solid var(--ink); background: var(--mustard); color: var(--ink); border-radius: 12px;
  padding: 10px 20px; font-weight: 900; font-size: 16px; box-shadow: 0 4px 0 var(--ink); transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.ghost { background: var(--paper); }
.btn.teal { background: var(--teal); color: #fff; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* nota de revisión */
.review .verdict { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.review .verdict .big { font-size: 40px; line-height: 1; }
.review .verdict.ok h2 { color: var(--teal-dark); }
.review .verdict.bad h2 { color: var(--coral-dark); }
.review .delta { font-weight: 900; border-radius: 8px; padding: 2px 8px; }
.review .delta.up { background: #d7efe9; color: var(--teal-dark); }
.review .delta.down { background: #fbdcd2; color: var(--coral-dark); }
table.check { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 14px; }
table.check th, table.check td { padding: 6px 8px; border-bottom: 1px solid var(--paper-line); text-align: left; }
table.check th { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 1px; }
table.check td.mark { font-weight: 900; width: 30px; text-align: center; }
table.check tr.ok td.mark { color: var(--ok); }
table.check tr.bad td.mark { color: var(--bad); }
table.check td.mono { font-family: var(--font-doc); }
.solution { background: #fff; border: 2px solid var(--paper-line); border-radius: 10px; padding: 12px 16px; }
.solution h4 { margin: 0 0 6px; font-family: var(--font-title); font-weight: 400; font-size: 20px; }
.solution ol { margin: 0; padding-left: 20px; }
.solution li { margin: 5px 0; font-size: 14px; }
table.mini { border-collapse: collapse; margin: 6px 0; font-family: var(--font-doc); font-size: 13px; }
table.mini th, table.mini td { border: 1px solid var(--paper-line); padding: 2px 8px; text-align: right; }
table.mini th { background: var(--paper-2); font-family: var(--font-ui); }
.err-kind { background: #fbdcd2; color: var(--coral-dark); border-radius: 8px; padding: 6px 10px; font-weight: 800; margin: 6px 0; display: inline-block; }

/* título */
.title-screen { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--sky); overflow: hidden; }
.title-screen .bg { position: absolute; inset: 0; }
.title-screen .bg svg { width: 100%; height: 100%; }
.title-card {
  position: relative; background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; padding: 28px 36px;
  width: min(560px, calc(100% - 32px)); text-align: center; box-shadow: 0 14px 0 var(--ink), 0 30px 60px rgba(0, 0, 0, 0.25);
  margin-bottom: 12vh;
}
.title-card h1 { font-family: var(--font-title); font-weight: 400; font-size: 64px; margin: 0; line-height: 1; letter-spacing: 1px; }
.title-card h1 span { color: var(--coral); }
.title-card .sub { font-size: 14px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; color: var(--teal-dark); margin: 6px 0 4px; }
.title-card .motto { font-family: var(--font-doc); margin: 6px 0 18px; }
.title-card .btn-row { justify-content: center; }
.mode-pick { display: flex; gap: 8px; justify-content: center; margin-top: 16px; font-size: 13px; font-weight: 800; }
.mode-pick button { border: 2px solid var(--ink); background: #fff; border-radius: 99px; padding: 4px 12px; font-weight: 800; }
.mode-pick button.on { background: var(--navy); color: var(--paper); }
.mode-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; min-height: 2.6em; }
.day-pick { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.day-pick button { width: 38px; height: 38px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; font-weight: 900; }
.day-pick button:hover { background: var(--mustard); }

/* circular */
.memo { display: grid; grid-template-columns: 150px 1fr; gap: 20px; }
.memo .portrait { background: var(--sky); border-radius: 12px; border: 3px solid var(--ink); align-self: start; }
.memo .portrait svg { display: block; width: 100%; height: auto; }
.memo .sign { font-family: var(--font-title); font-size: 20px; margin-top: 10px; }
.memo .ps { font-style: italic; color: var(--coral-dark); }
.memo-head { border-bottom: 2px dashed var(--paper-line); margin-bottom: 10px; padding-bottom: 6px; font-family: var(--font-doc); font-size: 13px; color: var(--ink-soft); }
.memo-news { background: var(--paper-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-top: 10px; }

/* resumen */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.stat { background: #fff; border: 2px solid var(--paper-line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 26px; font-family: var(--font-title); font-weight: 400; }
.stat span { font-size: 12px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 1px; }
table.summary { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.summary th, table.summary td { padding: 6px; border-bottom: 1px solid var(--paper-line); text-align: left; vertical-align: top; }
table.summary th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.pill { display: inline-block; border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.pill.ok { background: #d7efe9; color: var(--teal-dark); }
.pill.warn { background: #fbdcd2; color: var(--coral-dark); }
.pill.muted { background: var(--paper-2); color: var(--ink-soft); }
.truth-note { font-size: 12.5px; color: var(--ink-soft); }
.lesson { background: var(--navy); color: var(--paper); border-radius: 12px; padding: 12px 16px; margin-top: 14px; font-size: 14px; }
.lesson b { color: var(--mustard); }
.rank { text-align: center; margin: 16px 0; }
.rank .medal { font-size: 64px; }
.rank h3 { font-family: var(--font-title); font-weight: 400; font-size: 34px; margin: 4px 0; color: var(--teal-dark); }

/* toasts */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 12px; font-weight: 800; transition: transform 0.3s;
}
#toast.show { transform: translateX(-50%); }

/* ---------------- datos clicables del expediente ---------------- */
.v { cursor: pointer; border-radius: 4px; padding: 0 2px; margin: 0 -2px; text-decoration: underline dotted rgba(31, 42, 55, 0.35); text-underline-offset: 3px; transition: background 0.12s; }
.v:hover { background: var(--mustard); text-decoration: none; }
.tag .v { text-decoration-color: rgba(0, 0, 0, 0.4); }
.raw .v { text-decoration: none; margin: 0; }
.raw .v:hover { background: var(--mustard); }
.raw-sum { font-size: 13.5px; margin: 6px 0 2px; color: var(--ink-soft); }
.raw-sum .v { color: var(--ink); font-weight: 700; }
.nope { animation: nope 0.35s; }
@keyframes nope { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* ---------------- hoja de cálculo guiada ---------------- */
.ws { border: 2px dashed var(--paper-line); border-radius: 10px; padding: 10px 12px; margin: 4px 0 6px; background: #fff; }
.ws-empty { font-size: 13px; color: var(--ink-soft); text-align: center; padding: 6px; }
.ws-head { display: grid; gap: 2px; margin-bottom: 8px; }
.ws-head b { font-family: var(--font-title); font-weight: 400; font-size: 17px; }
.ws-head span { font-size: 11.5px; color: var(--ink-soft); line-height: 1.3; }
.ws-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 6px; font-family: var(--font-doc); font-size: 15px; padding: 6px 0; border-top: 1px dotted var(--paper-line); }
.ws-line.out { font-weight: 700; }
.ws-sym { font-weight: 700; padding-bottom: 6px; }
.ws-expr { display: inline-flex; flex-wrap: wrap; align-items: flex-end; gap: 3px; white-space: pre; }
.ws-res { padding-bottom: 5px; }
.ws-res b { color: var(--teal-dark); }
.slot, .ws-m, .ws-d { display: inline-flex; flex-direction: column; align-items: center; vertical-align: bottom; position: relative; }
.slot small, .ws-m small, .ws-d small { font-family: var(--font-ui); font-size: 10.5px; font-weight: 800; color: var(--ink-soft); line-height: 1.2; white-space: nowrap; }
.slot input { width: 74px; font-family: var(--font-doc); font-size: 14px; padding: 4px 5px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); text-align: center; }
.slot.crit input { border-color: var(--teal-dark); background: #e3f3f0; }
.slot.active input { outline: 3px solid var(--mustard); outline-offset: 1px; background: #fff8e1; }
.slot input.bad { border-color: var(--coral); background: #fdebe4; }
.slot.flash input { animation: flash 0.5s; }
@keyframes flash { from { background: var(--mustard); } }
.slot.sm input { width: 70px; }
.ws-tab { position: absolute; right: -8px; top: -4px; border: 0; background: none; font-size: 13px; padding: 0; line-height: 1; }
.ws-m b, .ws-d b { min-width: 34px; text-align: center; padding: 4px 5px; border-radius: 6px; font-weight: 700; font-size: 14px; }
.ws-m b { border: 2px dotted var(--ink-soft); color: var(--ink-soft); }
.ws-d b { background: #d7efe9; color: var(--teal-dark); border: 2px solid #b5ded6; }
.ws-d[data-v]:not([data-v=""]) { cursor: pointer; }
.ws-chip { cursor: pointer; background: #d7efe9; border-radius: 6px; padding: 2px 6px; }
.ws-chip:hover, .ws-d[data-v]:not([data-v=""]):hover b { background: var(--mustard); color: var(--ink); }
.ws-variants { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.ws-variants button { border: 2px solid var(--ink); background: #fff; border-radius: 99px; padding: 2px 10px; font-weight: 800; font-size: 12.5px; }
.ws-variants button.on { background: var(--navy); color: var(--paper); }
.ws-aux { background: var(--paper); border-radius: 8px; padding: 4px 8px; margin-bottom: 6px; }
.ws-aux summary { cursor: pointer; font-size: 12.5px; font-weight: 800; color: var(--teal-dark); padding: 2px 0; }
.ws-note { font-size: 11.5px; color: var(--ink-soft); margin: 4px 0 0; }
.ws-sub { font-size: 12.5px; margin-bottom: 4px; }
.ws-table { border-collapse: collapse; width: 100%; font-family: var(--font-doc); font-size: 13px; margin: 4px 0; }
.ws-table th, .ws-table td { border-bottom: 1px solid var(--paper-line); padding: 3px 5px; text-align: left; }
.ws-table th { font-family: var(--font-ui); font-size: 11.5px; color: var(--ink-soft); }
.ws-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ws-table tr.tot td, .ws-table tr.tot th { font-weight: 700; background: var(--paper-2); }
.low { color: var(--coral-dark) !important; background: #fbdcd2; font-weight: 700; }
.field input.auto { background: #eef8f6; border-color: var(--teal-dark); }
.mini-btn.use { margin: 6px 0 0 8px; font-family: var(--font-ui); }
.use-msg { font-family: var(--font-ui); font-size: 12px; color: var(--mustard); }

/* revisión: diagnóstico y gráficos */
.diag { background: #fff6dc; border: 2px solid var(--mustard); border-radius: 10px; padding: 8px 14px; margin: 8px 0; }
.diag h4 { margin: 0 0 4px; font-size: 15px; }
.diag ul { margin: 0; padding-left: 18px; }
.diag li { margin: 4px 0; font-size: 14px; }
.rv-plot { margin: 6px 0 14px; background: #fff; border: 2px solid var(--paper-line); border-radius: 10px; padding: 8px; }
.rv-plot svg { width: 100%; height: auto; display: block; }
.rv-plot figcaption { font-size: 13px; color: var(--ink-soft); text-align: center; margin-top: 2px; }
.truth-plot svg { width: 240px; max-width: 100%; height: auto; display: block; margin-top: 4px; }

/* ---------------- pantallas estrechas ---------------- */
@media (max-width: 1000px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  #office { grid-template-rows: 260px auto; }
  #desk, body.drawer-open #desk { grid-template-columns: 1fr; margin-right: 0; overflow: visible; }
  #stamps { flex-direction: row; flex-wrap: wrap; }
  .stamp { flex: 1 1 90px; }
  .tools { grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: 0; }
  #drawer { width: 100%; }
  #booth .sign { display: none; }
  #bubble { left: auto; right: 12px; top: 12px; max-width: 46%; }
  #bubble::before { display: none; }
  .memo { grid-template-columns: 1fr; }
  .memo .portrait { width: 120px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .title-card h1 { font-size: 44px; }
  #topbar { flex-wrap: wrap; gap: 8px; }
}

/* hoja: exponente pegado al hueco y huecos algo más compactos */
.slot:has(.sq), .ws-m:has(.sq), .ws-d:has(.sq) { margin-right: 9px; }
.sq { position: absolute; right: -10px; bottom: 16px; font-style: normal; font-size: 13px; font-weight: 700; }
.slot input { width: 64px; font-size: 13.5px; }
.ws-expr { gap: 2px; }
.xbar { font-family: var(--font-ui); font-weight: 700; }
