/* 逐段打卡与自定义表单控件 */

.subject-flow-segment {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 9.5px;
  text-align: left;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.16s var(--ease-spring);
}

.subject-flow-segment:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 16px rgba(38, 51, 45, 0.06);
  transform: translateY(-1px);
}

.subject-flow-segment:active {
  transform: scale(0.98);
}

.subject-flow-segment.is-checked {
  color: var(--mint-deep);
  background: var(--mint-soft);
  border-color: rgba(95, 149, 127, 0.12);
}

.subject-flow-segment .segment-check {
  display: inline-grid;
  flex: 0 0 15px;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 1px;
  color: transparent;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(46, 125, 111, 0.2);
  border-radius: 50%;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s var(--ease-spring);
}

.subject-flow-segment .segment-check svg {
  width: 9px;
  height: 9px;
  opacity: 0;
  transform: scale(0.55);
  transition:
    opacity 0.18s ease,
    transform 0.24s var(--ease-spring);
}

.subject-flow-segment.is-checked .segment-check {
  color: #fff;
  background: var(--mint-deep);
  border-color: var(--mint-deep);
}

.subject-flow-segment.is-checked .segment-check svg {
  opacity: 1;
  transform: scale(1);
}

.native-control {
  display: none !important;
}

.custom-control {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-trigger {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  background: rgba(118, 118, 128, 0.08);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.12s ease;
}

.custom-trigger:hover {
  background: rgba(118, 118, 128, 0.11);
}

.custom-trigger:focus-visible {
  outline: 2px solid rgba(46, 125, 111, 0.42);
  outline-offset: 1px;
}

.custom-trigger:active {
  transform: scale(0.995);
}

.custom-control.is-open .custom-trigger {
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 0 0 1px rgba(46, 125, 111, 0.2),
    0 8px 24px rgba(38, 51, 45, 0.07);
}

.custom-trigger-icon {
  display: grid;
  flex: 0 0 18px;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--mint-deep);
}

.custom-trigger-icon svg {
  width: 18px;
  height: 18px;
}

.custom-trigger-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-trigger.is-placeholder .custom-trigger-value {
  color: var(--muted);
}

.custom-chevron {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  color: var(--ink-soft);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition:
    color 0.2s ease,
    transform 0.24s var(--ease-spring);
}

.custom-control.is-open .custom-chevron {
  color: var(--mint-deep);
  transform: rotate(225deg) translateY(-1px);
}

.app-dialog.has-open-popover {
  overflow: visible;
}

.custom-popover {
  position: absolute;
  z-index: 40;
  max-height: min(70vh, 420px);
  padding: 8px;
  overflow-y: auto;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(38, 51, 45, 0.22);
  opacity: 0;
  transform: translateY(5px) scale(0.98);
  transform-origin: top center;
  transition:
    opacity 0.18s ease,
    transform 0.24s var(--ease-spring);
  backdrop-filter: blur(28px) saturate(1.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.15);
  overscroll-behavior: contain;
}

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

.custom-popover.is-floating {
  position: fixed;
}

.custom-popover.is-sheet {
  max-height: 70vh;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  border-radius: 22px;
  transform-origin: bottom center;
}

.popover-handle {
  display: none;
  width: 36px;
  height: 4px;
  margin: 2px auto 7px;
  background: rgba(60, 60, 67, 0.18);
  border-radius: 999px;
}

.custom-popover.is-sheet .popover-handle {
  display: block;
}

.popover-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 6px;
}

.popover-head strong {
  font-size: 12px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
}

.popover-close {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  background: rgba(118, 118, 128, 0.08);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    transform 0.18s var(--ease-spring);
}

.popover-close:hover {
  color: var(--ink);
  background: rgba(118, 118, 128, 0.14);
  transform: rotate(90deg);
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 2px;
}

.choice-option {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.16s var(--ease-spring);
}

.choice-option:hover:not(:disabled) {
  background: rgba(46, 125, 111, 0.07);
}

.choice-option:active:not(:disabled) {
  transform: scale(0.99);
}

.choice-option.is-selected {
  background: rgba(46, 125, 111, 0.1);
}

.choice-option:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.choice-check {
  display: grid;
  flex: 0 0 20px;
  place-items: center;
  width: 20px;
  height: 20px;
  color: transparent;
  background: rgba(255, 255, 255, 0.62);
  border: 1.5px solid rgba(60, 60, 67, 0.18);
  border-radius: 50%;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.choice-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.55);
  transition:
    opacity 0.16s ease,
    transform 0.22s var(--ease-spring);
}

