/* Clients pages. Look taken from docs/design/brightlane-demo.html (Clients tab).
   Colour tokens, fonts, the top bar and base styles come from shell.css
   (issue #39), which every page loads before this sheet. */

.pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--panel); padding: 6px 12px; cursor: pointer; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.seg .n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.search { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: var(--panel); }

.note { font-size: 13px; color: var(--muted); margin: 0 0 12px; max-width: 70ch; }
.error-line { margin: 0 0 12px; color: var(--bad); font-size: 13px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--soft); }
tr:last-child td { border-bottom: 0; }
td .who { font-weight: 500; }
.num, .phone { font-variant-numeric: tabular-nums; white-space: nowrap; }
.src { font-size: 12px; color: var(--muted); }
/* Missing info: outlined neutral, not yellow (yellow = court date within 7 days). */
.missing { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: 4px; border: 1px dashed var(--muted); background: transparent; color: var(--ink); }

.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; font-weight: 500; }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.flag { background: var(--flag); color: var(--flag-ink); }      /* soon: 0-7 days */
.st.bad { background: var(--bad-soft); color: var(--bad); }        /* date passed */
.st.none { background: var(--soft); color: var(--muted); }
.st.acc { background: var(--accent-soft); color: var(--ink); }
.cell-line + .cell-line { margin-top: 2px; }

/* Client name in the clients list links to the client page. */
a.who { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a.who:hover { text-decoration-color: currentColor; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }

/* Client detail page (issue #23). Look from the design's clientDetail view. */
.backbar { margin: 0 0 12px; }
.back { color: var(--accent); text-decoration: none; font-weight: 500; }
.back:hover { text-decoration: underline; }
.detail-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.detail-head h1 { margin: 0; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.pane h3 { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.kv > div { padding: 8px 12px; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { color: var(--muted); background: var(--soft); }
.matter { margin-bottom: 18px; }
.matter-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.matter-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.stepper { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 0 0 10px; }
.stepper li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.stepper li.done { color: var(--ink); }
.stepper li.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 500; }
.lookup { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lookup code { font-family: var(--mono); font-size: 13px; background: var(--soft); padding: 3px 8px; border-radius: 4px; user-select: all; overflow-wrap: anywhere; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.ok-line { margin: 0 0 12px; color: var(--ok); font-size: 13px; }

/* Quick add (issue #24). Look from the design's .qa / .qa-grid / .radios. */
.qa { border: 1px solid var(--accent); border-radius: 6px; padding: 12px 14px; margin-bottom: 14px; background: var(--panel); display: grid; gap: 10px; }
.qa-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.qa-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.qa label.f { display: grid; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.qa input.t { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--panel); font-size: 14px; color: var(--ink); min-width: 0; width: 100%; }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.radios legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; padding: 0; }
.radios label { display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.radios input { accent-color: var(--accent); margin: 0; }
.qa-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.qa-actions .error-line { margin: 0 auto 0 0; }
/* No phone and no email: a gentle reminder, not an error (not red). */
.reminder { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; font-size: 13px; }

/* Move to (issue #24). Look from the design's .stagebar. */
.stagewrap { margin-bottom: 10px; }
.stagebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--panel); max-width: 100%; }
.confirm { margin-top: 8px; border: 1px solid var(--bad); border-radius: 6px; padding: 10px 12px; background: var(--panel); }
.confirm p { margin: 0 0 8px; }
.confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stagewrap .ok-line { margin: 8px 0 0; }

/* Children under 18 Yes / No (issue #41). Look from the design's .kids. */
.kids { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-right: 8px; }

details.past { margin-top: 22px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
details.past summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.past[open] summary { margin-bottom: 12px; }

/* Phone width: each client becomes a stacked card, no sideways scrolling. */
@media (max-width: 600px) {
  .pane { padding: 12px; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; justify-content: center; padding: 8px 6px; }
  .search { min-width: 0; width: 100%; flex-basis: 100%; }
  #add-button { width: 100%; padding: 8px 12px; }
  .qa { padding: 10px; }
  .qa-actions .btn, .reminder .btn, .confirm-actions .btn { flex: 1 1 auto; padding: 8px 12px; }
  .tablewrap { overflow-x: visible; border: 0; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; }
  td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 6px 10px; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); font-size: 12px; color: var(--muted); font-weight: 600; }
  tr td:last-child { border-bottom: 0; }
  .phone { white-space: normal; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv .k { border-bottom: 0 !important; padding-bottom: 0; }
}
