/* Aspect Deal Room — Phase 0 prototype */
:root {
  --navy: #102a43;
  --navy-2: #243b53;
  --teal: #0e7490;
  --teal-light: #e0f2f7;
  --amber: #b45309;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e3e8ee;
  --text: #1f2a37;
  --muted: #64748b;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 42, 67, 0.08), 0 4px 16px rgba(16, 42, 67, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  padding-bottom: 60px;
}
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--navy); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #0e7490, #7c3aed);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 17px; letter-spacing: 0.2px; }
.brand-name strong { font-weight: 700; }
.brand-sub { font-size: 11px; opacity: 0.65; }
.role-switch { display: flex; gap: 8px; }
.role-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); color: #fff;
  border-radius: 10px; padding: 8px 14px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; transition: all .15s;
}
.role-btn:hover { background: rgba(255,255,255,0.16); }
.role-btn.active { background: #fff; color: var(--navy); border-color: #fff; }
.role-label { font-weight: 700; font-size: 13px; }
.role-who { font-size: 11px; opacity: 0.7; }

/* ---------- layout ---------- */
.view { max-width: 1100px; margin: 0 auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
h1 { font-size: 22px; color: var(--navy); }
h2 { font-size: 16px; color: var(--navy); margin-bottom: 10px; }
.hint { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }

/* ---------- matter head ---------- */
.matter-head-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.matter-type { font-size: 12px; font-weight: 600; color: var(--teal); background: var(--teal-light); border-radius: 99px; padding: 3px 10px; vertical-align: middle; margin-left: 8px; white-space: nowrap; }
.matter-ref { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.escalate-btn {
  background: #fff; color: var(--red); border: 1.5px solid #fecaca; border-radius: 10px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.escalate-btn:hover { background: #fef2f2; border-color: var(--red); }

/* stage pipeline */
.stage-pipeline { display: flex; gap: 4px; margin: 18px 0 6px; overflow-x: auto; padding-bottom: 4px; }
.stage {
  flex: 1; min-width: 86px; text-align: center; font-size: 11.5px; font-weight: 600;
  padding: 8px 4px; background: #eef1f5; color: var(--muted); position: relative;
}
.stage:first-child { border-radius: 8px 0 0 8px; }
.stage:last-child { border-radius: 0 8px 8px 0; }
.stage.done { background: #d7e7ee; color: var(--teal); }
.stage.current { background: var(--teal); color: #fff; box-shadow: 0 2px 8px rgba(14,116,144,.35); }
.stage.current::after { content: "you are here"; display: block; font-size: 9px; font-weight: 500; opacity: .85; }

.head-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 14px; margin-top: 14px; }
.ball-with, .overall-light, .latest-update {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.ball-with { background: linear-gradient(135deg, #fffbeb, #fff); border-color: #fde68a; }
.ball-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); font-weight: 700; }
.ball-holder { font-size: 20px; font-weight: 800; color: var(--amber); }
.ball-detail { font-size: 12px; color: var(--muted); }
.latest-update p { font-size: 13.5px; }

.light-pill { font-size: 14px; font-weight: 700; }
.light-pill.green { color: var(--green); }
.light-pill.orange { color: var(--orange); }
.light-pill.red { color: var(--red); }

/* ---------- key dates ---------- */
.dates-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.date-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.date-card .dl { font-size: 12px; font-weight: 700; color: var(--muted); }
.date-card .dv { font-size: 18px; font-weight: 800; color: var(--navy); margin: 2px 0; }
.date-card .dc { font-size: 12px; }
.date-card .dc.soon { color: var(--amber); font-weight: 700; }
.date-card .dc.ok { color: var(--green); font-weight: 600; }
.date-card .dc.slip { color: var(--red); }
.date-card.done-card { background: #f0fdf4; border-color: #bbf7d0; }

/* ---------- workstreams ---------- */
.ws { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; transition: all .15s; }
.ws:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.ws-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px #dcfce7; }
.dot.orange { background: var(--orange); box-shadow: 0 0 0 3px #fef3c7; }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px #fee2e2; }
.ws-name { font-weight: 700; font-size: 14.5px; color: var(--navy); flex: 1; }
.ws-ball { font-size: 12px; font-weight: 600; color: var(--amber); background: #fffbeb; border: 1px solid #fde68a; border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.ws-ball.aspect { color: var(--teal); background: var(--teal-light); border-color: #bae6fd; }
.ws-ball.done { color: var(--green); background: #f0fdf4; border-color: #bbf7d0; }
.ws-status { font-size: 13px; color: var(--text); margin-top: 6px; }
.ws-outstanding { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.ws-outstanding li { margin-left: 18px; }
.ws-learn { font-size: 12px; color: var(--teal); font-weight: 600; margin-top: 6px; display: inline-block; }

/* ---------- checklist ---------- */
.checklist-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.progress-wrap { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 320px; }
.progress-bar { flex: 1; height: 10px; background: #eef1f5; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); border-radius: 99px; transition: width .4s; }
#checklist-pct { font-size: 13px; font-weight: 700; color: var(--navy); }
.chk { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.chk:last-child { border-bottom: none; }
.chk-box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid #cbd5e1; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; margin-top: 1px; }
.chk.done .chk-box { background: var(--green); border-color: var(--green); }
.chk-body { flex: 1; }
.chk-item { font-size: 13.5px; font-weight: 600; }
.chk.done .chk-item { color: var(--muted); text-decoration: line-through; text-decoration-color: #cbd5e1; }
.chk-meta { font-size: 11.5px; color: var(--muted); }
.chk-who { font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.chk-who.Aspect { color: var(--teal); background: var(--teal-light); }
.chk-who.Client { color: #7c3aed; background: #f3e8ff; }
.chk-who.Broker { color: var(--amber); background: #fffbeb; }
.chk-who.Other { color: var(--muted); background: #eef1f5; }

/* ---------- chat ---------- */
.chat-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chat-tab {
  flex: 1; min-width: 220px; text-align: left; background: #eef1f5; border: 1.5px solid transparent; border-radius: 10px;
  padding: 10px 14px; cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--muted);
  display: flex; flex-direction: column; gap: 2px;
}
.chat-tab.active { background: #fff; border-color: var(--teal); color: var(--navy); }
.chat-aud { font-size: 11px; font-weight: 500; color: var(--muted); }
.chat-aud.lock { color: #7c3aed; font-weight: 600; }
.chat-window { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 6px 2px; }
.chat-window.private-bg { background: linear-gradient(180deg, #faf5ff, #fff); border-radius: 10px; padding: 12px; border: 1px dashed #d8b4fe; }
.privilege-note { font-size: 11.5px; color: #7c3aed; font-weight: 600; text-align: center; padding: 4px; }
.msg { max-width: 78%; border-radius: 12px; padding: 10px 13px; font-size: 13.5px; box-shadow: var(--shadow); }
.msg .m-head { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.msg .m-role { font-weight: 500; color: var(--muted); }
.msg .m-when { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.msg.me { align-self: flex-end; background: var(--teal-light); }
.msg.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.chat-compose { margin-top: 12px; }
.audience-pick { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.audience-pick label { display: flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text); cursor: pointer; }
.compose-row { display: flex; gap: 8px; }
#chat-input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; outline: none; }
#chat-input:focus { border-color: var(--teal); }
.send-btn { background: var(--teal); color: #fff; border: none; border-radius: 10px; padding: 10px 20px; font-weight: 700; cursor: pointer; }
.send-btn:hover { background: #0c637c; }

/* ---------- team ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.team-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.avatar { width: 46px; height: 46px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.team-card .t-name { font-weight: 700; font-size: 14px; color: var(--navy); }
.team-card .t-role { font-size: 12px; color: var(--teal); font-weight: 600; }
.team-card .t-org { font-size: 12px; color: var(--muted); }
.team-card .t-contact { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-style: italic; }

/* ---------- admin ---------- */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.admin-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.primary-btn { background: var(--teal); color: #fff; border: none; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.primary-btn:hover { background: #0c637c; }
.visibility-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .s-val { font-size: 24px; font-weight: 800; color: var(--navy); }
.stat .s-val.warn { color: var(--red); }
.stat .s-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .s-note { font-size: 10.5px; color: var(--teal); margin-top: 2px; }

.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-tab {
  background: #eef1f5; border: 1.5px solid transparent; border-radius: 10px 10px 0 0; padding: 10px 16px;
  font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.admin-tab.active { background: var(--card); border-color: var(--line); border-bottom-color: var(--card); color: var(--navy); }
.admin-tab .count { background: var(--navy); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 8px; margin-left: 4px; }
.admin-panel { background: var(--card); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius); box-shadow: var(--shadow); padding: 8px; overflow-x: auto; margin-top: -1px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); padding: 8px 8px; border-bottom: 2px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fafc; }
.td-client { font-weight: 700; color: var(--navy); max-width: 150px; }
.td-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.stage-chip { font-size: 11px; font-weight: 700; color: var(--teal); background: var(--teal-light); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.stage-chip.completed { color: var(--green); background: #f0fdf4; }
.ball-chip { font-size: 11.5px; font-weight: 600; color: var(--amber); }
.update-cell { min-width: 180px; font-size: 12px; color: var(--muted); }
.date-pair { white-space: nowrap; font-size: 12px; }
.date-pair .slipped { color: var(--red); font-weight: 600; }
.reason-chip { font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.reason-chip.price { color: var(--red); background: #fee2e2; }
.reason-chip.elsewhere { color: var(--amber); background: #fef3c7; }
.intake-chip { font-size: 11px; color: var(--muted); white-space: nowrap; }

.digest-card { margin-top: 4px; }
.digest { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: #fbfcfd; font-size: 13px; }
.digest h4 { color: var(--navy); font-size: 13.5px; margin: 12px 0 6px; }
.digest h4:first-child { margin-top: 0; }
.digest li { margin-left: 20px; margin-bottom: 4px; }
.digest .d-light { font-weight: 700; }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,42,67,0.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 26px; max-width: 560px; width: 100%;
  max-height: 85vh; overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h3 { color: var(--navy); margin-bottom: 10px; font-size: 17px; }
.modal p { font-size: 13.5px; margin-bottom: 12px; }
.modal textarea, .modal input, .modal select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13.5px; font-family: inherit; margin-bottom: 12px; outline: none;
}
.modal textarea:focus, .modal input:focus, .modal select:focus { border-color: var(--teal); }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.form-label input, .form-label select, .form-label textarea { margin-top: 4px; font-weight: 400; }
.modal-close {
  position: absolute; top: 14px; right: 14px; background: #eef1f5; border: none; width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; font-size: 13px; color: var(--muted);
}
#explainer-body { font-size: 14px; line-height: 1.65; }

/* matter detail modal */
.md-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.md-section { margin-top: 14px; }
.md-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px; }
.md-update { font-size: 13px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.md-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; }
.md-grid b { color: var(--navy); }
.privilege-banner { font-size: 11.5px; color: #7c3aed; background: #f3e8ff; border-radius: 8px; padding: 8px 12px; margin-top: 14px; font-weight: 600; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; border-radius: 12px; padding: 13px 22px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3); z-index: 200; max-width: 90vw; text-align: center;
}

/* ---------- broker-portal additions (Jess review, 17 Jun) ---------- */
.whoami { display: flex; flex-direction: column; align-items: flex-end; }
.who-name { font-weight: 700; font-size: 14px; }
.who-role { font-size: 11px; opacity: 0.65; }
.secondary-btn {
  background: #fff; color: var(--teal); border: 1.5px solid var(--teal); border-radius: 10px;
  padding: 10px 18px; font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.secondary-btn:hover { background: var(--teal-light); }
.chat-badge { font-size: 11px; font-weight: 700; color: var(--teal); background: var(--teal-light); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }

/* referrals — deliberately different look from the matters table */
.referral-panel { background: #fffdf7; }
.referral-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 14px; }
.referral-card {
  background: #fff; border: 1px solid #f0e6d2; border-left: 5px solid var(--green);
  border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow);
}
.referral-card.orange { border-left-color: var(--orange); }
.referral-card.red { border-left-color: var(--red); }
.rc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rc-pipeline { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--amber); }
.rc-received { font-size: 11px; color: var(--muted); margin-left: auto; }
.rc-business { font-weight: 800; font-size: 15px; color: var(--navy); }
.rc-name { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.rc-status { font-size: 12.5px; }
.rc-next { font-size: 12px; font-weight: 700; margin-top: 8px; color: var(--teal); }
.rc-next.urgent { color: var(--red); }

/* resource library */
.resources-panel { background: #f7fbfd; }
.events-block { padding: 12px 14px 4px; }
.events-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.events-head h4 { margin: 0; color: var(--navy); }
.event-row { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 8px; flex-wrap: wrap; box-shadow: var(--shadow); }
.event-date { font-weight: 700; color: var(--teal); white-space: nowrap; font-size: 13.5px; }
.event-body { flex: 1; min-width: 180px; }
.linklike.edit { color: var(--teal); font-size: 12px; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 14px; }
.resource-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  cursor: pointer; transition: all .15s; box-shadow: var(--shadow);
}
.resource-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.res-icon { font-size: 26px; margin-bottom: 8px; }
.res-title { font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 4px; }
.res-blurb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.res-cta { font-size: 12px; font-weight: 700; color: var(--teal); }

/* matter detail additions */
.stage-pipeline.mini { margin: 12px 0 2px; }
.stage-pipeline.mini .stage { min-width: 70px; font-size: 10px; padding: 6px 3px; }
.stage-pipeline.mini .stage.current::after { display: none; }
.md-ws { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.md-ws:last-child { border-bottom: none; }
.md-ws .dot { margin-top: 4px; }
.md-ws-body { flex: 1; font-size: 13px; }
.contact-row { display: flex; gap: 10px; flex-wrap: wrap; }
.contact-chip { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; display: flex; flex-direction: column; }
.contact-chip span { color: var(--muted); font-size: 11px; }
.contact-chip a { color: var(--teal); font-weight: 600; text-decoration: none; font-size: 12px; }
.doc-row { display: flex; align-items: baseline; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.doc-row:last-child { border-bottom: none; }
.doc-row:hover b { color: var(--teal); }
.intel-note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 6px; }
#md-intel-input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; outline: none; }
#md-intel-input:focus { border-color: var(--teal); }
.md-chat { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; padding: 8px; background: #f8fafc; border-radius: 10px; border: 1px solid var(--line); }
#md-chat-input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; outline: none; }
#md-chat-input:focus { border-color: var(--teal); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .head-grid { grid-template-columns: 1fr; }
  .role-btn .role-who { display: none; }
  h1 { font-size: 19px; }
  .msg { max-width: 92%; }
  .admin-head { align-items: stretch; flex-direction: column; }
}

/* ---------- app-only additions ---------- */
.linklike { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 11.5px; cursor: pointer; text-decoration: underline; padding: 2px 0; }
.whoami .linklike { align-self: flex-end; }
.linklike.danger { color: var(--red); font-size: 12px; }
.lpm-tools { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; padding: 14px; margin-top: 14px; }
.lpm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.lpm-tools select, .lpm-tools input, .lpm-tools textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; margin-top: 4px; outline: none; }
.lpm-tools .form-label { margin-bottom: 8px; display: block; }
.modal .secondary-btn { display: inline-block; }

/* ---------- deals-by-stage board ---------- */
.board { display: flex; gap: 10px; padding: 12px 14px 16px; align-items: flex-start; overflow-x: auto; }
.board-col { flex: 1; min-width: 155px; background: #f4f6f8; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.board-col.done-col { background: #f0fdf4; }
.board-col-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 4px 6px 8px; }
.board-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s; position: relative; }
.board-card:hover { transform: translateY(-2px); }
.board-card.orange { border-left-color: var(--orange); }
.board-card.red { border-left-color: var(--red); }
.bc-client { font-weight: 700; font-size: 12.5px; color: var(--navy); line-height: 1.3; }
.bc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bc-ball { font-size: 11px; font-weight: 600; color: var(--amber); margin-top: 4px; }
.board-card .chat-badge { position: absolute; top: 8px; right: 8px; font-size: 10px; padding: 1px 6px; }
.board-empty { text-align: center; color: #cbd5e1; padding: 12px; font-size: 13px; }

/* ---- Messages tab (conversation inbox, 20 Jul) ---- */
.chat-badge.unread { background: #dc2626; color: #fff; cursor: pointer; }
.chat-badge { cursor: pointer; }
.admin-tab .count.unread { background: #dc2626; }
.convo-list { display: flex; flex-direction: column; }
.convo-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line, #e6ebf0); cursor: pointer; }
.convo-row:hover { background: #f4f8fa; }
.convo-row.has-unread { background: #f0f7ff; }
.convo-row.has-unread:hover { background: #e6f1fc; }
.convo-body { flex: 1; min-width: 0; }
.convo-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.convo-snippet { font-size: 12.5px; color: #45596b; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line, #e6ebf0); flex-wrap: wrap; }
.thread-title { flex: 1; min-width: 200px; }
.thread-chat { height: min(52vh, 460px); max-height: none; margin: 10px 14px 0; }
.thread-compose { margin: 10px 14px 0; }
@media (max-width: 640px) {
  .thread-chat { height: 55vh; }
  .thread-head { gap: 8px; }
}
#thread-input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; outline: none; }
#thread-input:focus { border-color: var(--teal); }
