/* =========================
   Base modal infrastructure
   ========================= */
html {
  scrollbar-gutter: stable;
}
html.modal-open,
body.modal-open {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}
html.modal-open .content-inner,
body.modal-open .content-inner,
html.modal-open .content,
body.modal-open .content,
html.modal-open .app,
body.modal-open .app {
  overscroll-behavior: none;
}
@media (max-width: 980px) {
  html.modal-open .content-inner,
  body.modal-open .content-inner {
    overflow: hidden !important;
    touch-action: none;
  }
}
html.modal-open .site-header,
body.modal-open .site-header,
html.modal-open .viewShell__header,
body.modal-open .viewShell__header {
  visibility: hidden;
  pointer-events: none;
}
.modal,
.modal__sheet {
  --modal-radius: 24px;
  --modal-sheet-bg:
    radial-gradient(
      120% 100% at 50% 0%,
      rgba(124, 92, 255, 0.13),
      transparent 54%
    ),
    linear-gradient(180deg, rgba(14, 17, 32, 0.97), rgba(8, 11, 24, 0.99));
  --modal-sheet-border: 1px solid rgba(255, 255, 255, 0.1);
  --modal-sheet-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  --modal-head-pad-x: 24px;
  --modal-head-pad-y: 18px;
  --modal-body-pad-x: 24px;
  --modal-body-pad-y: 20px;
  --modal-footer-pad-x: 24px;
  --modal-footer-pad-y: 18px;
  --modal-control-h: 54px;
  --modal-control-radius: 16px;
  --modal-control-bg:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.055),
      rgba(255, 255, 255, 0.03)
    ),
    rgba(9, 13, 33, 0.88);
  --modal-control-bg-hover:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.062),
      rgba(255, 255, 255, 0.036)
    ),
    rgba(10, 15, 36, 0.94);
  --modal-control-border: rgba(255, 255, 255, 0.1);
  --modal-control-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 24px rgba(0, 0, 0, 0.18);
}

@media (max-width: 560px) {
  .modal,
  .modal__sheet {
    --modal-head-pad-x: 18px;
    --modal-head-pad-y: 16px;
    --modal-body-pad-x: 18px;
    --modal-body-pad-y: 18px;
    --modal-footer-pad-x: 18px;
    --modal-footer-pad-y: 16px;
    --modal-control-h: 52px;
    --modal-control-radius: 15px;
  }
}

.modal {
  --modal-enter-duration: 220ms;
  --modal-enter-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--modal-enter-duration) ease;
  background:
    radial-gradient(
      1200px 600px at 50% -20%,
      rgba(124, 92, 255, 0.22),
      transparent 60%
    ),
    radial-gradient(
      1000px 500px at 80% 100%,
      rgba(34, 211, 238, 0.16),
      transparent 55%
    ),
    linear-gradient(180deg, rgba(18, 24, 42, 0.56), rgba(10, 16, 30, 0.64));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.modal.is-open .modal__backdrop {
  opacity: 1;
}

.modal__sheet {
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: min(var(--modal-max-h, calc(100vh - 32px)), 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--modal-radius);
  background: var(--modal-sheet-bg);
  border: var(--modal-sheet-border);
  box-shadow: var(--modal-sheet-shadow);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transform: translate(-50%, calc(-50% + 12px)) scale(0.985);
  opacity: 0;
  transition:
    transform var(--modal-enter-duration) var(--modal-enter-ease),
    opacity var(--modal-enter-duration) ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.modal.is-open .modal__sheet {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

@media (max-width: 560px) {
  .modal__sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top) - 8px));
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }

  .modal.is-open .modal__sheet {
    transform: translateY(0);
  }
}

.modal__sheet,
.modal__sheet * {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal__grab {
  display: none;
}

@media (max-width: 560px) {
  .modal__grab {
    display: block;
    position: absolute;
    top: 10px;
    left: 50%;
    width: 70px;
    height: 5px;
    border-radius: 999px;
    margin: 0;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.16);
    z-index: 12;
    pointer-events: none;
  }
}

.modal__head,
.modal__header,
.tfHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: var(--modal-head-pad-y) var(--modal-head-pad-x)
    calc(var(--modal-head-pad-y) - 2px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
  background: inherit;
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .modal__head,
  .modal__header,
  .tfHeader {
    padding-top: var(--modal-head-pad-y);
  }
}

