@property --bg { syntax: "<color>"; inherits: true; initial-value: #000000; }
@property --surface { syntax: "<color>"; inherits: true; initial-value: #0a0a0a; }
@property --surface-hover { syntax: "<color>"; inherits: true; initial-value: #111111; }
@property --surface-pop { syntax: "<color>"; inherits: true; initial-value: #0d0d0d; }
@property --segment-active { syntax: "<color>"; inherits: true; initial-value: #111111; }
@property --segment-active-pop { syntax: "<color>"; inherits: true; initial-value: #171717; }
@property --fill { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.09); }
@property --fill-strong { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.14); }
@property --ink { syntax: "<color>"; inherits: true; initial-value: #f5f5f5; }
@property --ink-2 { syntax: "<color>"; inherits: true; initial-value: #c8c8c8; }
@property --ink-3 { syntax: "<color>"; inherits: true; initial-value: #9a9a9a; }
@property --line { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.24); }
@property --check-border { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.52); }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #4caf78; }
@property --accent-ink { syntax: "<color>"; inherits: true; initial-value: #b7e3cb; }
@property --accent-soft { syntax: "<color>"; inherits: true; initial-value: rgba(76, 175, 120, 0.18); }
@property --accent-border { syntax: "<color>"; inherits: true; initial-value: #4caf78; }
@property --on-accent { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --on-accent-text { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --danger { syntax: "<color>"; inherits: true; initial-value: #e58b82; }
@property --danger-soft { syntax: "<color>"; inherits: true; initial-value: rgba(229, 139, 130, 0.16); }
@property --bar-bg { syntax: "<color>"; inherits: true; initial-value: rgba(0, 0, 0, 0.86); }
@property --toast-bg { syntax: "<color>"; inherits: true; initial-value: #111111; }
@property --sheet-backdrop { syntax: "<color>"; inherits: true; initial-value: rgba(0, 0, 0, 0.58); }
@property --cat-priority { syntax: "<color>"; inherits: true; initial-value: #4caf78; }
@property --cat-priority-ink { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --cat-normal { syntax: "<color>"; inherits: true; initial-value: #f0c14d; }
@property --cat-normal-ink { syntax: "<color>"; inherits: true; initial-value: #1a1400; }
@property --cat-low { syntax: "<color>"; inherits: true; initial-value: #d6d6d6; }
@property --cat-low-ink { syntax: "<color>"; inherits: true; initial-value: #111111; }

:root {
  color-scheme: dark;
  --theme-duration: 0.8s;
  --theme-ease: cubic-bezier(0.45, 0.02, 0.2, 1);
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-hover: #111111;
  --surface-pop: #0d0d0d;
  --segment-active: #111111;
  --segment-active-pop: #171717;
  --fill: rgba(255, 255, 255, 0.09);
  --fill-strong: rgba(255, 255, 255, 0.14);
  --ink: #f5f5f5;
  --ink-2: #c8c8c8;
  --ink-3: #9a9a9a;
  --line: rgba(255, 255, 255, 0.24);
  --check-border: rgba(255, 255, 255, 0.52);
  --accent: #4caf78;
  --accent-ink: #b7e3cb;
  --accent-soft: rgba(76, 175, 120, 0.18);
  --accent-border: #4caf78;
  --on-accent: #ffffff;
  --on-accent-text: #ffffff;
  --danger: #e58b82;
  --danger-soft: rgba(229, 139, 130, 0.16);
  --bar-bg: rgba(0, 0, 0, 0.86);
  --toast-bg: #111111;
  --sheet-backdrop: rgba(0, 0, 0, 0.58);
  --cat-priority: #4caf78;
  --cat-priority-ink: #ffffff;
  --cat-normal: #f0c14d;
  --cat-normal-ink: #1a1400;
  --cat-low: #d6d6d6;
  --cat-low-ink: #111111;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --column: 1180px;
  --radius: 4px;
  --font: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --wordmark: "Outfit", "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f3f2;
  --surface: #ffffff;
  --surface-hover: #e8eae8;
  --surface-pop: #ffffff;
  --segment-active: #ffffff;
  --segment-active-pop: #f7f8f7;
  --fill: rgba(22, 28, 24, 0.055);
  --fill-strong: rgba(22, 28, 24, 0.1);
  --ink: #171a17;
  --ink-2: #3f463f;
  --ink-3: #6a726a;
  --line: rgba(22, 28, 24, 0.11);
  --check-border: rgba(22, 28, 24, 0.38);
  --accent: #2b9a5c;
  --accent-ink: #1d7a48;
  --accent-soft: rgba(43, 154, 92, 0.12);
  --accent-border: #2b9a5c;
  --on-accent: #ffffff;
  --on-accent-text: #ffffff;
  --danger: #c24747;
  --danger-soft: rgba(194, 71, 71, 0.1);
  --bar-bg: rgba(242, 243, 242, 0.88);
  --toast-bg: #111111;
  --sheet-backdrop: rgba(16, 20, 16, 0.28);
  --cat-priority: #2b9a5c;
  --cat-priority-ink: #ffffff;
  --cat-normal: #c4921a;
  --cat-normal-ink: #1a1400;
  --cat-low: #5a605a;
  --cat-low-ink: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-hover: #111111;
  --surface-pop: #0d0d0d;
  --segment-active: #111111;
  --segment-active-pop: #171717;
  --fill: rgba(255, 255, 255, 0.09);
  --fill-strong: rgba(255, 255, 255, 0.14);
  --ink: #f5f5f5;
  --ink-2: #c8c8c8;
  --ink-3: #9a9a9a;
  --line: rgba(255, 255, 255, 0.24);
  --check-border: rgba(255, 255, 255, 0.52);
  --accent: #4caf78;
  --accent-ink: #b7e3cb;
  --accent-soft: rgba(76, 175, 120, 0.18);
  --accent-border: #4caf78;
  --on-accent: #ffffff;
  --on-accent-text: #ffffff;
  --danger: #e58b82;
  --danger-soft: rgba(229, 139, 130, 0.16);
  --bar-bg: rgba(0, 0, 0, 0.86);
  --toast-bg: #111111;
  --sheet-backdrop: rgba(0, 0, 0, 0.58);
  --cat-priority: #4caf78;
  --cat-priority-ink: #ffffff;
  --cat-normal: #f0c14d;
  --cat-normal-ink: #1a1400;
  --cat-low: #d6d6d6;
  --cat-low-ink: #111111;
}

/* Смена темы включается после первого кадра, чтобы загрузка не проигрывала переход. */
html.theme-animate {
  transition-property: --bg, --surface, --surface-hover, --surface-pop, --segment-active, --segment-active-pop, --fill, --fill-strong, --ink, --ink-2, --ink-3, --line, --check-border, --accent, --accent-ink, --accent-soft, --accent-border, --on-accent, --on-accent-text, --danger, --danger-soft, --bar-bg, --toast-bg, --sheet-backdrop, --cat-priority, --cat-priority-ink, --cat-normal, --cat-normal-ink, --cat-low, --cat-low-ink;
  transition-duration: var(--theme-duration);
  transition-timing-function: var(--theme-ease);
}

html.theme-animate .card {
  transition: border-color var(--theme-duration) var(--theme-ease);
}

/* Короткий transition фона иначе конфликтует с анимацией --bg/--surface и даёт моргание. */
html.theme-animate .task-face,
html.theme-animate .archive-face {
  transition: none;
}

html.theme-animate .theme-button svg {
  transition: opacity var(--theme-duration) var(--theme-ease), transform var(--theme-duration) var(--theme-ease);
}

@media (prefers-reduced-motion: reduce) {
  html.theme-animate,
  html.theme-animate .card,
  html.theme-animate .task-face,
  html.theme-animate .archive-face,
  html.theme-animate .theme-button svg {
    transition: none;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  scroll-padding-top: 72px;
  background-color: var(--bg);
  scrollbar-width: auto;
  scrollbar-color: var(--accent) transparent;
}

html.is-locked {
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
select {
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* Ниже 16px Safari на iPhone зумит поле и сдвигает всю страницу. */
input,
textarea,
select {
  font-size: 16px;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--fill-strong);
}

/* Шапка */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}

.bar.is-condensed {
  border-bottom-color: var(--line);
}

.bar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: var(--column);
  height: 56px;
  margin: 0 auto;
  padding: 0 24px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  justify-self: start;
  text-align: left;
}

.logo-word {
  font-family: var(--wordmark);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.logo-mark {
  flex: none;
  width: 3px;
  height: 20px;
  background: var(--accent);
}

.bar-title {
  max-width: 40vw;
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.35s var(--ease);
}

.bar.is-condensed .bar-title {
  opacity: 1;
  transform: none;
}

.bar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 2px;
}

.lang {
  position: relative;
  display: flex;
  align-items: center;
  height: 40px;
  z-index: 3;
}

.lang-toggle {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-toggle:hover,
.lang.is-open .lang-toggle,
.lang:focus-within .lang-toggle {
  background: var(--fill);
  color: var(--ink);
}

.lang-pop {
  position: absolute;
  top: 100%;
  right: -12px;
  display: grid;
  grid-template-rows: 0fr;
  width: 192px;
  padding: 6px 12px 14px;
  opacity: 0;
  pointer-events: none;
  transition: grid-template-rows 0.42s var(--ease), opacity 0.16s ease;
}

.lang-pop-clip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 168px;
  min-height: 0;
  overflow: hidden;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-pop);
}

.lang-option {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 2px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-option:hover,
.lang-option:focus-visible {
  background: var(--fill);
  color: var(--ink);
  outline: none;
}

.lang-option[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

.lang-option[aria-selected="true"]:hover,
.lang-option[aria-selected="true"]:focus-visible {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .lang:hover .lang-pop,
  .lang:focus-within .lang-pop {
    grid-template-rows: 1fr;
    opacity: 1;
    pointer-events: auto;
    transition: grid-template-rows 0.45s var(--ease), opacity 0.28s ease 0.04s;
  }
}

.lang.is-open .lang-pop {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
  transition: grid-template-rows 0.45s var(--ease), opacity 0.28s ease 0.04s;
}

.theme-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-button:hover {
  background: var(--fill);
  color: var(--ink);
}

.theme-button svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
}

.theme-button .icon-sun {
  opacity: 0;
  transform: rotate(-28deg) scale(0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-button .icon-moon {
    opacity: 0;
    transform: rotate(28deg) scale(0.7);
  }

  :root:not([data-theme="light"]) .theme-button .icon-sun {
    opacity: 1;
    transform: none;
  }
}

:root[data-theme="dark"] .theme-button .icon-moon {
  opacity: 0;
  transform: rotate(28deg) scale(0.7);
}

:root[data-theme="dark"] .theme-button .icon-sun {
  opacity: 1;
  transform: none;
}

.archive-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 12px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.archive-button:hover {
  background: var(--fill);
  color: var(--ink);
}

.archive-button svg {
  width: 18px;
  height: 18px;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.count.is-pulse {
  animation: pulse 0.7s var(--ease);
}

@keyframes pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.3); background: var(--accent); color: var(--on-accent-text); }
  100% { transform: scale(1); }
}

/* Страница и сводка */

.page {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 30px 24px 56px;
  background: var(--bg);
}

.site-foot {
  width: 100%;
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.site-foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  max-width: var(--column);
  margin: 0 auto;
  position: relative;
  padding: 20px 24px 28px;
}

.site-foot-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.site-foot-name {
  font-family: var(--wordmark);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.site-foot-note {
  color: var(--ink-3);
  font-size: 13px;
}

.site-foot-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-left: auto;
}

.site-foot-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.site-foot-link svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-2);
  stroke-width: 1.6;
}

.site-foot-link:hover {
  background: var(--fill);
  border-color: color-mix(in srgb, var(--ink) 28%, var(--line));
}

.site-foot-link:hover svg {
  color: var(--ink);
}

.site-foot-actions {
  display: flex;
  gap: 8px;
}

.studio {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: inline-flex;
  width: max-content;
  max-width: calc(100% - 560px);
  color: var(--ink);
  text-decoration: none;
  transform: translate(-50%, -50%);
}

.studio:focus-visible {
  outline: none;
}

.studio-view {
  position: relative;
  height: 22px;
}

.studio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  white-space: nowrap;
}

.studio-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--check-border);
  border-radius: 4px;
  color: var(--on-accent);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.studio-check svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  transition: stroke-dashoffset 0.32s var(--ease) 0.06s;
}

.studio-kicker {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1;
}

.studio-name {
  font-family: var(--wordmark);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.studio:hover .studio-check,
.studio:focus-visible .studio-check,
.studio.is-near .studio-check {
  border-color: var(--accent);
  background: var(--accent);
}

.studio:hover .studio-check svg,
.studio:focus-visible .studio-check svg,
.studio.is-near .studio-check svg {
  stroke-dashoffset: 0;
}

.studio:hover .studio-name,
.studio:focus-visible .studio-name,
.studio.is-near .studio-name {
  color: var(--accent-ink);
}

.studio:focus-visible .studio-row {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .studio-check,
  .studio-check svg {
    transition: none;
  }
}

.hero {
  padding-bottom: 24px;
}

.project-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 42ch);
  margin-left: -10px;
  padding: 2px 8px 2px 10px;
  border-radius: var(--radius);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.project-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chevron {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 4px;
  color: var(--ink-3);
  stroke-width: 2;
  transition: transform 0.3s var(--ease), color 0.2s ease;
}

@media (hover: hover) {
  .project-switch:hover .chevron {
    color: var(--ink);
    transform: translateY(2px);
  }
}

.project-switch[aria-expanded="true"] .chevron {
  color: var(--ink);
  transform: rotate(180deg);
}

.progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 8px;
  row-gap: 11px;
  margin-top: 16px;
}

.progress-value {
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.progress-label {
  color: var(--ink-2);
  font-size: 15px;
}

.progress.is-empty .progress-value,
.progress.is-empty .progress-track {
  display: none;
}

.progress.is-empty .progress-label {
  grid-column: 1 / -1;
}

.progress-track {
  grid-column: 1 / -1;
  height: 2px;
  overflow: hidden;
  background: var(--fill-strong);
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.7s var(--ease);
}

/* Переключатель категорий */

.segments {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 8px 6px 7px;
  color: var(--ink-2);
  transition: color 0.2s ease, box-shadow 0.2s ease;
}

.segment + .segment {
  border-left: 1px solid var(--line);
}

.segment:hover {
  color: var(--ink);
}

.segment[aria-selected="true"] {
  color: var(--ink);
  box-shadow: inset 0 -1.5px 0 var(--ink);
}

.segment-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.segment-meta {
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}

.segment.is-warn .segment-meta,
.group.is-warn .group-count {
  color: var(--ink-2);
}

.segment.is-full .segment-meta,
.group.is-full .group-count {
  color: var(--ink);
  font-weight: 600;
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-priority { background: var(--cat-priority); }
.dot-normal { background: var(--cat-normal); }
.dot-low { background: var(--cat-low); }

/* Секции задач */

.board {
  display: grid;
  gap: 34px;
}

.group[data-category="priority"] {
  --cat: var(--cat-priority);
  --cat-ink: var(--cat-priority-ink);
}

.group[data-category="normal"] {
  --cat: var(--cat-normal);
  --cat-ink: var(--cat-normal-ink);
}

.group[data-category="low"] {
  --cat: var(--cat-low);
  --cat-ink: var(--cat-low-ink);
}

.group-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 6px 10px;
}

.group-head h2 {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.pips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--cat) 62%, transparent);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.pip.is-on {
  background: var(--cat);
  box-shadow: none;
}

.group-count {
  min-width: 52px;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  transition: color 0.2s ease;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.group .card {
  border-left: 2px solid var(--cat);
}

.task {
  position: relative;
  min-height: 56px;
  cursor: text;
}

.task.is-new,
.task-face {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  min-height: 56px;
  padding: 0 10px 0 16px;
}

.task-face {
  position: relative;
  z-index: 1;
  background: var(--bg);
  transition: background 0.15s ease;
}

.task + .task .task-face::before,
.task + .task.is-new::before,
.task + .limit-note::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 62px;
  height: 1px;
  background: var(--line);
}

.task.is-new:hover,
.task.is-new:focus-within,
.task:hover .task-face,
.task:focus-within .task-face {
  background: var(--surface-hover);
}

.task.is-swiping .task-face,
.task.is-swiping:hover .task-face,
.task.is-swiping:focus-within .task-face,
.task.is-settling .task-face,
.task.is-settling:hover .task-face,
.task.is-settling:focus-within .task-face,
.task.is-committing .task-face {
  background: var(--bg);
  animation: none;
}

.task.is-restored .task-face {
  animation: restored 1.4s ease;
}

@keyframes restored {
  0%, 30% { background: var(--fill-strong); }
  100% { background: transparent; }
}

/* Свайп строки на десктопе */

.task.is-swiping,
.task.is-committing,
.task.is-settling,
.archive-item.is-swiping,
.archive-item.is-committing,
.archive-item.is-settling {
  overflow: hidden;
}

.task.is-committing,
.task.is-leaving,
.archive-item.is-committing {
  pointer-events: none;
}

.swipe-action {
  position: absolute;
  inset: 0;
  z-index: 0;
  color: #fff;
  pointer-events: none;
  opacity: 0;
}

.swipe-action.is-trailing {
  background: #e23d34;
}

.swipe-action.is-leading {
  background: #1f8a4c;
}

.task.is-swipe-left .swipe-action.is-trailing,
.archive-item.is-swipe-left .swipe-action.is-trailing,
.task.is-swipe-right .swipe-action.is-leading,
.archive-item.is-swipe-right .swipe-action.is-leading {
  opacity: 1;
}

.task.is-armed.is-swipe-left .swipe-action.is-trailing,
.archive-item.is-armed.is-swipe-left .swipe-action.is-trailing {
  background: #c92e26;
}

.task.is-armed.is-swipe-right .swipe-action.is-leading,
.archive-item.is-armed.is-swipe-right .swipe-action.is-leading {
  background: #187243;
}

.swipe-icon {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  opacity: 0;
}

.swipe-action.is-trailing .swipe-icon {
  right: 0;
}

.swipe-action.is-leading .swipe-icon {
  left: 0;
}

.swipe-icon svg {
  width: 23px;
  height: 23px;
  stroke-width: 2;
}

.task[data-index],
.archive-item,
.deleted-item {
  touch-action: pan-y;
  -webkit-touch-callout: none;
}

.task.is-holding .task-face {
  background: var(--surface-hover);
  transform: scale(1.012);
}

.task.is-holding,
.task.is-lifting,
.task.is-swiping,
.archive-item.is-swiping,
.deleted-item.is-swiping {
  touch-action: none;
}

html.is-row-holding,
html.is-row-dragging {
  touch-action: none;
  overscroll-behavior: none;
}

html.is-select-locked,
html.is-select-locked *,
html.is-row-holding,
html.is-row-holding *,
html.is-row-dragging,
html.is-row-dragging * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

html.is-row-dragging,
html.is-row-dragging * {
  cursor: grabbing !important;
}

.task.is-lifting {
  z-index: 30;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.18);
  transform: scale(1.015);
}

.task.is-lifting .task-face {
  background: var(--bg);
  border-radius: inherit;
}

.task-gap {
  position: relative;
  box-sizing: border-box;
  border-radius: 12px;
  background: var(--fill);
}

.task-gap::before {
  content: '';
  position: absolute;
  inset: 8px 12px;
  border: 1.5px dashed var(--ink-3);
  border-radius: 9px;
}

.task-copy {
  position: relative;
  min-width: 0;
  padding: 16px 0;
}

.task-text,
.task-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 23px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.task-text {
  height: 23px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: text;
  user-select: none;
}

.task.is-partial .task-text {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
}

.task-title {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
  white-space: pre-wrap;
}

.task:not(.is-new):not(.is-writing) .task-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

.task.is-new .task-title,
.task.is-writing .task-title {
  position: relative;
  width: 100%;
  height: 23px;
  margin: 0;
  clip-path: none;
}

.task.is-new .task-text,
.task.is-writing .task-text {
  display: none;
}

.task.is-multiline.is-new,
.task.is-multiline .task-face {
  align-items: start;
}

.task.is-multiline .check,
.task.is-multiline .add-icon {
  margin-top: 17px;
}

.task.is-multiline .task-dates {
  margin-top: 9px;
}

.task-reveal {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 72px;
  height: 16px;
  color: var(--ink-3);
  cursor: ns-resize;
  touch-action: none;
  transform: translateX(-50%);
}

.task-reveal svg {
  width: 18px;
  height: 10px;
}

.task:hover .task-reveal,
.task-reveal:hover,
.task-reveal:focus-visible {
  color: var(--ink-2);
}

html.is-revealing,
html.is-revealing * {
  cursor: ns-resize !important;
  user-select: none !important;
}

.task-title::placeholder {
  color: var(--ink-3);
  font-weight: 400;
}

.task-title:disabled {
  -webkit-text-fill-color: currentColor;
  opacity: 1;
}

.add-icon {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 22px;
  height: 22px;
  color: var(--ink-3);
  transition: opacity 0.2s ease;
}

.add-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.task.is-new .task-title::placeholder {
  color: var(--ink-3);
}

.task.is-new:focus-within .add-icon {
  opacity: 0.45;
}

/* Галочка */

.check {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--cat, var(--check-border));
  border-radius: 4px;
  color: var(--cat-ink, var(--on-accent));
  transition: border-color 0.2s ease, background 0.25s ease, transform 0.2s var(--ease), opacity 0.2s ease;
}

.check::before {
  content: '';
  position: absolute;
  inset: -11px;
}

.check:hover {
  background: color-mix(in srgb, var(--cat, var(--ink)) 14%, transparent);
}

.check:active {
  transform: scale(0.92);
}

.check svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  transition: stroke-dashoffset 0.32s var(--ease) 0.06s;
}

.task.is-empty .check {
  opacity: 0.3;
  pointer-events: none;
}

.task.is-done .check {
  border-color: var(--cat);
  background: var(--cat);
  color: var(--cat-ink);
}

.task.is-done .check svg {
  stroke-dashoffset: 0;
}

.task.is-done .task-title,
.task.is-done .task-text {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}

.task.is-done .task-dates {
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.limit-note {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  min-height: 52px;
  padding: 0 16px;
  color: var(--ink-3);
  font-size: 14px;
}

.limit-note svg {
  justify-self: center;
  width: 17px;
  height: 17px;
}

/* Поля дат */

.task-dates {
  display: flex;
  gap: 6px;
}

.task-dates.is-fresh {
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateX(4px); }
  to { opacity: 1; transform: none; }
}

.date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  cursor: text;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.task:hover .date:not(:focus-within):not(.is-invalid),
.task:focus-within .date:not(:focus-within):not(.is-invalid),
.date.has-value:not(:focus-within):not(.is-invalid) {
  border-color: transparent;
  background: var(--fill);
}

.date:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.date-label {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.date-box {
  position: relative;
  display: block;
  width: 9.3ch;
  height: 20px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}

.date-input,
.date-ghost {
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 20px;
}

.date-input {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 20px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
}

.date-input:disabled {
  -webkit-text-fill-color: currentColor;
  opacity: 1;
}

.date-ghost {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--ink-3);
  font-weight: 500;
  white-space: pre;
  pointer-events: none;
}

.date-ghost-typed {
  color: transparent;
}

.date-cal {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 2px;
  color: var(--ink-3);
  transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.date-cal svg {
  width: 18px;
  height: 18px;
}

.date-cal:hover {
  background: var(--fill-strong);
  color: var(--ink);
}

.date:not(.has-value) .date-cal {
  opacity: 0;
}

.task:hover .date-cal,
.task:focus-within .date-cal {
  opacity: 1;
}

.date.is-soon:not(:focus-within) {
  background: var(--fill-strong);
}

.date.is-soon .date-input,
.date.is-soon .date-label {
  color: var(--ink);
}

.date.is-overdue:not(:focus-within) {
  background: var(--danger-soft);
}

.date.is-overdue .date-input,
.date.is-overdue .date-label {
  color: var(--danger);
}

.date.is-invalid,
.date.is-invalid:focus-within {
  border-color: var(--danger);
  animation: shake 0.32s ease;
}

@keyframes shake {
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

/* Всплывающие окна */

.popover {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-pop);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.16s ease, transform 0.28s var(--ease);
}

.popover[data-side="top"] {
  transform: translateY(6px) scale(0.98);
  transform-origin: bottom left;
}

.popover.is-open {
  opacity: 1;
  transform: none;
}

.menu {
  width: 300px;
  padding: 6px;
}

.menu-label {
  padding: 8px 10px 6px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.menu-list {
  max-height: min(320px, 50vh);
  max-height: min(320px, 50lvh);
  overflow: auto;
  overscroll-behavior: contain;
}

.menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px 0 10px;
  border-radius: 2px;
  font-size: 15px;
  text-align: left;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--fill);
  outline: none;
}

.menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--ink);
  stroke-width: 2.2;
  opacity: 0;
}

.menu-item[aria-checked="true"] {
  font-weight: 600;
}

.menu-item[aria-checked="true"] svg {
  opacity: 1;
}

.menu-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.menu-meta {
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.menu-footer {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.new-project {
  display: flex;
  gap: 6px;
  padding: 4px;
}

.new-project input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  outline: none;
  background: var(--fill);
  font-size: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.new-project input::placeholder {
  color: var(--ink-3);
}

.new-project input:focus {
  border-color: var(--accent);
  background: var(--surface-pop);
}

.new-project button {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.new-project button:disabled {
  opacity: 0.3;
  cursor: default;
}

.project-limit {
  margin: 0;
  padding: 8px 10px 6px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
}

/* Календарь */

.calendar {
  width: 300px;
  padding: 14px 12px 10px;
  user-select: none;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-left: 8px;
}

.cal-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.cal-nav {
  display: flex;
  gap: 2px;
}

.cal-nav button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: background 0.15s ease;
}

.cal-nav button:hover {
  background: var(--fill);
}

.cal-nav svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.cal-week,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-week span {
  padding: 2px 0 6px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.cal-day {
  width: 36px;
  height: 36px;
  margin: 1px auto;
  border-radius: 50%;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s ease;
}

.cal-day:hover {
  background: var(--fill);
}

.cal-day.is-outside {
  color: var(--ink-3);
}

.cal-day.is-today {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-day.is-selected {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.cal-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.cal-foot button {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.cal-foot button + button {
  color: var(--ink-2);
}

.cal-foot button:hover {
  background: var(--fill);
}

/* Архив */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--sheet-backdrop);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.sheet.is-open .sheet-backdrop {
  opacity: 1;
}

.sheet-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 20px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface-pop);
  transform: translateX(calc(100% + 24px));
  transition: transform 0.45s var(--ease);
}

.sheet.is-open .sheet-panel {
  transform: none;
}

.sheet-panel.is-dragging {
  transition: none;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 14px 24px;
}

.sheet-head h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sheet-head p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 14px;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-button:hover {
  background: var(--fill-strong);
  color: var(--ink);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.sheet-tools {
  display: grid;
  gap: 12px;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--line);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-3);
  cursor: text;
  transition: border-color 0.15s ease;
}

.search:focus-within {
  border-color: var(--accent);
}

.search > svg {
  flex: none;
  width: 17px;
  height: 17px;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.search input::placeholder {
  color: var(--ink-3);
}

.search-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 2px;
  background: var(--ink-3);
  color: var(--surface-pop);
}

.search-clear svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease, box-shadow 0.2s ease;
}

.chip + .chip {
  border-left: 1px solid var(--line);
}

.chip:hover {
  color: var(--ink);
}

.chip[aria-checked="true"] {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -1.5px 0 var(--ink);
}

.sheet-body {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 20px 28px;
}

.archive-day {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 18px 4px 8px;
  background: linear-gradient(var(--surface-pop) 75%, transparent);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.archive-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-item {
  position: relative;
  border-radius: var(--radius);
}

.archive-face {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 10px 8px;
  border-radius: inherit;
  background: var(--surface-pop);
  transition: background 0.18s ease;
}

.archive-item:hover .archive-face,
.archive-item:focus-within .archive-face {
  background: linear-gradient(var(--fill), var(--fill)), var(--surface-pop);
}

.archive-item.is-swiping .archive-face,
.archive-item.is-swiping:hover .archive-face,
.archive-item.is-settling .archive-face,
.archive-item.is-settling:hover .archive-face,
.archive-item.is-committing .archive-face {
  background: var(--surface-pop);
  animation: none;
}

.archive-item + .archive-item .archive-face::before {
  content: '';
  position: absolute;
  top: 0;
  right: 6px;
  left: 6px;
  height: 1px;
  background: var(--line);
}

.archive-item.is-fresh .archive-face {
  animation: restored 2.2s ease;
}

.archive-group.is-leaving,
.archive-item.is-leaving {
  pointer-events: none;
}

.archive-restore {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease, transform 0.2s var(--ease);
}

.archive-item:hover .archive-restore,
.archive-restore:hover,
.archive-restore:focus-visible {
  background: var(--fill-strong);
  color: var(--ink);
}

.archive-restore:active {
  transform: scale(0.9);
}

.archive-restore svg {
  width: 18px;
  height: 18px;
  transition: transform 0.28s var(--ease);
}

.archive-restore:hover svg,
.archive-restore:focus-visible svg {
  transform: translateX(-1.5px);
}

.archive-restore.is-denied {
  animation: shake 0.32s ease;
}

.archive-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-actions .archive-restore,
.archive-delete {
  width: 40px;
  height: 36px;
}

.archive-delete {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease, transform 0.2s var(--ease);
}

.archive-item:hover .archive-delete,
.archive-delete:hover,
.archive-delete:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}

.archive-delete:active {
  transform: scale(0.9);
}

.archive-delete svg {
  width: 16px;
  height: 16px;
}

.archive-title {
  font-size: 15px;
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.archive-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 7px;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 13px;
}

.archive-meta > span {
  white-space: nowrap;
}

.archive-meta > span + span::before {
  content: '·';
  margin-right: 7px;
}

.archive-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}

.archive-item[data-category="priority"] .archive-cat,
.deleted-item[data-category="priority"] .archive-cat { color: var(--cat-priority); }
.archive-item[data-category="normal"] .archive-cat,
.deleted-item[data-category="normal"] .archive-cat { color: var(--cat-normal); }
.archive-item[data-category="low"] .archive-cat,
.deleted-item[data-category="low"] .archive-cat { color: var(--cat-low); }

.archive-time {
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.archive-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 72px 24px;
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
}

.archive-empty svg {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  stroke-width: 1.4;
}

.archive-empty strong {
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.archive-empty span {
  max-width: 360px;
}

/* Профиль */

.profile-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-button:hover,
.profile-button[aria-pressed="true"] {
  background: var(--fill);
  color: var(--ink);
}

.profile-button svg {
  width: 18px;
  height: 18px;
}

.profile-button .count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--bar-bg);
  font-size: 10px;
}

.profile-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 12px -8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-back:hover {
  background: var(--fill);
  color: var(--ink);
}

.profile-back svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.profile-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.profile-lead {
  margin-top: 6px;
  color: var(--ink-2);
}

.profile-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-block {
  margin-bottom: 28px;
}

.profile-block h2 {
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  text-align: left;
  transition: background 0.15s ease;
}

.profile-stat + .profile-stat {
  border-left: 1px solid var(--line);
}

.profile-stat:hover {
  background: var(--fill);
}

.profile-stat strong {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.profile-stat span {
  color: var(--ink-2);
  font-size: 13px;
}

.profile-rename {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.profile-field {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.profile-field span {
  color: var(--ink-3);
  font-size: 12px;
}

.profile-field input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.profile-field input:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.profile-note {
  max-width: 560px;
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-theme {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 480px;
}

.text-button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.text-button:hover:not(:disabled) {
  background: var(--fill);
}

.text-button:disabled {
  color: var(--ink-3);
  cursor: default;
}

.text-button.is-danger {
  color: var(--danger);
}

.text-button.is-danger:hover:not(:disabled) {
  background: var(--danger-soft);
}

.profile-projects {
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.profile-projects li + li {
  border-top: 1px solid var(--line);
}

.profile-project {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  text-align: left;
  transition: background 0.15s ease;
}

.profile-project:hover {
  background: var(--fill);
}

.profile-project.is-current {
  box-shadow: inset 2px 0 0 var(--ink);
}

.profile-project-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-project.is-current .profile-project-name {
  font-weight: 600;
}

.profile-project-meta {
  flex: none;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.deleted-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 14px;
}

.deleted-toolbar p {
  color: var(--ink-2);
  font-size: 14px;
}

#deleted-list .archive-group {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

#profile .archive-day {
  position: static;
  padding: 12px 14px 0;
  background: transparent;
}

.deleted-item {
  position: relative;
  border-radius: var(--radius);
}

.deleted-face {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
}

.deleted-item + .deleted-item .deleted-face {
  box-shadow: inset 0 1px 0 var(--line);
}

.deleted-item.is-swiping,
.deleted-item.is-committing,
.deleted-item.is-settling {
  overflow: hidden;
}

.deleted-item.is-committing,
.deleted-item.is-leaving {
  pointer-events: none;
}

.deleted-item.is-swipe-left .swipe-action.is-trailing,
.deleted-item.is-swipe-right .swipe-action.is-leading {
  opacity: 1;
}

.deleted-item.is-armed.is-swipe-left .swipe-action.is-trailing {
  background: #c92e26;
}

.deleted-item.is-armed.is-swipe-right .swipe-action.is-leading {
  background: #187243;
}

.deleted-item.is-swiping .deleted-face,
.deleted-item.is-settling .deleted-face,
.deleted-item.is-committing .deleted-face {
  background: var(--bg);
}

.deleted-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Уведомление */

.toasts {
  position: fixed;
  right: 0;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 8px 8px 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: #f5f5f5;
  opacity: 0;
  pointer-events: auto;
  transform: translateY(18px);
  transition: opacity 0.22s ease, transform 0.4s var(--ease);
}

.toast.is-open {
  opacity: 1;
  transform: none;
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.toast-icon svg {
  width: 10px;
  height: 10px;
  stroke: #f5f5f5;
  stroke-width: 2;
}

.toast-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.toast-text strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.toast-label-short {
  display: none;
}

.toast-text span {
  max-width: 240px;
  overflow: hidden;
  color: rgba(245, 245, 243, 0.78);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.toast-actions {
  display: flex;
  gap: 2px;
  margin-left: 6px;
}

.toast-action {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #f5f5f5;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.toast-action + .toast-action {
  color: rgba(245, 245, 243, 0.88);
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.09);
}

.toast.toast-ask {
  position: fixed;
  left: 50%;
  bottom: max(112px, calc(96px + env(safe-area-inset-bottom)));
  z-index: 55;
  gap: 16px;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 8px 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-pop);
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, 12px);
}

.toast.toast-ask.is-open {
  transform: translate(-50%, 0);
}

.toast-ask .toast-text {
  flex: 1;
  gap: 1px;
}

.toast-ask .toast-text strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.toast-ask .toast-text span {
  max-width: none;
  overflow: visible;
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: unset;
}

.toast-ask .toast-actions {
  gap: 2px;
  margin-left: 0;
}

.toast-ask .toast-action {
  height: 32px;
  padding: 0 12px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
}

.toast-ask .toast-action + .toast-action {
  background: transparent;
  color: var(--ink-2);
}

.toast-ask .toast-action:hover {
  background: var(--ink);
  opacity: 0.86;
}

.toast-ask .toast-action + .toast-action:hover {
  background: var(--fill);
  color: var(--ink);
  opacity: 1;
}

.toast-ask .toast-close {
  width: 32px;
  height: 32px;
  color: var(--ink-3);
}

.toast-ask .toast-close:hover {
  background: var(--fill);
  color: var(--ink);
}

.toast-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin-left: 2px;
  border-radius: var(--radius);
  color: rgba(245, 245, 243, 0.72);
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #f5f5f5;
}

.toast-close svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.feedback {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}

.feedback-backdrop {
  position: absolute;
  inset: 0;
  background: var(--sheet-backdrop);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.feedback.is-open .feedback-backdrop {
  opacity: 1;
}

.feedback-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: min(680px, calc(100dvh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface-pop);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.22s ease, transform 0.4s var(--ease);
}

.feedback.is-open .feedback-panel {
  opacity: 1;
  transform: none;
}

.feedback-panel.is-lifted {
  transition: none;
  overscroll-behavior: contain;
}

.feedback-panel.is-lifted .feedback-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-pop);
}

.feedback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 14px 0 22px;
}

.feedback-head h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.feedback-head p {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 14px;
}

.feedback form {
  display: grid;
  gap: 14px;
  padding: 18px 22px 22px;
}

.stars {
  display: flex;
  gap: 2px;
  width: fit-content;
  border-radius: var(--radius);
  user-select: none;
}

.star {
  position: relative;
  width: 36px;
  height: 36px;
  color: var(--ink-3);
  cursor: pointer;
}

.star svg {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.4;
}

.star > svg {
  fill: none;
}

.star-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--part, 0) * 100%);
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  pointer-events: none;
  transition: width 0.12s ease;
}

.star-fill svg {
  fill: currentColor;
  stroke: currentColor;
}

.stars-caption {
  margin-top: -6px;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.feedback-field {
  display: grid;
  gap: 5px;
}

.feedback-field span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.feedback-field em {
  color: var(--ink-3);
  font-style: normal;
  font-weight: 400;
}

.feedback-field input,
.feedback-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.feedback-field input {
  height: 40px;
  padding: 0 12px;
}

.feedback-field textarea {
  min-height: 96px;
  max-height: 218px;
  padding: 10px 12px;
  overflow-y: auto;
  resize: vertical;
}

#feedback-idea-text {
  max-height: 262px;
}

.feedback-field input:focus-visible,
.feedback-field textarea:focus-visible {
  outline: none;
  border-color: var(--ink);
}

.feedback-error {
  color: var(--danger);
  font-size: 13px;
}

.feedback-submit {
  justify-self: start;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.feedback-submit:disabled {
  opacity: 0.38;
  cursor: default;
}

.signup-prompt {
  z-index: 65;
}

.signup-prompt .feedback-head {
  padding-right: 22px;
}

.signup-body {
  display: grid;
  gap: 16px;
  padding: 10px 22px 22px;
}

.signup-copy {
  display: grid;
  gap: 8px;
}

.signup-copy p {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.signup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.signup-later {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}

.signup-later:hover {
  background: var(--fill);
}

.wipe {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.wipe.is-open {
  opacity: 1;
}

.wipe-panel {
  width: min(560px, 100%);
  outline: none;
}

.wipe-panel h2 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.wipe-panel p {
  max-width: 46ch;
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.45;
}

.wipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.wipe-back,
.wipe-confirm {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 600;
}

.wipe-back {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.wipe-back:hover {
  background: var(--fill);
}

.wipe-confirm {
  border: 0;
  background: #9f2d2d;
  color: #ffffff;
}

.wipe-confirm:hover:not(:disabled) {
  filter: brightness(1.08);
}

.wipe-confirm:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .star-fill,
  .feedback-backdrop,
  .feedback-panel,
  .wipe {
    transition: none;
  }
}

/* Вход и регистрация */

#profile.is-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  width: 100%;
  max-width: none;
  min-height: calc(100dvh - 56px);
  padding: 40px 24px 80px;
}

#profile.is-gate .hero,
#profile.is-gate #auth-gate {
  width: min(400px, 100%);
}

#profile.is-gate .hero {
  padding-bottom: 0;
}

#profile.is-gate .profile-title {
  font-size: 36px;
  letter-spacing: -0.04em;
}

