/* ALOKE — THE APPOINTMENTS PANEL (appoint.hwe.sa), 2026-09-19.
   Loaded after console-theme.css / console-shell.css / panel.css: tokens
   only, no literals. Everything below is THIS room's furniture — the day
   grid, the time sheet, the slot picker, the booking cards. */

.ap-main { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s4); max-width: 1280px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.ap-view { display: flex; flex-direction: column; gap: var(--s4); }
.ap-view.hidden, .ap-form.hidden { display: none; }
.ap-off { max-width: 640px; margin: var(--s5) auto; text-align: center; }
.ap-h-btn { float: inline-end; margin-inline-start: var(--s2); }
.cs-top-actions { display: flex; align-items: center; gap: var(--s3); }
#apNewBtn .ic { width: 16px; height: 16px; }

/* ── the day bar ─────────────────────────────────────────────────────── */
.ap-daybar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.ap-daynav { display: flex; align-items: center; gap: var(--s1); }
.ap-daynav input[type="date"] { min-height: 36px; height: 36px; padding: 0 var(--s2); }
.ap-daytitle { margin: 0; font-size: var(--t-lg); flex: 1 1 auto; min-width: 0; }
.ap-filters select { min-height: 36px; height: 36px; }
.ap-tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.ap-tiles .pl-tile { padding: var(--s3); }
.ap-tiles .pl-tile-n { font-size: var(--t-xl); }
.ap-tile-ok .pl-tile-n { color: var(--ok); }
.ap-tile-warn .pl-tile-n { color: var(--warn); }
.ap-tile-danger .pl-tile-n { color: var(--danger); }

/* ── the calendar: one column per provider, one row per slot ────────── */
.ap-calwrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.ap-cal { display: grid; grid-template-columns: 64px repeat(var(--ap-cols, 1), minmax(160px, 1fr)); min-width: max-content; position: relative; }
.ap-cal-h { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line-strong); padding: var(--s2); font-size: var(--t-sm); font-weight: 700; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ap-cal-h .sub { font-size: var(--t-xs); color: var(--muted); font-weight: 400; }
.ap-cal-h .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.ap-cal-t { font-size: var(--t-xs); color: var(--muted); padding: 2px var(--s1); text-align: center; border-inline-end: 1px solid var(--line); font-variant-numeric: tabular-nums; direction: ltr; }
.ap-cal-t.h { border-top: 1px solid var(--line); }
.ap-cal-c { border-top: 1px solid var(--line); border-inline-end: 1px solid var(--line); min-height: 28px; position: relative; }
.ap-cal-c.off { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); }
.ap-cal-c.q { border-top-color: transparent; }
.ap-cal-c:hover:not(.off) { background: var(--accent-weak); cursor: pointer; }
.ap-blk { position: absolute; inset-inline: 3px; top: 1px; border-radius: 8px; padding: 4px 8px; font-size: var(--t-xs); line-height: 1.3; color: #fff; background: var(--accent); overflow: hidden; z-index: 1; box-shadow: var(--e-rest); cursor: pointer; border-inline-start: 4px solid rgba(255, 255, 255, .55); }
.ap-blk strong { display: block; font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-blk .m { opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-blk.st-pending { background: var(--warn); }
.ap-blk.st-scheduled { background: var(--info); }
.ap-blk.st-reschedule { background: var(--danger); }
.ap-blk.st-done { background: var(--ok); opacity: .75; }
.ap-blk.st-no_show, .ap-blk.st-cancelled { background: var(--muted); opacity: .55; text-decoration: line-through; }
.ap-now { position: absolute; inset-inline: 0; height: 2px; background: var(--danger); z-index: 1; pointer-events: none; }

/* ── lists & cards ───────────────────────────────────────────────────── */
.ap-listbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.ap-listbar input[type="search"] { flex: 1 1 220px; min-height: 36px; height: 36px; }
.ap-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-btn); overflow: hidden; }
.ap-seg button { border: 0; background: transparent; padding: 6px 14px; font: inherit; font-size: var(--t-sm); color: var(--ink-2); cursor: pointer; min-height: 36px; }
.ap-seg button + button { border-inline-start: 1px solid var(--line); }
.ap-seg button.on { background: var(--accent); color: var(--on-accent); }
.ap-list { display: flex; flex-direction: column; gap: var(--s2); }
.ap-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); cursor: pointer; border-inline-start: 5px solid var(--accent); }
.ap-row:hover { border-color: var(--line-strong); box-shadow: var(--e-rest); }
.ap-row .when { flex: 0 0 auto; text-align: center; min-width: 64px; }
.ap-row .when b { display: block; font-size: var(--t-lg); font-variant-numeric: tabular-nums; direction: ltr; }
.ap-row .when span { font-size: var(--t-xs); color: var(--muted); }
.ap-row .main { flex: 1 1 200px; min-width: 0; }
.ap-row .name { font-weight: 700; unicode-bidi: plaintext; }
.ap-row .meta { font-size: var(--t-sm); color: var(--muted); unicode-bidi: plaintext; }
.ap-row.st-pending { border-inline-start-color: var(--warn); }
.ap-row.st-reschedule { border-inline-start-color: var(--danger); }
.ap-row.st-done { border-inline-start-color: var(--ok); }
.ap-row.st-cancelled, .ap-row.st-no_show { border-inline-start-color: var(--line-strong); opacity: .7; }
.ap-st { font-size: var(--t-xs); padding: 2px 8px; border-radius: var(--r-chip); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.ap-st.st-confirmed { background: var(--ok-weak); color: var(--ok); }
.ap-st.st-pending { background: var(--warn-weak); color: var(--warn); }
.ap-st.st-reschedule { background: var(--danger-weak); color: var(--danger); }
.ap-st.st-scheduled { background: var(--info-weak); color: var(--info); }
.ap-st.st-done { background: var(--ok-weak); color: var(--ok); }
.ap-st.st-paid { background: var(--ok-weak); color: var(--ok); }
.ap-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); margin-top: var(--s3); }
.ap-card { padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); display: flex; flex-direction: column; gap: var(--s1); cursor: pointer; border-inline-start: 5px solid var(--accent); }
.ap-card:hover { box-shadow: var(--e-rest); border-color: var(--line-strong); }
.ap-card.pl-off { opacity: .55; }
.ap-card .t { font-weight: 700; font-size: var(--t-md); unicode-bidi: plaintext; }
.ap-card .s { font-size: var(--t-sm); color: var(--muted); unicode-bidi: plaintext; }
.ap-card .chips { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: 2px; }
.ap-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: var(--t-sm); flex: 0 0 auto; }
.ap-card-h { display: flex; align-items: center; gap: var(--s2); }