.modal__title,
.tfTitle {
  min-width: 0;
  font-weight: 800;
  font-size: var(--fs-md);
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.modal__body,
.tfBody {
  padding: var(--modal-body-pad-y) var(--modal-body-pad-x);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal__footer,
.tfFooter {
  padding: var(--modal-footer-pad-y) var(--modal-footer-pad-x)
    calc(var(--modal-footer-pad-y) + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: inherit;
  flex: 0 0 auto;
}

.modal__close {
  width: var(--tap, 44px);
  height: var(--tap, 44px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.formStack {
  padding: var(--pad-card);
  display: grid;
  gap: var(--space-3);
}

.modalGrid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .modalGrid2 {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

/* =========================
   Shared scrollbars
   ========================= */
.modal__sheet,
.modal__body,
.tfBody {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.modal__body::-webkit-scrollbar,
.modal__sheet::-webkit-scrollbar,
.tfBody::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}
.modal__body::-webkit-scrollbar-thumb,
.modal__sheet::-webkit-scrollbar-thumb,
.tfBody::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
.modal__body::-webkit-scrollbar-track,
.modal__sheet::-webkit-scrollbar-track,
.tfBody::-webkit-scrollbar-track {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal__backdrop,
  .modal__sheet {
    transition: none !important;
  }
}

/* =========================
   Shared modal form controls
   ========================= */
.modal select {
  min-height: var(--modal-control-h);
}
.modal textarea {
  resize: vertical;
}
.modal .field input,
.modal .field textarea,
.modal .field select,
.modal .field__input,
.modal .tfInput,
.modal select.tfInput,
.modal textarea.tfInput {
  border-radius: var(--modal-control-radius);
  border: 1px solid var(--modal-control-border);
  background: var(--modal-control-bg);
  box-shadow: var(--modal-control-shadow);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}
.modal .field input,
.modal .field select,
.modal .field__input:not(textarea):not(select),
.modal .tfInput:not(textarea):not(select),
.modal select.tfInput {
  min-height: var(--modal-control-h);
}
.modal .field textarea,
.modal textarea.tfInput {
  min-height: 120px;
}
.modal .field input:focus,
.modal .field textarea:focus,
.modal .field select:focus,
.modal .field__input:focus,
.modal .tfInput:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.82);
  box-shadow:
    0 0 0 4px rgba(124, 92, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(180deg, rgba(124, 92, 255, 0.1), rgba(255, 255, 255, 0.04)),
    rgba(10, 15, 36, 0.96);
}
.modal .field input::placeholder,
.modal .field textarea::placeholder,
.modal .field__input::placeholder,
.modal .tfInput::placeholder {
  color: rgba(255, 255, 255, 0.38);
}
.modal input[type="date"],
.modal input[type="time"] {
  color-scheme: dark;
  padding-right: 70px;
}
.modal input[type="date"]::-webkit-calendar-picker-indicator,
.modal input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2) !important;
  opacity: 0.95;
  cursor: pointer;
}
@supports (-webkit-appearance: none) {
  .modal input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.9)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 26px center;
    background-size: 18px 18px;
  }

  .modal input[type="time"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.9)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6l4 2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 26px center;
    background-size: 18px 18px;
  }

  .modal input[type="date"]::-webkit-calendar-picker-indicator,
  .modal input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0 !important;
    width: 70px;
    height: 44px;
    cursor: pointer;
  }
}
.modal select,
.modal .field select,
.modal select.tfInput {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.82)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px 18px;
}

.modalGrid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 720px) {
  .modalGrid2 {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

/* =========================
   Shared scrollbars
   ========================= */
.modal__sheet,
.tfBody {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.modal__sheet::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}
.modal__sheet::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.tfBody::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}
.tfBody::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
.tfBody::-webkit-scrollbar-track {
  background: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal__backdrop,
  .modal__sheet {
    transition: none !important;
  }
}
/* =========================
   Task flow modal
   ========================= */
.tfHeader {
  padding: var(--modal-head-pad-y) var(--modal-head-pad-x)
    calc(var(--modal-head-pad-y) - 2px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);

  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap !important;
  width: 100%;
}
@media (max-width: 480px) {
  .tfHeader {
    padding: var(--modal-head-pad-y) var(--modal-head-pad-x)
      calc(var(--modal-head-pad-y) - 2px);
  }
}
.tfHeaderLeft {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap !important;
}
.tfHeaderRight {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.tfBack {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex: 0 0 36px;
}
.tfBack:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.tfBack.is-visible {
  display: flex;
}
.modal--task-flow .tfBack {
  display: none !important;
}
.tfTitleWrap {
  min-width: 0;
}
.tfTitle {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: white;
  line-height: 1.2;
}
.tfSubtitle {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.6);
  margin-top: 1px;
}
.tfClose {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex: 0 0 36px;
}
.tfClose:hover {
  background: rgba(239, 68, 68, 0.15);
  color: rgba(239, 68, 68, 1);
}
.tfBody {
  padding: var(--modal-body-pad-y) var(--modal-body-pad-x);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 480px) {
  .tfBody {
    padding: var(--modal-body-pad-y) var(--modal-body-pad-x);
  }
}
.tfFooter {
  padding: var(--modal-footer-pad-y) var(--modal-footer-pad-x)
    calc(var(--modal-footer-pad-y) + 2px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: none;
}
@media (max-width: 480px) {
  .tfFooter {
    padding: var(--modal-footer-pad-y) var(--modal-footer-pad-x)
      calc(var(--modal-footer-pad-y) + 2px);
  }
}
.tfFooter.is-visible {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}
@media (max-width: 560px) {
  .tfFooter.is-visible {
    flex-direction: column;
    align-items: stretch;
  }
}
.tfStep {
  display: none;
  animation: tfStepIn 0.2s ease;
}
.tfStep.is-active {
  display: block;
}
.tfTypeSwitch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}
.tfTypeSwitchBtn {
  min-width: 0;
  border: none;
  border-radius: 12px;
  padding: 12px 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tfTypeSwitchBtn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.tfTypeSwitchBtn.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(34, 211, 238, 0.9));
  box-shadow: 0 10px 24px rgba(124, 92, 255, 0.28);
}
@media (max-width: 420px) {
  .tfTypeSwitchBtn {
    padding: 11px 8px;
    font-size: var(--fs-xs);
  }
}
@keyframes tfStepIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.tfProgress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.tfDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}
.tfDot.is-active {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 1),
    rgba(34, 211, 238, 1)
  );
  box-shadow:
    0 0 0 4px rgba(124, 92, 255, 0.18),
    0 6px 16px rgba(124, 92, 255, 0.35);
}
.tfDot.is-done {
  background: rgba(16, 185, 129, 1);
}

