/* Дизайн-система «Помощник Саши» v2 — світле небо, скло, живий герой дня. Довідник: docs/DESIGN_SYSTEM.md */

:root {
  color-scheme: light;
  --bg: #F2F4F8;
  --bg-a: #D9E6FF; --bg-b: #FFE3D2; --bg-c: #D8F3E6; --bg-d: #EADCFF;
  --surface: rgba(255, 255, 255, .74);
  --surface-solid: #FFFFFF;
  --surface-2: rgba(22, 32, 58, .06);
  --surface-3: rgba(22, 32, 58, .11);
  --ink: #16203A;
  --ink-2: #4A5470;
  --ink-3: #5E6883;
  --line: rgba(22, 32, 58, .10);
  --line-strong: rgba(22, 32, 58, .2);
  --glass-edge: rgba(255, 255, 255, .8);
  --hero-ink: #FFFFFF;
  --hero-ink-2: rgba(255, 255, 255, .72);
  --primary: linear-gradient(135deg, #2F5FD3 0%, #5B85F0 100%);
  --primary-flat: #2F5FD3;
  --primary-ink: #FFFFFF;
  --focus: #2F5FD3;

  --role-a: #2F5FD3; --role-a-text: #2448B0; --role-a-soft: #E4EAFB;
  --role-f: #1E9A5A; --role-f-text: #157447; --role-f-soft: #DDF3E6;
  --role-l: #B04E9A; --role-l-text: #8E3A7C; --role-l-soft: #F5E3F0;

  --good: #157447; --good-soft: #DDF3E6;
  --warn: #9A6100; --warn-soft: #FBEFD2;
  --danger: #B93434; --danger-soft: #FBE2E2;

  --chart-line: #2F5FD3; --chart-grid: rgba(22, 32, 58, .09); --chart-text: #5E6883;

  --r-card: 22px; --r-btn: 14px; --r-chip: 999px;
  --shadow-card: 0 10px 30px -18px rgba(22, 32, 58, .35), 0 1px 0 rgba(255, 255, 255, .6) inset;
  --shadow-lift: 0 24px 50px -24px rgba(31, 52, 140, .55);
  --shadow-dock: 0 12px 40px -14px rgba(22, 32, 58, .45);
  --nav-h: 64px;
  --font-ui: "Manrope", -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "Piazzolla", "Iowan Old Style", "Times New Roman", Georgia, serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1426;
  --bg-a: #1B2A5C; --bg-b: #4A2A3C; --bg-c: #143A34; --bg-d: #2E2456;
  --surface: rgba(23, 30, 51, .72);
  --surface-solid: #171E33;
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .11);
  --ink: #EEF1FA;
  --ink-2: #AEB6CC;
  --ink-3: #8F99B4;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);
  --glass-edge: rgba(255, 255, 255, .12);
  --primary: linear-gradient(135deg, #5B85F0 0%, #8FB0FF 100%);
  --primary-flat: #5B85F0;
  --primary-ink: #0E1426;
  --focus: #8FB0FF;

  --role-a: #5B85F0; --role-a-text: #8FB0FF; --role-a-soft: #1F2A45;
  --role-f: #2FA061; --role-f-text: #5FC98F; --role-f-soft: #16301F;
  --role-l: #CB5FB0; --role-l-text: #E48DCB; --role-l-soft: #35213A;

  --good: #5FC98F; --good-soft: #16301F;
  --warn: #E2B04A; --warn-soft: #33290F;
  --danger: #F08383; --danger-soft: #3A1B1B;

  --chart-line: #8FB0FF; --chart-grid: rgba(255, 255, 255, .08); --chart-text: #AEB6CC;
  --shadow-card: 0 10px 30px -18px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .06) inset;
  --shadow-lift: 0 24px 50px -22px rgba(0, 0, 0, .8);
  --shadow-dock: 0 12px 40px -12px rgba(0, 0, 0, .8);
}

[data-theme="dark"] .illo-raster { filter: invert(.92) hue-rotate(180deg) saturate(1.3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.45;
  font-feature-settings: "cv05", "ss01"; -webkit-font-smoothing: antialiased;
  overflow-x: hidden; min-height: 100dvh; overflow-wrap: break-word;
}
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }

/* Аврора: чотири м'які плями, що повільно пливуть за контентом */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .9; will-change: transform; }
.aurora i:nth-child(1) { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: var(--bg-a); animation: drift1 38s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 50vmax; height: 50vmax; right: -20vmax; top: -10vmax; background: var(--bg-b); animation: drift2 46s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 55vmax; height: 55vmax; left: 10vmax; bottom: -30vmax; background: var(--bg-c); animation: drift3 52s ease-in-out infinite alternate; }
.aurora i:nth-child(4) { width: 40vmax; height: 40vmax; right: 5vmax; bottom: -15vmax; background: var(--bg-d); animation: drift1 60s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(12vmax, 8vmax) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-10vmax, 12vmax) scale(.95); } }
@keyframes drift3 { to { transform: translate(8vmax, -10vmax) scale(1.08); } }

a { color: inherit; text-decoration: none; }
a.link { color: var(--role-a-text); text-underline-offset: 3px; }
a.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--role-a-soft); }

.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; font-variation-settings: "opsz" 28; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }

