/* Teselar portal · estilos
   Paleta y tipografías de la marca. Las fuentes reales se cargan con Adobe Fonts (ver js/config.js). */

:root {
  --cream: #F3EFE6;
  --ink: #282426;
  --red: #F02A24;
  --burdeo: #4A1715;
  --pink: #EFA1DD;
  --cyan: #4DC6E5;
  --yellow: #F5B51B;
  --green: #4D8B3A;

  --bg: var(--cream);
  --surface: #FBF9F3;
  --surface-2: #E9E3D4;
  --text: var(--ink);
  --muted: #655c5e;
  --line: var(--ink);
  --line-soft: rgba(40, 36, 38, .16);
  --red-text: #C41D18;
  --green-text: #386a29;
  --side-bg: var(--ink);
  --side-text: var(--cream);
  --side-active: var(--cream);
  --side-active-text: var(--ink);
  --btn-bg: var(--ink);
  --btn-text: var(--cream);
  --focus: #1a73e8;
  --shadow: 4px 4px 0 var(--ink);

  --font-display: "obviously-super", "Archivo Black", "Arial Black", system-ui, sans-serif;
  --font-body: "fantabular-mvb", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 9px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #282426;
  --surface: #332a2c;
  --surface-2: #43373a;
  --text: var(--cream);
  --muted: #bfb3ae;
  --line: rgba(243, 239, 230, .62);
  --line-soft: rgba(243, 239, 230, .16);
  --red-text: #ff7a73;
  --green-text: #8fcf79;
  --side-bg: var(--burdeo);
  --side-text: var(--cream);
  --side-active: var(--cream);
  --side-active-text: var(--ink);
  --btn-bg: var(--cream);
  --btn-text: var(--ink);
  --focus: #8ab4f8;
  --shadow: 4px 4px 0 rgba(243, 239, 230, .85);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; line-height: 1.08; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(1.85rem, 4.4vw, 3rem); }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

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

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

/* ───────── Layout ───────── */
.shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
.main { min-width: 0; padding: 0 16px 120px; }
.content { max-width: 1060px; margin: 0 auto; padding-top: 8px; display: grid; gap: 22px; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 252px 1fr; }
  .side {
    display: flex; flex-direction: column; gap: 22px;
    position: sticky; top: 0; height: 100vh; padding: 22px 16px;
    background: var(--side-bg); color: var(--side-text);
  }
  .main { padding: 0 32px 64px; }
  .bottom-nav { display: none !important; }
  .top-logo { display: none !important; }
}

.logo { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; letter-spacing: -.02em; text-decoration: none; display: inline-flex; align-items: baseline; gap: 8px; }
.logo small { font-family: var(--font-body); font-weight: 600; font-size: .78rem; letter-spacing: 0; opacity: .8; border: 1.5px solid currentColor; border-radius: 99px; padding: 0 8px; }
.logo img { height: 30px; display: block; }

.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 99px;
  text-decoration: none; font-weight: 600; color: var(--side-text); border: 1.5px solid transparent;
}
.nav a:hover { border-color: rgba(243, 239, 230, .5); }
.nav a[aria-current="page"] { background: var(--side-active); color: var(--side-active-text); }
.nav a[aria-current="page"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: auto; }
.nav svg { width: 20px; height: 20px; flex: none; }
.side-foot { margin-top: auto; display: grid; gap: 10px; font-size: .9rem; }
.side-foot .who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pink); color: var(--ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; flex: none; }
.side-foot .who small { display: block; opacity: .75; }
.side-foot button { background: none; border: 1.5px solid rgba(243, 239, 230, .5); color: inherit; border-radius: 99px; padding: 7px 14px; }
.side-foot button:hover { background: rgba(243, 239, 230, .12); }

.topbar { display: flex; align-items: center; gap: 8px; padding: 14px 0 6px; position: sticky; top: 0; z-index: 20; background: var(--bg); }
.topbar .spacer { flex: 1; min-width: 0; }
.topbar > *, .pop-wrap { flex: none; }
.topbar .spacer { flex: 1 1 0; }
@media (max-width: 560px) {
  .topbar { gap: 6px; }
  .topbar .logo { font-size: 1.35rem; } .topbar .logo small { display: none; }
  .icon-btn, .pill-btn { width: 40px; height: 40px; } .pill-btn { width: auto; padding: 0 12px; }
  }
