/* ============================================================
   Date Picker 2 (.dp2-*) — appointment scheduler, 3 variants
   ------------------------------------------------------------
   Standalone from v1 (.dp-*). New family for design exploration.
   Uses UOB tokens only. Min readable text 16px (--uob-font-base),
   min touch target 48px. Accent (--uob-primary) on selected state.

   Variants (modifier on .dp2):
     .dp2--vertical  Option A  date chips + vertical time list
     .dp2--calendar  Option B  month grid + 2-col time pills
     .dp2--guided    Option C  week strip + AM/PM groups + sheet
   ============================================================ */

.dp2 {
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-family: 'Noto Sans', sans-serif;
}

/* ── Branch selector (dropdown with search) ── */
.dp2-branch,
.dp2-service,
.dp2-date-field,
.dp2-time-slot-field { position: relative; display: flex; flex-direction: column; gap: 6px; }
.dp2-label {
  font-size: var(--uob-font-sm);
  font-weight: 700;
  color: var(--uob-black);
  line-height: 1.4;
}
.dp2-label .req { color: var(--uob-red); }

/* Field shell — keep 48px branch control height inside appointment forms */
.dp2-branch-field { position: relative; width: 100%; min-width: 0; }
.dp2-branch .dd-trigger.dp2-branch-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  font-family: inherit;
  font-size: var(--uob-font-base);
  color: var(--uob-black);
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: border-color 0.15s;
  user-select: none;
  outline: none;
}
.dp2-branch .dd-trigger.dp2-branch-trigger:hover { border-color: var(--uob-primary); border-width: 1px; }
.dp2-branch .dd-trigger.dp2-branch-trigger.is-open,
.dp2-branch .dd-trigger.dp2-branch-trigger:focus {
  border-color: var(--uob-primary);
  border-width: 1px;
}
.dp2-branch .dd-trigger.dp2-branch-trigger.is-error {
  border-color: var(--uob-red);
  border-width: 2px;
}
.dp2-branch .dd-value.dp2-branch-trigger__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--uob-font-base);
  color: var(--uob-black);
}
.dp2-branch .dd-value.dp2-branch-trigger__value.is-placeholder { color: var(--uob-grey-40); }
/* Match .service-pill__check accent + column (20px) */
.dp2-branch .dd-search-icon-wrap {
  width: 20px;
  justify-content: center;
}
.dp2-branch .dd-search-icon {
  color: var(--uob-orange);
}
.dp2-branch .dd-search-input {
  font-size: var(--uob-font-base);
}
.dp2-branch .dd-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--uob-grey-40);
  transition: transform 0.2s;
}
.dp2-branch .dd-trigger.is-open .dd-chevron,
.dp2-branch .dd-chevron.is-up {
  transform: rotate(180deg);
  color: var(--uob-primary);
}

.dp2-branch-panel,
.dp2-branch .dd-panel.dp2-branch-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--uob-white);
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  display: none;
  margin-top: 0;
}
.dp2-branch-panel.is-open,
.dp2-branch-panel.is-visible,
.dp2-branch .dd-panel.dp2-branch-panel.is-open,
.dp2-branch .dd-panel.dp2-branch-panel.is-visible { display: block; }

/* Sheet-only search row (layout-c mobile) */
.dp2-branch-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--uob-grey-10);
  position: sticky;
  top: 0;
  background: var(--uob-white);
}
.dp2-branch-search svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--uob-grey-40); }
.dp2-branch-search input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: var(--uob-font-base);
  color: var(--uob-black);
  background: transparent;
}
.dp2-branch-option,
.dp2-branch .dd-option.dp2-branch-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--uob-radius-sm);
  font-size: var(--uob-font-base);
  color: var(--uob-black);
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.1s;
}
.dp2-branch-option:hover,
.dp2-branch .dd-option.dp2-branch-option:hover,
.dp2-branch .dd-option.dp2-branch-option.is-highlighted {
  background: var(--uob-hover-blue);
  color: var(--uob-white);
}
.dp2-branch-option.is-selected,
.dp2-branch .dd-option.dp2-branch-option.is-selected {
  background: var(--uob-grey-10);
  color: var(--uob-primary);
  font-weight: 700;
}
.dp2-branch .dd-no-results {
  padding: 10px 12px;
  font-size: var(--uob-font-base);
}