#profile.is-gate .profile-lead {
  max-width: 34ch;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.45;
}

#profile.is-welcome .hero {
  display: none;
}

#profile.is-terms {
  width: min(680px, calc(100% - 48px));
  max-width: 680px;
  margin-right: auto;
  margin-left: auto;
  padding-top: 36px;
}

.auth-card {
  animation: auth-in 0.45s var(--ease);
}

.auth-done {
  display: grid;
  justify-items: center;
  padding: 36px 0 8px;
  text-align: center;
  animation: auth-in 0.45s var(--ease);
}

.auth-done-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  color: var(--accent);
  animation: auth-mark 0.5s var(--ease);
}

.auth-done-mark svg {
  width: 76px;
  height: 76px;
  stroke: currentColor;
  stroke-width: 1.7;
}

.auth-done-mark path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: auth-draw 0.55s var(--ease) 0.18s forwards;
}

.auth-done h2 {
  margin-top: 18px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-done p {
  margin-top: 8px;
  color: var(--ink-2);
}

@keyframes auth-mark {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: none; }
}

@keyframes auth-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes auth-label {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.auth-switch {
  display: flex;
  gap: 22px;
  margin: 26px 0 22px;
}

.auth-switch button {
  position: relative;
  padding: 0 0 8px;
  color: var(--ink-3);
  font-size: 15px;
  font-weight: 500;
}

.auth-switch button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.auth-switch button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1.5px;
  background: var(--ink);
}

