/* Ритм — мини-апп, версия 5 (17.11.2026): своё лицо поверх скелета v4.
   Ночь-графит как основная тема, один фирменный акцент (лайм) с лёгким свечением, мотив ритма:
   кольцо дня из тактов, пульс серии, неделя тактами. Статусы и сроки — словами-плашками.
   Заголовки и цифры — Unbounded (кириллица, лежит рядом в fonts/), текст — системный. */
@font-face{font-family:"Unbounded";font-style:normal;font-weight:400 800;font-display:swap;
  src:url(fonts/unbounded-cyr.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Unbounded";font-style:normal;font-weight:400 800;font-display:swap;
  src:url(fonts/unbounded-lat.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122,U+2212}

:root{
  --bg:#0B0C0F; --cell:#15171C; --cell2:#1C1F25; --sheet:#111317; --line:rgba(255,255,255,.07); --line2:rgba(255,255,255,.12);
  --label:#F1F2F4; --label2:rgba(232,236,243,.58); --label3:rgba(232,236,243,.32);
  --fill:rgba(255,255,255,.055); --fill2:rgba(255,255,255,.1);
  --accent:#C8F24A; --ink:#0B0C0F; --glow:rgba(200,242,74,.42); --accent-soft:rgba(200,242,74,.13);
  --red:#FF5C4F; --red-soft:rgba(255,92,79,.15); --amber:#FFB347; --amber-soft:rgba(255,179,71,.14);
  --blue:#71A9FF; --blue-soft:rgba(113,169,255,.15); --violet:#9B8CFF; --rose:#FF7EA6; --mint:#3FD9A6;
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",system-ui,"Segoe UI",Roboto,sans-serif;
  --display:"Unbounded",var(--font);
  color-scheme:dark;
}

*{box-sizing:border-box}
html,body{margin:0}
body{background:radial-gradient(120% 420px at 50% -120px,rgba(200,242,74,.075),transparent 70%) no-repeat,var(--bg);color:var(--label);
  font-family:var(--font);font-size:16px;line-height:1.3;letter-spacing:-.005em;
  -webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;overscroll-behavior-y:none;font-variant-numeric:tabular-nums}
button,input,select,textarea{font:inherit;color:inherit;letter-spacing:inherit}
button{cursor:pointer;background:none;border:0;padding:0;text-align:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
p{margin:0}
svg.i{width:1em;height:1em;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}

main{max-width:600px;margin:0 auto;padding:8px max(16px,env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
.pane{display:flex;flex-direction:column;gap:20px}
.pane[hidden]{display:none}

/* ---------- заголовок ---------- */
.nav{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;padding-top:10px}
.nav h1{margin:0;font-family:var(--display);font-size:27px;line-height:34px;font-weight:600;letter-spacing:-.01em}
.nav .date{font-size:14px;color:var(--label2);margin-top:3px}
.nav .tools{display:flex;gap:8px;align-items:center;padding-bottom:3px}
.plus{width:38px;height:38px;border-radius:13px;background:var(--accent);color:var(--ink);display:grid;place-items:center;font-size:20px;
  box-shadow:0 0 18px -2px var(--glow)}
.plus svg.i{stroke-width:2.6}
.plus.ghost{background:var(--fill);color:var(--accent);box-shadow:none}
.capsule{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 13px;border-radius:12px;background:var(--fill);
  border:1px solid var(--line);font-size:14px;font-weight:600;color:var(--label)}
.capsule .d{width:7px;height:7px;border-radius:2px;background:var(--c,var(--label3))}

/* ---------- сводка дня: кольцо из тактов + пульс серии ---------- */
.pulse-card{background:var(--cell);border:1px solid var(--line);border-radius:20px;padding:16px;display:flex;flex-direction:column;gap:14px}
.pulse-top{display:flex;align-items:center;gap:16px}
.beats{width:76px;height:76px;flex:none;overflow:visible}
.beats path{fill:none;stroke-width:7;stroke-linecap:round;stroke:var(--fill2);transition:stroke .3s}
.beats path.on{stroke:var(--accent);filter:drop-shadow(0 0 4px var(--glow))}
.beats.full path.on{filter:drop-shadow(0 0 7px var(--glow))}
.pulse-num{font-family:var(--display);font-size:30px;font-weight:600;line-height:1;letter-spacing:-.02em}
.pulse-num small{font-size:16px;color:var(--label2);font-weight:500;margin-left:3px}
.pulse-sub{font-size:14px;color:var(--label2);margin-top:6px}
.pulse-sub b{color:var(--accent);font-weight:600}
.streak-row{display:flex;align-items:center;gap:12px;padding-top:12px;border-top:1px solid var(--line)}
.streak-row .sn{font-family:var(--display);font-size:18px;font-weight:600;color:var(--label);white-space:nowrap}
.streak-row .sn small{font-family:var(--font);font-size:13px;color:var(--label2);font-weight:500;margin-left:4px}
.ecg{flex:1;min-width:0;height:30px;overflow:visible}
.ecg polyline{fill:none;stroke:var(--accent);stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round;filter:drop-shadow(0 0 3px var(--glow))}
.ecg .base{stroke:var(--line2);stroke-width:1;filter:none;stroke-dasharray:2 3}
.ecg circle{fill:var(--accent);filter:drop-shadow(0 0 5px var(--glow))}
.ecg circle.idle{fill:none;stroke:var(--accent);stroke-width:1.5}
.pop{animation:pop .5s ease} @keyframes pop{40%{transform:scale(1.07)}}

/* ---------- сигналы: утро, вечер, уточнить ---------- */
.signals{display:flex;flex-direction:column;gap:8px}
.signal{display:flex;align-items:center;gap:12px;width:100%;padding:12px 14px;border-radius:16px;background:var(--cell);
  border:1px solid color-mix(in srgb,var(--sc) 35%,transparent);text-align:left}
.signal:active{background:var(--cell2)}
.signal .dot{width:9px;height:9px;border-radius:50%;background:var(--sc);flex:none;box-shadow:0 0 0 0 var(--sc);animation:beat 2.4s ease-out infinite}
@keyframes beat{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--sc) 60%,transparent)}70%,100%{box-shadow:0 0 0 9px transparent}}
.signal .body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.signal .ttl{font-size:16px;font-weight:600}
.signal .sub{font-size:13px;color:var(--label2)}
.signal .go{color:var(--sc);font-size:13px;font-weight:700;white-space:nowrap}
.s-amber{--sc:var(--amber)} .s-violet{--sc:var(--violet)} .s-blue{--sc:var(--blue)}

/* ---------- группы и строки ---------- */
.group{display:flex;flex-direction:column;gap:8px}
.gh{padding:0 4px;font-size:11px;line-height:16px;font-weight:700;letter-spacing:.09em;color:var(--label2);text-transform:uppercase;
  display:flex;justify-content:space-between;align-items:center;gap:10px}
.gh .cnt{font-family:var(--display);font-weight:500;letter-spacing:.02em}
.gh .cnt b{color:var(--accent);font-weight:600}
.gf{padding:0 4px;font-size:13px;line-height:18px;color:var(--label2)}
.cells{background:var(--cell);border:1px solid var(--line);border-radius:18px;overflow:hidden}
.cell{position:relative;display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:11px 14px;text-align:left}
.cell+.cell::before{content:"";position:absolute;top:0;right:0;left:var(--inset,48px);height:1px;background:var(--line)}
.cell:active{background:var(--fill)}
.cell .body{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}
.cell .ttl{font-size:16px;line-height:21px;overflow-wrap:anywhere}
.cell .meta{display:flex;gap:6px;align-items:center;flex-wrap:wrap;font-size:12.5px;line-height:16px;color:var(--label2)}
.cell .sub{font-size:13px;line-height:17px;color:var(--label2)}
.cell .trail{font-size:14px;color:var(--label2);white-space:nowrap}
.cell .chev{color:var(--label3);display:grid;place-items:center}
.cell .chev svg.i{stroke-width:2.6;width:13px;height:13px}
.cell.done .ttl{color:var(--label3);text-decoration:line-through;text-decoration-color:var(--label3)}
.cell.done .meta{opacity:.55}
.cell.virtual .ttl{color:var(--label2)}
.empty{padding:16px;color:var(--label2);font-size:15px}

/* отметка: квадрат-такт, сделано — лайм со свечением */
.chk{width:24px;height:24px;flex:none;display:grid;place-items:center;margin:-10px -6px;padding:10px 6px;box-sizing:content-box}
.chk i{width:22px;height:22px;border-radius:7px;border:1.5px solid var(--label3);display:grid;place-items:center;transition:background .15s,border-color .15s,box-shadow .2s}
.chk.main i{border-color:var(--accent)}
.cell.done .chk i,.cell.picked .chk i{background:var(--accent);border-color:var(--accent);box-shadow:0 0 12px -1px var(--glow)}
.cell.done .chk i::after,.cell.picked .chk i::after{content:"";width:9px;height:5px;border-left:2.2px solid var(--ink);border-bottom:2.2px solid var(--ink);transform:rotate(-45deg) translate(1px,-1px)}
.cell.virtual .chk i{border-style:dashed}
.time{font-family:var(--display);font-size:14px;font-weight:500;width:46px;flex:none;color:var(--label)}

/* плашки: важность справа, трек и срок под названием */
.pill{flex:none;font-size:12px;line-height:16px;font-weight:600;padding:3px 8px;border-radius:7px;white-space:nowrap}
.pill.p1{color:var(--red);background:var(--red-soft)}
.pill.p2{color:var(--label2);background:var(--fill)}
.pill.p3{color:var(--label3);box-shadow:inset 0 0 0 1px var(--line2)}
.pill.q{color:var(--blue);background:var(--blue-soft)}
.tag{display:inline-flex;align-items:center;gap:5px;font-weight:600;color:var(--c);padding:1px 7px 1px 6px;border-radius:6px;
  background:color-mix(in srgb,var(--c) 14%,transparent);white-space:nowrap}
.tag i{width:6px;height:6px;border-radius:2px;background:var(--c)}
.due{font-weight:600;white-space:nowrap}
.due.late{color:var(--red)} .due.today{color:var(--accent)} .due.soon{color:var(--label)} .due.far{color:var(--label2);font-weight:500}
.due.none{color:var(--label3);font-weight:500} .due.ask{color:var(--blue)}
.flag{white-space:nowrap} .flag.warn{color:var(--amber);font-weight:600}
.meta>.due+.flag::before,.meta>.flag+.flag::before{content:"·";margin-right:6px;color:var(--label3);font-weight:400}

/* ---------- сегменты ---------- */
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;background:var(--fill);border:1px solid var(--line);border-radius:12px;padding:3px;gap:3px}
.seg button{border-radius:9px;padding:8px 6px;font-size:13.5px;font-weight:600;text-align:center;color:var(--label2);white-space:nowrap}
.seg button[aria-pressed="true"]{background:var(--accent);color:var(--ink);box-shadow:0 0 14px -4px var(--glow)}
.seg button[aria-pressed="true"][data-s="prio"][data-v="1"]{background:var(--red-soft);color:var(--red);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--red) 40%,transparent)}
.seg button[aria-pressed="true"][data-s="prio"][data-v="2"]{background:var(--fill2);color:var(--label);box-shadow:none}
.seg button[aria-pressed="true"][data-s="prio"][data-v="3"]{background:transparent;color:var(--label2);box-shadow:inset 0 0 0 1px var(--line2)}