/* Shared flow chooser block used by tasks / goals / finance modals */
.gFHead {
  text-align: center;
  padding: 10px 0 16px;
}
.gFHeadIco {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: var(--fs-3xl);
  margin: 0 auto 12px;
}
.gFHead h3 {
  font-size: var(--fs-xl);
  font-weight: 900;
}
.gFHead p {
  font-size: var(--fs-sm);
  color: var(--gT5, rgba(255, 255, 255, 0.62));
  margin-top: 4px;
}
.gTypeGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 0;
}
.gTypeCard {
  min-width: 0;
  padding: 24px 16px;
  border-radius: var(--gR, 18px);
  border: 2px solid var(--gBrd, rgba(255, 255, 255, 0.08));
  background: var(--gCard, rgba(255, 255, 255, 0.03));
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
  text-align: center;
  color: #fff;
}
.gTypeCard:hover {
  border-color: var(--gBrdH, rgba(124, 92, 255, 0.45));
  background: var(--gCardH, rgba(255, 255, 255, 0.05));
  transform: translateY(-2px);
}
.gTypeI {
  font-size: var(--fs-3xl);
  margin-bottom: 10px;
}
.gTypeN {
  font-size: var(--fs-sm);
  font-weight: 800;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gTypeD {
  font-size: var(--fs-xs);
  color: var(--gT5, rgba(255, 255, 255, 0.62));
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media (max-width: 480px) {
  .gFHead {
    padding: 8px 0 14px;
  }

  .gTypeGrid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 0 10px;
  }

  .gTypeCard {
    padding: 20px 14px;
  }
}

.tfTypeCard {
  background: rgba(255, 255, 255, 0.02);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}
@media (max-width: 560px) {
  .tfTypeCard {
    padding: 20px;
  }
}
.tfTypeCard:hover {
  border-color: rgba(124, 92, 255, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}
.tfTypeCard.is-selected {
  border-color: rgba(124, 92, 255, 1);
  background: rgba(124, 92, 255, 0.1);
}
@media (max-width: 560px) {
}
.tfImportantRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
}
.tfImportantText {
  min-width: 0;
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
}
.tfImportantTitle {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.tfImportantSub {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-secondary);
}
.tfSwitch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  user-select: none;
}
.tfSwitch__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.tfSwitch__track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  cursor: pointer;
  transition:
    background 0.14s var(--ease),
    border-color 0.14s var(--ease),
    box-shadow 0.14s var(--ease);
}
.tfSwitch__thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition:
    transform 0.14s var(--ease),
    background 0.14s var(--ease);
}
.tfSwitch__input:checked + .tfSwitch__track {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.tfSwitch__input:checked + .tfSwitch__track .tfSwitch__thumb {
  transform: translate(18px, -50%);
  background: rgba(255, 255, 255, 0.92);
}
.tfSwitch__input:focus-visible + .tfSwitch__track {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(139, 92, 246, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.tfGroup {
  margin-bottom: 20px;
}
.tfLabel {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.66);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.tfInput {
  width: 100%;
  min-height: var(--modal-control-h);
  padding: 0 16px;
  background: var(--modal-control-bg);
  border: 1px solid var(--modal-control-border);
  border-radius: var(--modal-control-radius);
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: var(--modal-control-shadow);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}
.tfInput:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.82);
  background:
    linear-gradient(180deg, rgba(124, 92, 255, 0.1), rgba(255, 255, 255, 0.04)),
    rgba(10, 15, 36, 0.96);
  box-shadow:
    0 0 0 4px rgba(124, 92, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.22);
}
.tfRow2 {
  display: grid;

  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}
.tfGroup--schedule {
  margin-bottom: 18px;
}
.tfScheduleUnified {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 1px minmax(132px, 0.85fr);
  align-items: stretch;
  min-height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(8, 13, 30, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.tfScheduleUnifiedBtn {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: white;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, opacity 0.18s ease;
}
.tfScheduleUnifiedBtn:hover {
  background: rgba(255, 255, 255, 0.03);
}
.tfScheduleUnifiedBtn.is-empty .tfScheduleUnifiedValue {
  color: rgba(255, 255, 255, 0.58);
}
.tfScheduleUnifiedBtn.is-disabled {
  opacity: 0.72;
}
.tfScheduleUnifiedIcon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.72);
}
.tfScheduleUnifiedIcon svg {
  display: block;
  width: 100%;
  height: 100%;
}
.tfScheduleUnifiedValue {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tfScheduleUnifiedDivider {
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}
.tfScheduleNativeInput {
  position: absolute;
  top: 0;
  bottom: 0;
  opacity: 0.01;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}
#tfSingleDate.tfScheduleNativeInput {
  left: 0;
  width: calc(57.4468% - 0.5px);
}
#tfSingleTime.tfScheduleNativeInput {
  right: 0;
  width: calc(42.5532% - 0.5px);
}
@media (max-width: 420px) {
  .tfRow2 {
    grid-template-columns: 1fr;
  }
  .tfScheduleUnified {
    grid-template-columns: 1fr;
  }
  .tfScheduleUnifiedDivider {
    width: auto;
    height: 1px;
  }
  #tfSingleDate.tfScheduleNativeInput,
  #tfSingleTime.tfScheduleNativeInput {
    left: 0;
    right: 0;
    width: 100%;
  }
  #tfSingleDate.tfScheduleNativeInput {
    top: 0;
    bottom: 50%;
  }
  #tfSingleTime.tfScheduleNativeInput {
    top: 50%;
    bottom: 0;
  }
}
.tfRepeatMode {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.tfRepeatBtn {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}
.tfRepeatBtn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}
.tfRepeatBtn.is-active {
  border-color: rgba(124, 92, 255, 1);
  background: rgba(124, 92, 255, 0.1);
  color: rgba(160, 175, 255, 1);
}
.tfDays {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.tfDayBtn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tfDayBtn:hover:not(.is-selected) {
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}
.tfDayBtn.is-selected {
  border-color: transparent;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 1),
    rgba(34, 211, 238, 1)
  );
  color: white;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.35);
}
.tfDatesGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.tfDateBtn {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.tfDateBtn:hover:not(.is-selected) {
  border-color: rgba(255, 255, 255, 0.15);
  color: white;
}
.tfDateBtn.is-selected {
  border-color: transparent;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 1),
    rgba(34, 211, 238, 1)
  );
  color: white;
}
.tfHint {
  margin-top: 10px;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.64);
}
.tfWarn {
  display: none;
  padding: 14px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 12px;
  margin-top: 18px;
  font-size: var(--fs-sm);
  color: rgba(245, 158, 11, 1);
  align-items: center;
  gap: 12px;
}
.tfWarn.is-show {
  display: flex;
}
.tfExisting {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: none;
}
.tfExisting.is-show {
  display: block;
}
.tfExistingTitle {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tfExistingList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tfExistingItem {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.tfExistingMain {
  min-width: 0;
  flex: 1;
}
.tfExistingTitleTxt {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tfExistingMeta {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.35;
}
.tfMiniBtns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.tfMiniBtn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.tfMiniBtn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.tfMiniBtn.is-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  color: rgba(239, 68, 68, 1);
}
.tfBtnPrimary {
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.95),
    rgba(34, 211, 238, 0.95)
  );
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 750;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.tfBtnPrimary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#taskFlowModal {
  color-scheme: dark;
}
#taskFlowModal input[type="date"]::-webkit-calendar-picker-indicator,
#taskFlowModal input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}
#fnFlowModal {
  color-scheme: dark;
}
#fnFlowModal input[type="date"]::-webkit-calendar-picker-indicator,
#fnFlowModal input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}
.modal__sheet--finance-flow {
  width: min(560px, calc(100vw - 28px));
  max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top) - 12px));
  display: flex;
  flex-direction: column;
}
@media (max-width: 560px) {
  .modal--finance-flow .modal__sheet--finance-flow {
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
  }
}

