/* =====================================================================
 * ob-plan-event.css (web v3 R6-T5): the event editor (a sheet on a phone, a dialog from 601 px), the guest confirm,
 * the delete confirm, the paste-an-invite dialog and the two header actions.
 * Boards: PlanEventPhone (476 x 752), PlanEventTablet (1024 x 768), PlanInvitePhone (476 x 752), PlanDayStates cells 8 and 9.
 * Tokens only (--ob3-*), so Paper and Graphite come from the same rules. Every control is at least 44 px.
 * ===================================================================== */

#obp-editor[hidden] { display: none; }

.obpe-scrim {
  position: fixed; inset: 0; z-index: var(--obs-z-confirm, 3000);
  display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box;
  background: var(--ob3-scrim);
}
.obpe-scrim.obpe-scrim-top { z-index: calc(var(--obs-z-confirm, 3000) + 1); }

.obpe-dialog {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  overflow: auto; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 20px;
  border-radius: var(--ob3-radius-sheet); background: var(--ob3-surface); color: var(--ob3-ink);
  box-shadow: 0 24px 60px var(--ob3-shadow); font-family: var(--ob3-font-sans, inherit);
}
.obpe-dialog:focus { outline: none; }
.obpe-confirm-dlg { width: min(440px, 100%); gap: 8px; }
.obpe-grab { display: none; }

.obpe-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.obpe-h { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; color: var(--ob3-ink); }
.obpe-sub { margin: 0; font-size: 13px; line-height: 18px; color: var(--ob3-muted); }
.obpe-x {
  flex: 0 0 44px; width: 44px; height: 44px; margin: -8px -8px 0 0; padding: 0; border: 0; border-radius: var(--ob3-radius-full);
  background: transparent; color: var(--ob3-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.obpe-x:hover { background: var(--ob3-sunk); color: var(--ob3-ink); }

.obpe-ic { width: 18px; height: 18px; flex: 0 0 18px; }

.obpe-body { display: flex; flex-direction: column; gap: 4px; }
.obpe-body[inert] { opacity: 0.55; }
.obpe-lab { display: block; margin-top: 8px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ob3-muted); }
.obpe-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.obpe-in {
  width: 100%; min-height: 44px; box-sizing: border-box; padding: 0 14px; border-radius: var(--ob3-radius-control);
  border: 1px solid var(--ob3-line); background: var(--ob3-card); color: var(--ob3-ink); font: inherit; font-size: 15px;
}
.obpe-in::placeholder { color: var(--ob3-muted); opacity: 1; }
.obpe-in.has-ic { padding-left: 42px; }
.obpe-in:disabled { opacity: 0.5; }
.obpe-in.is-bad { border-color: var(--ob3-alert); }
.obpe-ta { min-height: 88px; padding-top: 12px; padding-bottom: 12px; resize: vertical; line-height: 20px; }
.obpe-ctl { position: relative; }
.obpe-ctl > .obpe-ic { position: absolute; left: 14px; top: 13px; color: var(--ob3-muted); pointer-events: none; }
.obpe-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.obpe-two[hidden] { display: none; }
.obpe-two.is-off { opacity: 0.55; }
.obpe-two > div { min-width: 0; }

.obpe-sw-row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 4px; }
.obpe-sw-row .obpe-lab { margin: 0; font-size: 14px; color: var(--ob3-ink); }
.obpe-sw {
  appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 52px; width: 52px; height: 32px; margin: 0; border-radius: var(--ob3-radius-full);
  background: var(--ob3-line-strong); cursor: pointer; transition: background var(--ob3-dur-short, 0.15s) var(--ob3-ease, ease);
}
.obpe-sw::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--ob3-surface);
  box-shadow: 0 1px 3px var(--ob3-shadow); transition: transform var(--ob3-dur-short, 0.15s) var(--ob3-ease, ease);
}
.obpe-sw:checked { background: var(--ob3-accent); }
.obpe-sw:checked::after { transform: translateX(20px); }
.obpe-sw-row { position: relative; }
/* a 44 px hit area around the 32 px switch */
.obpe-sw { outline-offset: 3px; }