/* ---------- неделя тактами ---------- */
.week{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;background:var(--cell);border:1px solid var(--line);border-radius:18px;padding:8px 6px}
.wd{display:flex;flex-direction:column;align-items:center;gap:5px;padding:7px 0 8px;border-radius:12px}
.wd .w{font-size:10.5px;font-weight:700;letter-spacing:.06em;color:var(--label2);text-transform:uppercase}
.wd .n{font-family:var(--display);font-size:17px;font-weight:500;line-height:22px}
.wd .c{height:16px;display:flex;gap:2.5px;align-items:flex-end}
.wd .c i{width:3px;border-radius:1.5px;background:var(--label3)}
.wd .c i:nth-child(1){height:9px} .wd .c i:nth-child(2){height:14px} .wd .c i:nth-child(3){height:7px} .wd .c i:nth-child(4){height:12px} .wd .c i:nth-child(5){height:6px}
.wd .c i.r{background:var(--red)}
.wd .c.zero{width:14px;border-bottom:1.5px dotted var(--label3);height:9px}
.wd[aria-pressed="true"]{background:var(--accent-soft);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 45%,transparent)}
.wd[aria-pressed="true"] .n{color:var(--accent)}
.wd[aria-pressed="true"] .c i:not(.r){background:var(--accent)}