.modal__sheet img,
.modal__sheet video,
.modal__sheet canvas,
.modal__sheet svg {
  max-width: 100%;
  height: auto;
}

/* Mobile-native date/time fields rendered in project style */
.appPicker {
  --picker-radius: 16px;
  position: relative;
  min-height: 54px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px 0 18px;
  border-radius: var(--picker-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.055),
      rgba(255, 255, 255, 0.03)
    ),
    rgba(9, 13, 33, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.18);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
  cursor: pointer;
}
.appPicker:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.062),
      rgba(255, 255, 255, 0.036)
    ),
    rgba(10, 15, 36, 0.94);
}
.appPicker.is-focus {
  border-color: rgba(124, 92, 255, 0.82);
  box-shadow:
    0 0 0 4px rgba(124, 92, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(180deg, rgba(124, 92, 255, 0.1), rgba(255, 255, 255, 0.04)),
    rgba(10, 15, 36, 0.96);
}
.appPicker.is-empty .appPicker__value {
  color: rgba(255, 255, 255, 0.38);
}
.appPicker__value {
  min-width: 0;
  flex: 1;
  color: rgba(255, 255, 255, 0.94);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appPicker__icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  opacity: 0.92;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}
.appPicker--date .appPicker__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.96)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='4'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}
.appPicker--time .appPicker__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.96)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}
.appPicker__native {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  opacity: 0 !important;
  cursor: pointer !important;
  border: 0 !important;
  background: transparent !important;
  appearance: none;
  -webkit-appearance: none;
  color: transparent !important;
  padding: 0 !important;
}
.appPicker__native::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.tfGroup > .appPicker,
.gFg > .appPicker {
  margin-top: 0;
}
@media (max-width: 560px) {
  .appPicker {
    min-height: 52px;
    padding-inline: 15px;
    border-radius: 15px;
  }
}