/* ── Month navigator (shared) ── */
.dp2-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dp2-month__label { font-size: var(--uob-font-base); font-weight: 700; color: var(--uob-black); line-height: 1.4; }
.dp2-month__nav { display: flex; gap: 4px; }
.dp2-month__arrow {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--uob-grey-20);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  color: var(--uob-primary);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s;
}
.dp2-month__arrow:hover:not(:disabled) { background: var(--uob-hover-blue); border-color: var(--uob-hover-blue); color: var(--uob-white); }
.dp2-month__arrow:disabled { color: var(--uob-grey-30); cursor: not-allowed; }
.dp2-month__arrow svg { width: 18px; height: 18px; }

.dp2-duration {
  margin: 0;
  font-size: var(--uob-font-sm);
  color: var(--uob-grey-40);
  line-height: 1.5;
}

/* ── Legend (shared) ── */
.dp2-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: var(--uob-font-sm);
  color: var(--uob-black);
}
.dp2-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.dp2-legend__swatch { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.dp2-legend__swatch--selected { background: var(--uob-primary); }
.dp2-legend__swatch--available { background: var(--uob-white); border: 1px solid var(--uob-grey-30); }
.dp2-legend__swatch--unavailable { background: var(--uob-grey-10); border: 1px solid var(--uob-grey-30); }

/* ── Empty state (shared) ──
   Reads as one wide unavailable date chip: same grey fill, radius, and height
   as .dp2-date rather than a dashed panel. */
.dp2-empty {
  border: none;
  border-radius: var(--uob-radius-md);
  background: var(--dp2-slot-bg, var(--uob-grey-10));
  min-height: 76px;
  padding: 12px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.dp2-empty__text { font-size: var(--uob-font-sm); color: var(--uob-grey-40); line-height: 1.5; }
.dp2-empty__cta {
  font-size: var(--uob-font-base);
  font-weight: 700;
  color: var(--uob-primary);
  background: var(--uob-white);
  border: 1.5px solid var(--uob-primary);
  border-radius: var(--uob-radius-full);
  min-height: 44px;
  padding: 8px 20px;
  cursor: pointer;
  font-family: inherit;
}
.dp2-empty__cta:hover { background: var(--uob-primary); color: var(--uob-white); }

/* ============================================================
   Date carousel (shared base for chip-style dates)
   ============================================================ */
.dp2-dates {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.dp2-date {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 76px;
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--uob-primary);
  font-family: inherit;
  padding: 8px 4px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dp2-date:hover:not(.is-active):not(.is-readonly) { background: var(--uob-hover-blue); border-color: var(--uob-hover-blue); color: var(--uob-white); }
.dp2-date.is-active { background: var(--uob-primary); border-color: var(--uob-primary); color: var(--uob-white); }
/* Read-only (unavailable) dates: greyed but still clickable to preview slots. */
.dp2-date.is-readonly { color: var(--uob-grey-30); cursor: pointer; background: var(--uob-grey-10); }
/* The read-only date currently being previewed — same as .is-readonly, white fill. */
.dp2-date.is-preview:not(.is-active) {
  color: var(--uob-grey-30);
  border-color: var(--uob-grey-30);
  background: var(--uob-white);
}
.dp2-date__dow { font-size: var(--uob-font-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.dp2-date__num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.dp2-date__mon { font-size: var(--uob-font-sm); }

/* ============================================================
   OPTION A — .dp2--vertical : vertical full-width time list
   ============================================================ */
.dp2--vertical {
  --dp2-slot-bg: color-mix(in srgb, var(--uob-white) 55%, var(--uob-grey-10));
  /* Size the time grid from the schedule column width (not the viewport), so
     both stacked mobile and the narrow Layout E form pane (≈861–976px) drop
     to 3 columns before pills overflow. */
  container-type: inline-size;
  container-name: dp2-vertical;
}
/* Vertical date chips — default shell matches time slots. */
.dp2--vertical .dp2-date {
  border: none;
  background: var(--dp2-slot-bg);
}
.dp2--vertical .dp2-date:hover:not(.is-active):not(.is-readonly) {
  border: none;
  background: var(--uob-hover-blue);
  color: var(--uob-white);
}
.dp2--vertical .dp2-date.is-active {
  border: none;
  background: var(--uob-primary);
  color: var(--uob-white);
}
.dp2--vertical .dp2-date.is-preview:not(.is-active) {
  border: none;
}
.dp2--vertical .dp2-date.is-readonly,
.dp2--vertical .dp2-date.is-preview:not(.is-active) {
  color: var(--uob-grey-40);
}
.dp2--vertical .dp2-date.is-readonly.is-preview {
  box-shadow: inset 0 0 0 1px var(--uob-grey-40);
}
.dp2--vertical .dp2-date__mon {
  font-size: var(--uob-font-sm);
  font-weight: 400;
  text-transform: uppercase;
  color: var(--uob-black);
  opacity: 0.5;
  line-height: 1;
}
.dp2--vertical .dp2-date:hover:not(.is-active):not(.is-readonly) .dp2-date__mon,
.dp2--vertical .dp2-date.is-active .dp2-date__mon {
  color: var(--uob-white);
  opacity: 1;
}
.dp2--vertical .dp2-date.is-readonly .dp2-date__mon,
.dp2--vertical .dp2-date.is-preview:not(.is-active) .dp2-date__mon {
  color: inherit;
  opacity: 1;
}
.dp2--vertical .dp2-times {
  --dp2-times-gap: 10px;
  --dp2-times-cols: 3;
  display: grid;
  /* Default 3 cols: fits ≤375px and the Layout E split form pane. */
  grid-template-columns: repeat(var(--dp2-times-cols), minmax(0, 1fr));
  grid-auto-flow: row;
  gap: var(--dp2-times-gap);
  /* Slot width matching a full row (for short-row centering below). */
  --dp2-time-col: calc(
    (100% - (var(--dp2-times-cols) - 1) * var(--dp2-times-gap)) / var(--dp2-times-cols)
  );
}
/* Short of a full 3-col row: keep pill width, center the group. */
.dp2--vertical .dp2-times:not(:has(> :nth-child(3))) {
  justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(0, var(--dp2-time-col)));
}
/* 4 cols only when the schedule column itself is wide enough for 22px pills.
   Double class matches .dp2--vertical .dp2-times specificity so this wins. */
@container dp2-vertical (min-width: 520px) {
  .dp2-times.dp2-times {
    --dp2-times-cols: 4;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  /* Short of a full 4-col row: keep pill width, center the group. */
  .dp2-times.dp2-times:not(:has(> :nth-child(4))) {
    justify-content: center;
    grid-template-columns: repeat(auto-fit, minmax(0, var(--dp2-time-col)));
  }
}
.dp2--vertical .dp2-time {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 2px;
  border: none;
  border-radius: var(--uob-radius-md);
  background: var(--dp2-slot-bg);
  font-family: inherit;
  /* Match .dp2-date__num on desktop; mobile override below. */
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--uob-primary);
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, color 0.12s;
}
.dp2--vertical .dp2-time__label {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding: 0 8px;
  /* Match parent .dp2-time slot grey (not a white inset pill). */
  background: var(--dp2-slot-bg);
  border-radius: var(--uob-radius-md);
  color: var(--uob-primary);
  line-height: 1.1;
}
.dp2--vertical .dp2-time:hover:not(.is-active):not(:disabled):not(.is-readonly) .dp2-time__label {
  background: var(--uob-hover-blue);
  color: var(--uob-white);
}
.dp2--vertical .dp2-time:hover:not(.is-active):not(:disabled):not(.is-readonly) { background: var(--uob-hover-blue); }
.dp2--vertical .dp2-time.is-active { background: var(--uob-primary); }
.dp2--vertical .dp2-time.is-active .dp2-time__label {
  background: var(--uob-primary);
  color: var(--uob-white);
}
.dp2--vertical .dp2-time.is-active .dp2-time__check { opacity: 1; }
/* Unavailable (readonly preview or disabled): match .dp2-date.is-readonly palette. */
.dp2--vertical .dp2-time.is-readonly,
.dp2--vertical .dp2-time:disabled {
  cursor: not-allowed;
  color: var(--uob-grey-30);
  background: var(--uob-grey-10);
  border: 1px solid var(--uob-grey-30);
  font-weight: 700;
  position: relative;
  overflow: hidden;
}
/* Diagonal "/" strikethrough, edge to edge (bottom-left → top-right). */
.dp2--vertical .dp2-time.is-readonly::after,
.dp2--vertical .dp2-time:disabled::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top left,
    transparent calc(50% - 0.5px),
    var(--uob-grey-30) calc(50% - 0.5px),
    var(--uob-grey-30) calc(50% + 0.5px),
    transparent calc(50% + 0.5px)
  );
  pointer-events: none;
}
.dp2--vertical .dp2-time__meridiem {
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
  padding-left: 8px;
  padding-right: 8px;
  font-size: var(--uob-font-base);
  font-weight: 400;
  color: var(--uob-black);
  opacity: 0.5;
  line-height: 1;
}
.dp2--vertical .dp2-time:hover:not(.is-active):not(:disabled):not(.is-readonly) .dp2-time__meridiem,
.dp2--vertical .dp2-time.is-active .dp2-time__meridiem {
  color: var(--uob-white);
  opacity: 1;
}
.dp2--vertical .dp2-time.is-readonly .dp2-time__label,
.dp2--vertical .dp2-time:disabled .dp2-time__label {
  background: var(--uob-grey-10);
  color: var(--uob-grey-30);
}
.dp2--vertical .dp2-time__sub { font-size: var(--uob-font-sm); font-weight: 400; color: var(--uob-grey-40); }
.dp2--vertical .dp2-time__check { width: 20px; height: 20px; flex-shrink: 0; opacity: 0; }

/* Preview mode: time slots for a read-only date — visible but not selectable. */
.dp2--vertical .dp2-times--preview .dp2-time {
  pointer-events: none;
  cursor: default;
  justify-content: center;
}

/* ============================================================
   OPTION B — .dp2--calendar : month grid + 2-col time pills
   ============================================================ */
.dp2--calendar .dp2-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.dp2--calendar .dp2-grid__dow {
  text-align: center;
  font-size: var(--uob-font-sm);
  font-weight: 700;
  color: var(--uob-grey-40);
  padding: 4px 0;
}
.dp2--calendar .dp2-cell {
  aspect-ratio: 1 / 1;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--uob-radius-md);
  background: var(--uob-grey-10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: var(--uob-font-base);
  font-weight: 700;
  color: var(--uob-black);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dp2--calendar .dp2-cell:hover:not(.is-active):not(:disabled) { border-color: var(--uob-primary); }
.dp2--calendar .dp2-cell.is-active { background: var(--uob-primary); border-color: var(--uob-primary); color: var(--uob-white); }
.dp2--calendar .dp2-cell:disabled,
.dp2--calendar .dp2-cell.is-muted {
  background: transparent;
  color: var(--uob-grey-30);
  cursor: not-allowed;
  font-weight: 400;
}
.dp2--calendar .dp2-cell.is-empty { background: transparent; border: none; cursor: default; }

.dp2--calendar .dp2-times {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.dp2--calendar .dp2-time {
  min-height: 48px;
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  font-family: inherit;
  font-size: var(--uob-font-base);
  font-weight: 700;
  color: var(--uob-black);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px;
  line-height: 1.2;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dp2--calendar .dp2-time:hover:not(.is-active):not(:disabled) { border-color: var(--uob-primary); }
.dp2--calendar .dp2-time.is-active { background: var(--uob-primary); border-color: var(--uob-primary); color: var(--uob-white); }
.dp2--calendar .dp2-time:disabled {
  cursor: not-allowed;
  background: var(--uob-grey-10);
  border-style: dashed;
  border-color: var(--uob-grey-20);
  color: var(--uob-grey-40);
  font-weight: 400;
}
.dp2--calendar .dp2-time__sub { font-size: var(--uob-font-xs); font-weight: 400; }

/* ============================================================
   OPTION C — .dp2--guided : week strip + AM/PM groups + sheet
   ============================================================ */
.dp2--guided .dp2-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.dp2--guided .dp2-day {
  min-height: 64px;
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--uob-black);
  font-family: inherit;
  padding: 6px 2px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dp2--guided .dp2-day:hover:not(.is-active):not(:disabled) { border-color: var(--uob-primary); }
.dp2--guided .dp2-day.is-active { background: var(--uob-primary); border-color: var(--uob-primary); color: var(--uob-white); }
.dp2--guided .dp2-day:disabled { color: var(--uob-grey-30); cursor: not-allowed; background: var(--uob-grey-10); }
.dp2--guided .dp2-day__dow { font-size: var(--uob-font-xs); font-weight: 700; text-transform: uppercase; }
.dp2--guided .dp2-day__num { font-size: var(--uob-font-lg); font-weight: 700; line-height: 1.1; }

.dp2--guided .dp2-group { display: flex; flex-direction: column; gap: 10px; }
.dp2--guided .dp2-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--uob-font-sm);
  font-weight: 700;
  color: var(--uob-grey-40);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dp2--guided .dp2-group__title svg { width: 16px; height: 16px; }
.dp2--guided .dp2-times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dp2--guided .dp2-time {
  min-height: 48px;
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-full);
  background: var(--uob-white);
  font-family: inherit;
  font-size: var(--uob-font-base);
  font-weight: 700;
  color: var(--uob-black);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dp2--guided .dp2-time:hover:not(.is-active):not(:disabled) { border-color: var(--uob-primary); }
.dp2--guided .dp2-time.is-active { background: var(--uob-primary); border-color: var(--uob-primary); color: var(--uob-white); }
.dp2--guided .dp2-time:disabled {
  cursor: not-allowed;
  background: var(--uob-grey-10);
  border-style: dashed;
  border-color: var(--uob-grey-20);
  color: var(--uob-grey-40);
  font-weight: 400;
  text-decoration: line-through;
}

/* Bottom sheet (mobile branch picker for Option C) */
.dp2-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.4);
  display: none;
}
.dp2-sheet-backdrop.is-open { display: block; }
.dp2-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  background: var(--uob-white);
  border-radius: var(--uob-radius-lg) var(--uob-radius-lg) 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 80vh;
  display: none;
  flex-direction: column;
}
.dp2-sheet.is-open { display: flex; }
.dp2-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: var(--uob-radius-full);
  background: var(--uob-grey-20);
  margin: 8px auto 12px;
}
.dp2-sheet__title {
  font-size: var(--uob-font-lg);
  font-weight: 700;
  color: var(--uob-black);
  margin-bottom: 12px;
}
.dp2-sheet__list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

