/* Планер — оформление по макетам: Manrope + Lora (цитаты), синий акцент, цвета квадрантов. */
:root {
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --text: #16181D;
  --text-2: #3A3F4B;
  --muted: #6B7280;
  --faint: #9AA0AA;
  --line: #ECEDF1;
  --track: #E3E5EA;
  --chip: #F1F2F5;
  --accent: #2F5BEA;
  --accent-strong: #1E44C4;
  --accent-soft: #E8EEFF;
  --on-accent: #FFFFFF;
  --danger: #C2352F;
  --scrim: rgba(22, 24, 29, 0.55);

  --q1: #D23B3B; --q1-soft: #FBE4E4;
  --q2: #D9A21B; --q2-soft: #FBF0D4;
  --q3: #F07C2E; --q3-soft: #FDE8DA;
  --q4: #9AA0AA; --q4-soft: #ECEEF1;

  --r-card: 18px;
  --nav-h: 64px;
  --sans: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Lora, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1013; --card: #1B1D22; --text: #F2F3F5; --text-2: #D3D6DC; --muted: #9AA0AA; --faint: #6B7280;
    --line: #2A2D34; --track: #2E3139; --chip: #262930; --accent: #5B7FF5; --accent-strong: #8AA3FF;
    --accent-soft: #1E2A52; --danger: #FF6B63; --scrim: rgba(0, 0, 0, 0.6);
    --q1-soft: #3A1F21; --q2-soft: #3A3018; --q3-soft: #3B2617; --q4-soft: #2A2D34;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1013; --card: #1B1D22; --text: #F2F3F5; --text-2: #D3D6DC; --muted: #9AA0AA; --faint: #6B7280;
  --line: #2A2D34; --track: #2E3139; --chip: #262930; --accent: #5B7FF5; --accent-strong: #8AA3FF;
  --accent-soft: #1E2A52; --danger: #FF6B63; --scrim: rgba(0, 0, 0, 0.6);
  --q1-soft: #3A1F21; --q2-soft: #3A3018; --q3-soft: #3B2617; --q4-soft: #2A2D34;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 500 15px/1.35 var(--sans); overflow-x: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; }

.shell { display: flex; justify-content: center; }
main { width: 100%; max-width: 640px; padding: 20px 16px calc(var(--nav-h) + 110px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }

/* ── Заголовки ── */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.date { font-size: 13px; font-weight: 600; color: var(--muted); }
h1 { margin: 2px 0 0; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.head-aside { font-size: 13px; font-weight: 600; color: var(--muted); }
.cap { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 4px 8px; display: flex; justify-content: space-between; gap: 8px; }
.cap.danger { color: var(--danger); }
.card { background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.quote { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--text-2); }

/* ── Котик дня ── */
.catday { display: flex; gap: 14px; align-items: center; padding: 12px; }
.catday img { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; flex: none; }
.catday .t { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; margin-top: 2px; }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 9px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.catday .quote { font-size: 14px; margin-top: 8px; }

/* ── Строка задачи ── */
.row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.row:first-child { border-top: 0; }
.ring { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--qc, var(--faint)); display: grid; place-items: center; margin-top: 0; transition: background .15s, transform .15s; }
.ring:active { transform: scale(.88); }
.ring svg { opacity: 0; }
.done .ring { background: var(--qc, var(--faint)); }
.done .ring svg { opacity: 1; }
.row .body { flex: 1; min-width: 0; }
.row .t { font-size: 15px; font-weight: 600; line-height: 1.3; word-wrap: break-word; }
.done .t { color: var(--faint); text-decoration: line-through; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.pill { padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--text-2); font-weight: 600; }
.late { color: var(--danger); }
.segs { display: flex; gap: 4px; }
.segs i { flex: 1; height: 4px; border-radius: 2px; background: var(--track); }
.segs i.on { background: var(--qc, var(--accent)); }

/* ── Чипы ── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.chip span { color: var(--faint); margin-left: 4px; }
.chip.on { background: var(--text); color: var(--bg); }
.qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qbtn { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: var(--card); border: 1.5px solid transparent; font-size: 13.5px; font-weight: 700; text-align: left; }
.qbtn.on { border-color: var(--qc); background: var(--qs); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--qc); flex: none; }

/* ── Матрица ── */
.matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 300px; gap: 10px; }
.quad { background: var(--card); border-radius: var(--r-card); border-top: 4px solid var(--qc); padding: 12px 14px; display: flex; flex-direction: column; overflow: hidden; }
.quad-h { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; white-space: nowrap; }
.quad-n { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: var(--qs); }
.quad-s { font-size: 12px; font-weight: 600; color: var(--muted); margin: 2px 0 8px; }
.quad-list { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.qt { display: block; width: 100%; text-align: left; border-top: 1px solid var(--line); padding: 8px 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.quad .more { font-size: 12.5px; font-weight: 700; color: var(--accent); padding-top: 4px; text-align: left; }
.quad img { margin-top: auto; width: 100%; height: 78px; border-radius: 12px; object-fit: cover; flex: none; }
.quad .empty-q { color: var(--faint); font-size: 13px; padding-top: 4px; }

/* ── Статистика ── */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--card); border-radius: var(--r-card); padding: 14px 16px; }
.num { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.num small { font-size: 16px; font-weight: 700; color: var(--muted); }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.chart { position: relative; padding: 16px; }
.chart-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 800; }
.chart-h span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.peek { position: absolute; right: 16px; top: -34px; width: 68px; height: 68px; border-radius: 50%; object-fit: cover; border: 4px solid var(--bg); }
.chart.has-peek { margin-top: 22px; overflow: visible; }
.chart.has-peek .chart-h { padding-right: 76px; }
.vcap { font-size: 12.5px; font-weight: 600; margin: 8px 0 6px; min-height: 17px; }
.vcap b { color: var(--accent); font-weight: 700; }
.vbars { display: flex; align-items: flex-end; gap: 2px; height: 96px; border-bottom: 1px solid var(--track); }
.vbar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.vbar i { display: block; width: 100%; background: var(--accent); opacity: .85; border-radius: 4px 4px 0 0; }
.vbar.zero i { height: 2px !important; background: var(--track); opacity: 1; border-radius: 1px; }
.vbar.sel i { opacity: 1; background: var(--accent-strong); }
.vlabels { display: flex; gap: 2px; margin-top: 5px; }
.vlabels span { flex: 1; text-align: center; font-size: 10px; font-weight: 600; color: var(--faint); }
.vlabels span.sel { color: var(--text); }
.hbars { display: grid; gap: 11px; margin-top: 12px; }
.hrow { display: grid; grid-template-columns: 118px minmax(0, 1fr) 28px; gap: 10px; align-items: center; font-size: 13.5px; font-weight: 600; }
.hrow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--qc, var(--accent)); border-radius: 0 4px 4px 0; }
.hrow .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Всё сделано / пусто ── */
.hero img { width: 100%; height: 220px; object-fit: cover; }
.hero .in { padding: 16px 18px 18px; }
.hero h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.hero .sub { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.hero .quote { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.45; }
.collection { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.collection img, .collection .lock { width: 100%; aspect-ratio: 1; border-radius: 14px; object-fit: cover; }
.collection .lock { background: var(--track); display: grid; place-items: center; color: var(--faint); }

/* ── Навигация ── */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line); padding: 4px 8px env(safe-area-inset-bottom); display: flex; justify-content: center; }
.nav-in { display: flex; width: 100%; max-width: 640px; height: var(--nav-h); }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: #8A909C; }
.nav button.on { color: var(--accent); }
.fab { position: fixed; z-index: 11; right: max(20px, calc(50% - 300px)); bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; box-shadow: 0 10px 24px rgba(47, 91, 234, .35); }
.fab:active { transform: scale(.94); }

