/* ============================================================
   INTAKE DASHBOARD — PROVA COMPONENT LAYER (dashboard.css)
   Requires tokens.css. Two parts:
     A) Remapped existing hooks (drop-in reskin, zero markup change)
     B) New shell + evidence components (used by the redesign markup)
   ============================================================ */

/* ============ A0. BASE ============ */
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--sans); font-size: 15.5px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
h1, h2, h3 { color: var(--ink); }
h1 { font-family: var(--serif); font-size: 1.65rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .3rem; }
h2 { font-family: var(--sans); font-size: 1.02rem; font-weight: 700; margin: 1.9rem 0 .75rem; }
.subtle { color: var(--muted); font-size: .9rem; }
::selection { background: var(--green-tint); }

/* Mono metadata helper — the evidence voice */
.k, .meta, time { font-family: var(--mono); }

/* ============ A1. EXISTING HOOKS, RESKINNED ============ */

/* --- top bar (legacy layout; superseded by .shell below) --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; height: var(--topbar-h);
  background: var(--navy-deep); border-bottom: 1px solid var(--navy-line);
}
.topbar .brand {
  font-family: var(--serif); font-weight: 600; font-size: 1.05rem;
  color: #fff; text-decoration: none; letter-spacing: .01em;
}
.topbar nav { display: flex; gap: .25rem; align-items: center; }
.topbar nav a {
  text-decoration: none; color: var(--slate-dark); font-size: .86rem; font-weight: 600;
  padding: .35rem .6rem; border-radius: 7px; transition: color .15s, background .15s;
}
.topbar nav a:hover { color: #fff; background: var(--navy-card); }
.topbar nav a.active { color: #fff; background: var(--navy-card); box-shadow: inset 0 -2px 0 var(--green); }
.userchip { font-family: var(--mono); font-size: .72rem; color: var(--slate-dark); }

.container { max-width: var(--content-max); margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }

/* --- cards --- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem;
}

/* --- forms --- */
label {
  display: block; font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--slate);
  margin: .7rem 0 .3rem;
}
input, select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; font-size: .92rem;
  background: var(--mist); color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green); background: #fff;
  box-shadow: 0 0 0 3px rgba(70,162,71,.16);
}
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

