/* Planio Mini App — стиль по мотивам Harvee: системный шрифт, белые карточки, индиго-акцент. */
:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --soft: #F5F5F8;
  --ink: #1C1C1E;
  --ink-2: #2C2C2E;
  --muted: #6C6C72;
  --faint: #8E8E93;
  --line: #E5E5EA;
  --track: #D1D1D6;
  --accent: #5E5CE6;
  --accent-ink: #4846C9;
  --accent-soft: #ECECFB;
  --accent-mid: #A9A8F2;
  --deep: #2F2F7E;
  --deep-2: #1F1F55;
  --good: #248A3D; --good-dot: #34C759;
  --bad: #C4271A;  --bad-dot: #FF453A;
  --warn-bg: #FBEFE8; --warn-ink: #7A3212; --warn-btn: #A3431A; --warn: #E07A4F;
  --shadow: 0 1px 2px rgba(28,28,30,.04), 0 8px 24px rgba(28,28,30,.05);
  --tabs-bg: rgba(255,255,255,.88);
  --tab-active: #EDEDF2;
  --tab-cut: #FFFFFF;
  --heat-0: #EEF0FB; --heat-1: #C9C9F5; --heat-2: #8F8FE3; --heat-3: #5E5CE6; --heat-4: #23236A;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1C1C1E;
  --soft: #2C2C2E;
  --ink: #F2F2F7;
  --ink-2: #E5E5EA;
  --muted: #A1A1A8;
  --faint: #8E8E93;
  --line: #2C2C2E;
  --track: #3A3A3C;
  --accent: #7D7AFF;
  --accent-ink: #A5A3FF;
  --accent-soft: #26264A;
  --accent-mid: #5552B8;
  --good: #4CD964; --bad: #FF6B60;
  --warn-bg: #3A2218; --warn-ink: #F7C6AE; --warn-btn: #E07A4F;
  --shadow: none;
  --tabs-bg: rgba(28,28,30,.88);
  --tab-active: #2C2C2E;
  --tab-cut: #1C1C1E;
  --heat-0: #1F1F2E; --heat-1: #34345E; --heat-2: #4E4CA8; --heat-3: #7D7AFF; --heat-4: #C9C8FF;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased;
  min-height: 100vh; overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }

#app { max-width: 520px; margin: 0 auto; padding: 14px 20px 120px; display: flex; flex-direction: column; gap: 16px; }
#app.focus { padding-bottom: 32px; }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 6px; }
.round { width: 48px; height: 48px; border-radius: 24px; border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(28,28,30,.06); flex-shrink: 0; }
.round svg { width: 20px; height: 20px; }
.pill { min-height: 40px; padding: 0 18px; border-radius: 20px; border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; font-size: 16px; font-weight: 600; box-shadow: 0 2px 8px rgba(28,28,30,.06); }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 2px 2px 0; }
.h1 { font-size: 30px; font-weight: 700; letter-spacing: -.6px; }
.h2 { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.h3 { font-size: 17px; font-weight: 700; }
.sub { font-size: 15px; color: var(--muted); }
.cap { font-size: 13px; color: var(--muted); }

/* герой «загрузка дня» */
.hero { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.hero .label { font-size: 19px; font-weight: 500; color: var(--faint); }
.hero .word { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1.05; color: var(--accent); }
.hero .word.over { color: var(--warn); }
.hero .word.free { color: var(--accent-mid); }
.hero p { font-size: 17px; line-height: 1.4; color: var(--ink-2); margin-top: 2px; }
.scale { position: relative; margin-top: 12px; height: 28px; display: flex; align-items: center; gap: 6px; }
.scale i { height: 18px; border-radius: 9px; background: var(--track); }
.scale i.mid { background: linear-gradient(90deg, var(--accent-mid), var(--accent) 50%, var(--accent-mid)); }
.scale .knob { position: absolute; top: -4px; width: 36px; height: 36px; margin-left: -18px; border-radius: 18px; background: #FFF;
  border: 3px solid var(--accent); box-shadow: 0 4px 12px rgba(94,92,230,.35); display: flex; align-items: center; justify-content: center;
  transition: left .5s cubic-bezier(.2,.8,.2,1); }
.scale .knob::after { content: ""; width: 12px; height: 12px; border-radius: 6px; background: var(--accent); }
.scale.over .knob { border-color: var(--warn); } .scale.over .knob::after { background: var(--warn); }
.scale-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--faint); padding: 0 4px; }
.divider { height: 1px; background: var(--line); margin: 2px 0; }

