/*
 * Growth Partner — Lijsten board (lists#show), UX overhaul phase 5a.
 * Spec: docs/ux-overhaul/mockup/Pijplijn.dc.html (header, filter row,
 * columns, cards). Restyles the existing kanban classes (application.css)
 * on top of the gp- components; served after application.css, so equal
 * specificity wins here. Classes only (CSP). Phone rules at the bottom.
 */

/* ── Header: name + switcher, description + deal count, actions ── */
.pipeline-header { align-items: flex-start; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.pipeline-header-main { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; flex: 1 1 320px; }
.pipeline-title-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.pipeline-header-desc { margin: 0; color: var(--gp-body); font-size: 0.95rem; }
.pipeline-header-desc .count { color: var(--gp-body); font-size: 0.95rem; }
.pipeline-header-desc > span + .count::before { content: " · "; }
.pipeline-header .page-header-actions { align-self: center; }
.pipeline-header .page-header-actions .gp-btn,
.pipeline-header .page-header-actions form { margin: 0; }
.pipeline-header .page-header-actions button.gp-btn { width: auto; }

/* List switcher: a Pico <details class="dropdown">, sized like a quiet button. */
.list-switcher { margin: 0; }
.list-switcher > summary.gp-btn { height: 30px; padding: 0 10px; line-height: 1; }
.list-switcher > summary.gp-btn::after { margin-inline-start: 0.4rem; }
.list-switcher ul { min-width: 220px; max-height: 60vh; overflow-y: auto; }
.list-switcher li a { display: flex; align-items: center; gap: 0.25rem; color: var(--gp-ink); }

.pipeline-filter-group > a { flex: none; margin: 0; }

/* ── Filter row: owner chips + attention chips ── */
.pipeline-filters {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem;
  justify-content: flex-start; /* Pico spreads a <nav> with space-between */
  margin: 0 0 1rem;
}
.pipeline-filters-label { color: var(--gp-body); font-size: 0.85rem; }
.pipeline-filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pipeline-chip { min-height: 30px; color: var(--gp-ink); }
.pipeline-chip:hover { border-color: var(--gp-navy); color: var(--gp-navy); }
.pipeline-chip[aria-current="true"] {
  background: var(--gp-navy); border-color: var(--gp-navy); color: #fff;
}
.pipeline-chip.gp-chip-amber { color: var(--gp-amber-ink); }
.pipeline-chip.gp-chip-amber[aria-current="true"] {
  background: var(--gp-amber-ink); border-color: var(--gp-amber-ink); color: #fff;
}
.pipeline-chip:focus-visible { outline: 2px solid var(--gp-navy); outline-offset: 2px; }
.pipeline-chip-count { font-variant-numeric: tabular-nums; font-weight: 700; }
.pipeline-chip-avatar { width: 18px; height: 18px; font-size: 0.5rem; }

/* ── Board + columns ── */
.kanban-toolbar { margin-bottom: 0.5rem; }
.kanban-toggle-lost { color: var(--gp-navy); font-weight: 600; font-size: 0.85rem; }
.kanban-board { gap: 12px; align-items: stretch; }
.kanban-board-5 { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
.kanban-board-6 { grid-template-columns: repeat(6, minmax(200px, 1fr)); }
.kanban-column {
  margin: 0; display: flex; flex-direction: column; gap: 10px;
  background: var(--gp-panel-bg); border: 0; border-radius: 14px; padding: 12px;
}
.kanban-column.drag-over { background: var(--gp-navy-tint); box-shadow: inset 0 0 0 2px var(--gp-navy); }
.kanban-column-header {
  align-items: center; margin: 0; padding: 0;
  font-family: var(--gp-font-heading); font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.12em; color: var(--gp-navy);
}
.kanban-column-count {
  background: #fff; color: var(--gp-navy); font-family: var(--gp-font-heading);
  font-size: 0.8rem; letter-spacing: 0; font-variant-numeric: tabular-nums;
}
.kanban-column-cards { gap: 10px; flex: 1; }
.kanban-column-empty {
  font-style: normal; font-size: 0.8rem; color: var(--gp-body);
  border: 1.5px dashed var(--gp-line); border-radius: 12px; padding: 18px 0.5rem;
}

/* ── Card ── */
.kanban-card {
  display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: 1px solid var(--gp-line); border-radius: 12px; padding: 12px;
  color: var(--gp-ink);
}
.kanban-card:hover { border-color: var(--gp-navy); }
.kanban-card-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.kanban-card-title {
  flex: 1; min-width: 0; margin: 0;
  font-family: var(--gp-font-heading); font-weight: 700; font-size: 0.92rem; line-height: 1.25;
  color: var(--gp-navy);
}
.kanban-card-title .stealth-link { color: var(--gp-navy); }
.kanban-card-contact { margin: 0; font-size: 0.85rem; color: var(--gp-ink); }

/* Staleness: one muted line ("contact 3d geleden · 5d in gecontacteerd"),
   danger red + bold when ListItem#stale?. */
.kanban-card-staleness { display: block; flex: none; line-height: 1.35; }
.kanban-card-staleness small { display: inline; font-size: 0.78rem; color: var(--gp-body); }
.kanban-card-staleness small + small::before { content: "· "; }
.kanban-card-staleness.is-stale small { color: var(--gp-red-ink); font-weight: 700; }

.kanban-card-meta { flex-wrap: wrap; gap: 6px; font-size: 0.8rem; }
.kanban-card-next { max-width: 100%; min-width: 0; font-size: 0.75rem; }
.kanban-card-next-title { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kanban-card-next-due { flex: none; font-weight: 700; }
.kanban-card-owner { margin-left: auto; display: inline-flex; }
.kanban-card-owner .gp-avatar { width: 24px; height: 24px; font-size: 0.62rem; }
/* "Open" sits at the end of the meta row (it used to float over the title). */
.kanban-card-open {
  position: static; margin-left: auto;
  font-size: 0.75rem; font-weight: 600; color: var(--gp-navy);
}
.kanban-card-owner + .kanban-card-open { margin-left: 0; }
.kanban-card:focus-visible { outline: 2px solid var(--gp-navy); outline-offset: 2px; }
/* The card whose deal is open in the side panel (set by quickview_controller). */
.kanban-card.is-selected {
  border-color: var(--gp-navy);
  box-shadow: 0 0 0 1px var(--gp-navy), inset 4px 0 0 var(--gp-green);
}

/* ── Deal side panel (UX overhaul 5b) ──
   The shared #quickview-dialog (showModal: focus trap + Escape). Phone and
   tablet: a full-screen sheet (base rules, below 900px). Desktop: docked to
   the right edge, full height, with a transparent backdrop so the board stays
   visible beside it (see the min-width block). Overrides the old centred
   modal in application.css. Pico gives every <dialog> a full-viewport
   min-size, an overlay filter and an entry animation; all three are undone
   here. `display` is left to Pico (it hides the closed dialog). */
.quickview-dialog {
  position: fixed; inset: 0; margin: 0;
  width: 100vw; max-width: 100vw; min-width: 0;
  height: 100dvh; max-height: 100dvh; min-height: 0;
  border: 0; border-radius: 0; box-shadow: none;
  background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; animation: none;
}
.quickview-scroll {
  width: 100%; height: 100%; max-height: none;
  overflow-y: auto; overscroll-behavior: contain;
}
.quickview-panel { display: flex; flex-direction: column; gap: 14px; padding: 0 0 18px; }

.quickview-header {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: 16px 18px 14px; background: #fff;
  border-bottom: 1px solid var(--gp-line); box-shadow: none;
}
.quickview-head-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.quickview-title {
  flex: 1 1 auto; min-width: 0; white-space: normal;
  font-family: var(--gp-font-heading); font-weight: 700; font-size: 1.1rem; line-height: 1.25;
  color: var(--gp-navy);
}
.quickview-title a, .quickview-title .stealth-link { color: var(--gp-navy); }
.quickview-close { flex: none; font-size: 0.8rem; color: var(--gp-ink); padding: 0 12px; }
.quickview-close:hover { color: var(--gp-navy); }

.quickview-stage { display: flex; flex-direction: column; gap: 12px; }
.quickview-steps-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.quickview-steps { flex: 1 1 auto; flex-wrap: nowrap; gap: 5px; min-width: 0; }
.quickview-steps .gp-step-bar { min-width: 8px; }
.quickview-step-label { white-space: nowrap; }
.quickview-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.quickview-actions form { margin: 0; }
.quickview-next-form { flex: 1 1 auto; }
.quickview-next { width: 100%; }
.quickview-owner {
  width: auto; max-width: 11rem; height: 30px; margin: 0; padding: 0 28px 0 10px;
  font-size: 0.8rem; color: var(--gp-ink);
}

/* Call card: navy, the number as a white button (green stays the ONE primary
   action of the panel, "Naar <volgende fase>"). */
.quickview-call {
  margin: 0 18px; padding: 14px 16px;
  flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px;
}
.quickview-call-who { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.quickview-call-btn { flex: none; }

/* The drawer underneath, unchanged in markup, stacked into one column. */
.quickview-body .pipeline-drawer { padding: 0 18px; background: transparent; }
.quickview-body .pipeline-drawer-grid { grid-template-columns: 1fr; gap: 14px; }
.quickview-body .pipeline-drawer-contact { grid-template-columns: 1fr 1fr; }
.quickview-body .pipeline-drawer-contact .span-2 { grid-column: 1 / -1; }

@media (min-width: 900px) {
  .quickview-dialog {
    inset: 0 0 0 auto;
    width: 420px; max-width: 100vw;
    border-left: 1px solid var(--gp-line);
    box-shadow: -12px 0 32px rgba(14, 58, 90, 0.12);
  }
  .quickview-dialog::backdrop { background: transparent; }
}

/* ── Phone ── */
@media (max-width: 640px) {
  .pipeline-header .page-header-actions { margin-left: 0; width: 100%; }
  /* Each chip group scrolls sideways inside its own row. */
  .pipeline-filter-group { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
  .pipeline-chip, .list-switcher > summary.gp-btn, .pipeline-header .gp-btn { min-height: 40px; }
  .pipeline-view-toggle > a { min-height: 40px; display: inline-flex; align-items: center; }
  .kanban-card-open { min-height: 40px; display: inline-flex; align-items: center; }

  /* Columns scroll sideways inside the board: one column ~85% wide. */
  .kanban-board, .kanban-board-5, .kanban-board-6 {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 85%;
  }

  /* Full-screen deal sheet: a clear close button (>= 44px), 40px controls. */
  .quickview-close { min-width: 44px; min-height: 44px; }
  .quickview-owner-form { flex: 1 1 100%; }
  .quickview-owner { height: 40px; width: 100%; max-width: none; }
  .quickview-header { padding: 12px 14px; }
  .quickview-call { margin: 0 14px; }
  .quickview-body .pipeline-drawer { padding: 0 14px; }
  .quickview-body .pipeline-drawer-contact { grid-template-columns: 1fr; }
}