/* ---------- карточки ---------- */
.cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.card{background:var(--cell);border:1px solid var(--line);border-radius:18px;padding:13px 14px;display:flex;flex-direction:column;gap:7px;text-align:left;min-width:0}
.card.wide{grid-column:1/-1}
.card .ch{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--c)}
.card .ch .chev{margin-left:auto;color:var(--label3);display:grid}
.card .ch svg.i{width:15px;height:15px}
.card .ch .chev svg.i{width:12px;height:12px;stroke-width:2.6}
.card .v{font-family:var(--display);font-size:25px;font-weight:600;line-height:1.1;letter-spacing:-.02em}
.card .v small{font-family:var(--font);font-size:14px;color:var(--label2);font-weight:500;margin-left:3px;letter-spacing:0}
.card .s{font-size:13px;color:var(--label2)}
.card.off .v{font-family:var(--font);font-size:16px;color:var(--label2);font-weight:600;letter-spacing:0}
.spark{display:flex;gap:3px;align-items:flex-end;height:28px}
.spark i{flex:1;border-radius:2px;background:var(--c);min-height:3px}
.spark i.dim{opacity:.35} .spark i.none{background:var(--fill2);height:3px!important}
.meter{height:6px;border-radius:3px;background:var(--fill2);overflow:hidden;position:relative}
.meter i{display:block;height:100%;border-radius:3px;background:var(--c,var(--accent));box-shadow:0 0 8px -1px var(--c,var(--glow))}
.meter i.over{background:var(--red)}
.meter.pace{overflow:visible} .meter.pace b{position:absolute;top:-3px;width:2px;height:12px;border-radius:1px;background:var(--label)}
.kv{display:flex;justify-content:space-between;gap:10px;font-size:14px}
.kv span:last-child{color:var(--label2)}
.bars7{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;align-items:end;height:96px}
.bars7 .b{display:flex;flex-direction:column;align-items:center;gap:5px;height:100%;justify-content:flex-end}
.bars7 .b i{width:100%;max-width:20px;border-radius:5px;background:color-mix(in srgb,var(--accent) 55%,transparent)}
.bars7 .b i.full{background:var(--accent);box-shadow:0 0 10px -2px var(--glow)} .bars7 .b i.zero{background:var(--fill2)}
.bars7 .b span{font-size:11px;color:var(--label2)} .bars7 .b.today span{color:var(--accent);font-weight:700}
.heat{display:grid;grid-template-columns:repeat(12,1fr);grid-template-rows:repeat(7,auto);grid-auto-flow:column;gap:3px}
.heat i{aspect-ratio:1;border-radius:3px;background:var(--fill)}
.heat i.full{background:var(--accent)} .heat i.morning{background:var(--accent);opacity:.38}
.heat i.freeze{background:var(--violet);opacity:.45} .heat i.pre,.heat i.future{background:none}
.heat i.today{background:none;box-shadow:inset 0 0 0 1.5px var(--accent)}
.legend{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:12px;color:var(--label2)}
.legend b{display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:4px;vertical-align:-1px}
.dots7{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;padding:0 14px 13px}
.dots7 button{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:11px;color:var(--label2)}
.dots7 i{width:26px;height:26px;border-radius:8px;background:var(--fill);display:block}
.dots7 button.on i{background:var(--accent);box-shadow:0 0 10px -2px var(--glow)}
.dots7 button.today{color:var(--accent);font-weight:700}
.dots7 button.today:not(.on) i{box-shadow:inset 0 0 0 1.5px color-mix(in srgb,var(--accent) 55%,transparent)}
.dots7 button:disabled{opacity:.4;cursor:default}
.ops .op{display:flex;justify-content:space-between;gap:10px;padding:9px 0;font-size:15px;box-shadow:inset 0 1px 0 var(--line)}
.ops .op:first-child{box-shadow:none}

