/* Portal-wide smart search — header trigger, command palette and preview card.
   The palette owns its colours so it looks the same on the portal home
   (Montserrat, blue gradient header) and in the Coach Journal (Inter, navy). */

.ps-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.ps-trigger:hover { background: rgba(255, 255, 255, .2); }
.ps-trigger:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ps-trigger-icon { font-size: 13px; line-height: 1; }
.ps-trigger kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 6px;
  background: rgba(0, 0, 0, .14);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  opacity: .9;
}

@media (max-width: 700px) {
  .ps-trigger { width: 36px; justify-content: center; padding: 0; }
  .ps-trigger-text, .ps-trigger kbd { display: none; }
}

/* ── overlay and dialog ─────────────────────────────────────────────────── */

.ps-overlay {
  --ps-ink: #1b1843;
  --ps-muted: #5f5c7a;
  --ps-soft: #f5f7fb;
  --ps-line: rgba(27, 24, 67, .1);
  --ps-line-strong: rgba(27, 24, 67, .16);
  --ps-navy: #003463;
  --ps-blue: #0eaae4;
  --ps-orange: #f7941d;
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
  background: rgba(8, 20, 40, .48);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.ps-overlay[hidden] { display: none; }

.ps-dialog {
  width: min(940px, 100%);
  max-height: min(78vh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  color: var(--ps-ink);
  box-shadow: 0 30px 90px rgba(7, 19, 38, .4), 0 2px 8px rgba(7, 19, 38, .18);
  animation: ps-pop .16s ease-out;
}

@keyframes ps-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.ps-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--ps-line);
}

.ps-input-icon { font-size: 16px; }

.ps-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ps-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 16px 0;
}

.ps-input::placeholder { color: #9a98b3; font-weight: 500; }

.ps-esc {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 7px;
  background: var(--ps-soft);
  color: var(--ps-muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.ps-body {
  display: flex;
  min-height: 0;
  flex: 1;
}

.ps-list-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.ps-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px 12px;
}

.ps-hint {
  margin: 8px 8px 2px;
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(247, 148, 29, .13);
  color: #8a4c00;
  font-size: 11.5px;
  font-weight: 700;
}

.ps-group { margin-top: 6px; }

.ps-group-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 6px;
  background: #fff;
  color: var(--ps-muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ps-group-count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ps-soft);
  color: var(--ps-muted);
  font-size: 10px;
  letter-spacing: 0;
}

.ps-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 11px;
  cursor: pointer;
  outline: none;
}

.ps-row:hover { background: var(--ps-soft); }

.ps-row[aria-selected="true"] {
  background: rgba(14, 170, 228, .12);
  box-shadow: inset 0 0 0 1px rgba(14, 170, 228, .38);
}

.ps-row-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 52, 99, .1), rgba(14, 170, 228, .14));
  font-size: 16px;
}

.ps-row-main { min-width: 0; flex: 1; }