.auth-fields {
  display: grid;
  gap: 16px;
}

.auth-field {
  display: grid;
  gap: 5px;
}

.auth-field > span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.auth-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input:hover {
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
}

.auth-field input:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--fill);
}

.auth-field input.is-invalid {
  border-color: var(--danger);
  animation: shake 0.32s ease;
}

.auth-password {
  position: relative;
  display: block;
}

.auth-password input {
  padding-right: 48px;
}

.auth-reveal {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 46px;
  height: 48px;
  color: var(--ink-3);
  transition: color 0.15s ease;
}

.auth-reveal:hover {
  color: var(--ink);
}

.auth-reveal svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  transition: opacity 0.2s ease, transform 0.25s var(--ease);
}

.auth-reveal .eye-shut {
  opacity: 0;
  transform: scale(0.86);
}

.auth-reveal[aria-pressed="true"] .eye-open {
  opacity: 0;
  transform: scale(0.86);
}

.auth-reveal[aria-pressed="true"] .eye-shut {
  opacity: 1;
  transform: none;
}

.auth-consent {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.42s var(--ease), opacity 0.28s ease, margin-top 0.42s var(--ease);
}

.auth-card[data-mode="register"] .auth-consent {
  grid-template-rows: 1fr;
  margin-top: 14px;
  opacity: 1;
}

