/* Planner styles. Colours come from the site tokens in /assets/site.css. */
:root {
  --live-bg: #dcfce7;
  --live-fg: #166534;
  --danger: #b42318;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --live-bg: #14532d;
    --live-fg: #bbf7d0;
    --danger: #fca5a5;
    --shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
  }
}

[hidden] { display: none !important; }

button.btn { font: inherit; font-weight: 700; border: 0; cursor: pointer; }
.btn-ghost { border: 2px solid var(--brand) !important; color: var(--brand-dark); background: transparent; }
@media (prefers-color-scheme: dark) { .btn-ghost { color: #fdba74; } }

/* Toolbar */
.toolbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.toolbar .wrap { max-width: 1400px; }
.toolbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
.toolbar-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.toolbar-title a { font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; }
.summary { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tb-btn { font: inherit; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); text-decoration: none; cursor: pointer; }
.tb-btn:hover { border-color: var(--brand); }
.tb-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.tb-btn.danger { color: var(--danger); }
.switch { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 14px; color: var(--muted); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
body:not(.has-plan) #exportBtn,
body:not(.has-plan) #sendBtn,
body:not(.has-plan) #clearBtn,
body:not(.has-plan) .switch { display: none; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Empty state */
.wrap.planner-main { max-width: 1400px; padding-top: 8px; padding-bottom: 72px; }
.empty { max-width: 620px; padding: 40px 0 24px; }
.empty h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 12px; }
.empty p { color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); }

/* Days and time slots */
.day-title { font-size: 22px; margin: 28px 0 0; padding-bottom: 6px; }
.slot { border-top: 1px solid var(--border); padding: 14px 0 4px; scroll-margin-top: 72px; }
.slot-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.slot-time { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.slot-time .to { font-size: 15px; font-weight: 500; color: var(--muted); }
.slot-note { font-size: 14px; color: var(--muted); }
.slot.clash .slot-note { color: var(--brand-dark); font-weight: 700; }
@media (prefers-color-scheme: dark) { .slot.clash .slot-note { color: #fdba74; } }
.pill { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--bg-alt); color: var(--muted); }
.pill.live { background: var(--live-bg); color: var(--live-fg); }
.swipe-hint { display: none; }
.slot.past { opacity: 0.55; }

/* Lanes: one row per time slot, cards ordered by priority from left to right */
.lane { list-style: none; margin: 0; padding: 2px 2px 14px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.card { flex: 0 0 290px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.slot:not(.clash) .card { flex-basis: min(100%, 620px); }
.slot.clash .card { cursor: grab; }
.card:hover { border-color: var(--brand); }
.card.top { border: 2px solid var(--brand); padding: 11px 13px; }
.rank { font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.card.top .rank { color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .card.top .rank { color: #fdba74; } }
.card-open { all: unset; font-size: 16px; font-weight: 700; line-height: 1.3; cursor: pointer; overflow-wrap: anywhere; }
.card-open:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.card-meta { margin: 0; font-size: 14px; color: var(--muted); }
.card-meta .time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.card-people { margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.card-people .faces { display: flex; flex: none; }
.card-people img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); background: var(--bg-alt); }
.card-people img + img { margin-left: -7px; }
.card-people .names { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moves { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.move { font: inherit; font-size: 13px; font-weight: 600; min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-alt); color: var(--text); cursor: pointer; }
.move:hover:not(:disabled) { border-color: var(--brand); }
.move:disabled { opacity: 0.35; cursor: default; }
.ghost { opacity: 0.35; }
.sortable-fallback { box-shadow: var(--shadow); }
.all-done { color: var(--muted); padding: 32px 0; }

/* Dialogs */
dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15, 17, 20, 0.55); }
.dlg-head { position: sticky; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 10px; background: var(--card); }
.dlg-head h2 { font-size: 21px; line-height: 1.25; margin: 0; }
.dlg-body { padding: 0 20px 20px; }
.x { font: inherit; font-size: 24px; line-height: 1; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--bg-alt); color: var(--text); cursor: pointer; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.import-opt { padding: 14px 0; border-top: 1px solid var(--border); }
.import-opt h3 { font-size: 16px; margin: 0 0 4px; }
.import-opt p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.import-opt input[type=file] { max-width: 100%; font: inherit; font-size: 14px; }
.status { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg-alt); font-size: 14px; }
.status.error { background: #fdecec; color: #7d1f14; }
@media (prefers-color-scheme: dark) { .status.error { background: #3b1513; color: #fecaca; } }
.scope { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 12px 0 0; }
.scope legend { font-size: 14px; font-weight: 700; padding: 0 4px; }
.scope label { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.scope input { accent-color: var(--brand); }

/* Send to phone */
.send-steps { margin: 0 0 8px; padding-left: 20px; }
.send-steps li { margin: 4px 0; }
.send-link { width: 100%; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-alt); color: var(--text); resize: none; word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Session details */
.detail-when { margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.detail-where { margin: 0 0 12px; color: var(--muted); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.detail-desc { white-space: pre-line; color: var(--text); font-size: 15px; margin: 0 0 8px; }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.people li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.people img, .people .initials { width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover; background: var(--bg-alt); }
.people .initials { display: grid; place-items: center; font-weight: 800; color: var(--muted); }
.people div { min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.people span { color: var(--muted); }
#detailDialog h3 { font-size: 16px; margin: 18px 0 10px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 15px; box-shadow: var(--shadow); }
.toast button { font: inherit; font-weight: 700; border: 0; background: transparent; color: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 640px) {
  .toolbar { position: static; }
  .slot { scroll-margin-top: 8px; }
  .lane { align-items: flex-start; }
  .card { flex-basis: calc(100% - 44px); }
  .slot:not(.clash) .card { flex-basis: 100%; }
  .swipe-hint { display: inline; margin-left: auto; font-size: 13px; color: var(--muted); }
  .dlg-actions { justify-content: stretch; }
  .dlg-actions > * { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
