:root {
  --bg: #26292d; --bg-hi: #2c3036; --bg-lo: #1b1e21;
  --bg-2: #2e3237; --bg-3: #363b41; --line: #454b52;
  --ink: #f4f5f6; --ink-2: #b9bfc6; --ink-3: #7f868e;
  --accent: #ffffff; --on-accent: #1d2024; --accent-soft: rgba(255,255,255,.12); --accent-line: rgba(255,255,255,.4);
  --title-a: #ffffff; --title-b: #ffffff; --title-c: #9aa1a9; --glow: rgba(255,255,255,.35); --orb-1: rgba(255,255,255,.10); --orb-2: rgba(160,180,200,.10); --dots: rgba(255,255,255,.07);
  --ok: #8ee3a0; --warn: #f2c14e; --bad: #ff7b9c; --info: #6ec6ff;
  --radius: 14px;
  --font-hero: 'Fraunces', Georgia, serif;
  --font-display: 'Poppins', system-ui, sans-serif;
  --font-body: 'Poppins', system-ui, sans-serif;
}
/* Joako: negro y rojo fuerte */
:root[data-theme="red"] {
  --bg: #0c0c0d; --bg-hi: #17171a; --bg-lo: #050505;
  --bg-2: #141416; --bg-3: #1d1d21; --line: #2a2a2f;
  --ink: #f4f2f2; --ink-2: #b8b3b3; --ink-3: #7a7577;
  --accent: #e3192e; --on-accent: #ffffff; --accent-soft: rgba(227,25,46,.16); --accent-line: rgba(227,25,46,.6);
  --title-a: #ff7a8a; --title-b: #ff1f3d; --title-c: #a8061a; --glow: rgba(255,40,70,.55); --orb-1: rgba(255,30,60,.22); --orb-2: rgba(255,90,40,.14); --dots: rgba(227,25,46,.08);
  --ok: #9be7a8; --warn: #f2c14e; --bad: #ff8a65; --info: #ff6b7a;
}
/* Cande: azul marino y blanco crema */
:root[data-theme="navy"] {
  --bg: #0b1a33; --bg-hi: #122548; --bg-lo: #071226;
  --bg-2: #122444; --bg-3: #1a2f55; --line: #26406b;
  --ink: #f6efdf; --ink-2: #cbc3b2; --ink-3: #8a93a8;
  --accent: #f6efdf; --on-accent: #0b1a33; --accent-soft: rgba(246,239,223,.14); --accent-line: rgba(246,239,223,.5);
  --title-a: #fffaf0; --title-b: #f1e4c4; --title-c: #b8a77e; --glow: rgba(255,240,200,.35); --orb-1: rgba(110,150,255,.22); --orb-2: rgba(246,239,223,.10); --dots: rgba(246,239,223,.06);
  --ok: #9fdcb4; --warn: #f1cf7a; --bad: #ff9aa2; --info: #9cc3ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(255,255,255,.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 100%, rgba(255,255,255,.05), transparent 60%),
    linear-gradient(180deg, var(--bg-hi) 0%, var(--bg) 45%, var(--bg-lo) 100%);
  background-attachment: fixed;
  color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45;
  min-height: 100vh; position: relative;
}
/* trama de puntos (misma idea que la tipografía) + viñeta */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle, var(--dots) 0 1px, transparent 1.6px);
  background-size: 14px 14px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 20%, transparent 100%);
}
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    linear-gradient(115deg, transparent 38%, rgba(255,255,255,.035) 46%, rgba(255,255,255,.035) 50%, transparent 58%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%);
}
#app, #modal-root, #toast { position: relative; z-index: 1; }
.orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orbs i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .9; will-change: transform; }
.orbs i:nth-child(1) { width: 60vmax; height: 60vmax; left: -15vmax; top: -20vmax; background: radial-gradient(circle, var(--orb-1), transparent 65%); animation: drift1 26s ease-in-out infinite alternate; }
.orbs i:nth-child(2) { width: 55vmax; height: 55vmax; right: -20vmax; bottom: -25vmax; background: radial-gradient(circle, var(--orb-2), transparent 65%); animation: drift2 32s ease-in-out infinite alternate; }
.orbs i:nth-child(3) { width: 35vmax; height: 35vmax; left: 40%; top: 55%; background: radial-gradient(circle, var(--orb-1), transparent 65%); opacity: .5; animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(18vw, 14vh) scale(1.15); } }
@keyframes drift2 { from { transform: translate(0, 0) scale(1.1); } to { transform: translate(-16vw, -12vh) scale(.9); } }
@keyframes drift3 { from { transform: translate(0, 0); } to { transform: translate(-22vw, -18vh); } }
/* el brillo del título late muy despacio */
.login .hero .display { animation: shimmer 7s ease-in-out infinite alternate, breathe 5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { filter: drop-shadow(0 0 14px var(--glow)) drop-shadow(0 0 40px var(--glow)) drop-shadow(0 6px 0 rgba(0,0,0,.45)); } 50% { filter: drop-shadow(0 0 22px var(--glow)) drop-shadow(0 0 70px var(--glow)) drop-shadow(0 6px 0 rgba(0,0,0,.45)); } }
@media (prefers-reduced-motion: reduce) { .orbs i, .display { animation: none !important; } }
a { color: var(--info); }
.btn.sm.primary, .btn.primary.big { color: var(--on-accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: .02em; }
h2 { font-size: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--ink-2); letter-spacing: .14em; }
p { margin: 0 0 8px; }
small, .muted { color: var(--ink-3); }
.muted { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* ----- halftone square display title (como la referencia) ----- */
.display {
  font-family: var(--font-hero); font-weight: 900; text-transform: uppercase; letter-spacing: .02em; font-variation-settings: 'opsz' 144;
  color: var(--title-b);
  background-image: linear-gradient(175deg, var(--title-a) 0%, var(--title-b) 42%, var(--title-c) 100%);
  background-size: 100% 220%; background-position: 50% 0%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px var(--glow)) drop-shadow(0 0 40px var(--glow)) drop-shadow(0 6px 0 rgba(0,0,0,.45));
  line-height: 1.05;
  animation: shimmer 7s ease-in-out infinite alternate;
}
@keyframes shimmer { from { background-position: 50% 0%; } to { background-position: 50% 100%; } }
.display.sm { filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 3px 0 rgba(0,0,0,.45)); }
.rule { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; }
.rule::before, .rule::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* ----- layout ----- */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: rgba(0,0,0,.18); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { padding: 4px 8px 16px; }
.side .brand .display { font-size: 19px; }
.side .brand .day { font-family: var(--font-display); font-size: 11px; color: var(--ink-2); letter-spacing: .2em; margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.05); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.nav a .ic { width: 20px; text-align: center; font-size: 15px; }
.nav .grp { font-size: 10px; letter-spacing: .25em; color: var(--ink-3); text-transform: uppercase; padding: 12px 10px 4px; font-family: var(--font-display); }
.main { padding: 22px 28px 80px; max-width: 1200px; width: 100%; min-width: 0; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .who { display: flex; gap: 6px; align-items: center; }
.menu-btn { display: none; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 45; }

/* ----- components ----- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.card + .card { margin-top: 14px; }
.card h3 { margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.stat { text-align: center; padding: 14px 10px; }
.stat .n { font-family: var(--font-hero); font-size: 32px; font-weight: 900; }
.stat .l { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pill.on { background: var(--accent-soft); color: var(--ink); border-color: var(--accent-line); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bar { height: 10px; background: rgba(0,0,0,.35); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.bar.ok > i { background: linear-gradient(90deg, #5bbf74, var(--ok)); }
.bar.warn > i { background: linear-gradient(90deg, #d9a92f, var(--warn)); }
.bar.bad > i { background: linear-gradient(90deg, #d85a7b, var(--bad)); }
.bar.info > i { background: linear-gradient(90deg, #3f9fe0, var(--info)); }
.ascii { font-family: ui-monospace, Menlo, monospace; font-size: 14px; white-space: pre; color: var(--ink); line-height: 1.6; overflow-x: auto; }
.btn { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 500; transition: .15s; }
.btn:hover { background: #41474e; border-color: #5a616a; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.xs { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.btn.big { padding: 16px 22px; font-family: var(--font-display); font-weight: 600; letter-spacing: .06em; font-size: 15px; border-radius: 14px; }
.btn.alert { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; }
.field { margin-bottom: 10px; }
.pw { position: relative; }
.pw input { padding-right: 44px; }
.pw .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; display: grid; place-items: center; background: transparent; border: 0; color: var(--ink-3); cursor: pointer; border-radius: 8px; }
.pw .eye:hover { color: var(--ink); background: rgba(255,255,255,.06); }
form.inline { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); align-items: end; }
form.inline .wide { grid-column: span 2; }
form.inline .btn { height: 40px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li .t { flex: 1; }
.list li.done .t { text-decoration: line-through; color: var(--ink-3); }
.list li .meta { font-size: 12px; color: var(--ink-3); }
.must { color: var(--warn); font-weight: 700; }
.owner { font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 700; color: #1d2024; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
td.c, th.c { text-align: center; }
.hcell { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.25); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.hcell.done { background: var(--ok); color: #10361c; border-color: var(--ok); }
.hcell.miss { background: rgba(255,123,156,.25); color: var(--bad); border-color: var(--bad); }
.hcell.today { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.hcell.future { opacity: .3; cursor: default; }
.heat { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.heat i.d1 { background: var(--ok); border-color: var(--ok); }
.heat i.d0 { background: rgba(255,123,156,.35); }
.kanban { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.kanban .col { background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 120px; }
.kanban .col h4 { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.kcard { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 13px; margin-bottom: 8px; }
.kcard .row { margin-top: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chart { width: 100%; height: auto; display: block; }
.timer { font-family: var(--font-hero); font-size: 72px; font-weight: 900; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: .05em; }
.center { text-align: center; }
.big-day { text-align: center; padding: 34px 20px 26px; }
.big-day .display { font-size: clamp(38px, 7vw, 86px); }
.big-day .sub { font-family: var(--font-display); font-size: 12px; letter-spacing: .35em; color: var(--ink-2); margin-top: 12px; text-transform: uppercase; }
.big-day .count { font-family: var(--font-hero); font-size: clamp(30px, 4.4vw, 48px); font-weight: 900; margin-top: 16px; }
.big-day .count b { color: var(--ink); }
.big-day .count span { color: var(--ink-3); font-size: .6em; }
.progress-wrap { margin-top: 18px; }
.ticks { display: grid; grid-template-columns: repeat(6, 1fr); font-size: 10px; letter-spacing: .15em; color: var(--ink-3); text-transform: uppercase; font-family: var(--font-display); margin-top: 6px; }
.ticks span { text-align: right; }
.ticks span:first-child { text-align: left; }
.quote { font-size: 17px; font-style: italic; color: var(--ink-2); text-align: center; padding: 10px; }
.empty { color: var(--ink-3); font-size: 13px; padding: 10px 0; text-align: center; }
.emoji-scale { display: flex; gap: 6px; }
.emoji-scale button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.25); cursor: pointer; font-size: 12px; font-weight: 700; }
.emoji-scale button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.milestone { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.2); }
.milestone.on { border-color: var(--warn); background: rgba(242,193,78,.08); }
.milestone .tr { font-size: 22px; filter: grayscale(1); opacity: .4; }
.milestone.on .tr { filter: none; opacity: 1; }
.month { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(0,0,0,.18); }
.month.now { border-color: var(--accent); }
.month.past { opacity: .75; }
.month .mh { font-family: var(--font-display); font-size: 12px; letter-spacing: .15em; color: var(--ink-3); }
.month .mt { font-weight: 700; font-size: 16px; margin: 2px 0 6px; }
.timeline { display: flex; gap: 4px; }
.timeline i { flex: 1; height: 8px; border-radius: 3px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.timeline i.past { background: var(--accent); }
.timeline i.now { background: linear-gradient(90deg, var(--accent) 50%, rgba(0,0,0,.3) 50%); }
.before-after { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.before-after .arrow { color: var(--ink-3); font-family: var(--font-display); }
.before-after .v { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.before-after .k { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); }

/* ----- login ----- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 440px; }
.login .hero { text-align: center; margin-bottom: 26px; position: relative; }
.login .hero::before { content: ''; position: absolute; left: 50%; top: 50%; width: 520px; height: 260px; transform: translate(-50%, -50%); background: radial-gradient(ellipse, rgba(255,255,255,.12), transparent 65%); filter: blur(10px); pointer-events: none; z-index: -1; }
.login-wrap { background: radial-gradient(ellipse 50% 40% at 50% 30%, rgba(255,255,255,.04), transparent 70%); }
.login .hero .display { font-size: clamp(34px, 8vw, 60px); margin: 14px 0 10px; }
.login .card { padding: 24px; }
.login .switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.login .switch a { cursor: pointer; }
.error { color: var(--bad); font-size: 13px; margin-top: 8px; }

/* ----- modal / toast ----- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; padding: 20px; z-index: 50; backdrop-filter: blur(3px); }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h2 { margin-bottom: 12px; }
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 12px; }
.choices .btn { text-align: left; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 60; }
#toast.show { opacity: 1; }
.focus-btn { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; z-index: 46; background: var(--bg-lo); box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .side.open ~ .backdrop { display: block; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: calc(14px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr 1fr; }
  .kanban { grid-template-columns: repeat(2, 1fr); }
  .timer { font-size: 54px; }
}
@media (max-width: 560px) {
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .grid.c4 { grid-template-columns: 1fr 1fr; }
  .ticks em { display: none; }
  .ticks { font-size: 9px; }
  .big-day { padding: 24px 12px 20px; }
  .big-day .sub { letter-spacing: .15em; }
  .topbar .who .muted { display: none; }
  .before-after { grid-template-columns: 1fr; }
  .heat { grid-template-columns: repeat(15, 1fr); }
}