/* ── forms ───────────────────────────────────────────────────────────── */
.ap-form h4 { margin: var(--s4) 0 2px; font-size: var(--t-md); }
.ap-check, .ap-switch { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-md); min-height: 44px; cursor: pointer; }
.ap-switch { font-weight: 700; margin: var(--s2) 0; }
.ap-sheet { display: grid; gap: var(--s1); margin-top: var(--s2); }
.ap-sheet-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: var(--s2); padding: 4px 0; border-bottom: 1px solid var(--line); }
.ap-sheet-row:last-child { border-bottom: 0; }
.ap-sheet-row .d { font-size: var(--t-sm); font-weight: 600; }
.ap-sheet-spans { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; }
.ap-span { display: inline-flex; align-items: center; gap: 4px; }
.ap-span input[type="time"] { min-height: 32px; height: 32px; padding: 0 6px; width: 96px; font-size: var(--t-sm); }
.ap-span .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; }
.ap-span .x:hover { color: var(--danger); }
.ap-sheet-row .add { font-size: var(--t-xs); min-height: 28px; padding: 0 8px; }

/* ── dialogs & the slot picker ───────────────────────────────────────── */
.ap-dlg { border: 0; border-radius: var(--r-card); padding: var(--s4); width: min(560px, calc(100vw - 32px)); box-shadow: var(--e-float); background: var(--surface); color: var(--ink); }
.ap-dlg::backdrop { background: var(--cs-scrim); }
.ap-dlg h2 { margin: 0 0 var(--s3); font-size: var(--t-xl); }
.ap-dlg .pl-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.ap-slots { display: flex; flex-wrap: wrap; gap: var(--s1); max-height: 220px; overflow-y: auto; padding: 2px; }
.ap-slot { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-chip); padding: 6px 10px; font: inherit; font-size: var(--t-sm); font-variant-numeric: tabular-nums; direction: ltr; cursor: pointer; min-height: 36px; color: var(--ink); }
.ap-slot:hover { background: var(--accent-weak); }
.ap-slot.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.ap-slots .empty { width: 100%; margin: 0; }
.ap-one dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s3); margin: var(--s2) 0; font-size: var(--t-md); }
.ap-one dt { color: var(--muted); font-size: var(--t-sm); }
.ap-one dd { margin: 0; unicode-bidi: plaintext; }
.ap-one .ev { font-size: var(--t-xs); color: var(--muted); display: flex; gap: var(--s2); }
.ap-events { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s2); max-height: 120px; overflow-y: auto; }
#bkMatches { width: 100%; margin-top: 4px; }

@media (max-width: 720px) {
  .ap-main { padding: var(--s3); }
  .ap-cal { grid-template-columns: 52px repeat(var(--ap-cols, 1), minmax(140px, 1fr)); }
  .ap-h-btn { float: none; display: inline-flex; margin: var(--s2) 0 0; }
}