/* Only render the sheet trigger behaviour on small screens; on desktop
   Option C uses the same searchable panel as the other options. */
@media (min-width: 701px) {
  .dp2-sheet, .dp2-sheet-backdrop { display: none !important; }
}

/* ============================================================
   Option A additions — month dropdown, swipeable date strip,
   sticky summary bar
   ============================================================ */

/* Unified month bar (Layout A / vertical): [<] Jul 2026 [>] in one border.
   Center label opens the month dropdown; flanking arrows shift months. */
.dp2--vertical .dp2-month.dd-field {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  gap: 0;
}
.dp2--vertical .dp2-month__bar {
  display: flex;
  align-items: center;
  height: 48px;
  box-sizing: border-box;
  border: 1px solid var(--uob-grey-30);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  transition: border-color 0.15s, border-width 0.15s;
}
.dp2--vertical .dp2-month__bar.is-open,
.dp2--vertical .dp2-month__bar:has(.dd-trigger:focus) {
  border-width: 2px;
  border-color: var(--uob-primary-dark);
}
.dp2--vertical .dp2-month__label.dd-trigger {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0 8px;
  justify-content: center;
  font-size: var(--uob-font-base);
  gap: 0;
}
.dp2--vertical .dp2-month__label.dd-trigger:hover,
.dp2--vertical .dp2-month__label.dd-trigger:focus,
.dp2--vertical .dp2-month__label.dd-trigger.is-open {
  border: none;
  border-width: 0;
}
.dp2--vertical .dp2-month__label .dd-value--month {
  flex: 0 1 auto;
  font-weight: 400;
  color: var(--uob-black);
  font-size: var(--uob-font-base);
  text-align: center;
  text-transform: uppercase;
}
.dp2--vertical .dp2-month__bar .dp2-month__arrow {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--uob-primary);
}
.dp2--vertical .dp2-month__bar .dp2-month__arrow:hover:not(:disabled) {
  background: var(--uob-hover-blue);
  border-color: transparent;
  color: var(--uob-white);
}
.dp2--vertical .dp2-month__bar .dp2-month__arrow:first-child {
  border-radius: var(--uob-radius-md) 0 0 var(--uob-radius-md);
}
.dp2--vertical .dp2-month__bar .dp2-month__arrow:last-child {
  border-radius: 0 var(--uob-radius-md) var(--uob-radius-md) 0;
}
.dp2--vertical #dp2-month-dd > .dd-panel {
  left: 0;
  right: 0;
}
.dp2--vertical #dp2-month-dd .dd-option.is-selected {
  background: var(--uob-grey-10);
  color: var(--uob-primary);
  font-weight: 700;
}

