.nf-date {
  --nfd-accent: var(--nf-accent, #1d2327);
  --nfd-line: var(--nf-line, #dcdcde);
  --nfd-radius: var(--nf-radius, 8px);
  position: relative;
  display: block;
  min-width: 0;
}

.nf-date-trigger {
  display: flex;
  align-items: center;
  gap: 0.6em;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nf-date-icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background-color: currentColor;
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

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

.nf-date-text.is-empty {
  opacity: 0.55;
}

.nf-date.is-open .nf-date-icon {
  background-color: var(--nfd-accent);
  opacity: 1;
}

.nf-date-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 14px;
  border: 1px solid var(--nfd-line);
  border-radius: calc(var(--nfd-radius) * 1.5);
  background: #fff;
  color: #1d2327;
  font-size: 14px;
  line-height: 1.3;
  box-shadow: 0 22px 48px -14px rgba(0, 0, 0, 0.32), 0 2px 6px rgba(0, 0, 0, 0.06);
  animation: nf-date-in 0.14s ease-out;
}

.nf-date-panel[hidden],
.nf-date-backdrop[hidden] {
  display: none;
}

.nf-date.is-up .nf-date-panel:not(.is-floating) {
  top: auto;
  bottom: calc(100% + 6px);
}

.nf-date.is-end .nf-date-panel:not(.is-floating) {
  right: 0;
  left: auto;
}

.nf-date-panel.is-floating {
  position: fixed;
  bottom: auto;
  z-index: 100;
}

.nf-date-panel *,
.nf-date-panel *::before,
.nf-date-panel *::after {
  box-sizing: border-box;
}

.nf-date-panel button {
  margin: 0;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  box-shadow: none;
}

.nf-date-grab {
  display: none;
}

.nf-date-body {
  display: flex;
  gap: 14px;
}

.nf-date-calendar {
  width: 266px;
}

.nf-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.nf-date-nav {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 22px !important;
  line-height: 1;
  cursor: pointer;
}

.nf-date-nav span {
  margin-top: -2px;
}

.nf-date-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-weight: 600 !important;
  text-transform: capitalize !important;
  cursor: pointer;
}

.nf-date-caret {
  width: 0;
  height: 0;
  border-top: 5px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  opacity: 0.6;
}

.nf-date-nav:hover,
.nf-date-title:hover {
  background: color-mix(in srgb, var(--nfd-accent) 9%, transparent);
}

.nf-date-grid {
  display: grid;
  gap: 2px;
}

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

.nf-date-weekday {
  padding: 4px 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.5;
}

.nf-date-day {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nf-date-day:hover {
  background: color-mix(in srgb, var(--nfd-accent) 10%, transparent);
}

.nf-date-day.is-outside {
  opacity: 0.32;
}

.nf-date-day.is-today {
  font-weight: 700;
  color: var(--nfd-accent);
}

.nf-date-day.is-today::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}

.nf-date-day.is-chosen,
.nf-date-pick.is-chosen,
.nf-date-time.is-chosen {
  background: var(--nfd-accent);
  color: #fff;
  font-weight: 600;
  opacity: 1;
}

.nf-date-day.is-chosen::after {
  background: #fff;
}

.nf-date-panel button:focus-visible {
  outline: 2px solid var(--nfd-accent);
  outline-offset: 1px;
}

.nf-date-picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 4px;
}

.nf-date-pick {
  height: 44px;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 4%, transparent);
  color: inherit;
  text-transform: capitalize !important;
  cursor: pointer;
}

.nf-date-pick:hover {
  background: color-mix(in srgb, var(--nfd-accent) 12%, transparent);
}

.nf-date-pick.is-today:not(.is-chosen) {
  color: var(--nfd-accent);
  font-weight: 700;
}

.nf-date-clock {
  display: flex;
  flex-direction: column;
  width: 128px;
  padding-left: 14px;
  border-left: 1px solid var(--nfd-line);
}

.nf-date-clock-title {
  margin: 8px 0 10px;
  font-weight: 600;
  text-align: center;
}

.nf-date-cols {
  display: flex;
  flex: 1;
  align-items: stretch;
  gap: 4px;
}

.nf-date-colon {
  align-self: center;
  font-weight: 700;
  opacity: 0.4;
}

.nf-date-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  max-height: 252px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.nf-date-col::-webkit-scrollbar {
  display: none;
}

.nf-date-time {
  flex: none;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.nf-date-time:hover {
  background: color-mix(in srgb, var(--nfd-accent) 10%, transparent);
}

.nf-date-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--nfd-line);
}

.nf-date-link {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nfd-accent);
  font-weight: 600 !important;
  cursor: pointer;
}

.nf-date-link:first-child {
  color: inherit;
  opacity: 0.65;
}

.nf-date-link:hover {
  background: color-mix(in srgb, var(--nfd-accent) 9%, transparent);
  opacity: 1;
}

.nf-date-done {
  margin-left: auto !important;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--nfd-accent);
  color: #fff;
  font-weight: 600 !important;
  cursor: pointer;
}

.nf-date-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.nf-date-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.45);
  animation: nf-date-fade 0.18s ease-out;
}

.nf-date-panel.is-sheet {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99999;
  width: 100%;
  max-width: none;
  max-height: 92vh;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  border: 0;
  border-radius: 20px 20px 0 0;
  font-size: 16px;
  animation: nf-date-sheet 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nf-date-panel.is-sheet .nf-date-grab {
  display: block;
  width: 40px;
  height: 5px;
  margin: 2px auto 12px;
  border-radius: 999px;
  background: var(--nfd-line);
}

.nf-date-panel.is-sheet .nf-date-body {
  flex-direction: column;
}

.nf-date-panel.is-sheet .nf-date-calendar {
  width: 100%;
}

.nf-date-panel.is-sheet .nf-date-day {
  height: 44px;
}

.nf-date-panel.is-sheet .nf-date-nav {
  width: 44px;
  height: 44px;
}

.nf-date-panel.is-sheet .nf-date-clock {
  width: 100%;
  padding: 12px 0 0;
  border-top: 1px solid var(--nfd-line);
  border-left: 0;
}

.nf-date-panel.is-sheet .nf-date-clock-title {
  margin-top: 0;
}

.nf-date-panel.is-sheet .nf-date-col {
  max-height: 150px;
}

.nf-date-panel.is-sheet .nf-date-time {
  height: 44px;
}

.nf-date-panel.is-sheet .nf-date-foot {
  padding-top: 12px;
}

.nf-date-panel.is-sheet .nf-date-link,
.nf-date-panel.is-sheet .nf-date-done {
  min-height: 44px;
}

html.nf-date-lock,
html.nf-date-lock body {
  overflow: hidden;
}

@keyframes nf-date-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes nf-date-sheet {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@keyframes nf-date-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-date-panel,
  .nf-date-backdrop {
    animation: none;
  }

  .nf-date-col {
    scroll-behavior: auto;
  }
}

.startertk-forms-admin .nf-date-trigger {
  box-sizing: border-box;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--startertk-ui-line);
  border-radius: 8px;
  background: #fff;
  color: #1d2327;
  font-size: 13.5px;
}

.startertk-forms-admin .nf-date-trigger:focus-visible,
.startertk-forms-admin .nf-date.is-open .nf-date-trigger {
  border-color: var(--startertk-ui-600);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--startertk-ui-600) 18%, transparent);
}