/* Modal UI polish: consistent controls, cards and actions */
.modal .ppBtn,
.modal .btnWide,
.modal .ppBtn.ppBtn--wide,
.modal .ppBtn.ppBtn--big {
  min-height: 54px;
  border-radius: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.modal .ppBtn.ppBtn--ghost {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.03)
    ),
    rgba(11, 16, 36, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.14);
}
.tfImportantTitle {
  font-size: 17px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.96);
  line-height: 1.15;
}
.tfImportantSub {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
}
@media (max-width: 560px) {
  .modal .ppBtn,
  .modal .btnWide,
  .modal .ppBtn.ppBtn--wide,
  .modal .ppBtn.ppBtn--big,
  .tfBtnPrimary {
    min-height: 52px;
    border-radius: 16px;
  }
  .tfImportantRow {
    padding: 15px 16px;
    border-radius: 16px;
  }
  .tfImportantTitle {
    font-size: 16px;
  }
}

/* Final modal polish overrides */
.tfFooter {
  display: none;
  padding: var(--modal-footer-pad-y) var(--modal-footer-pad-x)
    calc(var(--modal-footer-pad-y) + 6px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tfFooter.is-visible {
  display: block;
  position: sticky;
  bottom: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 12, 22, 0.74),
    rgba(10, 12, 22, 0.96)
  );
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}
.tfBtnPrimary {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(
    135deg,
    rgba(124, 92, 255, 0.98),
    rgba(34, 211, 238, 0.96)
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 14px 32px rgba(34, 211, 238, 0.18);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}
.tfBtnPrimary:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 18px 38px rgba(34, 211, 238, 0.24);
  filter: saturate(1.05);
}
.tfBtnPrimary:active {
  transform: translateY(0);
}
.tfImportantRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.03)
    ),
    rgba(11, 16, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 26px rgba(0, 0, 0, 0.16);
}
.appPicker {
  min-height: var(--modal-control-h);
  border-radius: var(--modal-control-radius);
  border-color: var(--modal-control-border);
  background: var(--modal-control-bg);
  box-shadow: var(--modal-control-shadow);
}
.appPicker:hover {
  background: var(--modal-control-bg-hover);
}
@media (max-width: 560px) {
  .tfFooter {
    padding-bottom: calc(var(--modal-footer-pad-y) + 8px + var(--safe-bottom));
  }
  .tfFooter.is-visible {
    background: linear-gradient(
      180deg,
      rgba(10, 12, 22, 0.78),
      rgba(10, 12, 22, 0.98)
    );
  }
  .tfBtnPrimary {
    min-height: 52px;
    border-radius: 16px;
  }
}

