:root {
  --bg: #0B0B0E;
  --s1: #151519;
  --s2: #1C1C21;
  --b1: #25252B;
  --b2: #2E2E35;
  --b3: #3A3A42;
  --tx: #F5F5F4;
  --tx2: #D4D4D8;
  --mu: #A1A1AA;
  --ac: #7C6CFF;
  --acT: #B3A9FF;
  --tint: #1E1B36;
  --tintB: #3B3470;
  --ok: #4ADE80;
  --okT: #6EE7A0;
  --warn: #FFB547;
  --warnT: #FFC46E;
  --bad: #FF6B5B;
  --badT: #FF8A7D;
  --disp: 'Bricolage Grotesque', Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--tx); }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button, a, input, select, textarea { touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--acT); outline-offset: 2px; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.no-scroll { overflow: hidden; }

/* Barra superior */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top) + 14px) 20px 0; }
.switcher { display: flex; align-items: center; gap: 10px; background: var(--s1); border: 1px solid var(--b1); border-radius: 16px; padding: 6px 12px 6px 6px; min-height: 48px; max-width: 75%; }
.switcher .lbl { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.switcher .lbl small { font-size: 11px; color: var(--mu); font-weight: 500; }
.switcher .lbl b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.iconbtn { position: relative; width: 48px; height: 48px; flex: none; border-radius: 16px; background: var(--s1); border: 1px solid var(--b1); display: flex; align-items: center; justify-content: center; }
.iconbtn.sm { width: 44px; height: 44px; border-radius: 14px; }
.iconbtn .dot { position: absolute; top: 11px; right: 12px; width: 8px; height: 8px; border-radius: 99px; background: var(--bad); border: 2px solid var(--s1); }

.av { flex: none; display: flex; align-items: center; justify-content: center; color: #0B0B0E; font-family: var(--disp); font-weight: 800; }
.av-34 { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; }
.av-28 { width: 28px; height: 28px; border-radius: 9px; font-size: 13px; }
.av-48 { width: 48px; height: 48px; border-radius: 15px; font-size: 21px; }
.av-all { background: var(--ac); color: #fff; }

main { padding: 22px 20px calc(130px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.col { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.g4 { gap: 4px; } .g6 { gap: 6px; } .g8 { gap: 8px; } .g10 { gap: 10px; } .g12 { gap: 12px; } .g14 { gap: 14px; } .g16 { gap: 16px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.eyebrow { font-size: 14px; color: var(--mu); font-weight: 500; }
.h1 { margin: 0; font-family: var(--disp); font-size: 32px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.h1 em { font-style: normal; color: var(--acT); }
.h2 { margin: 0; font-family: var(--disp); font-size: 20px; font-weight: 700; }
.h3 { margin: 0; font-size: 15px; font-weight: 700; }
.muted { color: var(--mu); }
.small { font-size: 13px; }
.xs { font-size: 12px; }

.card { background: var(--s1); border: 1px solid var(--b1); border-radius: 24px; padding: 16px; }
.card.lg { border-radius: 26px; }
.card.late { background: #1F1312; border-color: #4A2420; }
.card.okc { background: var(--tint); border-color: var(--tintB); }

/* Semana */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wday { height: 72px; border-radius: 18px; background: var(--s1); border: 1px solid var(--b1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.wday .d { font-size: 11px; font-weight: 700; color: var(--mu); }
.wday .n { font-family: var(--disp); font-size: 18px; font-weight: 700; }
.wday.today { border: 1.5px solid var(--ac); }
.wday.on { background: var(--ac); border-color: transparent; color: #fff; }
.wday.on .d { color: #fff; }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 99px; display: block; }
.on .dots i { background: #fff !important; }

/* Siguiente */
.thumb-big { width: 78px; height: 112px; flex: none; border-radius: 16px; background: var(--tint); border: 1px solid var(--tintB); color: var(--acT); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.thumb-big span { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.countdown { display: inline-flex; align-items: center; gap: 6px; background: var(--ac); color: #fff; border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 800; align-self: flex-start; }
.countdown::before { content: ''; width: 6px; height: 6px; border-radius: 99px; background: #fff; }
.title-lg { font-family: var(--disp); font-size: 21px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.segs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.segs i { height: 6px; border-radius: 99px; background: var(--b2); display: block; }
.segs i.on { background: var(--acT); }
.btn { min-height: 50px; border-radius: 16px; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; }
.btn.lg { min-height: 56px; border-radius: 18px; font-size: 16px; font-weight: 800; }
.btn.pri { background: var(--ac); color: #fff; font-weight: 800; }
.btn.sec { background: var(--s2); border: 1px solid var(--b2); }
.btn.light { background: var(--tx); color: var(--bg); font-weight: 800; }
.btn.danger { background: transparent; border: 1px solid #4A2420; color: var(--badT); }
.btn.sm { min-height: 40px; border-radius: 12px; font-size: 13px; padding: 0 12px; }
.btn.bad { background: var(--bad); color: #1A0B09; font-weight: 800; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Anillo */
.ring { position: relative; flex: none; }
.ring svg { display: block; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring .c b { font-family: var(--disp); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--tx2); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 99px; display: block; }

/* Plataforma y estado */
.plat { flex: none; width: 24px; height: 24px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; letter-spacing: 0.03em; }
.plat.big { width: 32px; height: 32px; border-radius: 10px; font-size: 11px; }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 3px 9px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill.pub { background: rgba(74, 222, 128, 0.13); color: var(--okT); }
.pill.todo { background: rgba(255, 181, 71, 0.13); color: var(--warnT); }
.pill.late { background: rgba(255, 107, 91, 0.15); color: var(--badT); }
.cname { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--tx2); font-weight: 600; }
.cname i { width: 7px; height: 7px; border-radius: 99px; display: block; }

/* Línea de tiempo */
.tl { display: flex; gap: 12px; align-items: stretch; }
.tl .t { width: 44px; flex: none; display: flex; flex-direction: column; align-items: flex-end; padding-top: 14px; }
.tl .t b { font-size: 14px; }
.tl .t small { font-size: 11px; color: var(--mu); }
.tl .rail { width: 14px; flex: none; display: flex; flex-direction: column; align-items: center; padding-top: 18px; }
.tl .rail i { width: 12px; height: 12px; border-radius: 99px; display: block; }
.tl .rail u { flex: 1; width: 2px; background: var(--b1); margin-top: 4px; display: block; }
.node-pub { background: var(--ok); }
.node-todo { background: var(--bg); border: 2.5px solid var(--warn); }
.node-late { background: var(--bg); border: 2.5px solid var(--bad); }
.pcard { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px; border-radius: 20px; background: var(--s1); border: 1px solid var(--b1); text-align: left; }
.pcard.wide { width: 100%; margin: 0; padding: 12px 14px; }
.thumb { width: 44px; height: 44px; flex: none; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--tint); color: var(--acT); }
.thumb.done { background: var(--s2); color: #71717A; }
.ptitle { font-size: 15px; font-weight: 600; line-height: 1.25; }
.ptitle.done { color: var(--mu); text-decoration: line-through; text-decoration-color: #52525B; }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.empty { border: 1.5px dashed var(--b2); border-radius: 20px; padding: 22px; text-align: center; font-size: 14px; color: var(--mu); display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* Calendario */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.month .wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--mu); padding: 4px 0 6px; }
.mday { height: 46px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 15px; font-weight: 500; }
.mday.out { color: #52525B; }
.mday.today { color: var(--acT); font-weight: 800; border: 1.5px solid var(--ac); }
.mday.on { background: var(--ac); color: #fff; font-weight: 800; border: 0; }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--s1); color: var(--tx2); border: 1px solid var(--b1); display: flex; align-items: center; gap: 6px; }
.fchip.on { background: var(--tx); color: var(--bg); border-color: transparent; }

/* Progreso */
.stat { background: var(--s2); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--disp); font-size: 24px; font-weight: 800; }
.stat span { font-size: 12px; color: var(--mu); }
.bars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: end; height: 150px; }
.bars > div { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; }
.bars .pair i { width: 14px; border-radius: 6px; display: block; }
.track { height: 6px; background: var(--b1); border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; background: var(--acT); }
.ticon { width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--s2); color: var(--acT); display: flex; align-items: center; justify-content: center; }

/* Clientes */
.ccard { background: var(--s1); border: 1px solid var(--b1); border-radius: 24px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.addbtn { border: 1.5px dashed var(--b3); border-radius: 24px; min-height: 96px; color: var(--tx2); font-size: 15px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.addbtn span { width: 40px; height: 40px; border-radius: 13px; background: var(--s2); display: flex; align-items: center; justify-content: center; }

/* Barra de pestañas */
.tabbar { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); width: calc(100% - 28px); max-width: 452px; bottom: calc(14px + env(safe-area-inset-bottom)); height: 72px; border-radius: 26px; background: rgba(28, 28, 33, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--b2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; padding: 0 6px; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10.5px; font-weight: 700; min-height: 56px; color: var(--mu); }
.tab.on { color: var(--acT); }
.fab { justify-self: center; width: 54px; height: 54px; border-radius: 18px; background: var(--ac); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(124, 108, 255, 0.35); }

/* Hojas */
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.62); display: flex; flex-direction: column; justify-content: flex-end; animation: fade .18s ease-out; }
.sheet { width: 100%; max-width: 480px; margin: 0 auto; background: var(--s1); border-top: 1px solid var(--b2); border-radius: 30px 30px 0 0; max-height: 92dvh; overflow-y: auto; padding: 10px 20px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; animation: up .24s cubic-bezier(.2, .8, .2, 1); }
.handle { display: flex; justify-content: center; }
.handle i { width: 40px; height: 5px; border-radius: 99px; background: var(--b3); display: block; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .flabel { font-size: 13px; font-weight: 600; color: var(--tx2); }
.inp { width: 100%; font: inherit; font-size: 16px; color: var(--tx); background: var(--s2); border: 1px solid var(--b2); border-radius: 14px; padding: 0 14px; min-height: 52px; color-scheme: dark; }
textarea.inp { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.5; }
.inp::placeholder { color: #8A8A93; }
.chips { display: grid; gap: 8px; }
.chips.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chips.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chip { min-height: 46px; border-radius: 14px; background: var(--s2); border: 1px solid var(--b2); color: var(--tx2); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 10px; }
.chip.on { background: var(--ac); color: #fff; border-color: transparent; }
.chips.scroll { display: flex; overflow-x: auto; scrollbar-width: none; }
.chips.scroll .chip { flex: none; padding: 0 14px; }
.cap { white-space: pre-line; font-size: 14px; line-height: 1.5; border-radius: 16px; background: var(--s2); border: 1px solid var(--b1); padding: 14px; color: #E4E4E7; word-break: break-word; }
.cap.emptycap { color: var(--mu); font-style: italic; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--s2); border: 1px solid var(--b1); text-align: left; width: 100%; }
.check .box { width: 24px; height: 24px; flex: none; border-radius: 8px; border: 2px solid var(--b3); display: flex; align-items: center; justify-content: center; color: transparent; }
.check.on .box { background: var(--ac); border-color: var(--ac); color: #fff; }
.check span { font-size: 14px; font-weight: 500; color: var(--tx2); }
.check.on span { color: var(--tx); }
.listbtn { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: 16px; background: var(--s2); border: 1px solid var(--b1); width: 100%; text-align: left; }
.listbtn.on { border-color: var(--ac); }
.note { font-size: 13px; line-height: 1.5; color: var(--mu); }
.linkbtn { color: var(--acT); font-size: 13px; font-weight: 700; min-height: 32px; }

#toast { position: fixed; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--tx); color: var(--bg); font-size: 14px; font-weight: 700; padding: 12px 18px; border-radius: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 40px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ov, .sheet { animation: none; } }