.icon-btn {
  position: relative; width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 50%;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--red); color: var(--cream); border: 2px solid var(--bg); font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.pill-btn { height: 42px; padding: 0 14px; border-radius: 99px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.pill-btn:hover { background: var(--surface-2); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  background: var(--side-bg); color: var(--side-text); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  border-top: 1.5px solid var(--line);
}
.bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; font-size: .72rem; font-weight: 600; border-radius: 14px; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a[aria-current="page"] { background: var(--side-active); color: var(--side-active-text); }

/* ───────── Surfaces ───────── */
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card.flat { border-color: var(--line-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.hero { box-shadow: var(--shadow); padding: 22px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: minmax(0, 1fr); }
.cols-3 { grid-template-columns: minmax(0, 1fr); }
.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi .big-num { font-size: clamp(1.15rem, 2.7vw, 1.75rem); overflow-wrap: anywhere; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.big-num { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1; }

.page-head { display: grid; gap: 6px; padding-top: 10px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .92rem; color: var(--muted); }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-block; flex: none; }

/* ───────── Buttons & chips ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 0 18px; border-radius: 99px; border: 1.5px solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-text);
  font-weight: 700; text-decoration: none;
}
.btn:hover { background: var(--red); border-color: var(--red); color: var(--cream); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: .9rem; }
.btn svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 11px; border-radius: 99px; font-size: .84rem; font-weight: 700; border: 1.5px solid var(--ink); color: var(--ink); white-space: nowrap; }
.chip-ok { background: #b9dcaa; }
.chip-warn { background: var(--yellow); }
.chip-bad { background: var(--red); color: var(--cream); }
.chip-info { background: var(--cyan); }
.chip-pink { background: var(--pink); }
.chip-muted { background: var(--surface-2); color: var(--text); border-color: var(--line); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.filter[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }
.filter:hover { background: var(--surface-2); }
.filter[aria-pressed="true"]:hover { background: var(--btn-bg); }

/* ───────── Forms ───────── */
label { font-weight: 600; font-size: .94rem; }
.field { display: grid; gap: 6px; }
input[type="text"], input[type="url"], input[type="email"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 13px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--bg);
}
textarea { min-height: 120px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--red); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--red); flex: none; }

/* ───────── Progress: tiles (the memorable thing) ───────── */
.tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.tile-wrap { display: grid; gap: 6px; min-width: 0; }
.tile { position: relative; height: 40px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--bg); overflow: hidden; }
.tiles.lg .tile { height: 54px; border-radius: 14px; }
.tile-fill { position: absolute; inset: 0 auto 0 0; background: var(--c, var(--pink)); transition: width .5s ease; }
.tile-fill.done { border-right: 0; }
.tile-check { position: absolute; inset: 0; display: grid; place-items: center; color: #282426; }
.tile-check svg { width: 20px; height: 20px; }
.tile-pct { position: absolute; inset: 0; display: grid; place-items: center; }
.tile-pct b { background: var(--surface); color: var(--text); border: 1.5px solid var(--line); border-radius: 99px; padding: 0 7px; font-size: .78rem; line-height: 1.5; }
.tile-name { font-size: .78rem; font-weight: 600; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 720px) { .tile-name { font-size: .86rem; } }

.bar { height: 14px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--bg); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c, var(--red)); border-radius: 99px; transition: width .5s ease; }

.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-body); fill: var(--muted); font-size: 11px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap svg { width: 132px; height: 132px; flex: none; }
.donut-center { font-family: var(--font-display); font-weight: 800; fill: var(--text) !important; font-size: 17px !important; }
.donut-sub { font-size: 9px !important; fill: var(--muted) !important; }
.legend { display: grid; gap: 6px; font-size: .92rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--ink); margin-right: 8px; vertical-align: -1px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; gap: 4px; }
.hbar .bar { height: 12px; }

/* ───────── Lists ───────── */
.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item .grow { flex: 1; min-width: 160px; }
.list-item .title { font-weight: 700; }
.list-item a.title { text-decoration: none; }
.list-item a.title:hover { text-decoration: underline; }
.icon-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1.5px solid var(--ink); background: var(--c, var(--cream)); color: var(--ink); flex: none; }
.icon-tile svg { width: 20px; height: 20px; }
.empty { text-align: center; padding: 26px 12px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }

.project-card { display: grid; gap: 14px; text-decoration: none; transition: transform .15s; }
.project-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.project-card h3 { font-size: 1.2rem; }
.mini-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.mini-stats b { color: var(--text); }

/* ───────── Project tabs ───────── */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: thin; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 700; white-space: nowrap;
}
.tab:hover { background: var(--surface-2); }
.tab[aria-current="page"] { background: var(--btn-bg); color: var(--btn-text); }
.tab.add { border-style: dashed; background: transparent; }
.tab svg { width: 16px; height: 16px; }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; min-width: 420px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
th { background: var(--surface-2); font-size: .9rem; }
td input { border: 0; background: transparent; min-height: 34px; padding: 4px 6px; }
tr:last-child td { border-bottom: 0; } th:last-child, td:last-child { border-right: 0; }