.obpe-hint { margin: 2px 0 0; min-height: 0; font-size: 12px; line-height: 16px; color: var(--ob3-muted); }
.obpe-hint:empty, .obpe-hint[hidden] { display: none; }
.obpe-hint[data-kind="caution"] { color: var(--ob3-attention); font-weight: 600; }
.obpe-hint[data-kind="good"] { color: var(--ob3-good); font-weight: 600; }
.obpe-note { margin: 4px 0 0; font-size: 12px; line-height: 16px; color: var(--ob3-muted); }
.obpe-note[hidden] { display: none; }
.obpe-link { color: var(--ob3-accent-text); text-decoration: underline; }

.obpe-msg {
  margin-top: 8px; padding: 10px 14px; border-radius: 14px; background: var(--ob3-alert-tint); color: var(--ob3-alert);
  font-size: 13px; line-height: 18px; font-weight: 500;
}
.obpe-msg[hidden] { display: none; }
.obpe-msg.is-err { margin-top: 4px; }

/* the guest confirm: an amber panel inside the editor (PlanEventTablet) */
.obpe-confirm { margin-top: 10px; padding: 14px 16px; border-radius: 16px; background: var(--ob3-attention-tint); color: var(--ob3-ink); }
.obpe-confirm[hidden] { display: none; }
.obpe-cf-h { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin-bottom: 4px; color: var(--ob3-ink); }
.obpe-cf-h .obpe-ic { color: var(--ob3-attention); }
.obpe-cf-p { margin: 0 0 6px; font-size: 14px; line-height: 20px; color: var(--ob3-ink); overflow-wrap: anywhere; }
.obpe-cf-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
.obpe-cf-foot { margin: 0; font-size: 12px; line-height: 16px; color: var(--ob3-muted); }

.obpe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.obpe-btn {
  flex: 0 0 auto; height: 44px; min-height: 44px; padding: 0 20px; box-sizing: border-box; border-radius: var(--ob3-radius-full);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--ob3-line); background: var(--ob3-surface); color: var(--ob3-ink);
}
.obpe-btn.is-primary { background: var(--ob3-accent); border-color: var(--ob3-accent); color: var(--ob3-on-accent); }
.obpe-btn.is-danger { color: var(--ob3-alert); }
.obpe-btn.is-danger:hover { background: var(--ob3-alert-tint); }
.obpe-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.obpe-del { margin-left: auto; border-color: transparent; background: transparent; }
.obpe-del[hidden] { display: none; }
.obpe-del .obpe-ic { width: 14px; height: 14px; flex-basis: 14px; }
.obpe-confirm-dlg .obpe-btn.is-danger { background: var(--ob3-alert); border-color: var(--ob3-alert); color: var(--ob3-on-accent); }

.obpe-btn:focus-visible, .obpe-in:focus-visible, .obpe-x:focus-visible, .obpe-sw:focus-visible, .obpe-chip-x:focus-visible, .obpe-act:focus-visible {
  outline: var(--ob3-focus-ring); outline-offset: var(--ob3-focus-offset);
}

/* paste an invite */
.obpe-inv-ta { min-height: 132px; }
.obpe-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.obpe-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px 0 14px; border-radius: var(--ob3-radius-full); background: var(--ob3-sunk); font-size: 13px; max-width: 100%; }
.obpe-chip[hidden] { display: none; }
.obpe-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.obpe-chip-x { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ob3-muted); border-radius: var(--ob3-radius-full); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.obpe-ok {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 6px 8px 6px 14px;
  border-radius: 16px; background: var(--ob3-good-tint); color: var(--ob3-ink); font-size: 14px; line-height: 20px;
}
.obpe-ok[hidden] { display: none; }
.obpe-ok-t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.obpe-open { flex: 0 0 auto; padding: 0 16px; }

/* the two header actions T2 hosts (#obp-act-invite, #obp-act-new) */
.obpe-act {
  height: 44px; min-height: 44px; padding: 0 16px; box-sizing: border-box; border-radius: var(--ob3-radius-full);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--ob3-line); background: var(--ob3-surface); color: var(--ob3-ink);
}
.obp-act-host .obpe-act { min-width: 184px; }
[data-obpe-act="new"] { background: var(--ob3-accent); border-color: var(--ob3-accent); color: var(--ob3-on-accent); }
.obpe-act:disabled { opacity: 0.5; cursor: not-allowed; }
.obpe-act-off { display: block; font-size: 11px; line-height: 14px; color: var(--ob3-muted); }
.obpe-act-off[hidden] { display: none; }

.obpe-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--obs-z-toast, 2100); max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: var(--ob3-radius-full); background: var(--ob3-inverse-surface); color: var(--ob3-on-inverse); font-size: 14px;
}