/* ── Шторки и окна ── */
.scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); animation: fade .15s; }
.sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; animation: up .22s ease-out; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--track); margin: 0 auto; flex: none; }
.lbl-up { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 4px 8px; }
.field { width: 100%; background: var(--card); border: 1.5px solid transparent; border-radius: 14px; padding: 12px 14px; font-size: 15px; font-weight: 600; outline: none; }
.field:focus { border-color: var(--accent); }
textarea.field { resize: none; }
.title-edit { width: 100%; background: none; border: 0; outline: none; padding: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.025em; margin-top: 6px; }
.hint { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; color: var(--accent); margin: 8px 4px 0; min-height: 18px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dt { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto; gap: 8px; }
.btn { padding: 15px; border-radius: 14px; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 800; text-align: center; display: flex; gap: 8px; align-items: center; justify-content: center; }
.btn.soft { background: var(--card); color: var(--accent); font-weight: 700; }
.btn.grey { background: var(--chip); color: var(--text); font-weight: 700; }
.btn.danger { background: var(--card); color: var(--danger); font-weight: 700; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 46px; border-radius: 14px; background: var(--card); color: var(--muted); display: grid; place-items: center; }
.kicker { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step .t { flex: 1; font-size: 14.5px; font-weight: 600; }
.step.done .t { color: var(--faint); text-decoration: line-through; }
.step .x { color: var(--faint); padding: 4px; }
.suggest { padding: 14px 16px; }
.suggest ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; font-weight: 600; }
.paw { display: flex; gap: 12px; align-items: center; padding: 10px; animation: up .25s ease-out; }
.paw img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; flex: none; }
.paw b { font-size: 15px; font-weight: 800; display: block; }
.paw span { font-size: 13px; font-weight: 600; color: var(--muted); }