/* Appointment section title uses UOB blue. */
body[data-form="branch-appt"][data-layout-variant="vertical"] #schedule-block .section-title {
  color: var(--uob-primary);
}

/* Date strip bleeds to the card edges with left/right white fades to hint
   that it is horizontally swipeable. It is ALSO sticky: it pins below the
   appointment summary topbar (when visible) or to the form top otherwise.
   Stack (top → bottom): date chips → bottom fade → time slots scrolling under.
   Frost/blur lives on .dp2-dates-surface so backdrop-filter does not clip the
   hanging .dp2-dates-fade. */
.dp2-dates-viewport {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -28px;
  overflow: visible;
}
.dp2-dates-surface {
  position: relative;
  z-index: 2;
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* Desktop-only scroll chevrons above the date chips. Hidden on tablet/mobile
   where users can swipe the strip. Mirrors .dp2-month__arrow token treatment. */
.dp2-dates-nav {
  display: none;
}
.dp2-dates-nav__arrow {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--uob-grey-20);
  border-radius: var(--uob-radius-md);
  background: var(--uob-white);
  color: var(--uob-primary);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dp2-dates-nav__arrow:hover:not(:disabled) {
  background: var(--uob-hover-blue);
  border-color: var(--uob-hover-blue);
  color: var(--uob-white);
}
.dp2-dates-nav__arrow:disabled {
  color: var(--uob-grey-30);
  cursor: not-allowed;
}
.dp2-dates-nav__arrow svg {
  width: 18px;
  height: 18px;
}
@media (min-width: 861px) {
  .dp2-dates-nav.is-scrollable {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 6px 28px 0;
  }
}
/* Hangs below the strip so time slots scroll under a top→bottom fade (0% at foot). */
.dp2-dates-fade {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 40px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    #fff 0%,
    #fff 20%,
    rgba(255, 255, 255, 0) 100%
  );
}
.dp2-dates-viewport::before,
.dp2-dates-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 3;
}
.dp2-dates-viewport::before { left: 0; background: linear-gradient(to right, var(--uob-white), rgba(255, 255, 255, 0)); }
.dp2-dates-viewport::after { right: 0; background: linear-gradient(to left, var(--uob-white), rgba(255, 255, 255, 0)); }
body[data-form="branch-appt"][data-layout-variant="vertical"] #form-view {
  --dp2-topbar-h: 0px;
}
body[data-form="branch-appt"][data-layout-variant="vertical"] #form-view:has(.dp2-topbar.is-stuck) .dp2-dates-viewport {
  top: var(--dp2-topbar-h, 52px);
}
.dp2--vertical .dp2-dates {
  padding: 4px 28px;
  scrollbar-width: none;
  /* Center chips when they fit; fall back to start when overflowing so scroll works. */
  justify-content: safe center;
}
.dp2--vertical .dp2-dates::-webkit-scrollbar { display: none; }