/* a phone: the editor and the invite are a bottom sheet */
@media (max-width: 600px) {
  .obpe-scrim { align-items: flex-end; padding: 0; }
  .obpe-dialog { width: 100%; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); border-radius: var(--ob3-radius-sheet) var(--ob3-radius-sheet) 0 0; padding: 8px 16px 20px; }
  .obpe-confirm-dlg { border-radius: var(--ob3-radius-sheet); width: calc(100% - 32px); margin: 0 16px 16px; padding: 20px; }
  .obpe-scrim.obpe-scrim-top { align-items: center; padding: 0; }
  .obpe-grab { display: block; flex: 0 0 4px; width: 44px; height: 4px; margin: 4px auto 8px; border-radius: 2px; background: var(--ob3-line-strong); }
  .obpe-act-t { display: none; }
  .obpe-act, .obp-act-host .obpe-act { width: 44px; min-width: 44px; padding: 0; }
  .obpe-act-off { display: none; }
  .obpe-actions .obpe-btn:not(.obpe-del) { flex: 1 1 0; }
}
@media (prefers-reduced-motion: reduce) { .obpe-sw, .obpe-sw::after { transition: none; } }

/* ---------- beat the legacy theme.css button/input rule ----------
 * theme.css paints EVERY button, select, input and textarea with `:root[data-theme] ... { background, color, border-color !important }`.
 * These repeat the intended token colours at a higher specificity so Paper and Graphite both read the tokens. Nothing new here. */
:root[data-theme] body button.obpe-btn, :root[data-theme] body button.obpe-act { background: var(--ob3-surface) !important; color: var(--ob3-ink) !important; border-color: var(--ob3-line) !important; }
:root[data-theme] body button.obpe-btn.is-primary, :root[data-theme] body button.obpe-act[data-obpe-act="new"] { background: var(--ob3-accent) !important; color: var(--ob3-on-accent) !important; border-color: var(--ob3-accent) !important; }
:root[data-theme] body button.obpe-btn.is-danger { color: var(--ob3-alert) !important; }
:root[data-theme] body .obpe-confirm-dlg button.obpe-btn.is-danger { background: var(--ob3-alert) !important; color: var(--ob3-on-accent) !important; border-color: var(--ob3-alert) !important; }
:root[data-theme] body button.obpe-del { background: transparent !important; border-color: transparent !important; }
:root[data-theme] body button.obpe-x, :root[data-theme] body button.obpe-chip-x { background: transparent !important; color: var(--ob3-muted) !important; border-color: transparent !important; }
:root[data-theme] body .obpe-in { background: var(--ob3-card) !important; color: var(--ob3-ink) !important; border-color: var(--ob3-line) !important; }
:root[data-theme] body .obpe-in.is-bad { border-color: var(--ob3-alert) !important; }
:root[data-theme] body input.obpe-sw { background: var(--ob3-line-strong) !important; border-color: transparent !important; }
:root[data-theme] body input.obpe-sw:checked { background: var(--ob3-accent) !important; }
:root[data-theme] body button.obpe-btn:disabled, :root[data-theme] body button.obpe-act:disabled { opacity: 0.5; }

/* ---------- R6 fix round ---------- */
/* the date reads "Mon 28 Sept 2026" (a label over the real date input, which keeps entry, a11y and the native picker via showPicker) */
.obpe-datewrap .obpe-datelabel { position: absolute; left: 42px; top: 0; bottom: 0; z-index: 1; display: flex; align-items: center; font-size: 15px; color: var(--ob3-ink); pointer-events: none; }
.obpe-datein::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
:root[data-theme] body input.obpe-datein { color: transparent !important; }
.obpe-datewrap:focus-within .obpe-datelabel { display: none; }
:root[data-theme] body .obpe-datewrap:focus-within input.obpe-datein { color: var(--ob3-ink) !important; }
.obpe-ta { min-height: 64px; }
.obpe-two-ld .obpe-ta { min-height: 64px; }
/* a phone stacks Location over Description; from 601 px they share a row and the dialog stays near the board's height */
@media (max-width: 600px) { .obpe-two-ld { grid-template-columns: 1fr; gap: 0; } }
@media (min-width: 601px) { .obpe-dialog.obpe-editor { max-height: min(640px, calc(100vh - 32px)); max-height: min(640px, calc(100dvh - 32px)); } }