.task { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.task:first-child { border-top: 0; }
.task.done span { text-decoration: line-through; color: var(--muted); }

.comment { display: flex; gap: 12px; }
.comment .bubble { flex: 1; background: var(--bg); border: 1.5px solid var(--line-soft); border-radius: 4px var(--r-md) var(--r-md) var(--r-md); padding: 10px 14px; }
.comment.mine .bubble { background: var(--surface-2); }

/* ───────── Login ───────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 460px); display: grid; gap: 22px; }
.login-card .logo { font-size: 2.6rem; }

/* ───────── Modal / toast / popover ───────── */
.overlay { position: fixed; inset: 0; background: rgba(40, 36, 38, .55); z-index: 80; display: grid; place-items: end center; padding: 0; }
@media (min-width: 640px) { .overlay { place-items: center; padding: 20px; } }
.modal { width: min(100%, 520px); max-height: 92vh; overflow: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 22px; display: grid; gap: 16px; }
@media (min-width: 640px) { .modal { border-radius: var(--r-lg); box-shadow: var(--shadow); } }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.toast-zone { position: fixed; left: 0; right: 0; bottom: 92px; display: grid; justify-items: center; gap: 8px; z-index: 90; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toast-zone { bottom: 24px; } }
.toast { background: var(--ink); color: var(--cream); border: 1.5px solid var(--cream); border-radius: 99px; padding: 10px 18px; font-weight: 600; animation: pop .25s ease; }
:root[data-theme="dark"] .toast { background: var(--cream); color: var(--ink); border-color: var(--ink); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.popover { position: absolute; right: 0; top: 52px; width: min(92vw, 360px); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 14px; z-index: 40; display: grid; gap: 4px; }
.pop-wrap { position: relative; }
.pop-item { display: flex; gap: 10px; padding: 9px 4px; text-decoration: none; border-top: 1px solid var(--line-soft); font-size: .94rem; }
.pop-item:first-of-type { border-top: 0; }
.pop-item:hover { background: var(--surface-2); border-radius: 8px; }

/* ───────── Iso (mascot) ───────── */
.iso { position: fixed; right: 14px; bottom: 84px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
@media (min-width: 900px) { .iso { bottom: 18px; right: 20px; } }
.iso-btn { width: 76px; height: 76px; padding: 0; border: 0; background: none; filter: drop-shadow(3px 3px 0 var(--ink)); }
:root[data-theme="dark"] .iso-btn { filter: drop-shadow(3px 3px 0 rgba(243, 239, 230, .8)); }
.iso-btn svg { width: 100%; height: 100%; overflow: visible; animation: bob 3.6s ease-in-out infinite; }
.iso-hide { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font-size: .9rem; line-height: 1; opacity: 0; transition: opacity .15s; display: grid; place-items: center; padding: 0; }
.iso:hover .iso-hide, .iso:focus-within .iso-hide { opacity: 1; }
.iso-wrap { position: relative; }
.iso-bubble { max-width: 250px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md) var(--r-md) 4px var(--r-md); padding: 10px 14px; font-weight: 600; font-size: .94rem; box-shadow: 3px 3px 0 var(--line); animation: pop .25s ease; }
.iso-bubble .link-btn { display: block; margin-top: 4px; font-size: .88rem; }
.lid { transform-box: fill-box; transform-origin: top; transform: scaleY(0); transition: transform .5s ease; }
.iso[data-state="bored"] .lid { transform: scaleY(.62); }
.mouth-kiss { opacity: 0; transition: opacity .12s; }
.mouth-smile { opacity: 1; }
.iso[data-state="kiss"] .mouth-kiss { opacity: 1; }
.iso[data-state="kiss"] .mouth-smile { opacity: 0; }
.iso[data-state="happy"] .mouth-smile { d: path("M44 80 Q60 98 76 80"); }
.iso[data-state="happy"] svg { animation: hop .5s ease 2; }
.iso .zzz { opacity: 0; font-family: var(--font-display); font-size: 14px; fill: var(--text) !important; }
.iso[data-state="bored"] .zzz { opacity: 1; animation: bob 2s ease-in-out infinite; }
.iso-heart { position: absolute; left: 30px; top: 10px; color: var(--red); font-size: 22px; pointer-events: none; animation: float 1.3s ease-out forwards; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes float { from { transform: translateY(0) scale(.7); opacity: 1; } to { transform: translateY(-46px) scale(1.2); opacity: 0; } }

/* ───────── Tour ───────── */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(40, 36, 38, .72); border: 2px solid var(--cream); transition: all .25s ease; pointer-events: none; }
.tour-spot.none { box-shadow: none; border: 0; }
.tour-dim { position: fixed; inset: 0; background: rgba(40, 36, 38, .72); }
.tour-card { position: fixed; width: min(92vw, 360px); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 12px; }
.tour-card .iso-mini { width: 52px; height: 52px; flex: none; }
.tour-top { display: flex; gap: 12px; align-items: center; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-soft); }
.tour-dots i.on { background: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .iso-btn svg { animation: none; }
}

/* ───────── Ingreso con código ───────── */
.code-input { font-family: var(--font-display); font-size: 2rem; letter-spacing: .5em; text-align: center; padding-left: .5em; }
.form-error { color: var(--red-text); font-weight: 600; min-height: 1.5em; margin: 0; }
.form-error:empty { display: none; }
