/* Shared crystal surfaces and touch interaction layout. */
:root {
  --crystal-surface: #102b38;
  --crystal-panel: #132f3d;
  --crystal-edge: #b6e8e64f;
  --crystal-ease: cubic-bezier(.22, .76, .25, 1);
  --nav-measured: 58px;
  --capture-measured: 54px;
  --phone-gutter: 12px;
}
.ambient {
  background:
    linear-gradient(180deg, #06172270 0%, #061b2654 43%, #0a23301a 76%, #05172156),
    url('/crystal-background.webp') center 66% / cover no-repeat,
    #071b26;
}
.ambient i { display: none; }

.task-card {
  --glass-light: rgba(var(--spark), .82);
  --glass-rim: rgba(var(--facet), .56);
  --glass-split: rgba(var(--spectrum), .44);
  min-height: 113px;
  border-color: var(--glass-rim);
  background:
    radial-gradient(ellipse at 9% -14%, rgba(var(--facet), .30), transparent 49%),
    linear-gradient(156deg, rgba(var(--face), .58), rgba(var(--face), .35) 57%, rgba(var(--face), .53));
  backdrop-filter: blur(7px) saturate(145%);
  box-shadow:
    inset 0 1px 2px var(--glass-light), inset 0 -2px 6px rgba(var(--facet), .37),
    inset 0 0 0 3px rgba(var(--facet), .10), 0 8px 19px #010e1876,
    0 0 15px rgba(var(--facet), .11);
}
.task-card[data-shape="overdue"], .task-card[data-shape="critical"][data-tone="soon"] {
  box-shadow:
    inset 0 1px 3px var(--glass-light), inset 0 -2px 7px rgba(var(--facet), .45),
    inset 0 0 0 3px rgba(var(--facet), .13), 0 8px 23px #010e187d,
    0 0 16px rgba(var(--facet), .16);
}
.task-card::before {
  padding: 8px;
  background:
    radial-gradient(ellipse 42% 14% at 14% 0%, var(--glass-light), transparent 75%),
    radial-gradient(ellipse 28% 13% at 91% 100%, var(--glass-light), transparent 71%),
    conic-gradient(from 25deg at 54% 54%, transparent 0deg 69deg, var(--glass-split) 71deg 79deg,
      transparent 83deg 154deg, rgba(var(--spark), .34) 159deg 164deg,
      transparent 170deg 229deg, var(--glass-split) 232deg 244deg, transparent 250deg 360deg);
}
.task-card::after, .task-card:has(.task-important)::after, .task-card:has(.task-important)[data-tone="overdue"]::after {
  inset: 5px;
  border-color: rgba(var(--facet), .23);
  background:
    linear-gradient(152deg, rgba(var(--facet), .10) 0%, transparent 27% 68%, rgba(var(--spectrum), .13) 91%),
    linear-gradient(95deg, #0619233b, #06182320 58%, rgba(var(--face), .16));
  box-shadow: inset 1px 1px 1px rgba(var(--spark), .17), inset -1px -1px 2px rgba(var(--spectrum), .22);
}
.task-card.is-important:not([data-tone="overdue"])::after {
  background: linear-gradient(151deg, #a56da12a, #26193822 48%, #0b253524);
}
.task-glint { padding: 5px; opacity: .63; }
.task-card .task-glint::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(122deg, transparent 28%, rgba(var(--spark), .32) 33%, transparent 36% 67%,
    rgba(var(--spectrum), .28) 70%, transparent 75%);
  clip-path: polygon(0 0, 40% 0, 22% 12%, 0 31%, 0 0, 100% 100%, 66% 100%, 87% 86%, 100% 68%, 100% 100%);
}
.task-card[data-lift="hover"] .task-glint, .task-card:focus-within .task-glint { opacity: .91; }
.task-card:active .task-glint { opacity: .92; }
.task-card .task-title { font-weight: 738; letter-spacing: -.025em; }
.task-card .task-important { font-size: 13px; font-weight: 640; }
.task-card .task-meta { color: #bcd4db; }
.task-card .task-deadline, .task-card .task-reason { font-variant-numeric: tabular-nums; }
.task-card .task-card-button { gap: 5px; min-height: inherit; }
.task-card .task-card-actions {
  position: absolute;
  z-index: 3;
  right: 12px; top: 50%;
  padding: 0;
  transform: translateY(-50%);
}
.task-card:has(.task-card-actions) > .task-card-button {
  padding-inline-end: 65px;
  padding-block-end: 15px;
}
.task-card .task-move-button {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0;
  border-radius: 14px; border: 1px solid transparent;
  background: transparent; box-shadow: none; color: #b8d5dc;
  transition: background-color 160ms ease, color 180ms ease, transform 170ms var(--crystal-ease);
}
.task-card .task-move-button[data-touch-move] {
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.task-card .task-move-button .icon { width: 19px; height: 19px; }
.task-card .task-move-button:hover, .task-card .task-move-button:focus-visible {
  border-color: #b5efea4b; background: #294d5873; color: #e5fff7;
}
.task-card .task-move-button:active { background: #4a776fa8; transform: scale(.94); }
.task-card.is-completed {
  --face: 20, 72, 58; --facet: 121, 197, 165; --spark: 181, 244, 211; --spectrum: 106, 175, 153;
  min-height: 78px;
  border-radius: 19px;
  box-shadow: inset 0 1px 2px #c9f9e349, inset 0 -1px 4px #a4ffdf1b, 0 4px 10px #0410195c;
}
.task-card.is-completed .task-card-button { padding-block: 10px; }
.task-card.is-completed .task-title { font-size: clamp(16px, 1.45vw, 21px); color: #e2f5ee; }
.task-completed-status {
  display: inline-flex; gap: 5px; align-items: center; width: fit-content;
  font-size: 13px; line-height: 1.25; color: #b2ebce; font-weight: 730;
}
.task-completed-status .icon { width: 15px; height: 15px; }
.column-head { min-height: 51px; }
.column-title { overflow-wrap: anywhere; }
.column-count { color: #b5d3dc; font-size: .58em; font-variant-numeric: tabular-nums; }
.column-complete-mark { color: #a4e7c7; }

.quick-move-menu.quick-move-sheet {
  position: fixed; inset: auto var(--phone-gutter) max(7px, env(safe-area-inset-bottom), var(--tg-bottom)) var(--phone-gutter);
  width: min(calc(100vw - 24px), 540px); margin-inline: auto; max-height: min(81dvh, 545px); padding: 14px;
  border-radius: 25px; border: 1px solid #b2e8e477;
  background: radial-gradient(ellipse at 14% -14%, #92ddd137, transparent 63%), #102c39f7;
  box-shadow: inset 0 1px 2px #d8fff682, 0 20px 58px #021019ba;
  animation: move-sheet-in 230ms var(--crystal-ease) both;
}
@keyframes move-sheet-in { from { opacity: .3; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
.quick-move-sheet .quick-move-head { padding: 0 0 9px; gap: 12px; }
.quick-move-head h2, .quick-move-head h3 { font-size: 21px; line-height: 1.17; }
.quick-move-head p { color: #aacbd2; margin-top: 3px; overflow-wrap: anywhere; }
.quick-move-sheet .quick-move-list { gap: 5px; }
.quick-move-sheet .quick-move-option {
  min-height: 52px; border-radius: 12px; padding: 6px 9px;
  background: #21424e75; border: 1px solid #a8d7dc39; box-shadow: none;
}
.quick-move-sheet .quick-move-option:hover, .quick-move-sheet .quick-move-option:focus-visible { background: #315d66; }
.quick-move-sheet .quick-move-option.is-current { border-color: #b4f7df66; color: #c9f9e6; }
.quick-move-current { margin-inline-start: auto; color: #aecfcf; font-size: 12px; }
.quick-move-status-icon { color: #baf2dc; }
.task-touch-ghost {
  position: fixed; left: 0; top: 0; z-index: 29; pointer-events: none; width: min(230px, 64vw);
  min-height: 56px; padding: 11px 13px; overflow: hidden; overflow-wrap: anywhere;
  border: 1px solid #bdfff0ac; border-radius: 18px; color: #f0fff9;
  background: linear-gradient(140deg, #42767fed, #183d4bec);
  box-shadow: inset 0 1px 3px #d2fff9d6, 0 13px 28px #021820ac;
  backdrop-filter: blur(6px);
}
.board-drop-dock.is-touch-dock {
  z-index: 30; width: min(calc(100vw - 20px), 560px); display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px;
  bottom: calc(var(--nav-measured) + max(13px, env(safe-area-inset-bottom), var(--tg-bottom)));
  padding: 6px; border-radius: 17px;
}
.board-drop-dock.is-touch-dock [data-drop-status] { min-height: 49px; font-size: 14px; font-weight: 640; }
.board-drop-dock > span {
  grid-column: 1/-1; flex-basis: 100%; text-align: center;
  color: #b7ddd7; font-size: 13px; font-weight: 600; padding-block: 4px;
}
.drop-status-icon { color: #a7e4d7; }
.is-drop-target .drop-status-icon { color: inherit; }
.board-drop-dock.is-touch-dock [data-drop-status].is-drop-target { box-shadow: inset 0 1px 2px #ecfff9, 0 0 13px #82ffe75c; }
.quick-move-hint { color: #b3cfd5; font-size: 13px; line-height: 1.4; margin-block: 8px 0; }

.task-sheet.glass-dialog {
  --sheet-rim: #b9eceb81;
  --sheet-face: #122c39;
  --sheet-top: #234855;
}
.task-sheet:not([data-kind="details"]) { --sheet-top: #244755; }
.task-sheet .dialog-head { border-bottom-color: #b0e1e035; }
:is(.task-sheet .dialog-close, .quick-move-menu .quick-move-close, .shelf-dialog .shelf-close, .card-actions-sheet .card-actions-close) {
  position: relative; z-index: 0; isolation: isolate;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; flex: 0 0 44px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 12px;
  background: transparent; box-shadow: none; color: #d3efef;
}
:is(.task-sheet .dialog-close, .quick-move-menu .quick-move-close, .shelf-dialog .shelf-close, .card-actions-sheet .card-actions-close)::before {
  content: ''; pointer-events: none; position: absolute; z-index: -1; inset: 5px;
  border: 1px solid #cdf8f326; border-radius: 10px;
  background: linear-gradient(145deg, #c0e8f01f, #a5dee50b 59%, #84cdd214);
  box-shadow: inset 0 1px 1px #e3ffff22; transition: background-color 140ms ease, border-color 140ms ease;
}
:is(.task-sheet .dialog-close, .quick-move-menu .quick-move-close, .shelf-dialog .shelf-close, .card-actions-sheet .card-actions-close):is(:hover, :focus-visible, :active)::before {
  border-color: #cdf8f36e; background-color: #bcfcf225;
}
:is(.task-sheet .dialog-close, .quick-move-menu .quick-move-close, .shelf-dialog .shelf-close, .card-actions-sheet .card-actions-close) :is(.icon, .shelf-icon) {
  width: 23px; height: 23px; stroke-width: 1.8;
}
.main-nav .nav-button {
  position: relative; display: inline-flex; justify-content: center; align-items: center; gap: 7px;
  min-width: 0; padding-inline: clamp(5px, 1vw, 14px); font-size: clamp(13px, 1.28vw, 17px);
  color: #c3dce2; line-height: 1.12;
}
.main-nav .nav-button .icon { width: 17px; height: 17px; flex: 0 0 17px; }
.main-nav .nav-button.is-active {
  border-color: #b8ede870; color: #ebfff8;
  background: linear-gradient(145deg, #9bddd94c, #78c8c629 63%, #8ad1dd42);
  box-shadow: inset 0 1px 2px #e5fff78c, inset 0 -1px 2px #bcf6f229, 0 4px 8px #05263152;
}
.task-sheet .dialog-body { overscroll-behavior-y: contain; }
.task-sheet .dialog-frame { display: flex; flex-direction: column; }
.task-sheet .task-sheet-footer {
  flex: none; padding: 11px 18px 14px;
  background: #112e3be8; box-shadow: 0 -5px 16px #011b244d;
  border-top: 1px solid #a9dec93e;
}
.detail-overview { display: grid; gap: 8px; margin-block-end: 9px; }
.detail-state {
  width: fit-content; min-height: 30px; border-radius: 9px; padding: 4px 9px;
  display: inline-flex; align-items: center; gap: 6px; color: #d3e6e9;
  background: #294a5877;
}
.detail-state[data-state="done"] { border: 1px solid #9deac165; color: #c4f8d9; background: #1b5446a5; }
.detail-state-mark { display: grid; place-items: center; color: inherit; }
.detail-state-label { font-weight: 710; }
.detail-facts { margin-block: 2px 8px; }
.detail-fact {
  display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 1.5fr); align-items: baseline; gap: 9px;
  padding-block: 7px; border-bottom: 1px solid #a6d9df28;
}
.detail-fact dt { color: #aecaD3; }
.detail-fact dd { margin: 0; color: #e1efed; overflow-wrap: anywhere; font-weight: 580; }
.detail-footer { display: grid; gap: 6px; }
.detail-secondary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.detail-secondary-actions .button { width: 100%; }
.detail-footer .detail-main-action { width: 100%; min-height: 46px; }
.detail-more, .compose-other-types { width: fit-content; margin: 5px 0; }
.detail-more > summary, .compose-other-types > summary {
  display: flex; align-items: center; gap: 6px; min-height: 44px; width: fit-content;
  padding: 5px 9px; border-radius: 9px; cursor: pointer; color: #bbd9dd;
}
.detail-more > summary::-webkit-details-marker, .compose-other-types > summary::-webkit-details-marker { display: none; }
.detail-more > summary::after, .compose-other-types > summary::after {
  content: ''; width: 6px; height: 6px; transform: translateY(-1px) rotate(45deg);
  border: solid currentColor; border-width: 0 1px 1px 0;
}
.detail-more[open] > summary::after, .compose-other-types[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.detail-extra-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.compose-tools--shortcuts { display: flex; gap: 5px; align-items: start; margin-block-end: 1px; }
.task-sheet[data-task-status="done"] { --sheet-rim: #a7ebc479; --sheet-top: #25504c; }

.completion-toast {
  position: fixed; z-index: 9; right: 20px; bottom: 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px;
  width: min(425px, calc(100vw - 24px)); padding: 8px 8px 8px 12px;
  border: 1px solid #a0eed18c; border-radius: 15px; color: #d7fff1; background: #153f3cf5;
  box-shadow: inset 0 1px 2px #ddfff669, 0 8px 26px #01101c99;
  animation: move-sheet-in 200ms var(--crystal-ease) both;
}
.completion-message { display: flex; align-items: center; gap: 7px; font-weight: 715; overflow-wrap: anywhere; }
.completion-toast-actions { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.completion-toast-actions .button { min-height: 44px; padding-inline: 8px; font-size: 13px; }
.completion-dismiss { min-width: 44px; min-height: 44px; padding: 0; background: transparent; border-color: transparent; }
.completion-toast .completion-message { grid-column: 1; }
.completion-toast .completion-toast-actions { grid-column: 1; }
.completion-toast .completion-dismiss { grid-column: 2; grid-row: 1 / span 2; align-self: start; }

@media (max-width: 760px) {
  :root { --footer-safe: max(8px, env(safe-area-inset-bottom), var(--tg-bottom)); }
  html { scroll-padding-bottom: calc(var(--nav-measured) + var(--capture-measured) + var(--footer-safe) + 22px); }
  .app-shell, .is-telegram .app-shell {
    padding-bottom: calc(var(--nav-measured) + var(--capture-measured) + var(--footer-safe) + 23px);
  }
  .app-shell .main-nav {
    bottom: var(--footer-safe); left: var(--phone-gutter); right: var(--phone-gutter);
    padding: 3px; min-height: 52px; border-radius: 16px;
  }
  .app-shell .main-nav { gap: 2px; }
  .app-shell .main-nav .nav-button {
    flex: 1 1 0; min-height: 46px; padding: 4px 2px;
    flex-direction: column; gap: 3px; border-radius: 12px; font-size: clamp(11px, 3.1vw, 13px);
  }
  .main-nav .nav-button .icon { width: 17px; height: 17px; }
  .main-nav .nav-button .nav-count {
    position: absolute; top: 3px; right: 3px; margin: 0; padding: 1px 3px; min-width: 13px;
    min-height: 13px; font-size: 10px; line-height: 11px;
  }
  .mobile-capture, .is-telegram .mobile-capture {
    left: var(--phone-gutter); right: var(--phone-gutter);
    bottom: calc(var(--nav-measured) + var(--footer-safe) + 6px);
    border-radius: 16px;
  }
  :root[data-soft-keyboard] .mobile-capture, .is-telegram:root[data-soft-keyboard] .mobile-capture {
    bottom: max(8px, env(safe-area-inset-bottom), var(--tg-bottom), calc(var(--keyboard-inset, 0px) + 8px));
  }
  .mobile-capture input[name="captureText"] { flex: 1 1 105px; }
  .mobile-capture .button, .mobile-capture .voice-capture-button { border-radius: 12px; }
  .completion-toast { right: 12px; bottom: calc(var(--nav-measured) + var(--capture-measured) + var(--footer-safe) + 14px); }
  .day-tools .day-birthdays, .day-tools .day-products, .day-tools .tools-toggle { font-size: 13px; }
  .day-tools .tools-toggle { font-size: 0; min-width: 44px; margin-inline-start: auto; }
  .day-tools .tools-toggle .icon { width: 19px; height: 19px; }
  .mobile-status.board-status-strip {
    position: sticky; z-index: 3; top: max(4px, env(safe-area-inset-top), var(--tg-top));
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px;
    margin-bottom: 12px; padding: 3px; border: 1px solid #94d9d36b;
    border-radius: 16px; background: #112f3af2; box-shadow: inset 0 1px 2px #d2f9f449, 0 4px 12px #0115209d;
    backdrop-filter: blur(8px);
  }
  .board-status-strip .status-tab {
    min-height: 51px; min-width: 0; padding: 4px 2px; white-space: normal;
    display: grid; align-content: center; justify-items: center; gap: 1px;
    border-radius: 11px; color: #bed6db; font-size: 12px; font-weight: 620; line-height: 1.14;
  }
  .board-status-strip .status-tab.is-active, .board-status-strip .status-tab[aria-pressed="true"] {
    border-color: #a8ebd86e; color: #e1fff4;
    background: linear-gradient(160deg, #426d73, #295355);
    box-shadow: inset 0 1px 2px #caffef7d;
  }
  .status-tab-count { color: #b5ded3; font-variant-numeric: tabular-nums; font-size: 11px; }
  .board-column .column-head {
    position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .board.board-four-columns .board-column { min-height: 0; }
  .board .column-stack { gap: 9px; }
  .task-card, .today-group .task-card { min-height: 74px; }
  .task-card .task-card-button, .today-group .task-card .task-card-button {
    padding-inline: 14px 58px; padding-block: 12px;
  }
  .task-card:has(.task-card-actions) .task-card-button { padding-block: 12px; }
  .task-card .task-card-actions { right: 8px; }
  .task-card .task-title, .today-group .task-title { font-size: 19px; }
  .task-card .task-deadline, .task-card .task-meta { font-size: 14px; }
  .task-card .task-important { font-size: 12px; }
  .task-card.is-completed { min-height: 62px; }
  .task-card.is-completed .task-card-button { padding-block: 9px; }
  .task-card.is-completed .task-title { font-size: 16px; }
  .task-sheet.glass-dialog {
    border-radius: 24px 24px 16px 16px;
  }
  .task-sheet .dialog-head { padding: 9px 14px; }
  .task-sheet .dialog-body { padding: 12px 14px; }
  .task-sheet .task-sheet-footer { padding-inline: 13px; padding-block: 9px; }
  .compose-tools--shortcuts .button { width: fit-content; }
}
@media (prefers-reduced-motion: reduce) {
  .quick-move-menu.quick-move-sheet, .completion-toast { animation: none; }
  .task-card .task-glint { animation: none !important; }
}
