/* planner/planner.css — reuses design tokens defined in styles.css :root
   (this file is always loaded after styles.css on the *-plan.html shells,
   so var(--rust) etc are already in scope, dark mode included). */

.planner-hero { padding-bottom: 30px; }

.planner-shell { padding-top: 28px; }

.planner-loading { color: var(--muted); font-size: 16px; }

.p-offline-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--brick-soft);
  color: var(--brick);
  font-size: 14px;
  font-weight: 600;
}
.p-offline-banner[hidden] { display: none; }

.p-controls {
  position: sticky;
  top: var(--nav-h);
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 0;
  margin-bottom: 18px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}

.p-filters { display: flex; flex-wrap: wrap; gap: 6px; }

.p-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.p-chip[aria-pressed="true"] { background: var(--rust); border-color: var(--rust); color: #fff; }

.p-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.p-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.p-btn:hover { border-color: var(--rust); color: var(--rust); }
.p-btn:disabled { opacity: .45; cursor: not-allowed; }

.p-days { display: grid; gap: 26px; }

.pday { border-radius: 10px; }

.pday-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.pday-head .pday-base { color: var(--muted); font-size: 13px; font-weight: 600; }

.pday-list { display: grid; gap: 8px; min-height: 12px; }

.pday-list.sortable-ghost { opacity: .4; }

.pcard {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.pcard[data-fixed="true"] { background: var(--olive-soft); border-color: var(--olive); }
.pcard[data-kind="note"] { background: var(--gold-soft); border-style: dashed; }
.pcard.is-filtered-out { display: none; }
.pcard.is-flash { animation: p-flash 1.1s ease; }
@keyframes p-flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px var(--rust); } }

.pgrip {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  min-height: 36px;
  min-width: 28px;
  font-size: 16px;
  touch-action: none;
}
.pcard[data-fixed="true"] .pgrip { cursor: not-allowed; opacity: .5; }

.pcard-body { min-width: 0; }
.pcard-time {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--rust);
  font-variant-numeric: tabular-nums;
}
.pcard-title { font-size: 16px; font-weight: 600; line-height: 1.35; }
.pcard-title a { color: inherit; text-decoration: underline; text-decoration-color: var(--muted); }
.pcard-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.pcard-tags .status { min-height: 22px; padding: 2px 9px; font-size: 11px; }
.pcard-note { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pcard-warn { color: var(--brick); font-size: 12px; font-weight: 700; margin-top: 3px; }

.pcard-actions { display: flex; flex-direction: column; gap: 2px; }
.pcard-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 26px;
  min-width: 26px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.pcard-actions button:hover { background: var(--surface-alt); color: var(--ink); }
.pcard-actions .pbtn-row { display: flex; gap: 2px; }

.pleg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-display);
}
.pleg .pleg-icon { opacity: .7; }
.pleg.is-warn { color: var(--brick); font-weight: 700; }
.pleg.is-unknown { color: var(--brick); font-weight: 700; }
.pleg.is-trailing { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 8px; }

.pday-empty { color: var(--muted); font-size: 14px; padding: 10px 2px; }

.p-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(92vw, 420px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.p-toast[hidden] { display: none; }

.p-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16, 22, 14, .55);
  display: grid;
  place-items: center;
  padding: 20px;
}
.p-modal-backdrop[hidden] { display: none; }
.p-modal {
  width: min(100%, 560px);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.p-modal h2 { margin: 0 0 12px; font-family: var(--font-display); font-size: 20px; }
.p-modal ul { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.p-modal li { font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.p-modal .p-diff-added { color: var(--olive); }
.p-modal .p-diff-removed { color: var(--brick); text-decoration: line-through; }
.p-modal .p-diff-changed { color: var(--rust); }

.p-passcode-fields { display: grid; gap: 12px; margin: 0 0 16px; }
.p-passcode-fields input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--cream);
  color: var(--ink);
  font-size: 18px;
}
.p-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.p-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .p-controls { top: var(--nav-h); }
  .pcard { grid-template-columns: auto 1fr auto; gap: 8px; padding: 10px; }
  .pcard-title { font-size: 15px; }
  .p-actions { width: 100%; margin-left: 0; justify-content: flex-start; }
}

@media (max-width: 390px) {
  .pcard-actions .pbtn-row button { min-width: 24px; }
  .p-btn, .p-chip { padding: 6px 10px; font-size: 12px; }
}

/* Embedded planner + live map */
.planner-embed { scroll-margin-top: calc(var(--nav-h) + 60px); }
.planner-embed .p-controls { position: static; }

.p-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 22px; align-items: start; }
.p-layout .pmap-panel { order: 2; position: sticky; top: calc(var(--nav-h) + 12px); }
.p-layout .p-days { order: 1; }

.pmap-panel { display: grid; gap: 8px; min-width: 0; }
.pmap-daybar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.pmap-day {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  min-height: 34px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.pmap-day.is-empty { opacity: .55; }
.pmap-day[aria-pressed="true"] { background: var(--rust); border-color: var(--rust); color: #fff; opacity: 1; }
.pmap-summary { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--muted); }
.pmap-summary strong { color: var(--ink); font-family: var(--font-display); }
.pmap {
  height: min(70vh, 560px);
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  overflow: hidden;
  z-index: 0;
}
.pmap.pmap-off { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.pmap-hint { display: none; margin: 0; font-size: 12px; color: var(--muted); }

.pcard { cursor: pointer; }
.pcard.is-selected { border-color: var(--rust); box-shadow: 0 0 0 2px var(--rust); }
.pday-head { cursor: pointer; }

.pm-pin { background: none; border: 0; }
.pm-pin span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--pin, #bf6440); color: #fff; border: 2px solid #fff;
  font: 700 13px/1 system-ui, sans-serif; box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
}
.pm-pin.is-base span { background: #10160e; border-radius: 6px; }
.pm-pin.is-approx span { border-style: dashed; border-color: #10160e; }
.pm-pin.is-selected span { transform: scale(1.3); box-shadow: 0 0 0 3px rgba(191, 100, 64, .55), 0 1px 5px rgba(0, 0, 0, .45); }
.pm-pin.is-dot span { width: 14px; height: 14px; margin: 8px; font-size: 0; }
.pm-pin.is-dot.is-base span { width: 16px; height: 16px; margin: 7px; }
.pm-line.is-peak { stroke-linecap: round; }
.pm-arrow-wrap { background: none; border: 0; }
.pm-arrow { position: absolute; left: 0; top: 0; overflow: visible; }
.pm-leg { background: none; border: 0; }
.pm-lab {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  padding: 2px 7px; border-radius: 999px; background: #fffcf5; color: #201b17;
  border: 1px solid #bf6440; font: 700 11px/1.5 ui-monospace, Menlo, monospace;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.pm-lab.is-hi { background: #bf6440; color: #fff; }
.pm-lab.is-unknown { border-color: #9c4638; color: #9c4638; }
.pm-peak {
  margin-left: 5px; padding: 0 5px; border-radius: 999px; background: #9c4638; color: #fff;
  font-size: 9px; letter-spacing: .04em; text-transform: uppercase;
}

@media (max-width: 900px) {
  .p-layout { grid-template-columns: minmax(0, 1fr); }
  .p-layout .pmap-panel { order: 1; position: static; }
  .p-layout .p-days { order: 2; }
  .pmap { height: 320px; min-height: 260px; }
}
@media (pointer: coarse) { .pmap-hint { display: block; } }