/* Награда */
.reward-wrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: var(--scrim); animation: fade .2s; }
.reward { width: 100%; max-width: 380px; background: var(--card); border-radius: 28px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.reward img { width: 100%; height: 300px; object-fit: cover; }
.reward .in { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.reward .tag { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 800; max-width: 100%; }
.reward .tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reward h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.reward .quote { margin: 0; font-size: 18px; line-height: 1.45; }
.reward .stat { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 31; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 12px; border-radius: 2px; animation: fall linear forwards; }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(var(--nav-h) + 100px); transform: translateX(-50%); background: rgba(22, 24, 29, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px); animation: fade .2s; }
.center { min-height: 80vh; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.center img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; margin: 0 auto 16px; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2.5px solid var(--track); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.empty { text-align: center; color: var(--muted); padding: 24px 16px; font-weight: 600; }

@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.nav .brand { display: none; }
.cols, .charts, .stack { display: flex; flex-direction: column; gap: 18px; }
.cols > div { display: contents; }
.o0 { order: 0; } .o1 { order: 1; } .o2 { order: 2; }

/* ── Компьютер: меню слева, контент шире ── */
@media (min-width: 900px) {
  .nav { top: 0; right: auto; width: 220px; border-top: 0; border-right: 1px solid var(--line); padding: 28px 12px; display: block; }
  .nav-in { flex-direction: column; height: auto; gap: 4px; }
  .nav button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 15px; }
  .nav button.on { background: var(--accent-soft); }
  .nav .brand { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; padding: 0 14px 18px; }
  .shell { padding-left: 220px; }
  main { max-width: 920px; padding: 32px 32px 120px; }
  .fab { right: 32px; bottom: 32px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .cols > div { display: flex; flex-direction: column; gap: 18px; }
  .stack:empty { display: none; }
  .matrix { grid-auto-rows: 360px; gap: 14px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .sheet { max-width: 560px; bottom: 50%; transform: translateY(50%); border-radius: 24px; max-height: 86vh; animation: fade .2s; }
  .sheet .grip { display: none; }
  .toast { bottom: 40px; left: calc(50% + 110px); }
}