/* === 2026-03 mobile modal architecture fix === */
:root {
  --z-base: 1;
  --z-dropdown: 1200;
  --z-sticky: 1300;
  --z-toast: 1350;
  --z-sheet: 1400;
  --z-modal: 2600;
  --z-snackbar: 2650;
  --z-confirm: 2700;
  --z-tooltip: 2800;
  --modal-brand-overlay:
    radial-gradient(
      1200px 600px at 50% -20%,
      rgba(124, 92, 255, 0.16),
      transparent 60%
    ),
    radial-gradient(
      1000px 500px at 80% 100%,
      rgba(34, 211, 238, 0.12),
      transparent 55%
    ),
    rgba(8, 10, 18, 0.72);
  --modal-brand-surface:
    radial-gradient(
      120% 100% at 50% 0%,
      rgba(124, 92, 255, 0.13),
      transparent 54%
    ),
    linear-gradient(180deg, rgba(14, 17, 32, 0.97), rgba(8, 11, 24, 0.99));
}

/* goals step 1 real mobile fix: keep type cards in 2x2 grid on phones */
@media (max-width: 480px) {
  #goalsFormOv .gTypeGrid,
  #goalsDetailOv .gTypeGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 14px 0 10px !important;
  }

  #goalsFormOv .gTypeCard,
  #goalsDetailOv .gTypeCard {
    min-height: 128px !important;
    padding: 18px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  #goalsFormOv .gTypeI,
  #goalsDetailOv .gTypeI {
    font-size: 30px !important;
    margin-bottom: 8px !important;
    line-height: 1 !important;
  }

  #goalsFormOv .gTypeN,
  #goalsDetailOv .gTypeN {
    font-size: 14px !important;
    line-height: 1.15 !important;
    margin-bottom: 4px !important;
  }

  #goalsFormOv .gTypeD,
  #goalsDetailOv .gTypeD {
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  #goalsFormOv .ppBtn--ghost.ppBtn--big,
  #goalsDetailOv .ppBtn--ghost.ppBtn--big {
    min-height: 48px !important;
    padding: 12px 16px !important;
  }
}

/* =========================
   Task modal page-specific styles
   ========================= */
.task-modal {
  color-scheme: dark;
}
.task-modal__body > :last-child {
  margin-bottom: 0;
}
.task-modal__footer.is-visible {
  position: sticky;
  bottom: 0;
  z-index: 8;
}
@media (max-width: 560px) {
  .task-modal__footer.is-visible {
    padding-bottom: calc(
      var(--modal-footer-pad-y) + env(safe-area-inset-bottom)
    );
  }
}

/* ===== FINAL TASK MODAL FIX ===== */
/* isolate layout so footer never overlaps and modal doesn't stretch */

.modal--task-flow .task-modal {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 760px);
}

.modal--task-flow .task-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal--task-flow .task-modal__footer {
  position: relative !important;
  bottom: auto !important;
  margin-top: 0;
}

@media (max-width: 560px) {
  .modal--task-flow .task-modal {
    width: 100vw;
    max-width: 100vw;
    height: auto;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
  }
}

/* =========================
   Goals modal page-specific styles
   ========================= */
.goal-modal {
  display: flex;
  flex-direction: column;
  color-scheme: dark;
  max-height: min(92dvh, 760px);
}

.goal-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.goal-modal__footer.is-visible {
  position: sticky;
  bottom: 0;
  z-index: 8;
}

.goal-modal .gInp,
.goal-modal select.gInp,
.goal-modal input.gInp,
.goal-modal textarea.gInp {
  color: #fff;
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
}

.goal-modal .gInp::placeholder,
.goal-modal input.gInp::placeholder,
.goal-modal textarea.gInp::placeholder,
.goal-modal .gInp::-webkit-input-placeholder,
.goal-modal input.gInp::-webkit-input-placeholder,
.goal-modal textarea.gInp::-webkit-input-placeholder {
  color: rgba(255, 255, 255, 0.42);
  -webkit-text-fill-color: rgba(255, 255, 255, 0.42);
  opacity: 1;
}

.goal-modal input[type="date"].gInp,
.goal-modal input[type="number"].gInp {
  color: #fff;
  -webkit-text-fill-color: #fff;
  color-scheme: dark;
}

.goal-modal input[type="date"].gInp::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.15);
  opacity: 0.95;
}

.goal-modal .ppBtn,
.goal-modal .tfBtnPrimary,
.goal-modal .tfClose,
.goal-modal .tfBack,
.goal-modal .gTopMenuBtn {
  color: #fff;
}

