/* Aurex pickers: calendar, time list, suggestion list. Colours come from the theme tokens (light and dark), with fallbacks. */

/* the real input stays in the page (same id, name, value) but is not drawn; the button next to it is what people see */
input.ap-native {
  position: absolute !important; opacity: 0 !important; pointer-events: none !important;
  width: 1px !important; height: 1px !important; min-width: 0 !important; min-height: 0 !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; box-shadow: none !important;
}

.ap-btn {
  --ap-gold: var(--gold, #C6A15B);
  display: inline-flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
  box-sizing: border-box; min-width: 150px; max-width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--field-line, #D9D6CF); border-radius: 10px; background: var(--surface, #fff); color: var(--ink, #141518);
  font: inherit; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer; vertical-align: middle;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.ap-btn .ap-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-btn .ap-ico { flex: none; color: var(--gold-ink, #8A6A2E); }
.ap-btn.ap-empty .ap-txt { color: var(--muted, #5C5E66); font-weight: 400; }
.ap-btn:hover:not(:disabled) { border-color: var(--ap-gold); }
.ap-btn:focus-visible, .ap-btn[aria-expanded="true"] { border-color: var(--ap-gold); box-shadow: 0 0 0 3px rgba(198,161,91,.22); outline: none; }
.ap-btn:disabled { cursor: not-allowed; opacity: .65; background: var(--surface-2, #F7F6F3); }
.field > .ap-btn, .detail-item > .ap-btn, .tm-f > .ap-btn, .inv-field > .ap-btn, .tc-form .field > .ap-btn, .col-filter-dates .ap-btn,
.le-modal-body .field > .ap-btn, .le-portal-form .ap-btn { display: flex; flex-direction: row; width: 100%; }
.detail-item.locked .ap-btn { background: var(--surface-2, #F7F6F3); }
.filterbar.slim .ap-btn { min-height: 34px; padding: 5px 10px; font-size: .82rem; min-width: 128px; }
.ap-txt { font-variant-numeric: tabular-nums; }

/* ---------- the popover ---------- */
.ap-pop {
  position: fixed; z-index: 2147482100; box-sizing: border-box; width: 312px; max-width: calc(100vw - 16px);
  background: var(--surface, #fff); color: var(--ink, #141518);
  border: 1px solid var(--line, #E6E4DE); border-radius: 18px; padding: 14px;
  box-shadow: var(--shadow-3, 0 24px 60px rgba(17,18,20,.22)), 0 0 0 1px rgba(17,18,20,.02);
  font-family: var(--sans, 'Manrope', system-ui, sans-serif); font-size: 14px; line-height: 1.3;
  animation: ap-in .14s ease-out;
}
@keyframes ap-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ap-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.ap-pop button { font: inherit; color: inherit; cursor: pointer; }
.ap-pop button:disabled { cursor: not-allowed; }
.ap-pop button:focus-visible { outline: 2px solid var(--gold, #B8913F); outline-offset: 1px; }

.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.ap-nav { width: 36px; height: 36px; border-radius: 12px; border: 1px solid transparent; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--ink, #141518); flex: none; }
.ap-nav:hover:not(:disabled) { background: var(--hover, #F1EFEA); border-color: var(--line, #E6E4DE); }
.ap-nav:disabled { color: var(--ap-dis, #858790); }
.ap-title { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 0; border-radius: 12px; background: transparent; font-weight: 800; font-size: 15px; letter-spacing: -.005em; color: var(--ink, #141518); }
button.ap-title:hover { background: var(--hover, #F1EFEA); }
.ap-title svg { color: var(--gold-ink, #8A6A2E); }
.ap-static { cursor: default; }

.ap-dow, .ap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ap-dow { margin-bottom: 4px; }
.ap-dow span { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted, #5C5E66); padding: 4px 0; }
.ap-dow span.ap-we { color: var(--muted-2, #6B6D74); }
.ap-day { position: relative; height: 38px; width: 100%; padding: 0; border: 0; border-radius: 12px; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink, #141518); font-variant-numeric: tabular-nums; transition: background .1s; }
.ap-day:hover:not(:disabled):not(.ap-sel) { background: var(--hover, #F1EFEA); }
.ap-day.ap-we { color: var(--muted, #5C5E66); }
.ap-day.ap-out { color: var(--muted-2, #6B6D74); font-weight: 500; }
.ap-day.ap-today { box-shadow: inset 0 0 0 1.5px var(--gold-ink, #8A6A2E); color: var(--ink, #141518); font-weight: 800; }
.ap-day.ap-sel, .ap-cell.ap-sel, .ap-opt.ap-sel { background: var(--gold, #C6A15B); color: #1A1305; font-weight: 800; }
.ap-day.ap-sel.ap-today { box-shadow: inset 0 0 0 2px #1A1305; }
.ap-day:disabled { color: var(--ap-dis, #858790); background: var(--surface-2, #F7F6F3); font-weight: 500; text-decoration: line-through; text-decoration-color: rgba(133,135,144,.45); }

.ap-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px 0 4px; }
.ap-cell { height: 46px; border: 0; border-radius: 12px; background: var(--surface-2, #F7F6F3); font-weight: 700; font-size: 14px; color: var(--ink, #141518); }
.ap-cell:hover:not(:disabled):not(.ap-sel) { background: var(--hover, #F1EFEA); box-shadow: inset 0 0 0 1px var(--gold, #C6A15B); }
.ap-cell.ap-today { box-shadow: inset 0 0 0 1.5px var(--gold-ink, #8A6A2E); }
.ap-cell:disabled { color: var(--ap-dis, #858790); background: transparent; }

.ap-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2, #EFEDE8); }
.ap-link { border: 0; background: transparent; padding: 7px 10px; border-radius: 10px; font-weight: 800; font-size: 13px; color: var(--gold-ink, #8A6A2E); }
.ap-link:hover:not(:disabled) { background: var(--gold-soft, #F5EEDF); }
.ap-link.ap-muted { color: var(--muted, #5C5E66); }
.ap-link:disabled { color: var(--ap-dis, #858790); }

/* ---------- time list ---------- */
.ap-pop.ap-time { width: auto; min-width: 180px; padding: 6px; border-radius: 16px; }
.ap-list { max-height: 290px; overflow-y: auto; overscroll-behavior: contain; outline: none; padding: 2px; scrollbar-width: thin; scrollbar-color: var(--field-line, #D9D6CF) transparent; }
.ap-opt { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink, #141518); font-variant-numeric: tabular-nums; }
.ap-opt.ap-hr { font-weight: 700; }
.ap-opt.ap-act:not(.ap-sel), .ap-opt:hover:not(.ap-sel) { background: var(--hover, #F1EFEA); }
.ap-list:focus-visible .ap-opt.ap-act:not(.ap-sel) { box-shadow: inset 0 0 0 1.5px var(--gold, #B8913F); }
.ap-time .ap-foot { margin: 4px 0 0; padding: 6px 4px 0; }

/* ---------- suggestion list ---------- */
.ap-sug { position: fixed; z-index: 2147482100; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; padding: 4px;
  background: var(--surface, #fff); color: var(--ink, #141518); border: 1px solid var(--field-line, #D9D6CF); border-radius: 12px;
  box-shadow: var(--shadow-2, 0 10px 30px rgba(17,18,20,.14)); font-family: var(--sans, system-ui, sans-serif); font-size: 14px; animation: ap-in .12s ease-out; }
.ap-sug-item { padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--ink, #141518); line-height: 1.3; }
.ap-sug-item b { font-weight: 800; color: var(--gold-ink, #8A6A2E); }
.ap-sug-item:hover, .ap-sug-item.ap-act { background: var(--gold-soft, #F5EEDF); }

/* the invisible cover that swallows the second click of a double-click, so it can never press the button underneath */
.ap-shield { position: fixed; inset: 0; z-index: 2147482200; background: transparent; }

/* ---------- phones: a bottom sheet ---------- */
.ap-backdrop { position: fixed; inset: 0; z-index: 2147482100; display: flex; align-items: flex-end; justify-content: center; background: rgba(10,12,16,.5); animation: ap-fade .15s ease-out; }
@keyframes ap-fade { from { opacity: 0; } to { opacity: 1; } }
.ap-backdrop .ap-pop.ap-sheet { position: relative; width: 100%; max-width: 460px; left: auto; top: auto; border-radius: 24px 24px 0 0; border-bottom: 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); animation: ap-up .2s ease-out; max-height: 88vh; overflow-y: auto; }
.ap-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--field-line, #D9D6CF); margin: 4px auto 10px; }
.ap-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 8px; font-size: 15px; }
.ap-sheet-head b { font-weight: 800; }
.ap-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2, #F7F6F3); display: inline-flex; align-items: center; justify-content: center; color: var(--ink, #141518); }
.ap-sheet .ap-day { height: 44px; font-size: 15px; }
.ap-sheet .ap-nav, .ap-sheet .ap-title { height: 42px; }
.ap-sheet .ap-nav { width: 42px; }
.ap-sheet.ap-time { padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px)); }
.ap-sheet .ap-list { max-height: 52vh; }
.ap-sheet .ap-opt { padding: 13px 14px; font-size: 16px; }

/* dark: the tokens already switch; only the disabled grey and the gold text need a nudge */
@media (prefers-color-scheme: dark) { body:not([data-theme="light"]) { --ap-dis: #7D7B76; } }
body[data-theme="dark"] { --ap-dis: #7D7B76; }
body[data-theme="dark"] .ap-day:disabled, body[data-theme="dark"] .ap-nav:disabled { color: #7D7B76; }
@media (prefers-color-scheme: dark) { body:not([data-theme="light"]) .ap-day:disabled { color: #7D7B76; } }
@media (prefers-reduced-motion: reduce) { .ap-pop, .ap-sug, .ap-backdrop { animation: none; } }

/* phone-number and email boxes in the pop-ups were left out of the shared box look (square, grey); they now match the text, date and time boxes */
.modal-box .field input[type="tel"], .modal-box .field input[type="email"] {
  box-sizing: border-box; width: 100%; padding: 8px 11px; border: 1px solid var(--field-line, #D9D6CF); border-radius: 10px;
  background: var(--surface, #fff); color: var(--ink, #141518); font-family: inherit; font-size: .87rem;
}
.modal-box .field input[type="tel"]:focus, .modal-box .field input[type="email"]:focus { border-color: var(--gold, #C6A15B); box-shadow: 0 0 0 3px rgba(198,161,91,.22); outline: none; }
@media (max-width: 640px) { .modal-box .field input[type="tel"], .modal-box .field input[type="email"] { font-size: 16px; } }