/* --- buttons --- */
.btn, button {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1rem; border: 1.5px solid var(--action);
  background: var(--action); color: #fff; border-radius: 9px;
  font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .15s var(--ease), box-shadow .15s;
}
.btn:hover, button:hover { background: var(--action-dark); border-color: var(--action-dark); transform: translateY(-1px); }
.btn.secondary, button.secondary { background: #fff; color: var(--navy); border-color: var(--border); }
.btn.secondary:hover, button.secondary:hover { border-color: var(--navy); background: var(--mist); transform: translateY(-1px); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger-line); }
button.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* --- badges: the status taxonomy, mono evidence chips --- */
.badge {
  display: inline-block; font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .04em; padding: .14rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--quiet); background: var(--quiet-bg);
  white-space: nowrap;
}
.badge.active, .badge.qualified, .badge.match { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.badge.inactive, .badge.low_priority, .badge.not_a_fit, .badge.pending { color: var(--quiet); background: var(--quiet-bg); }
.badge.hot, .badge.fail { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.badge.needs_review, .badge.dup { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge.dup { margin-left: .4rem; font-size: .62rem; text-transform: uppercase; }

/* --- alerts --- */
.alert { padding: .65rem .85rem; border-radius: 9px; font-size: .88rem; margin-bottom: 1rem; border: 1px solid; }
.alert.error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.alert.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.alert.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }

/* --- metrics: serif numerals + mono labels (Prova .stat) --- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .85rem; }
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: .95rem 1.05rem;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.metric .num { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; color: var(--navy); line-height: 1.05; }
.metric .label { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: .3rem; }
.metric .hint { font-family: var(--mono); font-size: .68rem; color: var(--muted); margin-top: .35rem; }

/* --- toolbar (filter rows) --- */
.toolbar {
  display: flex; align-items: flex-end; gap: .85rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; padding: .9rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.toolbar label { margin: 0 0 .25rem; }
.toolbar .grow { flex: 1 1 auto; }

/* --- master-detail --- */
.lead-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
@media (max-width: 860px) { .lead-layout { grid-template-columns: 1fr; } }

/* --- tables: mono uppercase heads, navy hover, green-tint selection --- */
.ltable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ltable td, .ltable th { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ltable th {
  font-family: var(--mono); font-size: .66rem; font-weight: 600; color: var(--slate);
  text-transform: uppercase; letter-spacing: .1em; background: var(--mist);
}
.ltable tbody tr { cursor: pointer; transition: background .12s; }
.ltable tbody tr:hover { background: var(--navy-tint); }
.ltable tbody tr.selected { background: var(--green-tint); box-shadow: inset 3px 0 0 var(--green); }

/* --- transcript: document treatment --- */
.transcript {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 9px;
  padding: .7rem .85rem; background: #FBFCFE; font-size: .87rem;
}
.transcript .turn { margin: 0 0 .55rem; }
.transcript .who {
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin-right: .4rem;
}
.transcript .who.bot { color: var(--green-dark); }

/* --- field rows: the evidence ledger --- */
.field-row { display: flex; gap: .6rem; padding: .34rem 0; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.field-row:last-child { border-bottom: none; }
.field-row .k { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex: 0 0 132px; padding-top: .1rem; }
.field-row .v { flex: 1 1 auto; word-break: break-word; }

/* --- conversation controls --- */
.conv-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: .6rem; margin-top: .75rem; }
@media (max-width: 640px) { .conv-controls { grid-template-columns: 1fr; } }
.conv-notes { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.conv-notes li { border: 1px solid var(--border); border-radius: 7px; padding: .45rem .6rem; background: #fff; font-size: .88rem; }
.conv-summary { margin-top: .6rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 9px; background: var(--mist); font-size: .9rem; }
.conv-summary-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.conv-summary-head .k { font-family: var(--mono); color: var(--muted); font-weight: 600; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }

/* --- tabs --- */
.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--border); margin: .75rem 0 0; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--muted); font-weight: 700; font-size: .86rem; padding: .5rem .1rem; cursor: pointer;
}
.tab.active { color: var(--navy); border-bottom-color: var(--green); }
.tab:hover:not(.active) { color: var(--text); }

/* --- legal pages --- */
.legal-page { min-height: 100vh; background: var(--bg); }
.legal-page-inner { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.legal-back-link { display: inline-block; margin-bottom: 1.25rem; font-size: .85rem; color: var(--muted); text-decoration: none; }
.legal-back-link:hover { color: var(--navy); }
.legal-content h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
.legal-content h2 { font-size: 1.2rem; margin: 2rem 0 .6rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.legal-content h2:first-of-type { border-top: none; padding-top: 0; }
.legal-content h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; }
.legal-content p { margin: .6rem 0; }
.legal-content ul { margin: .5rem 0; padding-left: 1.4rem; }
.legal-content li { margin: .25rem 0; }
.legal-content em:first-of-type { display: block; color: var(--muted); font-size: .85rem; margin-bottom: 1.5rem; }
.legal-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0 1rem; }
.legal-content a { color: var(--navy); }

/* --- bar chart --- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: .5rem; }
.bars .col { flex: 1 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; max-width: 34px; background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; transition: background .15s; }
.bars .col:hover .bar { background: var(--green); }
.bars .bar.zero { background: var(--border); }
.bars .cap, .bars .tick { font-family: var(--mono); color: var(--muted); }
.bars .cap { font-size: .66rem; }
.bars .tick { font-size: .6rem; white-space: nowrap; }

/* ============ B. NEW SHELL + EVIDENCE COMPONENTS ============ */

/* --- B1. App shell: left rail + content --- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--navy-deep); color: var(--slate-dark);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.rail-brand {
  display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.2rem 1rem;
  border-bottom: 1px solid var(--navy-line);
}
.rail-brand .mark { width: 26px; height: 26px; }
.rail-brand .name { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; color: #fff; }
.rail-brand .firm { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--slate-dark); margin-top: .15rem; }
.rail-nav { flex: 1 1 auto; overflow-y: auto; padding: .9rem .7rem 1rem; }
.rail-group { margin-bottom: 1.15rem; }
.rail-group-label {
  font-family: var(--mono); font-size: .6rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: #5E7E99;
  padding: 0 .55rem .4rem;
}
.rail-nav a {
  display: flex; align-items: center; gap: .55rem;
  color: #C7D8E4; text-decoration: none; font-size: .88rem; font-weight: 600;
  padding: .42rem .55rem; border-radius: 8px; margin-bottom: 1px;
  transition: background .13s, color .13s;
}
.rail-nav a:hover { background: var(--navy-card); color: #fff; }
.rail-nav a.active { background: var(--navy-card); color: #fff; box-shadow: inset 2.5px 0 0 var(--green); }
.rail-nav a .ico { width: 15px; height: 15px; opacity: .75; flex-shrink: 0; }
.rail-foot { border-top: 1px solid var(--navy-line); padding: .8rem 1.2rem; }
.rail-foot .userchip { display: block; margin-bottom: .5rem; }
.rail-foot button { width: 100%; justify-content: center; font-size: .8rem; padding: .4rem .8rem; background: transparent; border-color: var(--navy-line); color: #C7D8E4; }
.rail-foot button:hover { background: var(--navy-card); border-color: var(--slate-dark); color: #fff; }
.shell-main { min-width: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .rail-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
  .rail-group-label { grid-column: 1 / -1; }
}

/* --- B2. Page head: eyebrow + serif title + description --- */
.page-head { margin-bottom: 1.5rem; }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: .66rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--green-dark); margin-bottom: .5rem;
}
.eyebrow::before { content: ""; display: inline-block; vertical-align: middle; width: 22px; height: 1.5px; background: var(--green); margin-right: 8px; }
.page-head h1 { margin: 0 0 .35rem; }
.page-head .sub { color: var(--slate); font-size: .93rem; max-width: 72ch; }

/* --- B3. Report document (reconciliation, lead dossier, consent) --- */
.report {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px -30px rgba(13,36,56,.25);
  padding: 20px 22px 16px; position: relative;
}
.report::after {
  content: ""; position: absolute; inset: 7px; pointer-events: none;
  border: 1px dashed rgba(7,73,117,.14); border-radius: 9px;
}
.report-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; row-gap: 6px;
  font-family: var(--mono); font-size: .64rem; letter-spacing: .12em;
  color: var(--slate); text-transform: uppercase;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.report-head b { color: var(--green-dark); font-weight: 600; }
.report-foot { font-family: var(--mono); font-size: .66rem; color: var(--slate); margin-top: 10px; }

/* --- B4. Event trail (audit/activity, run history) --- */
.trail { border-left: 2px solid var(--line); padding-left: 26px; }
.trail-item { position: relative; margin-bottom: 22px; }
.trail-item::before {
  content: ""; position: absolute; left: -32.5px; top: 4px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-tint);
}
.trail-item .when { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; color: var(--green-dark); font-weight: 600; text-transform: uppercase; }
.trail-item p { margin: .25rem 0 0; font-size: .9rem; color: var(--slate); }

/* --- B5. Chat bubbles (widget-style transcripts) --- */
.chat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.chat .msg { max-width: 84%; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-size: .9rem; line-height: 1.5; }
.chat .them { background: var(--mist); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat .us { background: var(--navy); color: #E8F0F6; margin-left: auto; border-bottom-right-radius: 4px; }
.chat .sys { font-family: var(--mono); font-size: .66rem; color: var(--green-dark); text-align: center; margin: 12px 0 2px; letter-spacing: .06em; }

/* --- B6. Utility --- */
.mono { font-family: var(--mono); }
.serif-num { font-family: var(--serif); font-weight: 600; color: var(--navy); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }
@media (prefers-reduced-motion: reduce) {
  .btn, button, .metric, .rail-nav a, .ltable tbody tr { transition: none; }
}