/* карточки */
.card { background: var(--card); border-radius: 28px; box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .k { font-size: 14px; color: var(--faint); font-weight: 500; }
.num { font-size: 26px; font-weight: 700; letter-spacing: -.5px; white-space: nowrap; }
.num.big { font-size: 34px; letter-spacing: -.8px; }
.num small { font-size: 16px; font-weight: 600; letter-spacing: 0; }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.status svg { width: 18px; height: 18px; flex-shrink: 0; }
.status.good { color: var(--good); } .status.bad { color: var(--bad); } .status.info { color: var(--accent-ink); }

/* текущая задача */
.now { background: var(--deep); color: #FFF; border-radius: 28px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.now .eyebrow { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: #C9C9F5; }
.now h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.25; }
.bar { height: 6px; border-radius: 999px; background: #4A4A9E; overflow: hidden; }
.bar > b { display: block; height: 100%; border-radius: 999px; background: #FFF; }
.now .cap { color: #C9C9F5; }
.row { display: flex; gap: 10px; }
.btn { min-height: 48px; padding: 0 18px; border-radius: 16px; border: none; font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn svg { width: 16px; height: 16px; }
.btn.white { background: #FFF; color: var(--deep); flex: 1; }
.btn.ghost-light { background: transparent; color: #FFF; border: 1.5px solid #6B6BC4; }
.btn.primary { background: var(--accent); color: #FFF; }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); min-height: 38px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:active { transform: scale(.98); }

/* лента дня */
.timeline { display: flex; flex-direction: column; gap: 6px; }
.tl { display: flex; gap: 12px; align-items: stretch; text-decoration: none; color: inherit; }
.tl .t { width: 46px; flex-shrink: 0; font-size: 14px; font-weight: 600; padding-top: 13px; font-variant-numeric: tabular-nums; }
.tl .t.dim, .tl .body.dim { color: var(--faint); }
.tl .body { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 16px; background: var(--soft); display: flex; align-items: center; gap: 12px; }
.tl .body.free { background: transparent; border: 1.5px dashed var(--track); flex-direction: column; align-items: flex-start; gap: 2px; }
.tl .body.free b { color: var(--accent-ink); font-size: 15px; }
.tl .body.plain { background: transparent; }
.tl .name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tl .meta { font-size: 13px; color: var(--muted); }
.tl .stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tl.done .name { color: var(--faint); text-decoration: line-through; }
.dot { width: 10px; height: 10px; border-radius: 5px; background: var(--accent); flex-shrink: 0; }
.dot.personal { background: var(--accent-mid); } .dot.event { background: var(--ink); } .dot.missed { background: var(--bad-dot); } .dot.done { background: var(--good-dot); }
.ico { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico svg { width: 16px; height: 16px; }

.banner { border-radius: 24px; padding: 18px 20px; background: var(--warn-bg); color: var(--warn-ink); display: flex; flex-direction: column; gap: 10px; }
.banner b { font-size: 15px; }
.banner p { font-size: 15px; line-height: 1.45; }
.banner .btn { background: var(--warn-btn); color: #FFF; align-self: flex-start; min-height: 42px; }

/* неделя */
.bars7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 156px; position: relative; }
.bars7 .norm { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--track); pointer-events: none; }
.bars7 button { border: none; background: transparent; padding: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bars7 .col { width: 100%; border-radius: 12px; background: var(--heat-2); min-height: 8px; transition: height .4s; }
.bars7 .col.free { background: var(--heat-0); } .bars7 .col.ok { background: var(--heat-2); }
.bars7 .col.tight { background: var(--accent); } .bars7 .col.over { background: var(--warn); }
.bars7 .col.off { background: transparent; border: 1.5px dashed var(--accent-mid); }
.bars7 .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.bars7 button[aria-pressed="true"] .lbl { color: var(--ink); font-weight: 800; }
.bars7 button[aria-pressed="true"] .col { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--soft); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 20px; font-weight: 700; }
.kpi span { font-size: 12px; color: var(--muted); }

/* сегменты */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--track); background: color-mix(in srgb, var(--track) 55%, transparent); border-radius: 14px; padding: 4px; }
.seg button { min-height: 40px; border: none; border-radius: 11px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button.warn { color: var(--bad); }

/* задачи */
.section-t { margin: 4px 2px 0; font-size: 13px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.taskcard { gap: 12px; padding: 16px; }
.taskcard .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chip { background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.chip.bad { background: var(--warn-bg); color: var(--warn-btn); }
.progress { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.progress > b { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.list { padding: 6px 16px; gap: 0; }
.li { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: none; }
.check { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--track); background: transparent; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; }
.check.on { background: var(--accent); border-color: var(--accent); color: #FFF; }
.check svg { width: 14px; height: 14px; }
.li .stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li .name { font-size: 15px; font-weight: 600; }
.li.done .name { color: var(--faint); text-decoration: line-through; }
.icon-btn { width: 40px; height: 40px; border: none; border-radius: 12px; background: transparent; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 18px; height: 18px; }

/* паттерны */
.heat { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.heat span { font-size: 11px; color: var(--muted); text-align: center; }
.heat i { aspect-ratio: 1; border-radius: 10px; background: var(--heat-0); }
.heat i.l1 { background: var(--heat-1); } .heat i.l2 { background: var(--heat-2); } .heat i.l3 { background: var(--heat-3); }
.heat i.l4 { background: var(--heat-4); } .heat i.l5 { background: var(--warn); } .heat i.pad { background: transparent; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.hours { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; align-items: end; height: 110px; }
.hours i { border-radius: 6px; background: var(--heat-1); min-height: 4px; }
.hours i.peak { background: var(--accent); }
.insights { background: var(--accent-soft); }
.insight { display: flex; gap: 12px; align-items: flex-start; }
.insight i { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); margin-top: 7px; flex-shrink: 0; }
.insight i.bad { background: var(--warn); } .insight i.good { background: var(--good-dot); }
.insight p { font-size: 15px; line-height: 1.45; }

/* фокус */
body.focus-mode { background: var(--deep-2); }
.focus { color: #FFF; display: flex; flex-direction: column; gap: 22px; min-height: calc(100vh - 46px); }
.focus .head { text-align: center; display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.focus .head .eyebrow { font-size: 14px; font-weight: 600; color: #C9C9F5; }
.focus h1 { font-size: 24px; font-weight: 700; letter-spacing: -.4px; line-height: 1.25; }
.focus .when { font-size: 15px; color: #C9C9F5; }
.ring { position: relative; width: 272px; height: 272px; align-self: center; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ring .time { font-size: 52px; font-weight: 700; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.ring .of { font-size: 15px; color: #C9C9F5; }
.ring.over .time { color: #FFC9B3; }
.hint { background: #2A2A70; border-radius: 20px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: #E4E4FA; }
.focus .actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.btn.focus-main { min-height: 56px; border-radius: 18px; background: #FFF; color: var(--deep-2); font-size: 16px; font-weight: 700; }
.btn.focus-alt { min-height: 52px; background: transparent; color: #FFF; border: 1.5px solid #4A4A9E; flex: 1; }

/* таб-бар-пилюля */
.tabs { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(354px, calc(100% - 32px));
  background: var(--tabs-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line); border-radius: 34px;
  box-shadow: 0 10px 30px rgba(28,28,30,.10); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px; z-index: 10; }
.tabs a { min-height: 56px; border-radius: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink); font-size: 12px; font-weight: 500; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current="page"] { background: var(--tab-active); color: var(--accent); font-weight: 600; }

/* нижний лист и тост */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 520px; background: var(--card); color: var(--ink); border-radius: 28px 28px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; animation: up .2s cubic-bezier(.2,.8,.2,1); }
.sheet .opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sheet .opts button { min-height: 52px; border-radius: 16px; border: none; background: var(--soft); font-size: 16px; font-weight: 600; }
.sheet .cancel { min-height: 50px; border: none; border-radius: 16px; background: transparent; color: var(--accent); font-size: 16px; font-weight: 600; }
.toast { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.empty { text-align: center; padding: 48px 12px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty b { color: var(--ink); font-size: 19px; }
.skeleton { height: 120px; border-radius: 28px; background: var(--card); opacity: .6; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
