/* The Deals board's filters, folded columns and card additions, and the deal
 * panel that opens over the board (public/js/page-deals.js and
 * public/js/deal-panel.js). The board's original rules stay in styles.css;
 * this sheet only adds to them, and loads after it so the phone rules below
 * win over the older 84vw column width there.
 */

/* ---- Filters ---- */
.deal-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 12px; }
.deal-filters input[type=search] {
  width: 230px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card);
}
.deal-filters .btn.on { background: #eff6ff; border-color: var(--blue); color: var(--blue-dark); }
.deal-filters .count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px;
  background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 700; text-align: center;
}
.deal-sort { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* ---- Columns ---- */
/* The header is a button now, because it folds the column. */
.col .col-head {
  width: 100%; border: none; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  border-radius: 7px;
}
.col .col-head:hover { background: rgba(255, 255, 255, .55); }
.col .col-head:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.col-empty { padding: 6px 4px 8px; }

/* Folded: a strip with the stage written down it, still a drop target. */
.col.shut { width: 46px; min-width: 46px; padding: 8px 4px; }
.col.shut .col-head {
  writing-mode: vertical-rl; flex-direction: row; align-items: center; gap: 8px;
  padding: 4px 0; min-height: 150px; white-space: nowrap;
}
.col.shut .col-head .sum { margin: 0; }

/* ---- Cards ---- */
.deal-card.on { border-color: var(--blue); box-shadow: 0 0 0 2px #bfdbfe; }
.deal-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.dc-end { margin-left: auto; white-space: nowrap; }
.dc-end.past { color: var(--red); font-weight: 600; }
.dc-gaps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
/* Left, never pushed right: the My To Do dock sits over the bottom right of
   the screen and has already swallowed two right-aligned buttons here. */
.dc-foot { display: flex; margin-top: 8px; }

.dp-gap {
  display: inline-block; border-radius: 6px; padding: 2px 7px; font-size: 11.5px; font-weight: 600;
}
.dp-gap.hard { background: #fef3c7; color: #92400e; }
.dp-gap.soft { background: #eef2f7; color: #475569; }

/* ---- The panel ---- */
/* Over the board rather than instead of it, below modals (100) so Edit deal
   opens on top of it, above the phone tab bar (90). */
.dp {
  position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100vw; z-index: 92;
  display: flex; flex-direction: column; background: var(--card);
  border-left: 1px solid var(--border); box-shadow: -14px 0 40px rgba(15, 23, 42, .16);
  /* No slide-in. The panel is redrawn on every refresh() - after a save, a
     move, an undo - so an entrance animation would replay each time. */
}
.dp-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 8px; }
.dp-title { flex: 1; min-width: 0; }
.dp-title h3 { font-size: 16px; line-height: 1.3; margin: 0 0 3px; }
/* The actions sit at the top, not in a footer: the My To Do dock is fixed in
   the bottom right corner, exactly where a drawer's footer buttons would be. */
.dp-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 4px 18px 12px; border-bottom: 1px solid var(--border);
}
.dp-body { flex: 1; overflow-y: auto; padding: 4px 18px 96px; }
.dp-sec { padding: 12px 0; border-bottom: 1px solid var(--border); }
.dp-sec:last-child { border-bottom: none; }
.dp-label {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.dp-price { font-size: 22px; font-weight: 700; color: var(--green); }
.dp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dp-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.dp-kv span { color: var(--muted); }
.dp-gaps {
  margin-top: 10px; padding: 10px 12px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb;
}
.dp-gap-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }

/* ---- Phone ---- */
/* 860px is where phone.css turns the app over; see the note there. */
@media (max-width: 860px) {
  .deal-filters input[type=search] { flex: 1 1 100%; width: auto; }
  .deal-sort { margin-left: 0; flex: 1 1 100%; white-space: nowrap; }
  .deal-sort select { flex: 1; min-width: 0; width: 100%; }

  /* A list of stages, one under another, rather than nine columns side by
     side. Every stage starts folded on a phone, so the page opens on the list
     of stages with their counts and a tap opens one. */
  .board { flex-direction: column; align-items: stretch; overflow-x: visible; }
  .col, .col.shut { width: auto; min-width: 0; padding: 8px 10px; }
  .col.shut .col-head { writing-mode: horizontal-tb; min-height: 0; padding: 6px 4px; }
  .col .col-head { padding: 6px 4px 10px; }
  .col.shut .col-head .sum { margin-left: auto; }

  .dp { width: auto; left: 0; border-left: none; }
  .dp-actions .btn { padding: 8px 12px; }
}