/* ---------- Каркас ---------- */
.app { display: flex; min-height: 100dvh; }
.main { flex: 1 1 auto; width: 100%; max-width: 44rem; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 36px); }
@media (min-width: 768px) { .main { padding: 24px 36px 48px; max-width: 56rem; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px 0 16px; }
.page-head-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 2px; width: max-content; min-height: 36px; padding: 6px 10px 6px 4px; margin-left: -4px; border-radius: 999px; color: var(--ink-2); font-weight: 700; font-size: 14px; }
.back svg { width: 18px; height: 18px; }
.back:active { background: var(--surface-2); }
.page-title { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1.1; letter-spacing: -.015em; font-variation-settings: "opsz" 32; }
@media (min-width: 768px) { .page-title { font-size: 38px; } }
.avatar { min-width: 40px; height: 40px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-card); color: var(--ink-2); font-weight: 700; font-size: 13px; flex: none; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* Бічна навігація iPad */
.sidenav { display: none; }
@media (min-width: 768px) {
  .sidenav { display: flex; flex-direction: column; width: 240px; flex: none; position: sticky; top: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 24px 14px; background: var(--surface); border-right: 1px solid var(--glass-edge); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; font-family: var(--font-display); font-size: 21px; font-weight: 500; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-family: var(--font-ui); font-weight: 800; font-size: 14px; box-shadow: 0 6px 14px -6px rgba(47, 95, 211, .7); }
  .nav-list { display: flex; flex-direction: column; }
  .nav-group { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 14px 10px 6px; display: flex; align-items: center; gap: 8px; }
  .nav-group::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--g, var(--line-strong)); }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; font-weight: 600; font-size: 14px; color: var(--ink-2); min-height: 42px; transition: background .15s, transform .12s; }
  .nav-item svg { width: 18px; height: 18px; flex: none; }
  .nav-item:hover { background: var(--surface-2); color: var(--ink); transform: translateX(2px); }
  .nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(47, 95, 211, .7); }
  .sidenav-bottom { margin-top: auto; }
}