.choice-option.is-selected .choice-check {
  color: #fff;
  background: var(--mint-deep);
  border-color: var(--mint-deep);
}

.choice-option.is-selected .choice-check svg {
  opacity: 1;
  transform: scale(1);
}

.choice-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-empty {
  padding: 18px 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.time-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: 6px 0 10px;
}

.time-display [data-time-preview] {
  color: var(--mint-deep);
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.time-display small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

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

.time-column {
  min-width: 0;
}

.time-column-label {
  display: block;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
  letter-spacing: 0.08em;
}

.time-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 156px;
  padding: 3px;
  overflow-y: auto;
  background: rgba(118, 118, 128, 0.055);
  border-radius: 12px;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
}

.time-options::-webkit-scrollbar {
  display: none;
}

.time-option {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 8px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  scroll-snap-align: center;
  transition:
    color 0.16s ease,
    background 0.16s ease,
    transform 0.16s var(--ease-spring);
}

.time-option:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

.time-option.is-selected {
  color: #fff;
  background: var(--mint-deep);
  box-shadow: 0 5px 12px rgba(46, 125, 111, 0.18);
}

.time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 1px 2px;
}

.time-preset {
  min-height: 28px;
  padding: 4px 9px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  background: rgba(118, 118, 128, 0.07);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.16s ease,
    background 0.16s ease,
    transform 0.16s var(--ease-spring);
}

.time-preset:hover {
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.time-preset:active {
  transform: scale(0.96);
}

.time-preset.is-selected {
  color: var(--mint-deep);
  background: var(--mint-soft);
  box-shadow: inset 0 0 0 1px rgba(46, 125, 111, 0.16);
}

.popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.popover-actions .form-button {
  flex: 1;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}

.popover-actions.is-split .date-today-button {
  flex: 0 0 auto;
}

.date-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 8px;
}

.date-toolbar strong {
  font-size: 12px;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

.date-nav {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  background: rgba(118, 118, 128, 0.07);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 0.16s ease,
    background 0.16s ease,
    transform 0.16s var(--ease-spring);
}

.date-nav:hover {
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.date-nav:active {
  transform: scale(0.94);
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.date-weekdays span {
  padding: 4px 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.date-day,
.date-blank {
  display: grid;
  place-items: center;
  height: 31px;
}

.date-day {
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition:
    color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s var(--ease-spring);
}

.date-day:hover {
  background: var(--mint-soft);
}

.date-day:active {
  transform: scale(0.94);
}

.date-day.is-today {
  color: var(--mint-deep);
  box-shadow: inset 0 0 0 1px rgba(46, 125, 111, 0.3);
}

.date-day.is-selected {
  color: #fff;
  background: var(--mint-deep);
  box-shadow: 0 5px 12px rgba(46, 125, 111, 0.18);
}

.import-choice .custom-control {
  flex: 1 1 190px;
  width: auto;
}

.import-choice .custom-trigger,
.import-duplicate-row .custom-trigger {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
}

.import-duplicate-row .custom-control {
  width: auto;
  min-width: 150px;
}

.import-pending-fields .custom-trigger {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 10.5px;
  border-radius: 8px;
}

.import-pending-fields .custom-trigger-icon {
  display: none;
}

@media (max-width: 768px) {
  .subject-flow-segment {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 9px;
  }

  .custom-trigger {
    min-height: 44px;
    font-size: 16px;
  }

  .custom-trigger-icon,
  .custom-trigger-icon svg {
    width: 20px;
    height: 20px;
  }

  .custom-popover.is-sheet {
    box-shadow: 0 30px 80px rgba(38, 51, 45, 0.26);
  }

  .choice-option {
    min-height: 46px;
    font-size: 14px;
  }

  .popover-head strong {
    font-size: 13px;
  }

  .time-display [data-time-preview] {
    font-size: 38px;
  }

  .time-option {
    min-height: 34px;
    font-size: 13px;
  }

  .date-day,
  .date-blank {
    height: 34px;
  }

  .date-day {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .custom-popover,
  .custom-chevron,
  .custom-trigger,
  .subject-flow-segment,
  .choice-option,
  .time-option,
  .date-day {
    transition: none;
  }
}