/* Empty month: the bar sits inside the 28px bleed so it lines up with the
   month navigator, and the now-empty strip and its chevrons step aside. */
.dp2--vertical .dp2-dates-surface .dp2-empty {
  margin: 4px 28px;
}
.dp2--vertical .dp2-dates-surface:has(.dp2-empty) .dp2-dates,
.dp2--vertical .dp2-dates-surface:has(.dp2-empty) .dp2-dates-nav {
  display: none;
}

/* Date strip entrance — Option A only: LTR slide when in view / month nav */
@keyframes dp2-dates-slide-in {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}
.dp2--vertical .dp2-dates.is-awaiting-reveal {
  opacity: 0;
  transform: translateX(-24px);
}
.dp2--vertical .dp2-dates.is-sliding-in {
  animation: dp2-dates-slide-in 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Selected-time tick — micro draw + pop animation */
.dp2--vertical .dp2-time__check { transform-origin: center; }
.dp2--vertical .dp2-time__check polyline {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
}
.dp2--vertical .dp2-time.is-active .dp2-time__check {
  animation: dp2-check-pop 0.28s ease both;
}
.dp2--vertical .dp2-time.is-active .dp2-time__check polyline {
  animation: dp2-check-draw 0.32s ease 0.05s both;
}
@keyframes dp2-check-draw { to { stroke-dashoffset: 0; } }
@keyframes dp2-check-pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Appointment summary — solid UOB blue bar, edge-to-edge on #form-view
   (left / right / top). Hidden on load; fades in once the branch trigger
   scrolls off screen. Bottom corners: blue scoops wrap the white content’s
   convex top corners (concave in the blue), matching the reference silhouette. */
.dp2-topbar {
  --dp2-topbar-corner: calc(var(--uob-radius-lg) * 2); /* 16px */
  position: sticky;
  top: 0;
  z-index: 30;
  /* Bleed past #form-view's 1px border so no white hairlines show L/R. */
  width: calc(100% + 2px);
  margin: 0 -1px;
  box-sizing: border-box;
  background: var(--uob-primary);
  border: none;
  border-radius: 0;
  /* Solid side paints (0 blur) — covers any remaining subpixel border gap. */
  box-shadow: -1px 0 0 var(--uob-primary), 1px 0 0 var(--uob-primary);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Opacity/visibility only — delayed max-height on hide reflowed the page mid-fade
     and fed the mobile IntersectionObserver stick/unstick loop. Height cancel
     (margin-bottom: -H) is applied in JS while .is-stuck so net layout space stays 0. */
  transition: opacity 0.24s ease, visibility 0s linear 0.24s;
}
.dp2-topbar.is-stuck {
  max-height: none;
  overflow: visible;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.24s ease, visibility 0s;
}
/* Blue paints the outside of each white top corner (concave blue / convex white). */
.dp2-topbar::before,
.dp2-topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: var(--dp2-topbar-corner);
  height: var(--dp2-topbar-corner);
  pointer-events: none;
  transform: translateY(100%);
}
.dp2-topbar::before {
  left: 0;
  background: radial-gradient(
    circle at 100% 100%,
    transparent var(--dp2-topbar-corner),
    var(--uob-primary) var(--dp2-topbar-corner)
  );
}
.dp2-topbar::after {
  right: 0;
  background: radial-gradient(
    circle at 0 100%,
    transparent var(--dp2-topbar-corner),
    var(--uob-primary) var(--dp2-topbar-corner)
  );
}
.dp2-topbar__services {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 28px 0;
}
.dp2-topbar__services[hidden] { display: none; }
.dp2-topbar__service {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.dp2-topbar__icon--check { stroke: currentColor; }
.dp2-topbar__service .dp2-topbar__text { font-weight: 700; }
.dp2-topbar:has(.dp2-topbar__service) .dp2-topbar__inner { padding-top: 8px; }
.dp2-topbar__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: transparent;
  border: none;
  box-shadow: none;
}
.dp2-topbar__col { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dp2-topbar__icon { width: 20px; height: 20px; color: var(--uob-orange); flex-shrink: 0; }
.dp2-topbar__text {
  font-size: var(--uob-font-base);
  font-weight: 400;
  color: var(--uob-white);
  line-height: 1.5;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp2-topbar__col--branch .dp2-topbar__text,
.dp2-topbar__text.is-filled {
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .dp2-topbar,
  .dp2-topbar.is-stuck { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dp2--vertical .dp2-time.is-active .dp2-time__check,
  .dp2--vertical .dp2-time.is-active .dp2-time__check polyline { animation: none; }
  .dp2--vertical .dp2-time__check polyline { stroke-dashoffset: 0; }
  .dp2--vertical .dp2-dates.is-awaiting-reveal,
  .dp2--vertical .dp2-dates.is-sliding-in { animation: none; opacity: 1; transform: none; }
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .dp2--guided .dp2-times { grid-template-columns: repeat(2, 1fr); }
  .dp2--calendar .dp2-cell { min-height: 40px; }
  .dp2-dates-viewport { margin: 0 -16px; }
  .dp2-dates-viewport::before,
  .dp2-dates-viewport::after { width: 16px; }
  .dp2--vertical .dp2-dates { padding: 4px 16px; }
  .dp2-topbar__services { padding: 14px 16px 0; }
  .dp2-topbar__inner {
    grid-template-columns: 1fr;
    padding: 14px 16px;
    gap: 8px;
  }
  .dp2-topbar:has(.dp2-topbar__service) .dp2-topbar__inner { padding-top: 8px; }
  /* Tighter time pills on stacked mobile (3-col grid via container query). */
  .dp2--vertical .dp2-times { --dp2-times-gap: 6px; }
  .dp2--vertical .dp2-time {
    min-height: 48px;
    padding: 2px;
    justify-content: flex-start;
    text-align: center;
  }
  .dp2--vertical .dp2-time__label {
    padding: 0 6px;
    /* Match .dp2-date__num / desktop clock digits; meridiem stays base below. */
    font-size: 22px;
  }
  .dp2--vertical .dp2-time__meridiem {
    align-self: center;
    margin-left: auto;
    padding-left: 6px;
    padding-right: 6px;
    font-size: var(--uob-font-base);
    line-height: 1;
  }
}