/* Плаваючий док iPhone */
.bottomnav {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h);
  background: var(--surface); border: 1px solid var(--glass-edge); border-radius: 24px; box-shadow: var(--shadow-dock);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
}
@media (min-width: 768px) { .bottomnav { display: none; } }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; font-size: 10.5px; font-weight: 700; color: var(--ink-3); border: 0; background: none; padding: 0; letter-spacing: .01em; }
.tab svg { width: 22px; height: 22px; position: relative; z-index: 1; transition: transform .2s; }
.tab::before { content: ""; position: absolute; top: 7px; width: 40px; height: 28px; border-radius: 14px; background: var(--primary); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1.2); }
.tab.active { color: var(--role-a-text); }
.tab.active::before { opacity: 1; transform: scale(1); }
.tab.active svg { color: #fff; }
.tab:active svg { transform: scale(.88); }

/* Аркуш «Ещё» */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(14, 20, 38, .45); opacity: 0; pointer-events: none; transition: opacity .2s; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface-solid); border-radius: 26px 26px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 12px; }
body.sheet-open .sheet { transform: none; }
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); font-weight: 700; font-size: 14px; min-height: 54px; transition: transform .1s; }
.sheet-item svg { width: 20px; height: 20px; color: var(--role-a); }
.sheet-item.active { background: var(--primary); color: #fff; }
.sheet-item.active svg { color: inherit; }
.sheet-item:active { transform: scale(.97); }

/* ---------- Компоненти ---------- */
.card { position: relative; background: var(--surface); border-radius: var(--r-card); padding: 16px; border: 1px solid var(--glass-edge); box-shadow: var(--shadow-card); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 16px; margin: 0 0 10px; letter-spacing: -.01em; }
.card-title .count { font-weight: 700; color: var(--ink-3); font-size: 13px; background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.card-title > * { min-width: 0; }
.card-title.wrap { flex-wrap: wrap; }
.card-title.wrap form { flex: 1 1 200px; }

/* Герой дня: небо за часом доби + дуга сонця */
.card.hero { --sky-1: #2140A6; --sky-2: #3E62D8; --glow: #7FB2FF; color: var(--hero-ink); border: 0; box-shadow: var(--shadow-lift); padding: 20px 18px 18px; overflow: hidden; background: radial-gradient(120% 90% at 100% 100%, var(--glow) 0%, transparent 55%), linear-gradient(160deg, var(--sky-1) 0%, var(--sky-2) 100%); -webkit-backdrop-filter: none; backdrop-filter: none; }
.card.hero[data-daypart="morning"] { --sky-1: #1F3F9E; --sky-2: #4A6BE0; --glow: #FFB08A; }
.card.hero[data-daypart="day"] { --sky-1: #2140A6; --sky-2: #4C7CE8; --glow: #8FE2C9; }
.card.hero[data-daypart="evening"] { --sky-1: #2A2468; --sky-2: #5B49C7; --glow: #FF8E7A; }
.card.hero[data-daypart="night"] { --sky-1: #121A3E; --sky-2: #253A8A; --glow: #6C7BE0; }
.hero-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.hero .greeting { font-size: 13.5px; font-weight: 700; color: var(--hero-ink-2); margin: 0 0 2px; }
.hero .display { font-size: 36px; line-height: 1.02; margin: 0; }
.hero .muted { color: var(--hero-ink-2); }
.sun-arc { width: 132px; height: 78px; flex: none; margin: -6px -6px 0 0; overflow: visible; }
.sun-arc .track { fill: none; stroke: rgba(255, 255, 255, .28); stroke-width: 2; stroke-dasharray: 3 5; }
.sun-arc .done { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 220; animation: arc 1.4s cubic-bezier(.2, .7, .2, 1) .2s forwards; }
.sun-arc .horizon { stroke: rgba(255, 255, 255, .35); stroke-width: 1.5; }
.sun-arc .sun { fill: #FFD68A; filter: drop-shadow(0 0 10px rgba(255, 214, 138, .9)); opacity: 0; animation: pop .5s ease-out 1.2s forwards; }
.sun-arc .moon { fill: #E6ECFF; opacity: 0; animation: pop .5s ease-out 1.2s forwards; }
.sun-arc .tick { fill: rgba(255, 255, 255, .8); font: 700 10px var(--font-ui); }
@keyframes arc { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.hero-chips .chip { background: rgba(255, 255, 255, .16); color: var(--hero-ink); border: 1px solid rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.priorities { margin: 16px 0 0; padding: 0; list-style: none; counter-reset: p; }
.priorities li { counter-increment: p; display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, .18); font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.priorities li::before { content: counter(p); font-family: var(--font-display); font-style: italic; font-size: 22px; line-height: 1; color: var(--hero-ink-2); min-width: 18px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 22px 0 8px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 22px; letter-spacing: -.01em; }
.section-head .count { color: var(--ink-3); font-weight: 700; font-size: 13px; background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.section-head:first-child { margin-top: 4px; }

.list { margin: 0; padding: 0; list-style: none; }
.list > li, .row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child, .row:first-child { border-top: 0; }
.card > .list > li:last-child { padding-bottom: 2px; }
.row-body { min-width: 0; flex: 1 1 auto; }
.row-title { font-weight: 700; font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text { color: var(--ink-2); font-size: 14px; margin-top: 6px; line-height: 1.45; }
.row-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--role-a-text); min-width: 44px; padding-top: 2px; }

.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-chip); padding: 3px 10px; font-size: 12px; font-weight: 700; line-height: 1.4; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip svg { width: 12px; height: 12px; }
.chip.a { background: var(--role-a-soft); color: var(--role-a-text); }
.chip.f { background: var(--role-f-soft); color: var(--role-f-text); }
.chip.l { background: var(--role-l-soft); color: var(--role-l-text); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.muted { opacity: .55; }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.solid { background: var(--primary); color: #fff; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 8px; margin: 0; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { flex: none; padding: 8px 14px; font-size: 13px; min-height: 38px; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-card); color: var(--ink-2); transition: transform .12s; }
.chips .chip:active { transform: scale(.96); }
.chips.wrap { flex-wrap: wrap; overflow-x: hidden; overflow-y: auto; max-height: 240px; }
.chips .chip[hidden] { display: none; }
.chips .chip.active { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -8px rgba(47, 95, 211, .7); }
@media (min-width: 768px) { .chips { flex-wrap: wrap; } }

.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r-btn); font-weight: 700; font-size: 15px; border: 1px solid transparent; transition: transform .1s, box-shadow .2s, background .15s; text-align: center; overflow: hidden; }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 10px 22px -10px rgba(47, 95, 211, .75); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); }
.btn-primary:hover::after { animation: shimmer-btn .9s ease; }
@keyframes shimmer-btn { to { transform: translateX(120%); } }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-solid); }
.btn-ghost { background: transparent; color: var(--role-a-text); min-height: 40px; padding: 8px 12px; }
.btn-ghost:hover { background: var(--role-a-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 11px; }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 14px; }
.icon-btn.sm { width: 38px; height: 38px; min-height: 38px; border-radius: 11px; }

.field { display: block; width: 100%; min-width: 0; min-height: 46px; padding: 11px 14px; border-radius: var(--r-btn); border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--ink); font-size: 16px; -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s; }
[data-theme="dark"] .field { background: rgba(255, 255, 255, .05); }
.field::placeholder { color: var(--ink-3); }
.field:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 20%, transparent); }
select.field { max-width: 100%; text-overflow: ellipsis; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235E6883' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.field-file { padding: 9px 12px; font-size: 14px; }
.field-file::file-selector-button { font: inherit; font-weight: 700; border: 0; border-radius: 9px; padding: 6px 10px; margin-right: 10px; background: var(--role-a-soft); color: var(--role-a-text); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--role-a); flex: none; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 14px; padding: 3px; gap: 2px; }
.segmented .seg { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 11px; border: 0; background: transparent; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: background .2s, color .2s, box-shadow .2s; }
.segmented .seg svg { width: 16px; height: 16px; flex: none; }
.segmented .seg.active { background: var(--surface-solid); color: var(--ink); box-shadow: 0 2px 8px rgba(22, 32, 58, .14); }
[data-theme="dark"] .segmented .seg.active { background: var(--surface-3); }
/* B42: radio segmented (sphere in the person edit form) */
.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 3px; gap: 2px; }
.seg-opt { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt svg { width: 16px; height: 16px; flex: none; }
.seg-opt:has(input:checked) { background: var(--surface-solid); color: var(--ink); box-shadow: 0 2px 8px rgba(22, 32, 58, .14); }
[data-theme="dark"] .seg-opt:has(input:checked) { background: var(--surface-3); }
form[data-sphere="personal"] [data-only="work"], form[data-sphere="work"] [data-only="personal"] { display: none; }

.stat { position: relative; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-card); border-radius: var(--r-card); padding: 16px 14px 12px; min-width: 0; overflow: hidden; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.stat::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--role-f), #8FE2C9); }
.stat-label { font-size: 12.5px; color: var(--ink-3); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12.5px; font-weight: 700; }
.stat-delta.up { color: var(--good); } .stat-delta.down { color: var(--danger); } .stat-delta.flat { color: var(--ink-3); }
.stat-delta svg { width: 12px; height: 12px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 18px 24px; gap: 6px; }
.empty .illo { width: 172px; height: auto; margin-bottom: 8px; color: var(--ink); animation: float 6s ease-in-out infinite; }
.empty .illo-raster { width: 210px; height: auto; margin-bottom: 8px; animation: float 6s ease-in-out infinite; }
.empty h3 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 21px; }
.empty p { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 34ch; line-height: 1.5; }
.empty .btn { margin-top: 12px; }
.illo { --accent: var(--role-a); }
.illo.f { --accent: var(--role-f); } .illo.l { --accent: var(--role-l); }
.illo .ln { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.illo .ac { fill: var(--accent); }
.illo .pp { fill: var(--surface-solid); }
@keyframes float { 50% { transform: translateY(-5px); } }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; font-size: 14px; background: var(--surface-2); color: var(--ink); }
.banner.good { background: var(--good-soft); color: var(--good); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.ico svg { width: 14px; height: 14px; vertical-align: -2px; }  /* B19: іконка в рядку тексту (summary, note) */

.note { font-size: 12.5px; color: var(--ink-3); }
.prose { white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; color: var(--ink); }

/* Таймлайн (строки, історія) */
.timeline { margin: 0; padding: 0; list-style: none; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 12px; bottom: 12px; width: 2px; background: var(--line-strong); border-radius: 1px; }
.timeline > li { position: relative; padding: 10px 0 10px 28px; }
.timeline > li::before { content: ""; position: absolute; left: 2px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--dot, var(--role-l)); box-shadow: 0 0 0 3px var(--surface-solid); z-index: 1; }
.timeline > li.danger { --dot: var(--danger); } .timeline > li.warn { --dot: var(--warn); } .timeline > li.a { --dot: var(--role-a); } .timeline > li.f { --dot: var(--role-f); } .timeline > li.neutral { --dot: var(--line-strong); } .timeline > li.good { --dot: var(--good); }
.timeline > li.danger::after { content: ""; position: absolute; left: 2px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); opacity: .5; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { to { transform: scale(2.6); opacity: 0; } }

/* Тиждень як стрічка днів */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-pill { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-card); min-height: 62px; transition: transform .12s; }
.day-pill:active { transform: scale(.95); }
.day-pill .dow { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: lowercase; }
.day-pill .dom { font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.day-pill .dots { display: flex; gap: 2px; height: 6px; }
.day-pill .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--role-a); }
.day-pill.today { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 10px 20px -10px rgba(47, 95, 211, .8); }
.day-pill.today .dow { color: inherit; opacity: .75; }
.day-pill.today .dots i { background: currentColor; }
.day-pill.past { opacity: .55; }