.goal-modal .appPicker {
  border-radius: var(--gRs);
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.03)
    ),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.goal-modal .appPicker.is-focus {
  border-color: rgba(124, 92, 255, 0.78);
  box-shadow:
    0 0 0 4px rgba(124, 92, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

@media (max-width: 560px) {
  .goal-modal__footer.is-visible {
    padding-bottom: calc(
      var(--modal-footer-pad-y) + env(safe-area-inset-bottom)
    );
  }

  .modal--goals-detail .goal-modal,
  .modal--goals-form .goal-modal {
    width: 100vw;
    max-width: 100vw;
    height: auto;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
  }
}

/* === 2026-03-09 mobile modal hotfix: keep handle overlay without extra top band === */
@media (max-width: 560px) {
  .modal__grab + .modal__head,
  .modal__grab + .modal__header,
  .modal__grab + .tfHeader {
    padding-top: calc(var(--modal-head-pad-y) + 18px);
  }

  .modal--goals-detail .gDetailBar,
  .modal--goals-form .modal__grab,
  .ideasModal .modal__grab {
    top: 10px;
    margin-top: 0;
  }

  .modal--goals-detail .goal-modal,
  .modal--goals-form .goal-modal,
  .ideasModal .modal__sheet--ideas,
  .ideasDialog .ideasDialog__sheet {
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top) - 8px));
  }

  .modal--goals-detail .goal-modal__header {
    padding-top: calc(var(--modal-head-pad-y) + 18px);
  }

  .modal--goals-form .goal-modal__header {
    padding-top: var(--modal-head-pad-y);
  }

  .modal--goals-detail .goal-modal__body,
  .modal--goals-form .goal-modal__body {
    padding-bottom: calc(var(--modal-body-pad-y) + 10px);
  }

  .modal--goals-detail .goal-modal__footer.is-visible,
  .modal--goals-form .goal-modal__footer.is-visible {
    padding-bottom: calc(
      var(--modal-footer-pad-y) + env(safe-area-inset-bottom)
    );
  }
}


