/* Lead workspace: shared tokens, focused views and touch-friendly layouts. */
:root { --surface: #fff; --canvas: #f3f5f7; --ink: #20323b; --quiet: #647680; --rule: #dee5e9; --accent: #006c8a; }
body { background: var(--canvas); color: var(--ink); letter-spacing: 0; }
button, input, select, textarea { font-family: inherit; }
input, select, textarea { font-weight: 400; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #4fa6ca; outline-offset: 3px; }
.lead-agent-details > summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.lead-agent-details > summary::-webkit-details-marker { display: none; }
.lead-agent-details > summary::before { content: '+'; color: var(--accent); font-size: 22px; }
.lead-agent-details[open] > summary::before { content: '−'; }
.lead-agent-details > summary > span:first-of-type { flex: 1; min-width: 0; }
.lead-agent-details > summary small { display: block; margin-top: 3px; color: var(--quiet); font-weight: 400; }
.lead-agent-details > summary .source-pill { flex-shrink: 0; }
.lead-agent-body { border-top: 1px solid #dce5eb; margin-top: 16px; padding-top: 16px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ui-icon { width: 18px; height: 18px; flex: 0 0 18px; vertical-align: middle; }
.nav a { display: flex; gap: 12px; align-items: center; min-height: 44px; }
.nav .ui-icon { filter: brightness(0) invert(1); opacity: .8; }
.nav a.active .ui-icon { opacity: 1; }
.icon-button { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 5px; background: white; }
.topbar { margin-bottom: 22px; }
.topbar h1 { font-size: 27px; }
.panel { box-shadow: none; border: 1px solid var(--rule); border-radius: 6px; }
.tabs { box-shadow: none; background: transparent; border-width: 0 0 1px; border-radius: 0; padding: 0 0 8px; }
.tabs a::before, .tab-pill::before { display: none; }
.tabs a, .tab-pill { min-height: 42px; }
.tabs a.active, .tab-pill.active { background: #e2eef3; border-color: transparent; color: #075974; box-shadow: none; }
.queue-nav { display: flex; flex-wrap: wrap; gap: 9px; margin: 24px 0 18px; }
.queue-nav a { display: flex; align-items: center; gap: 16px; padding: 11px 16px; background: white; border: 1px solid var(--rule); border-radius: 6px; color: var(--quiet); text-decoration: none; min-height: 46px; }
.queue-nav a strong { font-variant-numeric: tabular-nums; background: #eef2f4; color: #374e59; padding: 2px 7px; border-radius: 4px; font-size: 12px; }
.queue-nav a[aria-current] { border-color: var(--accent); color: #075974; box-shadow: inset 0 -2px var(--accent); }
.queue-nav a[aria-current] strong { background: #dbedf3; color: #075974; }
.directory-toolbar { margin: 0 0 20px; }
.directory-search-row { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.directory-search-row label { flex: 1 1 140px; display: grid; gap: 6px; font-size: 12px; }
.directory-search-row label:first-of-type { flex: 3 1 270px; }
.directory-search-row button, .directory-search-row .button { min-height: 42px; }
.directory-filters { margin-top: 14px; }
.directory-filters summary { display: list-item; cursor: pointer; color: #426473; font-weight: 600; width: fit-content; padding: 5px 0; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 0; }
.filter-grid label { display: grid; gap: 6px; font-size: 12px; }
.filter-grid button { align-self: end; }
.directory-results { background: white; border-top: 1px solid var(--rule); padding-top: 18px; }
.directory-results > .section-heading { padding: 0 18px; }
.directory-results h2 { font-size: 18px; }
.table-scroll { overflow-x: auto; }
.grid > *, .panel { min-width: 0; }
.dinero-column-chart { max-width: 100%; overflow-x: auto; }
.dinero-column-chart.invoice-dual-axis { grid-template-columns: 64px minmax(620px, 1fr) 36px; min-height: 0; }
.invoice-dual-axis .dinero-chart-plot { height: 320px; }
.invoice-dual-axis .dinero-chart-column { min-height: 0; }
.invoice-dual-axis .dinero-axis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 34px; }
.invoice-dual-axis .dinero-grid-line:nth-child(2) { top: calc(25% - 8.5px); }
.invoice-dual-axis .dinero-grid-line:nth-child(3) { top: calc(50% - 17px); }
.invoice-dual-axis .dinero-grid-line:nth-child(4) { top: calc(75% - 25.5px); }
.invoice-dual-axis .dinero-grid-line:nth-child(5) { top: calc(100% - 34px); }
.invoice-count-axis { color: #1466a1; text-align: left; }
.lead-workspace-table { table-layout: fixed; min-width: 780px; }
.lead-workspace-table th:first-child { width: 26%; }
.lead-workspace-table th:nth-child(2) { width: 24%; }
.lead-workspace-table th:nth-child(3) { width: 12%; }
.lead-workspace-table th:last-child { width: 60px; }
.lead-workspace-table td { vertical-align: middle; padding: 16px 12px; overflow-wrap: anywhere; font-size: 13px; }
.lead-workspace-table th { padding: 13px 12px; }
.lead-workspace-table small { display: block; color: var(--quiet); font-size: 12px; margin-top: 5px; line-height: 1.5; }
.directory-company { font-size: 14px; color: #173f50; }
.missing-data { color: #986f20; }
.due-date { color: #a35917; font-weight: 700; }
.next-step-link { font-weight: 600; }
.directory-pagination { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px; color: var(--quiet); font-size: 13px; border-bottom: 1px solid var(--rule); }
.directory-pagination > div { display: flex; gap: 8px; }
.back-link { display: inline-block; margin: 0 0 18px; font-size: 13px; color: var(--quiet); }
.profile-workspace { min-width: 0; }
.profile-header { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-bottom: 22px; }
.profile-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-identity h2 { font-size: 25px; line-height: 1.25; margin: 0 0 9px; overflow-wrap: anywhere; }
.company-monogram { display: grid; place-items: center; flex: 0 0 54px; height: 54px; border-radius: 8px; background: #dceaf0; color: #075974; font-size: 25px; font-weight: 700; }
.profile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--quiet); font-size: 12px; }
.profile-contact { display: grid; gap: 8px; flex-shrink: 1; font-size: 13px; overflow-wrap: anywhere; text-align: right; }
.workspace-tabs { display: flex; overflow-x: auto; gap: 4px; padding: 0; border-bottom: 1px solid #cad7df; margin-bottom: 22px; }
.workspace-tabs a { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 12px 18px; border-bottom: 3px solid transparent; white-space: nowrap; color: #627984; font-size: 14px; font-weight: 650; text-decoration: none; }
.workspace-tabs a[aria-current] { color: #006c8a; border-bottom-color: #006c8a; background: #e8f1f5; }
.workspace-tabs a:hover { background: #edf2f5; }
.tab-count { padding: 2px 6px; font-size: 11px; background: #006c8a; color: white; border-radius: 4px; }
.profile-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 300px); gap: 26px; align-items: start; }
.profile-primary { min-width: 0; background: white; padding: 22px; border-top: 2px solid #dbe5e9; }
.profile-primary > h2 { font-size: 19px; margin-bottom: 20px; }
.profile-primary > .section-heading { margin-bottom: 18px; }
.profile-primary .section-heading h2 { font-size: 19px; }
.profile-aside { display: grid; gap: 0; min-width: 0; font-size: 13px; }
.profile-aside > * { min-width: 0; }
.profile-aside table, .profile-aside tbody, .profile-aside tr, .profile-aside td { display: block; width: 100%; }
.profile-aside thead { display: none; }
.profile-aside tr { border-bottom: 1px solid var(--rule); padding: 10px 0; }
.profile-aside td { border: 0; padding: 3px 0; overflow-wrap: anywhere; }
body[data-page=company] .topbar { display: none; }
.profile-aside > section, .profile-aside > details { border: 0; border-top: 1px solid #d4e0e6; border-radius: 0; background: transparent; padding: 18px 0; margin: 0; }
.profile-aside h3 { margin: 8px 0; font-size: 17px; }
.profile-aside summary, .activity-composer summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.profile-aside summary { min-height: 36px; }
.profile-aside .company-facts { grid-template-columns: 1fr; margin-top: 12px; }
.profile-aside .company-facts > div { background: transparent; min-height: 0; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.profile-aside .prompt-box { height: 240px; min-height: 160px; font-size: 12px; margin-top: 14px; }
.profile-aside .prompt-actions { flex-wrap: wrap; gap: 8px; }
.profile-aside .split-form { grid-template-columns: 1fr; }
.profile-aside form { margin-top: 14px; }
.profile-aside .lead-archive-form { padding: 0; }
.profile-primary .company-edit-box { border: 0; padding: 0; margin: 0; }
.company-edit-form { gap: 16px; }
.company-edit-form label { font-size: 13px; }
.mail-draft-active, .mail-draft-history { border-radius: 0; border: 0; box-shadow: none; background: transparent; margin: 0; }
.mail-draft-active > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 0 16px; cursor: pointer; }
.mail-draft-active > summary::before { content: '+'; width: 18px; font-size: 18px; color: var(--accent); }
.mail-draft-active[open] > summary::before { content: '-'; }
.draft-save-state { margin-left: auto; color: var(--quiet); font-size: 12px; font-weight: 400; }
.draft-save-state.dirty { color: #a35917; }
.mail-draft-active .timeline-item { border: 0; padding: 0; }
.mail-draft-active .timeline-item > strong { display: none; }
.mail-draft-active label { font-size: 12px; display: grid; gap: 6px; }
.mail-draft-active textarea[name=body] { min-height: 250px; height: 280px; max-height: 70vh; resize: vertical; font-size: 14px; line-height: 1.65; padding: 14px; font-weight: 400; }
.mail-actions { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.mail-actions form { margin: 0; }
.mail-history-section { border-top: 1px solid var(--rule); margin-top: 30px; padding-top: 22px; }
.mail-history-section h3 { font-size: 16px; }
.received-reply { border-left: 3px solid #3b9c84; background: #f1f8f5; padding: 14px 16px; margin-bottom: 22px; font-size: 13px; }
.received-reply summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.received-reply summary small { display: block; color: var(--quiet); margin-top: 5px; font-weight: 400; }
.received-reply p { max-height: 220px; overflow-y: auto; line-height: 1.6; }
.mail-draft-history { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.mail-draft-history summary { display: flex; flex-wrap: wrap; gap: 8px; cursor: pointer; line-height: 1.6; font-size: 12px; }
.mail-draft-history summary::before { content: '+'; font-size: 18px; font-weight: 700; color: var(--accent); }
.mail-draft-history[open] summary::before { content: '-'; }
.mail-draft-history textarea { height: 240px; }
.workspace-empty { text-align: center; padding: 35px 20px; color: var(--quiet); border-block: 1px dashed var(--rule); }
.workspace-empty h3 { font-size: 17px; margin-bottom: 18px; color: var(--ink); }
.finance-debug { overflow-x: auto; }
.dashboard-workspace { grid-template-areas: none; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.dashboard-stack { display: grid; gap: 16px; min-width: 0; }
.dashboard-stack > .panel, .dashboard-workspace > .dashboard-suppliers { grid-area: auto; }
.dashboard-suppliers .stat-list { max-height: 690px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #9fb8c4 #edf2f5; }
.dashboard-scroll-panel .inbound-reply-list, .dashboard-scroll-panel .lead-mail-status-list, .dashboard-followups-panel .followup-list { max-height: 410px; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; scrollbar-color: #9fb8c4 #edf2f5; }
.dashboard-scroll-panel .inbound-reply-list > :nth-child(n), .dashboard-scroll-panel .lead-mail-status-list > :nth-child(n) { display: block; }
.dashboard-focus { background: white; color: var(--ink); border-block: 1px solid var(--rule); border-radius: 0; }
.dashboard-focus .muted { color: var(--quiet); }
.dashboard-focus .eyebrow { color: var(--accent); }
.focus-actions a { background: #f1f5f7; border-color: var(--rule); color: var(--ink); }
.focus-actions a:hover { background: #e4eef2; }
.focus-actions strong { color: var(--accent); }
@media (max-width: 1180px) {
  .profile-columns { grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .queue-nav { gap: 7px; }
  .queue-nav a { padding: 10px; gap: 10px; }
  .profile-header { align-items: start; flex-direction: column; gap: 14px; }
  .profile-contact { display: flex; flex-wrap: wrap; gap: 10px 20px; text-align: left; }
}
@media (max-width: 900px) {
  .dashboard-workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .main { width: 100%; min-width: 0; grid-column: 1; }
  body[data-page=company] .topbar { display: flex; margin-bottom: 15px; }
  body[data-page=company] .topbar .page-heading > div, body[data-page=company] .topbar-action { display: none; }
  .profile-columns { grid-template-columns: 1fr; }
  .profile-primary { padding: 18px; }
  .profile-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
  .profile-aside > details[open] { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-scroll .lead-workspace-table, .lead-workspace-table tbody { min-width: 0; display: block; width: 100%; }
  .lead-workspace-table thead { display: none; }
  .lead-workspace-table tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); padding: 14px 16px; gap: 12px 18px; }
  .lead-workspace-table td { display: block; border: 0; padding: 0; }
  .lead-workspace-table td:first-child, .lead-workspace-table td:nth-child(2) { grid-column: 1 / -1; padding-right: 40px; }
  .lead-workspace-table td:not(:first-child):not(.row-open)::before { display: block; content: attr(data-label); color: var(--quiet); font-size: 11px; margin-bottom: 6px; }
  .lead-workspace-table td.row-open { position: absolute; right: 12px; top: 16px; }
  .lead-workspace-table th:first-child { width: auto; }
  .directory-results > .section-heading { padding: 0 16px; }
  .queue-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-nav a { justify-content: space-between; font-size: 12px; }
  .queue-nav a:first-child { grid-column: 1 / -1; }
  .queue-nav a strong { min-width: 26px; text-align: center; }
  .directory-search-row label:first-of-type { flex-basis: 100%; }
  .directory-search-row label { flex-basis: calc(50% - 12px); }
  .directory-search-row button, .directory-search-row > .button { flex: 1; }
}
@media (max-width: 480px) {
  .main { padding: 18px 12px; }
  .topbar h1 { font-size: 23px; }
  .profile-identity { gap: 12px; align-items: flex-start; }
  .profile-identity h2 { font-size: 21px; }
  .company-monogram { flex-basis: 42px; height: 42px; font-size: 20px; }
  .profile-aside { grid-template-columns: 1fr; }
  .profile-primary { padding: 16px; }
  .workspace-tabs a { padding: 12px 14px; font-size: 13px; }
  .filter-grid { grid-template-columns: 1fr; }
  .mail-actions, .mail-actions form { width: 100%; }
  .mail-actions button { width: 100%; }
  .mail-draft-active textarea[name=body] { height: 350px; min-height: 260px; }
  input, select, textarea { font-size: 16px; }
  button, .button, .icon-button { min-height: 44px; }
  .directory-pagination { padding: 14px 10px; }
  .profile-aside .split-form { grid-template-columns: 1fr; }
}
.opportunity-editor{margin-top:12px;border-top:1px solid #dce5eb;padding-top:12px}.opportunity-editor summary{font-weight:700;color:#096a88;cursor:pointer}.opportunity-editor .opportunity-form{display:grid;grid-template-columns:1fr;margin-top:12px;gap:10px}.opportunity-editor label{display:grid;gap:4px}.opportunity-editor textarea{min-height:100px}.opportunity-invoice{margin-top:12px;padding:12px;background:#edf6fa;border-radius:8px}.closed-opportunities .compact-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.opportunity-card small{display:block}.opportunity-stage-form button{white-space:normal}