/* Папки */
/* B22 (огляд мобільної версії 24.09): на телефоні папки — один стовпець. Дві колонки на 430 px давали
   вкладеним рівням 61 px ширини: картки вилазили за межі й перекривалися сусідньою сіткою, кнопка не
   натискалась. minmax(0, …) + min-width: 0 — щоб довга назва не розсувала сітку ширше за екран. */
.folders { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.folders > *, .folder-body > * { min-width: 0; }
@media (min-width: 560px) { .folders { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.folder { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-card); font-weight: 700; font-size: 14px; min-height: 54px; cursor: pointer; list-style: none; transition: transform .12s; }
.folder:active { transform: scale(.97); }
.folder::-webkit-details-marker { display: none; }
.folder svg { width: 22px; height: 22px; color: var(--role-a); flex: none; }
.folder-body { grid-column: 1 / -1; min-width: 0; padding: 6px 0 4px 8px; border-left: 2px solid var(--line-strong); margin-left: 12px; display: grid; gap: 8px; }
details.fold[open] > .folder { background: var(--role-a-soft); color: var(--role-a-text); }

/* Чек-лист задач */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task .tick { width: 26px; height: 26px; min-height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); background: transparent; padding: 0; flex: none; margin-top: 1px; display: grid; place-items: center; color: transparent; transition: background .2s, border-color .2s, transform .15s; }
.task .tick svg { width: 14px; height: 14px; }
.task .tick:hover { border-color: var(--role-a); color: var(--role-a); transform: scale(1.08); }
.task.done .tick { background: var(--good); border-color: var(--good); color: #fff; animation: pop .35s ease-out; }
.task.done .row-title { text-decoration: line-through; color: var(--ink-3); font-weight: 600; }
.task.cancelled .row-title { color: var(--ink-3); }
.task .row-title { white-space: normal; font-weight: 600; }
.task-actions { display: flex; gap: 4px; flex: none; }
.task-actions .btn { min-height: 34px; min-width: 34px; padding: 4px 8px; font-size: 12px; }

/* Розмова */
.bubble { max-width: 90%; padding: 10px 14px; border-radius: 18px; font-size: 14px; white-space: pre-wrap; line-height: 1.45; }
.bubble.user { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; margin-left: auto; }
.bubble.bot { background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 5px; }

/* Toast і скелетон */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 26px); transform: translateX(-50%) translateY(20px); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 16px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1.2); max-width: calc(100vw - 32px); box-shadow: var(--shadow-lift); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.danger { background: var(--danger); color: #fff; }
@media (min-width: 768px) { #toast { bottom: 24px; } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.skeleton { display: grid; gap: 8px; padding: 6px 0; }
.skeleton i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton i:nth-child(2) { width: 82%; } .skeleton i:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.htmx-swapping { opacity: 0; transition: opacity .12s; }
.htmx-added { opacity: 0; }
.htmx-settling { opacity: 1; transition: opacity .2s; }

/* Одна поява сторінки: картки піднімаються каскадом */
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }
.stack > *, .reveal > *, .card > * { min-width: 0; }
.reveal .stack > *, .reveal > .card, .reveal > form { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.reveal .stack > *:nth-child(2) { animation-delay: .07s; } .reveal .stack > *:nth-child(3) { animation-delay: .14s; } .reveal .stack > *:nth-child(4) { animation-delay: .21s; } .reveal .stack > *:nth-child(5) { animation-delay: .28s; } .reveal .stack > *:nth-child(n+6) { animation-delay: .34s; }

/* Вхід */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--glass-edge); border-radius: 28px; box-shadow: var(--shadow-lift); padding: 22px 22px 24px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.login-card .illo-raster { width: calc(100% + 44px); max-width: none; display: block; margin: -10px -22px 10px; animation: float 7s ease-in-out infinite; }
.login-title { font-family: var(--font-display); font-size: 34px; font-weight: 500; letter-spacing: -.015em; margin: 0; line-height: 1.05; }
.login-sub { color: var(--ink-2); margin: 6px 0 22px; font-size: 14.5px; }

/* Графік */
.chart-wrap { position: relative; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 9px; white-space: nowrap; transform: translate(-50%, -125%); opacity: 0; transition: opacity .12s; }
.chart-tip.show { opacity: 1; }
.chart-line { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 1.6s cubic-bezier(.2, .7, .2, 1) .2s forwards; }
.chart-area { opacity: 0; animation: fade .8s ease 1.1s forwards; }
.chart-dot { opacity: 0; animation: pop .35s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* Дрібне */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .grid-2.md-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stack { display: grid; gap: 10px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.mark svg { width: 18px; height: 18px; }
.mark.a { background: var(--role-a-soft); color: var(--role-a-text); }
.mark.f { background: var(--role-f-soft); color: var(--role-f-text); }
.mark.l { background: var(--role-l-soft); color: var(--role-l-text); }
.mark.n { background: var(--surface-2); color: var(--ink-2); }
.mark.danger { background: var(--danger-soft); color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.disclosure { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; min-height: 44px; }
.disclosure svg.chev { width: 18px; height: 18px; color: var(--ink-3); transition: transform .2s; flex: none; }
details[open] > .disclosure svg.chev { transform: rotate(180deg); }

/* B13 */
.stat.tile { display: block; cursor: pointer; transition: transform .12s; }
.stat.tile:active { transform: scale(.97); }
.stat.tile .stat-label { display: flex; align-items: center; gap: 6px; }
.stat.tile .stat-label svg { width: 14px; height: 14px; flex: none; }
/* B40: a whole-card link under inner chips (a link inside a link is not allowed) */
.stat.tile .stretched { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.stat-sub { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sub.warn { color: var(--warn); }
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-head span { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: lowercase; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-grid .day-pill { min-height: 50px; padding: 6px 0 4px; border-radius: 12px; }
.month-grid .day-pill .dom { font-size: 15px; }
.month-grid .day-pill .dots { align-items: center; }
.month-grid .day-pill .dots .more { font-size: 9px; font-weight: 800; line-height: 1; color: var(--ink-3); }
.day-pill.out { opacity: .35; }
.day-pill.sel:not(.today) { box-shadow: inset 0 0 0 2px var(--primary); border-color: transparent; }

/* B13 ask — логотип, плаваюча кнопка «Спросить» і шторка (текст, голос, озвучка, підтвердження дій) */
.brand-logo { width: 28px; height: 28px; border-radius: 8px; flex: none; box-shadow: 0 4px 10px -4px rgba(22, 32, 58, .4); }
.login-logo { width: 44px; height: 44px; border-radius: 12px; display: block; margin: 0 0 10px; box-shadow: 0 6px 14px -6px rgba(22, 32, 58, .45); }
/* Ihor 04.10.2026: the floating «Спросить» is just the icon; the mic next to it records in one tap without the sheet */
.ask-dock { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom, 0px)); z-index: 35; display: flex; align-items: center; gap: 10px; transition: opacity .2s; }
@media (min-width: 768px) { .ask-dock { right: 28px; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); } }
.ask-fab, .ask-fab-mic { width: 52px; height: 52px; border: 0; border-radius: 999px; display: grid; place-items: center; box-shadow: var(--shadow-lift); transition: transform .12s, background .15s; }
.ask-fab { background: var(--primary); color: var(--primary-ink); }
.ask-fab-mic { background: var(--surface-solid); color: var(--role-a-text); touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ask-fab svg, .ask-fab-mic svg { width: 23px; height: 23px; }
.ask-fab:active, .ask-fab-mic:active { transform: scale(.94); }
.ask-fab-mic.rec { background: var(--danger); color: #fff; animation: ask-pulse 1.2s ease-in-out infinite; }
.ask-fab-mic.busy { opacity: .6; pointer-events: none; }
body.ask-open .ask-dock { opacity: 0; pointer-events: none; }
.ask-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(14, 20, 38, .45); opacity: 0; pointer-events: none; transition: opacity .2s; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ask-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; max-height: min(80dvh, 720px); display: flex; flex-direction: column; background: var(--surface-solid); color: var(--ink); border-radius: 26px 26px 0 0; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-lift); visibility: hidden; transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .2s, visibility 0s linear .3s; }
.ask-sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 10px; flex: none; }
@media (min-width: 768px) { .ask-sheet { left: auto; right: 28px; bottom: 28px; width: 440px; border-radius: 26px; transform: translateY(24px); opacity: 0; pointer-events: none; } .ask-sheet::before { display: none; } }
body.ask-open .ask-sheet { visibility: visible; transform: none; opacity: 1; pointer-events: auto; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .2s, visibility 0s; }
body.ask-open .ask-backdrop { opacity: 1; pointer-events: auto; }
.ask-head { display: flex; align-items: center; gap: 10px; padding: 0 0 8px; flex: none; }
.ask-title { font-family: var(--font-display); font-size: 21px; font-weight: 500; flex: 1 1 auto; }
.ask-speak { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; min-height: 36px; }
.ask-speak input { width: 16px; height: 16px; accent-color: var(--role-a); margin: 0; }
.ask-close { width: 36px; height: 36px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.ask-close svg { width: 18px; height: 18px; }
.ask-answer { flex: 1 1 auto; min-height: 88px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--surface-2); border-radius: 16px; padding: 12px 14px; font-size: 14.5px; line-height: 1.45; overflow-wrap: break-word; }
.ask-answer:empty { display: none; }
.ask-text { white-space: pre-wrap; }
.ask-transcript { margin: 0 0 8px; color: var(--ink-2); font-size: 13.5px; }
.ask-pending { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--warn-soft); color: var(--ink); display: grid; gap: 8px; }
.ask-pending-title { font-weight: 800; font-size: 13px; color: var(--warn); }
.ask-preview { margin: 0; font: inherit; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: break-word; }
.ask-form { display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; flex: none; }
.ask-input { flex: 1 1 auto; resize: none; min-height: 46px; max-height: 120px; line-height: 1.35; }
.ask-mic, .ask-send { width: 46px; height: 46px; flex: none; border: 0; border-radius: 14px; display: grid; place-items: center; transition: transform .1s, background .15s; }
.ask-mic svg, .ask-send svg { width: 20px; height: 20px; }
.ask-mic { background: var(--role-a-soft); color: var(--role-a-text); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ask-mic.rec { background: var(--danger); color: #fff; animation: ask-pulse 1.2s ease-in-out infinite; }
@keyframes ask-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(185, 52, 52, .45); } 50% { box-shadow: 0 0 0 8px rgba(185, 52, 52, 0); } }
.ask-send { background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 18px -8px rgba(47, 95, 211, .7); }
.ask-mic:active, .ask-send:active { transform: scale(.94); }
.ask-attach { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); cursor: pointer; order: -1; }
.ask-attach svg { width: 20px; height: 20px; }
.ask-attach.on { background: var(--role-a-soft); color: var(--role-a-text); }
.ask-file { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; font-weight: 700; min-width: 0; }
.ask-file[hidden] { display: none; }
.ask-file > svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.ask-file span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-file-x { width: 32px; height: 32px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); display: grid; place-items: center; }
.ask-file-x svg { width: 16px; height: 16px; }
.ask-busy { padding-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
/* B13 ask: низ контенту не ховається під плаваючою кнопкою «Спросить» (кнопка 52px + відступ 22px над bottom-nav) */
.main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 92px); }
@media (min-width: 768px) { .main { padding-bottom: 96px; } }