.auth-consent-inner {
  /* Needed for 0fr collapse; side padding so the nudge never hits the clip edge. */
  overflow: hidden;
  padding-inline: 10px;
  margin-inline: -10px;
}

.auth-check-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  min-height: 28px;
  padding-bottom: 2px;
  will-change: transform;
}

.auth-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}

.auth-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.auth-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--check-border);
  border-radius: 4px;
  color: var(--on-accent-text);
  transition: border-color 0.2s ease, background 0.25s ease, transform 0.2s var(--ease);
}

.auth-box svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  transition: stroke-dashoffset 0.32s var(--ease) 0.05s;
}

.auth-check:hover .auth-box {
  border-color: var(--accent);
}

.auth-check input:focus-visible + .auth-box {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.auth-check input:checked + .auth-box {
  border-color: var(--accent);
  background: var(--accent);
}

.auth-check input:checked + .auth-box svg {
  stroke-dashoffset: 0;
}

.auth-check input:active + .auth-box {
  transform: scale(0.92);
}

.auth-check-line.is-shake {
  animation: auth-nudge 0.48s cubic-bezier(0.33, 0.1, 0.2, 1);
}

@keyframes auth-nudge {
  0%, 100% { transform: translateX(0); }
  12% { transform: translateX(-6px); }
  28% { transform: translateX(6px); }
  44% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  76% { transform: translateX(-1.5px); }
}

.auth-terms-link {
  padding: 0;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.auth-terms-link:hover {
  color: var(--accent);
}

.auth-error {
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
}

.auth-error.is-shake {
  animation: shake 0.32s ease;
}

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  transition: transform 0.2s var(--ease), opacity 0.2s ease;
}

.auth-submit-label {
  display: inline-block;
  animation: auth-label 0.35s var(--ease);
}

.auth-submit:hover:not(:disabled) {
  opacity: 0.88;
}

.auth-submit:active:not(:disabled) {
  transform: scale(0.985);
}

.auth-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

.auth-split {
  margin: 16px 0 12px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}

.auth-recover {
  display: block;
  margin: 2px auto 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}

.auth-recover:hover {
  color: var(--ink);
}

.auth-card[data-mode="register"] .auth-recover {
  display: none;
}

.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-google:hover {
  background: var(--fill);
  border-color: color-mix(in srgb, var(--ink) 18%, var(--line));
}

.auth-google svg {
  width: 18px;
  height: 18px;
  stroke: none;
}

.auth-google svg path {
  stroke: none;
}

.auth-google .g-blue { fill: #4285f4; }
.auth-google .g-green { fill: #34a853; }
.auth-google .g-yellow { fill: #fbbc05; }
.auth-google .g-red { fill: #ea4335; }

.auth-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-telegram:hover {
  background: var(--fill);
  border-color: color-mix(in srgb, var(--ink) 18%, var(--line));
}

.auth-telegram:disabled {
  cursor: default;
  opacity: 0.72;
}

.auth-telegram svg {
  width: 18px;
  height: 18px;
  stroke: none;
}

.auth-telegram svg path {
  fill: #2AABEE;
  stroke: none;
}

.auth-wait {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.auth-wait a {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-weight: 500;
}

.account-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.account-card .profile-rename {
  border: 0;
  border-radius: 0;
}

.account-password + .profile-rename {
  border-top: 1px solid var(--line);
}

.account-card-top,
.account-password {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.account-password {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border-top: 1px solid var(--line);
}

.account-password-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.account-card-top strong {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-password-main {
  min-width: 0;
}

.account-password-label {
  display: block;
  margin-bottom: 2px;
  color: var(--ink-3);
  font-size: 12px;
}

.account-quiet {
  flex: none;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.account-quiet:hover {
  color: var(--ink);
}

.account-row {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.account-row:hover {
  background: var(--fill);
}

.account-row.is-danger {
  color: var(--danger);
}

.account-row.is-danger:hover {
  background: var(--danger-soft);
}

.account-card-note {
  margin: 0;
  padding: 14px 16px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}

.account-card-error {
  margin: 0;
  padding: 0 16px 12px;
}

.account-card-error[hidden] {
  display: none;
}

.profile-secret {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.profile-secret-value {
  overflow: hidden;
  max-width: 28ch;
  color: var(--ink-2);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-secret-value.is-open {
  letter-spacing: 0;
}

.profile-secret .auth-reveal {
  position: static;
  width: 28px;
  height: 28px;
}

.profile-secret-note {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
}

#account-password-form {
  margin-top: 0;
}

.account-switch {
  margin-bottom: 28px;
}

.account-switch-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: transparent;
}

.account-switch-options button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 84px;
  padding: 16px 18px 15px;
  border: 1px solid var(--line);
  text-align: left;
  color: var(--ink-2);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.account-switch-options button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.account-switch-options button:last-child {
  margin-left: -1px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.account-switch-options button:hover {
  color: var(--ink);
}

.account-switch-options button[aria-selected="true"] {
  z-index: 1;
  border-color: var(--ink);
  color: var(--ink);
}

.account-switch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.account-switch-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.account-switch-now {
  display: none;
  flex: none;
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
}

.account-switch-options button[aria-selected="true"] .account-switch-now {
  display: inline;
}

.account-switch-meta {
  max-width: 36ch;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
}

.account-switch-options button[aria-selected="true"] .account-switch-meta {
  color: var(--ink-2);
}

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.hero-tools .project-switch {
  flex: 1 1 auto;
  min-width: 0;
}

.hero-tools .team-open {
  margin-left: auto;
}

.member-board-back,
.team-open,
.member-remove {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.member-board-back {
  padding-left: 6px;
}

.member-board-back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.member-board-back:hover,
.team-open:hover {
  background: var(--fill);
  color: var(--ink);
}

.member-remove {
  color: var(--danger);
}

.member-remove:hover {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

.space-context {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
}

/* Managing a member’s board: nav + danger on one row, project as the title below */
.hero.is-managing .hero-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "back remove"
    "project project";
  gap: 12px 14px;
  align-items: center;
  margin-bottom: 2px;
}

.hero.is-managing .member-board-back {
  grid-area: back;
  justify-self: start;
}

.hero.is-managing .member-remove {
  grid-area: remove;
  justify-self: end;
}

.hero.is-managing .project-switch {
  grid-area: project;
  flex: none;
  width: fit-content;
  max-width: 100%;
  margin-left: -10px;
}

.hero.is-managing .team-open {
  display: none;
}

.hero.is-managing .space-context {
  margin: 6px 0 0;
}

.hero.is-managing .progress {
  margin-top: 18px;
}

.auth-card[data-mode="login"] .auth-kind {
  display: none;
}

.auth-kind {
  margin-top: 18px;
}

.auth-kind-switch {
  margin: 0;
}

.auth-card:not([data-kind="business"]) .auth-company {
  display: none;
}

.auth-company {
  margin-top: 14px;
}

.task-origin {
  align-self: center;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}

.team-person-back {
  margin-bottom: 18px;
}

.team-assign {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

#team-task-category {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.team-assign-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.team-assign-dates .date {
  width: 100%;
  border-color: var(--line);
  background: transparent;
}

.team-assign-dates .date.has-value:not(:focus-within):not(.is-invalid) {
  border-color: var(--line);
  background: transparent;
}

.team-assign-dates .date.is-soon:not(:focus-within) {
  border-color: var(--line);
  background: var(--fill-strong);
}

.team-assign-dates .date.is-overdue:not(:focus-within) {
  border-color: var(--line);
  background: var(--danger-soft);
}

.team-assign-dates .date:focus-within {
  border-color: var(--accent);
  background: transparent;
}

.team-assign-dates .date .date-cal {
  opacity: 1;
}

@media (min-width: 641px) {
  .team-assign-dates .date .date-cal {
    margin-left: auto;
  }
}

.team-tasks {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.team-task {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.team-task:first-child {
  border-top: 0;
}

.team-task .dot {
  margin-top: 6px;
}

.team-task-title {
  font-size: 15px;
  font-weight: 500;
}

.team-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

.team-task.is-done .team-task-title {
  color: var(--ink-2);
}

#team-person-body h3 {
  margin: 16px 0 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

#team-remove {
  margin: 4px 0 28px;
}

.profile-button.is-signed-in::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--bar-bg);
  border-radius: 50%;
  background: var(--accent);
}

.terms {
  width: 100%;
  animation: auth-in 0.45s var(--ease);
}

.terms-date {
  margin-bottom: 8px;
  color: var(--ink-3);
  font-size: 13px;
}

.terms h2 {
  margin-bottom: 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.terms h3 {
  margin: 22px 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.terms p {
  margin: 0 0 8px;
  color: var(--ink-2);
}

.terms-lead {
  color: var(--ink);
}

/* Телефон и сенсорные экраны */

@media (hover: none) {
  .date {
    background: var(--fill);
  }

  .date:not(.has-value) .date-cal {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  html {
    overflow-x: clip;
    overscroll-behavior-x: none;
    scrollbar-width: none;
    touch-action: pan-y pinch-zoom;
  }

  html::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  body {
    overflow-x: clip;
    max-width: 100%;
    overscroll-behavior-x: none;
    touch-action: pan-y pinch-zoom;
  }

  .board,
  .group,
  .card,
  .page {
    min-width: 0;
    max-width: 100%;
  }

  .bar-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 8px;
    padding: 0 12px;
  }

  .logo {
    grid-column: 1;
    grid-row: 1;
    flex: none;
  }

  .logo-word {
    flex: none;
    font-size: 20px;
  }

  .bar-title {
    grid-column: 2;
    grid-row: 1;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0 2px;
    font-size: 14px;
    text-align: center;
  }

  .bar-actions {
    grid-column: 3;
    grid-row: 1;
    gap: 0;
  }

  .bar-actions .lang-toggle,
  .bar-actions .theme-button,
  .bar-actions .plan-button,
  .bar-actions .archive-button,
  .bar-actions .profile-button {
    width: 36px;
  }

  .archive-button {
    position: relative;
    justify-content: center;
    width: 40px;
    padding: 0;
  }

  .archive-button > span:not(.count) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .archive-button .count {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--bar-bg);
    font-size: 10px;
  }

  .page {
    padding: 18px 16px 40px;
  }

  .site-foot-inner {
    align-items: flex-start;
    padding: 18px 16px 22px;
  }

  .studio {
    position: static;
    max-width: none;
    margin-top: 8px;
    transform: none;
  }

  .site-foot-nav {
    margin-left: 0;
  }

  .feedback {
    align-items: end;
    padding: 0;
  }

  .feedback-panel {
    width: 100%;
    max-height: min(92dvh, 720px);
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .signup-prompt.feedback {
    align-items: center;
    padding: 16px;
  }

  .signup-prompt .feedback-panel {
    width: min(440px, 100%);
    border-radius: var(--radius);
  }

  .project-switch {
    font-size: 26px;
  }

  .hero.is-managing .hero-tools {
    gap: 10px 8px;
  }

  .hero.is-managing .member-board-back,
  .hero.is-managing .member-remove {
    height: 44px;
    max-width: 100%;
    font-size: 13px;
  }

  .hero.is-managing .member-board-back {
    min-width: 0;
    padding-right: 10px;
  }

  .hero.is-managing .member-board-back span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero.is-managing .member-remove {
    padding: 0 10px;
  }

  .hero.is-managing .project-switch {
    font-size: 24px;
  }

  .hero.is-managing .space-context {
    margin-top: 4px;
    font-size: 12px;
  }

  .segments {
    margin-bottom: 28px;
  }

  .segment {
    padding-right: 2px;
    padding-left: 2px;
  }

  .segment-label {
    gap: 4px;
    font-size: 12px;
  }

  .segment-label .dot,
  .chip .dot {
    width: 6px;
    height: 6px;
  }

  .pip {
    width: 5px;
    height: 5px;
  }

  .pips {
    gap: 3px;
  }

  .task.is-new,
  .task-face {
    grid-template-columns: 32px minmax(0, 1fr);
    padding: 0 12px 0 14px;
    column-gap: 14px;
  }

  .task-face.has-plan-col {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    padding-right: 8px;
  }

  .task-plan-slot {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    max-width: min(168px, 44vw);
    height: auto;
    margin-top: 0;
  }

  .task.is-multiline .task-plan-slot {
    margin-top: 0;
  }

  .task-plan-when-day {
    font-size: 10px;
  }

  .task-plan-when-time {
    font-size: 11px;
  }

  .task + .task .task-face::before,
  .task + .task.is-new::before,
  .task + .limit-note::before {
    left: 60px;
  }

  .task:not(.is-new) .task-copy {
    padding-bottom: 8px;
  }

  .task.has-reveal .task-copy {
    padding-bottom: 16px;
  }

  .task.is-multiline .task-dates {
    margin-top: 0;
  }

  .task-dates {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 12px;
  }

  .task-origin {
    grid-column: 1 / -1;
    padding-bottom: 4px;
  }

  /* Compact owner mark under the title — plan date/time keep the right column */
  .task-copy .task-origin {
    display: inline-flex;
    align-items: center;
    grid-column: 1;
    width: fit-content;
    max-width: 100%;
    margin-top: 4px;
    padding: 1px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-3);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.35;
    white-space: nowrap;
  }

  .task-plan-slot .task-origin {
    display: none;
  }

  .date {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 4px;
    row-gap: 1px;
    height: auto;
    min-height: 48px;
    padding: 6px 4px 6px 11px;
  }

  .date-label {
    grid-column: 1;
    grid-row: 1;
    font-size: 11px;
    line-height: 14px;
  }

  .date-box {
    grid-column: 1;
    grid-row: 2;
  }

  .date-cal {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .sheet-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(100dvh - 28px);
    border-radius: var(--radius) var(--radius) 0 0;
    transform: translateY(100%);
  }

  .sheet-head {
    touch-action: none;
  }

  .chip {
    font-size: 12.5px;
  }

  .toast {
    width: 100%;
  }

  .toast-text {
    flex: 1;
  }

  .toast-text span {
    max-width: none;
  }

  .toast-actions {
    margin-left: 0;
  }

  .toast-action {
    padding: 0 10px;
  }

  .toast-label-long {
    display: none;
  }

  .toast-label-short {
    display: inline;
  }

  .bar.is-profile .bar-title {
    display: none;
  }

  .profile-title {
    font-size: 26px;
  }

  .profile-stats {
    grid-template-columns: 1fr 1fr;
  }

  .profile-stat:nth-child(odd) {
    border-left: 0;
  }

  .profile-stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .profile-rename {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-theme {
    max-width: none;
  }

  .profile-theme .chip {
    padding: 0 4px;
    font-size: 12px;
  }

  .deleted-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .deleted-face {
    grid-template-columns: 1fr;
  }

  .account-password-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .account-switch-options {
    grid-template-columns: 1fr;
  }

  .account-switch-options button:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .account-switch-options button:last-child {
    margin-top: -1px;
    margin-left: 0;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  /* Палец: safe-area, крупные зоны нажатия, спокойнее плотность */

  .bar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  html {
    scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px));
  }

  .segment {
    justify-content: center;
    min-height: 44px;
    padding: 10px 2px 9px;
  }

  .date-cal {
    width: 44px;
    height: 44px;
  }

  .task-plan {
    width: 44px;
    height: 44px;
  }

  .task-plan-when {
    justify-content: center;
    min-height: 44px;
    padding: 6px 4px;
  }

  .task-reveal {
    width: 96px;
    height: 28px;
  }

  .task-reveal::before {
    content: "";
    position: absolute;
    inset: -10px -16px;
  }

  .chip {
    height: 40px;
  }

  .search {
    height: 44px;
  }

  .search-clear {
    width: 28px;
    height: 28px;
  }

  .calendar {
    width: min(360px, calc(100vw - 24px));
    padding: 16px 14px 12px;
  }

  .cal-nav button {
    width: 40px;
    height: 40px;
  }

  .cal-day {
    width: 40px;
    height: 40px;
  }

  .cal-foot button {
    height: 40px;
    padding: 0 12px;
  }

  .sheet-head {
    position: relative;
    padding: 22px 16px 14px;
  }

  .sheet-head::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--fill-strong);
    transform: translateX(-50%);
  }

  .sheet-tools {
    padding: 0 16px 14px;
  }

  .sheet-body {
    padding: 0 16px max(28px, env(safe-area-inset-bottom, 0px));
  }

  .profile-back {
    min-height: 44px;
    padding: 10px 10px 10px 4px;
  }

  .profile-field input,
  .text-button {
    min-height: 44px;
  }

  .profile-theme .chip {
    height: 40px;
    padding: 0 8px;
  }

  .auth-switch button {
    min-height: 44px;
    padding: 12px 0 10px;
  }

  .auth-recover {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 2px auto 10px;
    padding: 0 12px;
  }

  .auth-box {
    width: 24px;
    height: 24px;
  }

  .toast-action {
    height: 44px;
  }

  .lang-option {
    height: 44px;
  }
}

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

.auth-hint {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.4;
}

#invite-banner .profile-actions {
  padding: 0 16px 14px;
}

.missing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: min(440px, calc(100% - 48px));
  margin: 18vh auto 0;
}

.missing h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.missing p {
  margin: 0;
  color: var(--ink-2);
}

.missing-lead {
  margin: 12px 16px;
  color: var(--ink-2);
}

.terms a {
  color: inherit;
}

/* План недели */

.plan-strip {
  display: flex;
  gap: 6px;
  margin: 8px 0 22px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.plan-strip::-webkit-scrollbar {
  display: none;
}

.plan-day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 1px;
  width: 64px;
  height: 86px;
  padding: 8px 2px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-2);
  scroll-snap-align: center;
}

.plan-day-chip.is-past {
  color: var(--ink-3);
}

.plan-day-chip.is-today {
  color: var(--accent-ink);
}

.plan-day-chip[aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.plan-day-chip.is-drop {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.plan-chip-week {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-chip-date {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.plan-date-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-top: 3px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--fill);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.plan-date-count.is-busy {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.plan-day-chip.is-past .plan-date-count {
  background: var(--fill);
  color: var(--ink-3);
}

.plan-board {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.plan-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.plan-day-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.plan-day-title,
.plan-pool-title {
  font-size: 15px;
  font-weight: 600;
}

.plan-day-zoom {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.plan-day-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.plan-zoom-reset {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  background: transparent;
}

.plan-zoom-reset:hover,
.plan-zoom-reset:focus-visible {
  color: var(--ink);
  background: var(--fill);
  outline: none;
}

.plan-overview {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.plan-overview-track {
  position: relative;
  height: 14px;
  touch-action: none;
  cursor: ew-resize;
}

.plan-overview-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: var(--line);
  opacity: 0.7;
  pointer-events: none;
}

.plan-overview-tick {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: var(--line);
  opacity: 0.45;
  pointer-events: none;
  transform: translateX(-50%);
}

.plan-overview-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  z-index: 1;
  box-sizing: border-box;
  min-width: 3px;
  border-radius: 1px;
  border-left: 1px solid var(--bg);
  border-right: 1px solid var(--bg);
  background: color-mix(in srgb, var(--plan-ink, var(--accent)) 72%, transparent);
  pointer-events: none;
}

.plan-overview-block.is-full {
  z-index: 0;
  top: 4px;
  bottom: 4px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  background: color-mix(in srgb, var(--plan-ink, var(--accent)) 28%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--plan-ink, var(--accent)) 42%, transparent);
}

.plan-overview-block.is-priority { --plan-ink: var(--cat-priority); }
.plan-overview-block.is-normal { --plan-ink: var(--cat-normal); }
.plan-overview-block.is-low { --plan-ink: var(--cat-low); }

.plan-overview-window {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow:
    inset 1px 0 0 var(--accent-border),
    inset -1px 0 0 var(--accent-border);
  pointer-events: none;
}

.plan-overview-pick {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  width: 1px;
  background: var(--accent);
  pointer-events: none;
}

.plan-overview-pick::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.plan-hero-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-hero-title .profile-title {
  margin: 0;
}

.plan-help {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-3);
}

.plan-help svg {
  width: 16px;
  height: 16px;
}

.plan-help:hover,
.plan-help:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
  outline: none;
}

.plan-empty,
.plan-card-meta,
.plan-card-time {
  color: var(--ink-3);
  font-size: 12px;
}

.plan-pool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.plan-scale {
  padding: 0;
  overflow: hidden;
}

.plan-scale-track {
  position: relative;
  width: 100%;
  height: 168px;
  border-radius: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--fill) 55%, transparent), transparent 28%),
    var(--bg);
}

.plan-hour-band,
.plan-grid-line,
.plan-hour-label {
  position: absolute;
  pointer-events: none;
}

.plan-hour-band {
  top: 30px;
  bottom: 0;
  background: var(--fill);
  opacity: 0.45;
}

.plan-grid-line {
  top: 30px;
  bottom: 0;
  width: 1px;
  background: var(--line);
  opacity: 0.7;
}

.plan-grid-line.is-major {
  opacity: 1;
}

.plan-grid-line.is-half {
  top: 46px;
  opacity: 0.35;
}

.plan-hour-label {
  top: 8px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
  white-space: nowrap;
}

.plan-hour-label.is-start {
  transform: none;
}

.plan-hour-label.is-end {
  transform: translateX(-100%);
}

.plan-now {
  position: absolute;
  top: 22px;
  bottom: 6px;
  z-index: 4;
  width: 16px;
  margin-left: -8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  pointer-events: auto;
}

.plan-now-line {
  position: absolute;
  top: 10px;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.plan-now-head {
  position: absolute;
  top: 0;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border: 2px solid var(--on-accent);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

.plan-now:hover .plan-now-line,
.plan-now:focus-visible .plan-now-line {
  width: 3px;
  margin-left: -1.5px;
  background: var(--accent-ink);
}

.plan-now:hover .plan-now-head,
.plan-now:focus-visible .plan-now-head {
  transform: scale(1.12);
  background: var(--accent-ink);
}

.plan-now:focus-visible {
  outline: none;
}

.plan-block,
.plan-preview {
  position: absolute;
  top: 34px;
  bottom: 8px;
  z-index: 1;
}

.plan-block {
  --plan-edge: 8px;
  --plan-grip: 2px;
  --plan-grip-inset: 3px;
  display: grid;
  grid-template-columns: minmax(var(--plan-edge), var(--plan-edge)) minmax(0, 1fr) auto minmax(var(--plan-edge), var(--plan-edge));
  align-items: stretch;
  min-width: calc(var(--plan-edge) * 2);
  overflow: hidden;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--plan-ink, var(--accent)) 20%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--plan-ink, var(--accent)) 52%, transparent);
  touch-action: none;
}

.plan-block.is-full {
  min-width: 0;
}

.plan-block.is-priority,
.plan-card.is-priority { --plan-ink: var(--cat-priority); }
.plan-block.is-normal,
.plan-card.is-normal { --plan-ink: var(--cat-normal); }
.plan-block.is-low,
.plan-card.is-low { --plan-ink: var(--cat-low); }

.plan-block.is-lifting,
.plan-card.is-lifting,
.plan-pool-row.is-lifting {
  opacity: 0.35;
}

.plan-edge {
  position: relative;
  z-index: 2;
  width: var(--plan-edge);
  min-width: var(--plan-edge);
  max-width: var(--plan-edge);
  padding: 0;
  cursor: ew-resize;
  touch-action: none;
}

.plan-edge::after {
  content: "";
  position: absolute;
  top: 18%;
  bottom: 18%;
  width: var(--plan-grip);
  border-radius: 2px;
  background: color-mix(in srgb, var(--plan-ink, var(--accent)) 78%, transparent);
}

.plan-edge-start::after { left: var(--plan-grip-inset); }
.plan-edge-end::after { right: var(--plan-grip-inset); }

.plan-block-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 4px;
  overflow: hidden;
  text-align: left;
  touch-action: none;
  cursor: grab;
}

.plan-block-time,
.plan-block-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-block-time {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-block-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.plan-block-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding: 4px 2px 4px 0;
}

.plan-block .plan-check,
.plan-block .plan-remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--ink-2);
}

.plan-block .plan-remove {
  font-size: 15px;
  line-height: 1;
}

.plan-block.is-compact,
.plan-block.is-short,
.plan-block.is-micro {
  grid-template-columns: minmax(var(--plan-edge), var(--plan-edge)) minmax(0, 1fr) minmax(var(--plan-edge), var(--plan-edge));
}

.plan-block.is-compact .plan-block-actions,
.plan-block.is-compact .plan-block-title,
.plan-block.is-short .plan-block-actions,
.plan-block.is-short .plan-block-title,
.plan-block.is-micro .plan-block-actions {
  display: none;
}

.plan-block.is-short .plan-block-body {
  padding: 4px 2px;
}

.plan-block.is-short .plan-block-time {
  font-size: 10px;
}

.plan-block.is-micro .plan-block-body {
  padding: 0;
}

.plan-block.is-micro .plan-block-time,
.plan-block.is-micro .plan-block-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.plan-remove {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
}

.plan-remove:hover {
  color: var(--danger);
}

.plan-check:hover {
  color: var(--accent);
}

.plan-preview {
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 8px;
  padding: 6px 8px;
  border: 1.5px dashed var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-ink);
  pointer-events: none;
  overflow: hidden;
}

.plan-preview-time {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plan-preview-title {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-preview.is-conflict {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.plan-tip {
  position: fixed;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-pop);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.plan-tip-time {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-tip-title {
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.plan-tip-meta {
  color: var(--ink-3);
  font-size: 12px;
}

.plan-tip-guide {
  max-width: min(420px, calc(100vw - 16px));
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.plan-past {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}

.plan-card,
.plan-pool-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.plan-grip,
.plan-check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink-3);
}

.plan-grip svg,
.plan-check svg {
  width: 16px;
  height: 16px;
}

.plan-card-main,
.plan-pool-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-align: left;
}

.plan-card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.plan-card-meta,
.plan-card-time {
  flex: 0 0 auto;
}

.plan-today {
  grid-column: 2;
  justify-self: start;
  height: auto;
  color: var(--ink-2);
  font-size: 12px;
}

.plan-pool {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-pool.is-drop {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.plan-pool-title {
  margin: 0;
}

.plan-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.plan-filters::-webkit-scrollbar {
  display: none;
}

.plan-filter {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13px;
}

.plan-filter[aria-checked="true"] {
  color: var(--ink);
  border-color: var(--ink);
}

.plan-pool-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-place {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
}

.plan-place:hover {
  background: var(--fill);
}

.task-face.has-plan-col {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  padding-right: 8px;
}

.task-plan-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  align-self: center;
  min-width: 36px;
  max-width: min(248px, 52vw);
  height: auto;
}

.task-plan-slot.is-placed {
  min-width: 0;
}

.task.is-multiline .task-plan-slot {
  align-self: start;
  margin-top: 6px;
}

.task-plan-when {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 0;
  padding: 4px 2px;
  text-align: right;
  color: var(--ink-2);
}

.task-plan-when-day {
  overflow: hidden;
  max-width: 100%;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-plan-when-time {
  overflow: hidden;
  max-width: 100%;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-plan-when:hover .task-plan-when-time,
.task-plan-when:focus-visible .task-plan-when-time {
  color: var(--accent-ink, var(--ink));
}

.task-plan-when:focus-visible {
  outline: none;
}

.task-plan {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--ink-3);
  transition: color 0.15s ease, background 0.15s ease;
}

.task-plan-slot.is-placed .task-plan {
  color: var(--ink-2);
}

.task-plan svg {
  width: 18px;
  height: 18px;
}

.task-plan:hover,
.task-plan:focus-visible {
  color: var(--ink);
  background: var(--fill-strong);
  outline: none;
}

.plan-day-chip:hover,
.plan-filter:hover,
.plan-place:hover {
  color: var(--ink);
}

.plan-tip-task {
  gap: 4px;
  min-width: 132px;
  padding: 10px 12px;
}

.plan-tip-week {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-tip-date {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.plan-tip-task .plan-tip-time {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.plan-ghost {
  position: fixed;
  z-index: 70;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.is-plan-dragging,
html.is-plan-dragging * {
  cursor: grabbing;
  user-select: none;
}

html.is-plan-resizing,
html.is-plan-resizing * {
  cursor: ew-resize;
  user-select: none;
}

.popover-plan-actions {
  width: min(240px, calc(100vw - 24px));
}

.plan-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.plan-action {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.plan-action:hover,
.plan-action:focus-visible {
  background: var(--fill);
  outline: none;
}

.plan-action.is-done:hover,
.plan-action.is-done:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.plan-action.is-cancel:hover,
.plan-action.is-cancel:focus-visible {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.popover-plan {
  width: min(392px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.plan-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.plan-editor-when {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.plan-editor-modes,
.plan-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-editor-mode,
.plan-editor-action,
.plan-save {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.plan-editor-action.is-primary,
.plan-save {
  border-color: var(--ink);
}

.plan-editor-mode:hover:not(:disabled),
.plan-editor-action:hover:not(:disabled),
.plan-save:hover:not(:disabled) {
  background: var(--fill);
}

.plan-editor-mode[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--ink);
}

.plan-editor-clock {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-editor-span {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-span-controls {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 6px;
  align-items: center;
}

.plan-span-value {
  display: grid;
  place-items: center;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-block.is-span .plan-block-time {
  font-variant-numeric: tabular-nums;
}

.plan-clock {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-clock-label {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-clock-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.plan-clock-input:focus {
  border-color: var(--ink);
  outline: none;
}

.plan-clock-nudges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.plan-nudge {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.plan-nudge-hour {
  font-weight: 600;
}

.plan-nudge:hover {
  background: var(--fill);
}

.plan-nudge:active {
  background: var(--fill-strong);
}

.plan-nudge:disabled {
  opacity: 0.32;
  background: none;
  cursor: default;
}

@media (max-width: 640px) {
  .plan-button {
    position: relative;
    justify-content: center;
    width: 40px;
    padding: 0;
  }

  .plan-button > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .plan-day-chip {
    width: 60px;
    height: 80px;
  }

  .plan-day-head {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .plan-help {
    width: 44px;
    height: 44px;
  }

  .plan-board.is-mobile {
    overflow: visible;
  }

  .plan-busy {
    padding: 0 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .plan-busy-track {
    position: relative;
    height: 28px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--fill) 72%, transparent);
  }

  .plan-busy-rail {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 50%;
    height: 2px;
    margin-top: -1px;
    border-radius: 1px;
    background: var(--line);
    opacity: 0.8;
    pointer-events: none;
  }

  .plan-busy-tick {
    position: absolute;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--line);
    opacity: 0.5;
    pointer-events: none;
    transform: translateX(-50%);
  }

  .plan-busy-mark {
    position: absolute;
    top: 6px;
    bottom: 6px;
    z-index: 1;
    min-width: 10px;
    border: 0;
    border-radius: 2px;
    background: color-mix(in srgb, var(--plan-ink, var(--accent)) 78%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--plan-ink, var(--accent)) 45%, transparent);
  }

  .plan-busy-mark.is-priority { --plan-ink: var(--cat-priority); }
  .plan-busy-mark.is-normal { --plan-ink: var(--cat-normal); }
  .plan-busy-mark.is-low { --plan-ink: var(--cat-low); }

  .plan-busy-mark.is-full {
    top: 8px;
    bottom: 8px;
    opacity: 0.55;
  }

  .plan-busy-mark:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
  }

  .plan-busy-now {
    position: absolute;
    top: 3px;
    bottom: 3px;
    z-index: 2;
    width: 2px;
    background: var(--accent);
    pointer-events: none;
    transform: translateX(-50%);
  }

  .plan-busy-hours {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--ink-3);
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .plan-busy-hint {
    margin: 8px 0 0;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
  }

  .plan-day-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 12px 16px;
  }

  .plan-day-empty {
    margin: 8px 0;
    color: var(--ink-3);
    font-size: 14px;
  }

  .plan-day-gap {
    padding: 2px 4px;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
  }

  .plan-day-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: start;
    width: 100%;
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    border-left: 3px solid var(--plan-ink, var(--accent));
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
  }

  .plan-day-row.is-priority { --plan-ink: var(--cat-priority); }
  .plan-day-row.is-normal { --plan-ink: var(--cat-normal); }
  .plan-day-row.is-low { --plan-ink: var(--cat-low); }

  .plan-day-row:active,
  .plan-day-row.is-flash {
    background: var(--fill);
    border-color: color-mix(in srgb, var(--plan-ink, var(--accent)) 45%, var(--line));
  }

  .plan-day-row-time {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    min-width: 7.5ch;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
  }

  .plan-day-row-title {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 15px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .plan-day-row-meta {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
    color: var(--ink-3);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .plan-filters {
    padding-bottom: 2px;
    margin-right: -4px;
    padding-right: 16px;
  }

  .plan-filter {
    height: 40px;
    padding: 0 14px;
  }

  .plan-place {
    height: 44px;
    padding: 0 14px;
    font-size: 14px;
  }

  .plan-pool-row.is-mobile {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 52px;
  }

  .plan-card,
  .plan-pool-row {
    min-height: 48px;
  }

  .plan-pool {
    padding: 12px;
  }

  .plan-editor-mode,
  .plan-editor-action,
  .plan-save {
    min-height: 44px;
    height: auto;
    padding: 10px 14px;
  }

  .popover[data-side="sheet"] {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(400px, calc(100vw - 32px));
    max-height: min(72dvh, 560px);
    overflow: auto;
    border-radius: var(--radius);
    transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
    transform-origin: center center;
  }

  .popover[data-side="sheet"].is-open {
    transform: translate(-50%, -50%) scale(1);
  }

  .popover-plan,
  .popover-plan-actions {
    width: min(400px, calc(100vw - 32px));
  }

  .plan-sheet {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
    pointer-events: none;
  }

  .plan-sheet.is-open {
    pointer-events: auto;
  }

  .plan-sheet-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: var(--sheet-backdrop);
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  .plan-sheet.is-open .plan-sheet-backdrop {
    opacity: 1;
  }

  .plan-sheet-panel {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    max-height: min(72dvh, 560px);
    overflow: auto;
    padding: 18px 16px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-pop);
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.32s var(--ease);
  }

  .plan-sheet.is-open .plan-sheet-panel {
    opacity: 1;
    transform: none;
  }

  .plan-sheet-head {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
  }

  .plan-sheet-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
  }

  .plan-sheet-meta {
    color: var(--ink-2);
    font-size: 14px;
  }

  .plan-sheet-time {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .plan-sheet-edit {
    width: 100%;
    height: 44px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    background: transparent;
  }

  .plan-sheet-edit:active {
    background: var(--fill);
  }

  .plan-sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .plan-sheet-done,
  .plan-sheet-cancel {
    height: 48px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
  }

  .plan-sheet-done {
    border: 0;
    background: var(--accent);
    color: var(--on-accent-text);
  }

  .plan-sheet-cancel {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
  }

  .plan-sheet-cancel:active {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
  }

  /* Frozen snapshot of the page we left — sits under the current page for edge-back. */
  .nav-freeze-layer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    overflow: hidden;
    pointer-events: none;
    background: var(--bg);
    max-width: none;
  }

  .nav-freeze-inner {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
  }

  .nav-freeze-page {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    flex: none;
  }

  .nav-freeze-foot {
    flex: none;
    margin-top: auto;
    width: 100%;
    border-top: 1px solid var(--line);
  }

  /* Edge swipe back: slide the top page over the frozen snapshot underneath */
  html.is-edge-backing {
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  html.is-edge-backing #bar {
    z-index: 50;
  }

  .edge-back-scrim {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    background: #000;
    opacity: 0;
    pointer-events: none;
  }

  .edge-back-scrim.is-on {
    display: block;
  }

  .nav-freeze-layer.is-edge-back-under {
    will-change: transform;
  }

  .is-edge-back-foot {
    will-change: transform;
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.28);
  }

  .is-edge-back {
    will-change: transform;
    transition: none;
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.28);
  }

  .is-edge-back-sheet {
    background: var(--bg);
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  .is-edge-back-settle,
  .is-edge-back-under-settle {
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .edge-back-scrim.is-on {
    transition: opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .is-edge-back-out {
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: none;
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.18);
  }

  .is-edge-back-under-settle {
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }
}