.ps-row-title {
  overflow: hidden;
  color: var(--ps-ink);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ps-row-sub {
  overflow: hidden;
  margin-top: 1px;
  color: var(--ps-muted);
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ps-row-snippet {
  margin-top: 3px;
  color: #74718f;
  font-size: 11.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ps-row-snippet:empty { display: none; }

.ps-row-info,
.ps-recent-remove {
  flex: none;
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ps-navy);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.ps-recent-remove {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: transparent;
  color: #9a98b3;
  font-size: 14px;
}

.ps-recent-remove:hover { background: #fff; color: #b42318; }

mark.ps-mark {
  padding: 0 1px;
  border-radius: 3px;
  background: rgba(247, 148, 29, .34);
  color: inherit;
}

/* ── idle: recents and section chips ────────────────────────────────────── */

.ps-idle-title {
  padding: 10px 10px 4px;
  color: var(--ps-muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ps-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px 8px;
}

.ps-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--ps-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ps-ink);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.ps-chip:hover { border-color: rgba(14, 170, 228, .5); background: rgba(14, 170, 228, .07); }

.ps-idle-tip {
  padding: 4px 12px 14px;
  color: #8b89a3;
  font-size: 11.5px;
  line-height: 1.55;
}

.ps-status {
  padding: 10px 18px 14px;
  color: var(--ps-muted);
  font-size: 11.5px;
  min-height: 18px;
}

.ps-status.is-error { color: #b42318; }

.ps-empty {
  padding: 30px 24px 26px;
  text-align: center;
  color: var(--ps-muted);
}

.ps-empty strong { display: block; margin-bottom: 6px; color: var(--ps-ink); font-size: 14px; }
.ps-empty span { font-size: 12px; line-height: 1.55; }

/* ── preview column ─────────────────────────────────────────────────────── */

.ps-preview {
  width: 330px;
  flex: none;
  overflow-y: auto;
  padding: 18px 18px 22px;
  border-left: 1px solid var(--ps-line);
  background: #fbfcfe;
}

.ps-preview[hidden] { display: none; }

.ps-preview-kicker {
  color: var(--ps-blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ps-preview h2 {
  margin: 5px 0 2px;
  color: var(--ps-ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.ps-preview-sub { color: var(--ps-muted); font-size: 11.5px; line-height: 1.5; }

.ps-facts {
  display: grid;
  grid-template-columns: minmax(74px, auto) 1fr;
  gap: 7px 12px;
  margin: 16px 0 0;
  padding: 12px 0;
  border-top: 1px solid var(--ps-line);
  border-bottom: 1px solid var(--ps-line);
}

.ps-fact-label { color: var(--ps-muted); font-size: 11px; font-weight: 700; }
.ps-fact-value { color: var(--ps-ink); font-size: 11.5px; font-weight: 600; line-height: 1.45; }

.ps-lines { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.ps-line { display: flex; gap: 10px; }
.ps-line-label { flex: none; width: 44px; color: var(--ps-muted); font-size: 10.5px; font-weight: 700; padding-top: 1px; }
.ps-line-text { color: var(--ps-ink); font-size: 11.5px; font-weight: 700; line-height: 1.4; }
.ps-line-note { margin-top: 1px; color: var(--ps-muted); font-size: 10.5px; line-height: 1.4; }

.ps-preview-footer {
  margin-top: 14px;
  color: var(--ps-muted);
  font-size: 11px;
  line-height: 1.5;
}

.ps-preview-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 13px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0058f8 0%, #0eaae4 100%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  text-decoration: none;
}

.ps-preview-close { display: none; }

.ps-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 18px;
  border-top: 1px solid var(--ps-line);
  background: #fcfcfe;
  color: #8b89a3;
  font-size: 10.5px;
}

.ps-foot b { color: var(--ps-muted); font-weight: 800; }

.ps-sheet-backdrop { display: none; }

/* ── mobile ─────────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .ps-overlay { padding: 0; background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .ps-dialog {
    width: 100%;
    max-height: none;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    animation: none;
  }
  .ps-input-row { min-height: 60px; padding-top: env(safe-area-inset-top); }
  .ps-preview {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2010;
    width: auto;
    max-height: 74dvh;
    padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 50px rgba(7, 19, 38, .28);
    transform: translateY(105%);
    transition: transform .2s ease;
  }
  .ps-preview.ps-open { transform: none; }
  .ps-preview-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--ps-line);
    border-radius: 9px;
    background: #fff;
    color: var(--ps-muted);
    font-size: 13px;
    cursor: pointer;
  }
  .ps-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 2005;
    background: rgba(8, 20, 40, .38);
  }
  .ps-sheet-backdrop[hidden] { display: none; }
  .ps-row-info { display: inline-flex; }
  .ps-row { padding: 10px 8px; }
  .ps-scroll { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .ps-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-dialog { animation: none; }
  .ps-preview { transition: none; }
}