/* B13 cal */
.chip.cal-acc { margin-top: 4px; }

/* B13 pwa: підказка «На экран Домой» і кроки в Настройках */
.install-hint { margin: 0 0 14px; }
.install-hint[hidden] { display: none; }
/* B17: інлайн-форма дії (перенести, изменить, удалить) прихована, доки не натиснули кнопку */
form[hidden] { display: none !important; }
.install-hint .install-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.install-hint .btn { padding: 6px 12px; font-size: 13px; }
ol.steps { margin: 0; padding-left: 22px; color: var(--ink); font-size: 14px; line-height: 1.45; }
ol.steps li { margin: 4px 0; }

/* B13 docs: черга «ждут обработки» — чип статусу на картці й ряд дій «Разобрать / Это … / Пропустить» */
.chip.pending { background: var(--warn-soft); color: var(--warn); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.doc-actions form { display: contents; }
.doc-actions .btn { white-space: nowrap; }
.doc-error { margin: 8px 0 0; font-size: 13px; color: var(--danger); overflow-wrap: break-word; }

.tour-mark { flex: none; width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 800; }
.tour-mark.ok { background: var(--good-soft); color: var(--good); }
.tour-mark svg { width: 16px; height: 16px; }

/* B18 mobile actions */
/* `hidden` має ховати елемент навіть там, де дизайн-система задала свій `display`
   (як для інших [hidden]-шарів): на цьому тримаються згорнуті картки чатів. */
[hidden] { display: none !important; }
/* Панель дій під палець: один рядок, що не переноситься; вузький екран гортає її вбік, як чипи. */
.act-bar { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-height: 44px; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.act-bar::-webkit-scrollbar { display: none; }
.act-bar > *, .act-bar > form { flex: none; }
.act-bar .btn { min-height: 44px; padding: 8px 12px; font-size: 13.5px; gap: 6px; white-space: nowrap; }
.act-bar .btn svg { width: 19px; height: 19px; flex: none; }
.act-bar .act-mute { color: var(--ink-3); }
.act-bar .act-mute:hover { background: var(--surface-2); }
/* Скелетон очікування не має розсовувати смугу: `.skeleton` перебивав `display:none` у `.htmx-indicator`,
   через що порожні смужки стояли в кожному рядку дій і ламали його на кілька рядків. */
.skeleton.htmx-indicator { display: none; }
.htmx-request .skeleton.htmx-indicator, .skeleton.htmx-request.htmx-indicator { display: grid; }
.act-long { display: none; }
/* Вузький екран: смуга дій виходить на всю ширину рядка (лівіше колонки часу), кнопки щільніші — три дії влазять без гортання. */
@media (max-width: 767px) {
  .act-bar .btn { padding: 8px 8px; gap: 4px; font-size: 13px; }
  .act-bar.act-full { margin-left: -56px; width: calc(100% + 56px); max-width: none; }
}
@media (min-width: 768px) { .act-bar { flex-wrap: wrap; overflow: visible; } .act-short { display: none; } .act-long { display: inline; } }

/* Пункт чату: підсумок — до трьох рядків, клік розкриває повністю. */
.item-sum { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; cursor: pointer; }
.item-sum.open { display: block; -webkit-line-clamp: none; }
.item-open { color: var(--role-a-text); display: inline-flex; vertical-align: -3px; }
.item-open svg { width: 15px; height: 15px; }
/* «Показать все N» під згорнутою карткою чату і «Показать ещё чаты» під списком. */
.more-btn { min-height: 44px; width: 100%; justify-content: center; margin-top: 8px; }

/* Галочки під палець: сама галочка 24 px, тапається весь рядок. */
.ask-speak input, .invite-row input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--primary); }
.invite-row { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.invite-row .row-title { white-space: normal; }
.task-actions .btn { min-height: 44px; min-width: 44px; }

/* B18 фікс: рядок події живе всередині колонки-дня «Календаря». Успадкований від `.row`
   `align-items:flex-start` робив дочірні рядки max-content — кнопки дій вилазили за картку
   і розтягували документ. Тримаємо тіло рядка в межах контейнера, гортається лише `.act-bar`. */
.row-body { max-width: 100%; }
/* Дата й час — дві нерозривні групи: «ЧЧ:ММ» не переноситься посеред себе,
   а переїжджає на новий рядок цілком (перенос дозволений лише між групами). */
.dt-cells { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; max-width: 100%; }
.dt-cells .dt-part { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* B18: заголовок сторінки у двох варіантах — короткий для телефона, повний від 768 px. */
.title-long { display: none; }
@media (min-width: 768px) { .title-short { display: none; } .title-long { display: inline; } }

/* B33: «Напоминания» as in iOS Reminders */
.rem-search { position: relative; display: flex; align-items: center; }
.rem-search > svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.rem-search .field { padding-left: 38px; width: 100%; }
.rem-smart { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .rem-smart { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rem-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 6px 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface, var(--card, #fff)); border: 1px solid var(--line); color: inherit; text-decoration: none; min-height: 44px; }
.rem-tile:hover { border-color: var(--line-strong); }
.rem-tile-count { grid-column: 2; grid-row: 1; justify-self: end; font-size: 26px; font-weight: 700; line-height: 1; }
.rem-tile-name { grid-column: 1 / 3; grid-row: 2; font-weight: 600; color: var(--ink-2, var(--ink-3)); overflow-wrap: break-word; }
.rem-dot { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; flex: none; }
.rem-dot svg { width: 17px; height: 17px; }
.rem-list-row { text-decoration: none; color: inherit; align-items: center; min-height: 44px; }
.rem-list-row .chev-r { width: 16px; height: 16px; color: var(--ink-3); }
.rem-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rem-h { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 26px; flex-basis: 100%; overflow-wrap: break-word; }
.rem-group { font-size: 15px; }
.rem-late, .rem-group.rem-late { color: var(--danger); }
.task.rem { align-items: flex-start; }
.task.rem .tick { border-color: var(--lc, var(--line-strong)); }
.task.rem .tick:hover { border-color: var(--lc); color: var(--lc); }
.task.rem.done .tick { background: var(--lc, var(--good)); border-color: var(--lc, var(--good)); }
.task.rem .tick { min-width: 26px; }
.task.rem form { display: flex; }
.task.rem form .tick { position: relative; }
.task.rem form .tick::after { content: ""; position: absolute; inset: -9px; }
.rem-title { display: block; font-weight: 600; color: inherit; text-decoration: none; overflow-wrap: break-word; }
.task.done .rem-title { color: var(--ink-3); }
.rem-prio { color: var(--lc, var(--role-a)); font-weight: 800; }
.rem-notes { color: var(--ink-3); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; }
.rem-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.rem-meta a { color: inherit; }
.rem-ic { display: inline-flex; align-items: center; gap: 3px; }
.rem-ic svg { width: 13px; height: 13px; }
.rem-tag { color: var(--role-a) !important; text-decoration: none; }
.rem-src { display: inline-flex; align-items: center; gap: 3px; color: var(--role-a) !important; }
.rem-src svg { width: 13px; height: 13px; }
.rem-flag { color: #FF9500; flex: none; display: inline-flex; width: 18px; height: 18px; margin-top: 3px; }
.rem-quick { display: flex; gap: 8px; align-items: center; }
.rem-quick .field { flex: 1; min-width: 0; }
.rem-plus { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; flex: none; }
.rem-plus svg { width: 16px; height: 16px; }
.rem-hint { font-size: 12px; margin: -4px 0 0; overflow-wrap: break-word; }
.rem-color .rem-swatch { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: var(--c); }
.rem-color.active { outline: 2px solid var(--c); outline-offset: 1px; }
.rem-icon-pick svg { width: 18px; height: 18px; }
.rem-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.rem-switch span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.rem-switch svg { width: 18px; height: 18px; color: #FF9500; }
.rem-switch input { width: 22px; height: 22px; accent-color: #FF9500; }

/* B41: long-press reorder — iOS-style jiggle, the dragged item lifts and follows the finger */
[data-reorder] > [data-rid] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.jiggling > [data-rid] { animation: jiggle .28s ease-in-out infinite alternate; touch-action: none; cursor: grab; }
.jiggling > [data-rid]:nth-child(2n) { animation-delay: -.14s; animation-duration: .31s; }
.jiggling > [data-rid].dragging { animation: none; position: relative; z-index: 60; cursor: grabbing; box-shadow: 0 16px 34px -12px rgba(22, 32, 58, .45); opacity: .96; transition: none; }
@keyframes jiggle { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
.reorder-done { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); min-height: 44px; padding: 10px 26px; border: 0; border-radius: 22px; background: var(--primary); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 10px 24px -8px rgba(47, 95, 211, .7); }
@media (min-width: 1024px) { .reorder-done { bottom: 28px; } }
@media (prefers-reduced-motion: reduce) { .jiggling > [data-rid] { animation: none; outline: 2px dashed var(--primary); outline-offset: 2px; } }


/* B43: voice message as in Telegram — the bar on the mic's row, the lock pill above the mic */
.ask-fab-mic, .ask-mic { touch-action: none; }
.vrec { position: fixed; left: 12px; z-index: 60; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; border-radius: 26px; background: var(--surface-solid); color: var(--ink); box-shadow: var(--shadow-lift); overflow: hidden; -webkit-user-select: none; user-select: none; }
.vrec[hidden], .vrec-lock[hidden] { display: none; }
.vrec-btn { width: 40px; height: 40px; flex: none; border: 0; border-radius: 999px; display: grid; place-items: center; background: transparent; color: var(--ink-2); }
.vrec-btn svg { width: 21px; height: 21px; }
.vrec-trash { color: var(--danger); }
.vrec-send { background: var(--primary); color: var(--primary-ink); }
.vrec-stop { background: var(--surface-2); color: var(--danger); }
.vrec-play { background: var(--role-a-soft); color: var(--role-a-text); }
.vrec-play .i-pause, .vrec-play.on .i-play { display: none; }
.vrec-play.on .i-pause { display: block; }
.vrec-dot { width: 10px; height: 10px; flex: none; border-radius: 999px; background: var(--danger); animation: vrec-blink 1s ease-in-out infinite; }
@keyframes vrec-blink { 50% { opacity: .25; } }
.vrec-time { position: relative; z-index: 1; background: var(--surface-solid); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; min-width: 38px; }
.vrec-hint > span { display: inline-block; }
.vrec-hint { flex: 1 1 auto; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); font-weight: 700; font-size: 13.5px; }
/* hold: dot, time, «‹ влево»; locked: trash, dot, time, stop, send; preview: trash, play, time, send */
.vrec[data-state="hold"] .vrec-trash, .vrec[data-state="hold"] .vrec-stop, .vrec[data-state="hold"] .vrec-send,
.vrec .vrec-play, .vrec[data-state="preview"] .vrec-dot, .vrec[data-state="preview"] .vrec-stop,
.vrec[data-state="locked"] .vrec-hint, .vrec[data-state="preview"] .vrec-hint { display: none; }
.vrec[data-state="preview"] .vrec-play { display: grid; }
.vrec[data-state="locked"] .vrec-time, .vrec[data-state="preview"] .vrec-time { flex: 1 1 auto; }
.vrec-lock { position: fixed; z-index: 61; width: 42px; height: 78px; border-radius: 21px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--surface-solid); color: var(--ink-2); box-shadow: var(--shadow-lift); pointer-events: none; }
.vrec-lock svg { width: 20px; height: 20px; }
.vrec-lock svg + svg { animation: vrec-up 1s ease-in-out infinite; }
@keyframes vrec-up { 50% { transform: translateY(-4px); } }