/* значок в строке: тонированный квадрат, а не сплошной блок iOS */
.ico{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;flex:none;font-size:16px;color:var(--ic);background:color-mix(in srgb,var(--ic) 15%,transparent)}
.ico svg.i{stroke-width:2.2}
.ico.orange{--ic:var(--amber)} .ico.indigo{--ic:var(--violet)} .ico.blue{--ic:var(--blue)} .ico.green{--ic:var(--accent)}
.ico.pink{--ic:var(--rose)} .ico.teal{--ic:var(--mint)} .ico.gray{--ic:var(--label2)} .ico.red{--ic:var(--red)}

/* цвета треков — приглушённые под ночь, не спорят с акцентом */
.a-green{--c:var(--mint)} .a-orange{--c:#FF9F4A} .a-indigo{--c:var(--violet)} .a-purple{--c:#C98BFF}
.a-teal{--c:#4CC3F0} .a-gray{--c:#A1A7B3} .a-rose{--c:var(--rose)} .a-olive{--c:#D8C35C}
.tdot{width:9px;height:9px;border-radius:3px;background:var(--c);flex:none}

/* ---------- плавающая панель вкладок ---------- */
.tabs{position:fixed;left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));bottom:calc(12px + env(safe-area-inset-bottom));
  max-width:520px;margin:0 auto;display:grid;grid-template-columns:repeat(4,1fr);height:64px;padding:0 6px;border-radius:22px;
  background:rgba(21,23,28,.82);-webkit-backdrop-filter:saturate(160%) blur(18px);backdrop-filter:saturate(160%) blur(18px);
  border:1px solid var(--line2);box-shadow:0 14px 40px -12px rgba(0,0,0,.7);z-index:5}