.entityConfirmOverlay {
  backdrop-filter: blur(12px) saturate(0.92);
  position: fixed;
  inset: 0;
  z-index: var(--z-confirm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(5, 10, 24, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.entityConfirmOverlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.entityConfirmBox {
  width: min(100%, 344px);
  border-radius: 22px;
  padding: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(124, 92, 255, 0.14), transparent 54%),
    linear-gradient(180deg, rgba(14, 18, 38, 0.96), rgba(9, 13, 28, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  color: #e6e9f2;
  transform: translateY(8px) scale(0.985);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.entityConfirmOverlay.is-visible .entityConfirmBox {
  width: min(100%, 344px);
  border-radius: 22px;
  padding: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(124, 92, 255, 0.14), transparent 54%),
    linear-gradient(180deg, rgba(14, 18, 38, 0.96), rgba(9, 13, 28, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  color: #e6e9f2;
  transform: translateY(8px) scale(0.985);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.entityConfirmBox__icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin-bottom: 10px;
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.16);
  font-size: 24px;
}

.entityConfirmBox__title {
  margin: 0;
  color: #e6e9f2;
}

.entityConfirmBox__desc {
  margin: 0;
  color: #8c95b2;
}

.entityConfirmBox__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.entityConfirmBox__btn {
  flex: 1 1 0;
  min-height: 46px;
  border-radius: 14px;
  border: 0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.entityConfirmBox__btn--cancel {
  background: #eef2f7;
  color: #111827;
}

.entityConfirmBox__btn--ok {
  background: #ef4444;
  color: #fff;
}

.entitySnackbarHost {
  position: fixed;
  left: 50%;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 1450;
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 520px);
  pointer-events: none;
}

.entitySnackbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  background: rgba(17, 24, 39, 0.96);
  color: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}

.entitySnackbar.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.entitySnackbar.is-leaving {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

.entitySnackbar__msg {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

.entitySnackbar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.entitySnackbar__action,
.entitySnackbar__close {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.entitySnackbar__action {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  color: #93c5fd;
}

.entitySnackbar__action:hover,
.entitySnackbar__action:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.entitySnackbar__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
}

.entitySnackbar__close:hover,
.entitySnackbar__close:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

@media (max-width: 560px) {
  .entitySnackbarHost {
    width: calc(100vw - 20px);
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 10px));
  }

  .entitySnackbar {
    min-height: 52px;
    padding: 12px 12px 12px 14px;
    border-radius: 16px;
    gap: 10px;
  }

  .entitySnackbar__msg {
    font-size: 13px;
  }
}


.entityConfirmHost.is-open .entityConfirmBox {
  transform: translateY(0) scale(1);
}


.entityConfirmBox__actions button {
  height: 42px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}
.entityConfirmBox__actions button:active {
  transform: scale(0.985);
}


.entityConfirmBox__btn--cancel,
#entityConfirmCancel {
  background: rgba(255, 255, 255, 0.07);
  color: #e6e9f2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.entityConfirmBox__btn--cancel:hover,
#entityConfirmCancel:hover {
  background: rgba(255, 255, 255, 0.11);
}


.entityConfirmBox__btn--ok,
#entityConfirmOk {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.22);
}
.entityConfirmBox__btn--ok:hover,
#entityConfirmOk:hover {
  background: linear-gradient(180deg, #f15a5a, #dc2626);
}

.entityConfirmBox__btn--success {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.22);
}
.entityConfirmBox__btn--success:hover {
  background: linear-gradient(180deg, #34d399, #16a34a);
}

.entityConfirmBox__btn--purple {
  background: linear-gradient(180deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.24);
}
.entityConfirmBox__btn--purple:hover {
  background: linear-gradient(180deg, #9f7aea, #7c3aed);
}

.entityConfirmBox__btn--neutral {
  background: linear-gradient(180deg, #475569, #334155);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(51, 65, 85, 0.22);
}
.entityConfirmBox__btn--neutral:hover {
  background: linear-gradient(180deg, #64748b, #334155);
}


body.has-entity-confirm-open {
  overflow: hidden;
}

.entityConfirmBox:focus {
  outline: none;
}

.modal textarea.tfInput.tfInput--autoGrow {
  min-height: 56px;
  max-height: 180px;
  padding: 14px 16px;
  line-height: 1.4;
  resize: none;
  overflow-y: hidden;
}

.tfInput.tfInput--autoGrow {
  min-height: 56px;
  max-height: 180px;
  padding: 14px 16px;
  line-height: 1.4;
  resize: none;
  overflow-y: hidden;
}


/* entity confirm dialog: resilient wrapping for long unbroken text */
.entityConfirmOverlay {
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.entityConfirmBox {
  width: min(calc(100vw - 32px), 420px);
  max-width: 100%;
  max-height: min(calc(100dvh - 32px), 560px);
  min-width: 0;
  overflow: hidden;
}

.entityConfirmBox__title,
.entityConfirmBox__desc,
.entityConfirmBox__btn {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entityConfirmBox__title {
  display: block;
  line-height: 1.25;
}

.entityConfirmBox__desc {
  display: block;
  line-height: 1.45;
  max-height: min(34dvh, 180px);
  overflow: auto;
  padding-right: 2px;
}

.entityConfirmBox__actions {
  align-items: stretch;
}

@media (max-width: 420px) {
  .entityConfirmBox__actions {
    grid-template-columns: 1fr;
  }
}


/* === 2026-03-12 entity confirm modal: robust content separation and wrapping === */
.entityConfirmOverlay {
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.entityConfirmBox {
  width: min(100%, 420px);
  max-width: min(420px, calc(100vw - 32px));
  max-height: min(88dvh, calc(100dvh - 32px));
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  box-sizing: border-box;
}

.entityConfirmOverlay.is-visible .entityConfirmBox {
  width: min(100%, 420px);
  max-width: min(420px, calc(100vw - 32px));
  max-height: min(88dvh, calc(100dvh - 32px));
  transform: translateY(0) scale(1);
  opacity: 1;
}

.entityConfirmBox__title {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
}


.entityConfirmBox__entity[hidden] {
  display: none !important;
}

.entityConfirmBox__entity {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.entityConfirmBox__entityLabel {
  min-width: 0;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(140, 149, 178, 0.78);
}

.entityConfirmBox__entityValue {
  min-width: 0;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 700;
  color: #e6e9f2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entityConfirmBox__desc {
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #8c95b2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entityConfirmBox__actions {
  margin-top: 4px;
}

@media (max-width: 480px) {
  .entityConfirmBox,
  .entityConfirmOverlay.is-visible .entityConfirmBox {
    width: 100%;
    max-width: calc(100vw - 24px);
    padding: 16px;
    border-radius: 20px;
  }
}

@media (max-width: 360px) {
  .entityConfirmBox__actions {
    grid-template-columns: 1fr;
  }
}

/* === 2026-03-13 remove swipe handle from all modals === */
.modal__grab,
.gDetailBar {
  display: none !important;
}

@media (max-width: 560px) {
  .modal__grab,
  .gDetailBar {
    display: none !important;
  }

  .modal__head,
  .modal__header,
  .tfHeader,
  .modal__grab + .modal__head,
  .modal__grab + .modal__header,
  .modal__grab + .tfHeader,
  .modal--goals-detail .goal-modal__header,
  .modal--goals-form .goal-modal__header {
    padding-top: var(--modal-head-pad-y) !important;
  }
}


/* === 2026-03-13 unify modal visuals with ideas gradient === */
.entityConfirmBox {
  background:
    radial-gradient(
      120% 100% at 50% 0%,
      rgba(124, 92, 255, 0.13),
      transparent 54%
    ),
    linear-gradient(180deg, rgba(14, 17, 32, 0.97), rgba(8, 11, 24, 0.99));
}