.tabs button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:10.5px;font-weight:600;color:var(--label3);letter-spacing:.01em}
.tabs svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tabs button[aria-selected="true"]{color:var(--accent)}
.tabs button[aria-selected="true"]::before{content:"";position:absolute;top:-1px;left:50%;width:22px;height:2.5px;margin-left:-11px;border-radius:0 0 3px 3px;
  background:var(--accent);box-shadow:0 0 10px 1px var(--glow)}
.tabs button[aria-selected="true"] svg{filter:drop-shadow(0 0 6px var(--glow))}
.toast{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom));transform:translate(-50%,12px);background:var(--cell2);color:var(--label);
  border:1px solid var(--line2);padding:10px 16px;border-radius:14px;font-size:14px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;
  box-shadow:0 12px 30px rgba(0,0,0,.5);max-width:calc(100% - 32px);text-align:center;z-index:30}
.toast.show{opacity:1;transform:translate(-50%,0)}

/* ---------- нижний лист ---------- */
.sheet-back{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:flex-end;justify-content:center;z-index:20;animation:fade .2s ease}
@keyframes fade{from{background:rgba(0,0,0,0)}}
.sheet{background:var(--sheet);width:100%;max-width:600px;max-height:88vh;overflow-y:auto;border-radius:24px 24px 0 0;border-top:1px solid var(--line2);
  padding:6px max(16px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
  display:flex;flex-direction:column;gap:16px;animation:up .28s cubic-bezier(.2,.8,.2,1)}
@keyframes up{from{transform:translateY(40%)}}
.sheet>*{flex-shrink:0}
.grab{width:36px;height:4px;border-radius:2px;background:var(--line2);align-self:center;margin:4px 0 -4px}
.sheet h3{margin:4px 0 0;font-size:20px;font-weight:700;line-height:25px;overflow-wrap:anywhere;letter-spacing:-.01em}
.sheet .note{font-size:14px;color:var(--label2);margin-top:-8px}
.sheet .status{display:flex;gap:6px;align-items:center;flex-wrap:wrap;font-size:13px;margin-top:-6px}
.sheet .gh{margin-bottom:-8px}
.sheet .cells{background:var(--cell)}
.btn{display:block;width:100%;border-radius:14px;padding:14px;font-size:16px;font-weight:700;text-align:center;background:var(--accent);color:var(--ink);box-shadow:0 0 22px -6px var(--glow)}
.btn.plain{background:var(--cell);color:var(--label);box-shadow:none;border:1px solid var(--line)}
.btn.red{background:transparent;color:var(--red);box-shadow:none;border:1px solid color-mix(in srgb,var(--red) 30%,transparent)}
.btn:disabled{opacity:.5;cursor:default}
.sheet textarea,.sheet input,.sheet select{width:100%;border:1px solid var(--line2);background:var(--cell);border-radius:14px;padding:13px 15px;font-size:16px;resize:none;outline:none}
.sheet textarea:focus,.sheet input:focus{border-color:color-mix(in srgb,var(--accent) 60%,transparent)}
.check{color:var(--accent);display:grid;place-items:center}
.check svg.i{width:18px;height:18px;stroke-width:2.6}
.spin{width:18px;height:18px;border:2.5px solid rgba(11,12,15,.3);border-top-color:var(--ink);border-radius:50%;animation:spin .8s linear infinite;display:inline-block;vertical-align:-3px}
@keyframes spin{to{transform:rotate(360deg)}}
.gate{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;padding:64px 12px;color:var(--label2)}
.gate b{font-family:var(--display);font-size:22px;font-weight:600;color:var(--label)}
.skeleton{height:64px;border-radius:18px;background:var(--cell);border:1px solid var(--line)}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
