:root {
  --ink: #102628;
  --muted: #667778;
  --line: #dbe5e2;
  --paper: #f3f6f2;
  --surface: #fff;
  --teal: #0c5b5b;
  --teal-dark: #073f40;
  --teal-soft: #dff0ea;
  --gold: #dcae4f;
  --gold-soft: #fbf2dc;
  --red: #a94b45;
  --red-soft: #fae8e6;
  --blue-soft: #e5eff7;
  --shadow: 0 18px 45px rgba(24, 61, 59, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

html[data-theme="dark"] {
  --ink: #e5f0ed;
  --muted: #afc2be;
  --line: #31504e;
  --paper: #102021;
  --surface: #172c2d;
  --teal: #56b7ae;
  --teal-dark: #062f31;
  --teal-soft: #1e4947;
  --gold: #ebc15e;
  --gold-soft: #493c1f;
  --red: #ef9389;
  --red-soft: #4a2929;
  --blue-soft: #1c3544;
  --shadow: 0 18px 45px rgba(0, 0, 0, .25);
  --surface-raised: #1d3738;
  --surface-muted: #243f3f;
  --surface-deep: #112627;
}

* { box-sizing: border-box; }
html { min-height: 100%; max-width: 100%; overflow-x: hidden; background: var(--teal-dark); scroll-behavior: smooth; }
body { min-height: 100vh; max-width: 100%; margin: 0; overflow-x: hidden; background: var(--paper); overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .record-dialog,
html[data-theme="dark"] .data-table tbody tr,
html[data-theme="dark"] .form-actions { background: var(--surface); }
html[data-theme="dark"] .login-card > p:not(.eyebrow):not(.login-error),
html[data-theme="dark"] .login-card label { color: var(--muted); }
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] .form-grid textarea,
html[data-theme="dark"] .message-body,
html[data-theme="dark"] .checkbox-grid label,
html[data-theme="dark"] .check-line,
html[data-theme="dark"] .progress-legend div { color: var(--ink); background: #132627; }
html[data-theme="dark"] .secondary-button { color: var(--ink); background: var(--surface); }
html[data-theme="dark"] .secondary-button:hover { background: #203a3a; }
html[data-theme="dark"] .message-body { border-color: var(--line); }
html[data-theme="dark"] .warning-banner code { background: rgba(0,0,0,.2); }
html[data-theme="dark"] .entity-logo { color: white; background: #244443; }

.auth-pending .app-shell { visibility: hidden; }
.login-screen { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: radial-gradient(circle at 78% 15%, rgba(120,185,171,.2), transparent 30%), var(--teal-dark); }
.login-card { display: grid; gap: 13px; width: min(100%, 380px); padding: 34px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; color: var(--ink); background: rgba(255,255,255,.98); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-card .brand-mark { margin-bottom: 9px; }
.login-card .eyebrow { margin: 0; }
.login-card h1 { font-size: 2rem; }
.login-card > p:not(.eyebrow):not(.login-error) { margin: -4px 0 9px; color: var(--muted); font-size: .87rem; line-height: 1.55; }
.login-card label { color: var(--teal-dark); font-size: .76rem; font-weight: 800; }
.login-card input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(12,91,91,.12); }
.login-card .primary-button { width: 100%; margin-top: 4px; }
.login-error { min-height: 1.1em; margin: -4px 0 0; color: var(--red); font-size: .76rem; font-weight: 700; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: 246px; padding: 24px 18px; color: white; background: var(--teal-dark); }
.sidebar-backdrop, .pull-refresh-indicator { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: .96rem; letter-spacing: .01em; }
.brand small { margin-top: 3px; color: #9fc1bc; font-size: .76rem; }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; padding: 3px; overflow: hidden; border-radius: 12px; color: var(--teal-dark); background: #d9ece5; font-size: .73rem; font-weight: 900; letter-spacing: .08em; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.main-nav { display: grid; gap: 5px; margin-top: 48px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: #b9d0cc; background: transparent; text-align: left; cursor: pointer; }
.nav-item span { display: grid; place-items: center; width: 20px; color: #8fb5ae; font-size: 1rem; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.09); }
.nav-item.active span { color: var(--gold); }
.sidebar-footer { display: grid; gap: 17px; margin-top: auto; padding: 16px 10px 2px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-footer a { color: #b9d0cc; font-size: .78rem; font-weight: 700; text-decoration: none; }
.sidebar-logout { width: fit-content; padding: 0; border: 0; color: #b9d0cc; background: transparent; font-size: .78rem; font-weight: 700; cursor: pointer; }
.sidebar-logout:hover { color: white; }
.server-state { display: flex; align-items: center; gap: 8px; color: #8fb5ae; font-size: .72rem; }
.server-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(220,174,79,.13); }
.server-dot.online { background: #63c895; box-shadow: 0 0 0 3px rgba(99,200,149,.13); }
.server-dot.offline { background: #e27f77; box-shadow: 0 0 0 3px rgba(226,127,119,.13); }

.workspace { min-width: 0; min-height: 100vh; max-width: 100%; margin-left: 246px; }
.mobile-header { display: none; }
.mobile-header-actions { display: flex; align-items: center; gap: 3px; }
.refresh-button span { display: block; line-height: 1; }
.refresh-button.refreshing span { animation: refresh-spin .7s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1460px; margin: 0 auto; padding: 34px 38px 24px; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: .68rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, serif; font-size: 2.35rem; font-weight: 500; letter-spacing: -.03em; }
h2 { margin: 0; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 500; letter-spacing: -.015em; }
h3 { margin: 0; font-size: .98rem; }
.topbar-actions, .button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.primary-button, .secondary-button, .danger-filled-button, .text-button, .icon-button { border: 0; cursor: pointer; }
.primary-button, .secondary-button, .danger-filled-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; border-radius: 9px; font-size: .79rem; font-weight: 800; text-decoration: none; }
.primary-button { color: white; background: var(--teal); box-shadow: 0 9px 22px rgba(12,91,91,.15); }
.primary-button:hover { background: var(--teal-dark); }
.secondary-button { border: 1px solid var(--line); color: var(--teal-dark); background: var(--surface); }
.secondary-button:hover { border-color: #b9cdca; background: #f9fbfa; }
.text-button { padding: 6px 0; color: var(--teal); background: transparent; font-size: .78rem; font-weight: 800; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: transparent; font-size: 1.3rem; }
.icon-button:hover { background: rgba(12,91,91,.08); }
.link-button { text-decoration: none; }
.file-button { position: relative; cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.warning-banner { display: flex; align-items: center; gap: 12px; max-width: calc(1460px - 76px); margin: 0 auto 20px; padding: 14px 18px; border: 1px solid #e7c27b; border-radius: 11px; color: #71551d; background: var(--gold-soft); font-size: .83rem; }
.warning-banner span { color: #806c45; }
.warning-banner code { padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,.65); }
#app-main { min-width: 0; max-width: 1460px; margin: 0 auto; padding: 8px 38px 60px; }
.view { display: none; min-width: 0; }
.view.active { display: block; animation: reveal .22s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-card { position: relative; min-height: 135px; padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: -16px; bottom: -22px; width: 72px; height: 72px; border-radius: 50%; background: var(--teal-soft); opacity: .7; }
.metric-card.gold::after { background: var(--gold-soft); }
.metric-card.blue::after { background: var(--blue-soft); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-size: .73rem; font-weight: 750; }
.metric-card strong { display: block; margin: 14px 0 6px; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.metric-card small { font-size: .7rem; }
.skeleton-grid:empty::after { content: "Loading dashboard…"; grid-column: 1 / -1; padding: 34px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }

.overview-grid, .settings-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-top: 14px; }
.panel { padding: 23px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 5px 18px rgba(24,61,59,.025); }
.panel.span-two, .settings-grid .span-two { grid-column: 1 / -1; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-copy, .section-intro p { max-width: 760px; margin: 10px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.6; }
.pill { display: inline-flex; align-items: center; min-height: 27px; padding: 5px 9px; border-radius: 999px; color: var(--teal); background: var(--teal-soft); font-size: .67rem; font-weight: 850; }
.pill.priority { color: #6c5018; background: var(--gold-soft); }
.pill.qualified { color: var(--teal); background: var(--teal-soft); }
.pill.monitor { color: #3d6480; background: var(--blue-soft); }
.pill.archive, .pill.ineligible { color: #6c7475; background: #edf0ef; }
.pill.client { color: white; background: var(--teal); }
.progress-track { height: 11px; border-radius: 99px; background: #edf2ef; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #2a8580); transition: width .5s ease; }
.progress-pace { margin: 10px 0 0; color: var(--muted); font-size: .78rem; font-weight: 700; }
.progress-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.progress-legend div { padding: 13px; border-radius: 10px; background: #f7f9f7; }
.progress-legend strong, .progress-legend span { display: block; }
.progress-legend strong { font-size: 1.15rem; }
.progress-legend span { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.stage-list { display: grid; gap: 12px; }
.stage-row { display: grid; grid-template-columns: 115px 1fr 28px; gap: 10px; align-items: center; color: var(--muted); font-size: .75rem; }
.stage-row .bar { height: 8px; border-radius: 99px; background: #edf2ef; overflow: hidden; }
.stage-row .bar span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.stage-row strong { color: var(--ink); text-align: right; }

.table-shell { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; min-width: 780px; border-collapse: collapse; }
.data-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: #819091; font-size: .64rem; font-weight: 850; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 14px 12px; border-bottom: 1px solid #edf1ef; color: var(--muted); font-size: .79rem; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f8faf8; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.entity-cell { display: flex; align-items: center; gap: 11px; min-width: 215px; }
.entity-logo { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px; color: var(--teal-dark); background: var(--teal-soft); font-size: .72rem; font-weight: 900; overflow: hidden; }
.entity-logo img { width: 100%; height: 100%; padding: 3px; object-fit: contain; background: transparent; }
.entity-cell strong, .entity-cell small { display: block; }
.entity-cell strong { color: var(--ink); font-size: .8rem; }
.entity-cell small { max-width: 240px; margin-top: 3px; color: #899697; font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-cell .lead-linkedin-summary { color: var(--teal); font-size: .63rem; font-weight: 750; }
.score { font-family: Georgia, serif; color: var(--ink); font-size: 1.2rem; }
.score small { color: #91a09f; font-family: inherit; font-size: .66rem; }
.empty-state, .empty-compact { color: var(--muted); text-align: center; }
.empty-state { padding: 60px 25px; }
.empty-state .empty-symbol { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 15px; border-radius: 50%; color: var(--teal); background: var(--teal-soft); font-size: 1.25rem; }
.empty-state p { max-width: 420px; margin: 8px auto 18px; font-size: .82rem; line-height: 1.55; }
.empty-compact { padding: 30px 10px; font-size: .8rem; }

.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 11px; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf1ef; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--teal); background: var(--teal-soft); font-size: .7rem; }
.activity-item strong, .activity-item span { display: block; }
.activity-item strong { font-size: .76rem; }
.activity-item span { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.activity-item time { color: #91a09f; font-size: .66rem; }

.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 210px 180px 190px; gap: 10px; margin-bottom: 14px; }
.toolbar select, .search-box { min-height: 43px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.leads-toolbar { grid-template-columns: minmax(220px, 1.15fr) repeat(5, minmax(125px, 1fr)); }
.projects-toolbar { display: flex; justify-content: flex-end; grid-template-columns: none; }
.projects-toolbar select { width: min(240px, 100%); }
.outreach-toolbar { display: flex; justify-content: flex-end; grid-template-columns: none; }
.outreach-toolbar select { width: min(240px, 100%); }
.toolbar select { padding: 0 12px; color: var(--muted); font-size: .77rem; }
.search-box { display: flex; align-items: center; gap: 9px; padding: 0 13px; color: #95a2a2; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: .79rem; }
.table-panel { padding: 8px 10px; }
.section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; padding: 4px 0 8px; }
.card-grid, .message-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.record-card { display: flex; flex-direction: column; min-height: 220px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.record-card:hover { border-color: #bed0cd; box-shadow: var(--shadow); }
.record-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.record-card h3 { font-family: Georgia, serif; font-size: 1.15rem; font-weight: 500; }
.record-card p { color: var(--muted); font-size: .77rem; line-height: 1.55; }
.record-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.record-meta span { padding: 5px 7px; border-radius: 6px; color: var(--muted); background: #f0f4f1; font-size: .63rem; font-weight: 700; }
.record-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 15px; border-top: 1px solid #edf1ef; }
.record-card footer span { color: var(--muted); font-size: .68rem; }
.card-actions { display: flex; gap: 5px; }
.mini-button { min-height: 31px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--teal); background: white; font-size: .67rem; font-weight: 800; cursor: pointer; }
.mini-button:hover { background: var(--teal-soft); }
.mini-button:disabled { opacity: .52; cursor: not-allowed; }
.provision-button { color: white; border-color: var(--teal); background: var(--teal); }
.provision-button:hover { background: var(--teal-dark); }
.provision-complete-button { color: #247168; border-color: #a9d8d0; background: #e7f5f1; }
.mini-button:focus-visible, .primary-button:focus-visible, .secondary-button:focus-visible, .danger-filled-button:focus-visible, .icon-button:focus-visible, .nav-item:focus-visible { outline: 3px solid rgba(12,91,91,.3); outline-offset: 2px; }
.message-card blockquote { flex: 1; margin: 12px 0; color: var(--muted); font-size: .77rem; line-height: 1.6; white-space: pre-line; }
.message-detail { display: grid; gap: 16px; }
.message-detail .record-meta { margin: 0; }
.message-status-control { display: grid; grid-template-columns: 1fr minmax(150px, 220px); align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; color: var(--teal); font-size: .69rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.message-status-control select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font: .75rem Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: normal; text-transform: none; }
.message-context { padding: 14px; border-radius: 10px; background: #f5f8f6; }
.message-context.sequence-hold { border: 1px solid #efcaca; background: #fff6f6; }
.message-context.sequence-hold strong { color: #a53d3d; }
.quality-pill { font-weight: 750; }
.quality-pill.quality-approve, .quality-review.quality-approve { color: #267369; }
.quality-pill.quality-revise, .quality-review.quality-revise { color: #8a6300; }
.quality-pill.quality-block, .quality-pill.quality-hold, .quality-review.quality-block, .quality-review.quality-hold { color: #a53d3d; }
.quality-review { border: 1px solid #dce6e3; }
.quality-review.quality-block, .quality-review.quality-hold { border-color: #efcaca; background: #fff6f6; }
.quality-review.quality-revise { border-color: #ecd8a4; background: #fffaf0; }
.quality-review ul { margin: 9px 0 0; padding-left: 20px; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.quality-review code { font-size: .7rem; }
.message-context strong, .message-subject span { display: block; color: var(--teal); font-size: .66rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.message-context p { margin: 7px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.message-subject { display: grid; gap: 7px; padding: 2px 0; }
.message-subject strong { font-family: Georgia, serif; font-size: 1.08rem; font-weight: 500; line-height: 1.35; }
.message-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.message-action-note { flex: 1 0 100%; }
.message-body { min-height: 220px; margin: 0; padding: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fbfcfb; font: .83rem/1.68 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: pre-wrap; }
.conversation-detail { display: grid; gap: 15px; }
.conversation-detail > .record-meta { margin: 0; }
.conversation-timeline { display: grid; gap: 10px; }
.conversation-entry { padding: 14px; border: 1px solid var(--line); border-left: 4px solid #97aea9; border-radius: 10px; background: #fbfcfb; touch-action: pan-y; transition: transform .16s ease; }
.conversation-entry.incoming { border-left-color: #27746a; background: #f1f8f6; }
.conversation-entry.outgoing { border-left-color: #587a9d; }
.conversation-entry.note { border-left-color: #a1844e; background: #fffaf0; }
.conversation-entry header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conversation-entry header strong { color: var(--teal); font-size: .72rem; }
.conversation-entry-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.conversation-entry time, .conversation-entry footer { color: var(--muted); font-size: .67rem; }
.conversation-entry pre { margin: 9px 0 0; color: var(--ink); font: .78rem/1.58 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: pre-wrap; }
.conversation-evidence { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.conversation-evidence span { padding: 4px 7px; border: 1px solid #dce7e3; border-radius: 999px; background: #f5f9f7; color: var(--muted); font-size: .64rem; }
.conversation-entry footer { margin-top: 10px; padding-top: 9px; border-top: 1px solid #e3ece8; }
.conversation-subject { margin: 8px 0 0; color: var(--ink); font-size: .75rem; font-weight: 750; }
.conversation-empty { padding: 20px; border: 1px dashed #c9d7d3; border-radius: 10px; color: var(--muted); text-align: center; }
.conversation-empty strong { display: block; color: var(--teal); font-size: .78rem; }
.conversation-empty p { margin: 7px 0 0; font-size: .74rem; line-height: 1.55; }

.settings-grid { margin-top: 0; }
.compact-form { margin-top: 20px; }
.push-notification-settings { display: grid; gap: 12px; margin-top: 18px; }
.push-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.settings-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: .69rem; font-weight: 750; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); background: white; font-size: .78rem; font-weight: 450; }
.form-grid textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(12,91,91,.08); }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.checkbox-grid label, .check-line { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #fbfcfb; font-size: .7rem; }
.checkbox-grid input, .check-line input { accent-color: var(--teal); }
.form-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.form-section:first-child { padding-top: 0; }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin-bottom: 14px; }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; margin: 20px -24px -24px; padding: 15px 24px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.helper { color: #8a9898; font-size: .68rem; line-height: 1.5; }
.provisioning-preview, .provisioning-job { display: grid; gap: 14px; max-width: 720px; margin: 0 auto; }
.provisioning-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.provisioning-project-summary { display: grid; gap: 12px; }
.provisioning-project-summary h3 { margin: 0; color: var(--ink); font-family: Georgia, serif; font-size: 1.15rem; font-weight: 500; }
.provisioning-project-summary p { margin: -3px 0 0; }
.provisioning-project-summary .record-meta { margin: 0; }
.provisioning-hero { display: grid; gap: 10px; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.provisioning-hero.compact { gap: 8px; }
.provisioning-hero h3 { margin: 0; color: var(--ink); font-family: Georgia, serif; font-size: 1.06rem; font-weight: 500; }
.provisioning-hero p { margin: -2px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.provisioning-panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.provisioning-panel-heading h3 { margin: 0; font-size: .82rem; }
.provisioning-panel-heading span { color: var(--muted); font-size: .66rem; }
.keyword-chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.keyword-chip-list span { padding: 5px 8px; border-radius: 6px; color: #7b3834; background: var(--red-soft); font-size: .67rem; font-weight: 700; line-height: 1.35; }
.provisioning-sections { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.provisioning-section { display: grid; gap: 5px; padding: 13px; border-bottom: 1px solid #edf1ef; }
.provisioning-section:last-child { border-bottom: 0; }
.provisioning-section strong { display: flex; align-items: center; gap: 8px; color: var(--teal); font-size: .72rem; }
.provisioning-section strong i { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-size: .62rem; font-style: normal; }
.provisioning-section strong b { font-weight: 800; }
.provisioning-section span, .provisioning-progress span { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.provisioning-notice { padding: 13px 14px; border: 1px solid #dce6e3; border-radius: 10px; background: #f5f8f6; }
.provisioning-notice strong { display: block; color: var(--teal); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; }
.provisioning-notice p { margin: 5px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.provisioning-notice.error { border-color: #efcaca; background: #fff6f6; }
.provisioning-notice.error strong { color: #a53d3d; }
.provisioning-notice.success { border-color: #b9ded6; background: #eef8f5; }
.provisioning-notice.success strong { color: #267369; }
.approval-override { display: grid; gap: 16px; }
.approval-warning-list { display: grid; gap: 8px; margin: 0; padding: 0 0 0 20px; color: var(--ink); font-size: .78rem; line-height: 1.5; }
.approval-override-actions { margin-top: 4px; }
.provisioning-confirmation { padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.provisioning-confirmation > p { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.provisioning-actions { position: sticky; bottom: -24px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 18px -24px -24px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.provisioning-progress { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; }
.provisioning-progress > div:not(.progress-track) { display: grid; gap: 3px; }
.provisioning-progress strong { color: var(--teal); font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; }
.provisioning-progress small { color: var(--muted); font-size: .67rem; }

.record-dialog { width: min(900px, calc(100% - 28px)); max-height: min(900px, calc(100vh - 34px)); padding: 0; border: 0; border-radius: 17px; background: white; box-shadow: 0 30px 90px rgba(5,40,40,.28); overflow: hidden; overscroll-behavior: contain; }
.record-dialog::backdrop { background: rgba(5,28,29,.46); backdrop-filter: blur(3px); }
.dialog-frame { position: relative; display: flex; flex-direction: column; max-height: min(900px, calc(100vh - 34px)); overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.dialog-heading { display: flex; min-width: 0; align-items: center; gap: 12px; }
.dialog-heading > div { min-width: 0; }
.dialog-heading h2 { overflow-wrap: anywhere; }
.dialog-back { flex: 0 0 auto; font-size: 1.15rem; }
.dialog-body { flex: 1 1 auto; min-height: 0; padding: 24px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
html.drawer-open, body.drawer-open { overflow: hidden; overscroll-behavior: none; }
.detail-hero { display: grid; grid-template-columns: 1fr 160px; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-hero p { color: var(--muted); font-size: .82rem; line-height: 1.6; }
.score-card { display: grid; place-items: center; align-content: center; min-height: 125px; border-radius: 13px; color: white; background: var(--teal-dark); }
.score-card strong { font-family: Georgia, serif; font-size: 2.6rem; font-weight: 500; }
.score-card span { color: #b6d3cf; font-size: .68rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.detail-block { padding: 17px; border: 1px solid var(--line); border-radius: 11px; }
.detail-block.full { grid-column: 1 / -1; }
.detail-block h3 { margin-bottom: 12px; }
.detail-block p { margin: 0; color: var(--muted); font-size: .77rem; line-height: 1.55; }
.detail-list { display: grid; gap: 9px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid #edf1ef; }
.detail-row:last-child { padding-bottom: 0; border: 0; }
.detail-row strong { font-size: .73rem; }
.detail-row span { color: var(--muted); font-size: .69rem; text-align: right; }
.detail-row-button { width: 100%; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.detail-row-button:hover { color: var(--teal); }
.detail-row-button:hover span { color: var(--teal); }
.lead-project-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.lead-project-heading h3 { margin: 0 0 3px; }
.lead-project-heading p { margin: 0; }
.lead-project-list { display: grid; gap: 9px; }
.lead-project-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lead-project-row > div:first-child { display: grid; gap: 4px; min-width: 0; }
.lead-project-row strong { overflow: hidden; color: var(--ink); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.lead-project-row span { color: var(--muted); font-size: .67rem; }
.lead-project-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.contact-row { display: grid; width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); align-items: start; justify-content: stretch; gap: 10px; }
.contact-summary { display: block; width: 100%; min-width: 0; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
button.contact-summary { cursor: pointer; }
button.contact-summary:hover strong, button.contact-summary:hover .contact-open-hint { color: var(--teal); }
.contact-identity { display: grid; min-width: 0; gap: 3px; text-align: left !important; }
.contact-title, .contact-route, .contact-next { overflow-wrap: anywhere; color: var(--muted); font-size: .69rem; text-align: left !important; }
.contact-routing { width: fit-content; padding: 3px 7px; border-radius: 999px; color: var(--teal) !important; background: var(--teal-soft); font-size: .62rem !important; font-weight: 800; text-align: left !important; }
.contact-open-hint { flex: 0 0 auto; color: var(--teal) !important; font-weight: 800; }
.contact-row .contact-actions { display: flex; width: 100%; min-width: 0; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
.contact-linkedin { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.contact-linkedin-state { display: inline-flex; margin: 2px 0; text-align: left !important; }
.linkedin-status { display: inline-flex; min-height: 25px; align-items: center; width: fit-content; padding: 4px 8px; border: 0; border-radius: 999px; color: #536666; background: #edf1ef; font-size: .61rem; font-weight: 850; line-height: 1; white-space: nowrap; }
button.linkedin-status { cursor: pointer; }
button.linkedin-status:hover { filter: brightness(.97); box-shadow: 0 0 0 2px rgba(12,91,91,.1); }
.linkedin-status.connected { color: #176b61; background: #dff2ed; }
.linkedin-status.pending { color: #785719; background: var(--gold-soft); }
.linkedin-status.not-invited { color: #3d6480; background: var(--blue-soft); }
.linkedin-status.unknown { color: #7a5740; background: #f5ece2; }
.linkedin-status.unavailable, .linkedin-status.no-profile { color: #687575; background: #edf0ef; }
.linkedin-lead-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 12px; padding: 9px 10px; border: 1px solid #dce9e6; border-radius: 9px; background: #f4f9f7; }
.linkedin-lead-summary strong { color: var(--teal); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.linkedin-lead-summary span { color: var(--muted); font-size: .67rem; text-align: right; }
.linkedin-return-prompt { display: grid; justify-items: center; max-width: 520px; margin: 0 auto; padding: 14px 4px 4px; text-align: center; }
.linkedin-return-icon { display: grid; width: 48px; height: 48px; margin-bottom: 15px; place-items: center; border-radius: 12px; color: white; background: #0a66c2; font-size: 1rem; font-weight: 900; }
.linkedin-return-prompt h3 { font-size: 1rem; }
.linkedin-return-prompt p { max-width: 430px; margin: 9px 0 20px; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.linkedin-return-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.linkedin-return-safe-actions { display: flex; justify-content: flex-end; gap: 8px; }
.rejection-helper { margin: 0 0 14px; }
.rejection-reason-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rejection-reason-list label { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-size: .73rem; font-weight: 700; cursor: pointer; }
.rejection-reason-list label:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.rejection-reason-list input { accent-color: var(--red); }
.rejection-note { display: grid; gap: 7px; margin-top: 14px; color: var(--muted); font-size: .69rem; font-weight: 750; }
.rejection-note textarea { width: 100%; min-height: 78px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font: inherit; line-height: 1.5; resize: vertical; }
.danger-filled-button { color: white; border-color: var(--red); background: var(--red); }
.danger-filled-button:hover { border-color: #8e302c; background: #8e302c; }
.contact-learning-panel #contact-learning { display: grid; gap: 16px; }
.learning-progress { display: grid; gap: 11px; }
.learning-progress > div:first-child { display: grid; gap: 4px; }
.learning-progress strong { color: var(--ink); font-size: .76rem; line-height: 1.45; }
.learning-progress span { color: var(--muted); font-size: .68rem; line-height: 1.45; }
.learning-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.learning-stats > div { display: grid; gap: 2px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.learning-stats strong { color: var(--teal); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.learning-stats span { color: var(--muted); font-size: .65rem; }
.learning-reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.learning-reasons > span { margin-right: 3px; color: var(--muted); font-size: .66rem; font-weight: 750; }
.learning-reasons b { padding: 5px 8px; border-radius: 999px; color: #7b3834; background: var(--red-soft); font-size: .65rem; }
.learning-reasons b i { margin-left: 3px; font-style: normal; }
.learning-reasons small { color: var(--muted); font-size: .66rem; }
.learning-signals { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.learning-signals > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.learning-signals span { width: 100%; color: var(--muted); font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.learning-signals b { padding: 4px 7px; border-radius: 999px; color: var(--teal); background: var(--teal-soft); font-size: .63rem; }
.learning-signals b i { margin-left: 3px; color: var(--muted); font-style: normal; }
.learning-signals small { color: var(--muted); font-size: .65rem; }
.score-components { display: grid; gap: 7px; }
.score-component { display: grid; grid-template-columns: 1fr 100px 32px; gap: 8px; align-items: center; color: var(--muted); font-size: .68rem; }
.score-component .bar { height: 6px; border-radius: 99px; background: #edf2ef; overflow: hidden; }
.score-component .bar span { display: block; height: 100%; background: var(--teal); }
.danger-button { color: var(--red); border-color: #e7c7c4; }
.danger-button:hover { background: var(--red-soft); }
.linkedin-return-actions > .danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; border: 1px solid #e7c7c4; border-radius: 9px; color: var(--red); background: var(--surface); font-size: .79rem; font-weight: 800; cursor: pointer; }

.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100% - 40px)); pointer-events: none; }
.dialog-toast-region { position: absolute; z-index: 2; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(360px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 13px 15px; border-radius: 10px; color: white; background: var(--teal-dark); box-shadow: var(--shadow); font-size: .77rem; animation: toast-in .2s ease; }
.toast.error { background: #843d39; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.pwa-install-hint { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: flex; align-items: flex-start; gap: 12px; width: min(390px, calc(100% - 40px)); padding: 14px; border: 1px solid #b9d5cf; border-radius: 13px; color: white; background: var(--teal-dark); box-shadow: 0 18px 45px rgba(5,40,40,.24); }
.pwa-install-hint div { display: grid; gap: 4px; }
.pwa-install-hint strong { font-size: .8rem; }
.pwa-install-hint span { color: #c2dad5; font-size: .72rem; line-height: 1.45; }
.pwa-install-hint .icon-button { flex: 0 0 auto; width: 30px; height: 30px; color: white; font-size: 1.1rem; }
.pwa-install-hint .icon-button:hover { background: rgba(255,255,255,.1); }

html[data-theme="dark"] .record-dialog { background: var(--surface); }
html[data-theme="dark"] .dialog-header { background: #153031; }
html[data-theme="dark"] .provisioning-project-summary,
html[data-theme="dark"] .provisioning-hero,
html[data-theme="dark"] .provisioning-confirmation,
html[data-theme="dark"] .provisioning-progress,
html[data-theme="dark"] .provisioning-actions { background: var(--surface-deep); }
html[data-theme="dark"] .provisioning-section { border-color: var(--line); }
html[data-theme="dark"] .provisioning-section strong i { color: var(--teal-dark); background: var(--teal); }
html[data-theme="dark"] .keyword-chip-list span { color: #f3b6af; background: var(--red-soft); }
html[data-theme="dark"] .message-status-control,
html[data-theme="dark"] .message-context {
  border: 1px solid var(--line);
  color: var(--teal);
  background: var(--surface-raised);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}
html[data-theme="dark"] .message-status-control select,
html[data-theme="dark"] .message-body,
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] .form-grid textarea {
  border-color: #3a5e5a;
  color: var(--ink);
  background: var(--surface-deep);
}
html[data-theme="dark"] .rejection-note textarea { border-color: #3a5e5a; color: var(--ink); background: var(--surface-deep); }
html[data-theme="dark"] .message-status-control select:focus,
html[data-theme="dark"] .form-grid input:focus,
html[data-theme="dark"] .form-grid select:focus,
html[data-theme="dark"] .form-grid textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(86, 183, 174, .14);
}
html[data-theme="dark"] .record-meta span,
html[data-theme="dark"] .checkbox-grid label,
html[data-theme="dark"] .check-line {
  border-color: transparent;
  color: #c8d7d4;
  background: var(--surface-muted);
}
html[data-theme="dark"] .mini-button {
  border-color: var(--line);
  color: #8bd0c9;
  background: var(--surface-deep);
}
html[data-theme="dark"] .mini-button:hover { background: var(--surface-muted); }
html[data-theme="dark"] .linkedin-lead-summary { border-color: var(--line); background: #193435; }
html[data-theme="dark"] .linkedin-status.connected { color: #8bd0c9; background: #193f3c; }
html[data-theme="dark"] .linkedin-status.pending { color: #e2c77f; background: #453a22; }
html[data-theme="dark"] .linkedin-status.not-invited { color: #9dc6df; background: #213a48; }
html[data-theme="dark"] .linkedin-status.unknown { color: #d5b28d; background: #44352a; }
html[data-theme="dark"] .linkedin-status.unavailable,
html[data-theme="dark"] .linkedin-status.no-profile { color: #aebbbb; background: #293c3d; }
html[data-theme="dark"] .pill.priority { color: #f2cf79; background: #4b3c1c; }
html[data-theme="dark"] .pill.archive,
html[data-theme="dark"] .pill.ineligible { color: #c1cfcc; background: var(--surface-muted); }
html[data-theme="dark"] .progress-track,
html[data-theme="dark"] .stage-row .bar,
html[data-theme="dark"] .score-component .bar { background: #294544; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #1b3535; }
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .activity-item,
html[data-theme="dark"] .record-card footer,
html[data-theme="dark"] .detail-row { border-color: var(--line); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #79918d; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .card-grid, .message-grid { grid-template-columns: 1fr 1fr; }
  .leads-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .leads-toolbar .search-box { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.2); }
  .sidebar-backdrop { position: fixed; z-index: 44; inset: 0; display: block; border: 0; visibility: hidden; opacity: 0; background: rgba(3,26,27,.38); backdrop-filter: blur(1px); transition: opacity .18s ease, visibility .18s ease; pointer-events: none; }
  .sidebar.open + .sidebar-backdrop { visibility: visible; opacity: 1; pointer-events: auto; }
  .workspace { margin-left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 25; display: flex; align-self: stretch; align-items: center; justify-content: space-between; width: 100%; min-width: 0; max-width: none; height: calc(66px + env(safe-area-inset-top)); padding: calc(10px + env(safe-area-inset-top)) 18px 10px; color: white; background: var(--teal-dark); }
  .mobile-header .brand { padding: 0; }
  .mobile-header .brand-mark { width: 36px; height: 36px; }
  .mobile-header .icon-button { color: white; }
  .mobile-header .refresh-button { width: 36px; height: 36px; font-size: 1.15rem; }
  .pull-refresh-indicator { position: fixed; z-index: 24; top: calc(56px + env(safe-area-inset-top)); left: 50%; display: flex; align-items: center; gap: 6px; min-height: 29px; padding: 5px 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: white; background: rgba(7,63,64,.94); box-shadow: 0 5px 18px rgba(3,26,27,.16); opacity: 0; transform: translate(-50%, -12px); transition: opacity .12s ease, transform .12s ease; pointer-events: none; }
  .pull-refresh-indicator.visible { opacity: 1; }
  .pull-refresh-indicator.ready span { transform: rotate(180deg); }
  .pull-refresh-indicator.refreshing span { animation: refresh-spin .7s linear infinite; }
  .pull-refresh-indicator span { font-size: .88rem; transition: transform .14s ease; }
  .pull-refresh-indicator small { font-size: .61rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
  .topbar { padding: 25px 22px 20px; }
  #app-main { padding: 8px 22px 45px; }
  .warning-banner { margin: 0 22px 18px; }
  #app-main { padding-bottom: calc(45px + env(safe-area-inset-bottom)); }
  .overview-grid, .settings-grid { grid-template-columns: 1fr; }
  .panel.span-two, .settings-grid .span-two, .settings-actions { grid-column: auto; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-block.full { grid-column: auto; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .topbar-actions > * { flex: 1; }
  h1 { font-size: 2rem; }
  .metric-grid, .card-grid, .message-grid { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .panel.span-two { grid-column: auto; }
  .progress-legend { grid-template-columns: 1fr; }
  .section-intro { align-items: flex-start; flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; }
  .search-box { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .rejection-reason-list { grid-template-columns: 1fr; }
  .learning-stats { grid-template-columns: 1fr 1fr; }
  .learning-signals { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .checkbox-grid { grid-template-columns: 1fr 1fr; }
  .linkedin-return-actions { align-items: stretch; flex-direction: column-reverse; }
  .linkedin-return-safe-actions { align-items: stretch; flex-direction: column-reverse; }
  .linkedin-return-actions button { width: 100%; }
  .detail-hero { grid-template-columns: 1fr; }
  .score-card { min-height: 95px; }
  .table-panel { padding: 8px; }
  .table-shell { overflow: visible; }
  .data-table { min-width: 0; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody { display: block; }
  .data-table tbody { display: grid; gap: 10px; }
  .data-table tbody tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
  .data-table tbody tr:hover { background: #fff; }
  .data-table td { display: grid; gap: 3px; min-width: 0; padding: 0; border: 0; color: var(--ink); font-size: .73rem; }
  .data-table td::before { content: attr(data-label); color: #819091; font-size: .57rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
  .data-table td:first-child { grid-column: 1 / -1; padding-right: 56px; }
  .data-table td:first-child::before { display: none; }
  .data-table td:nth-child(4) { position: absolute; top: 16px; right: 15px; display: block; }
  .data-table td:nth-child(4)::before { display: none; }
  .data-table td:nth-child(6) { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid #edf1ef; }
  .data-table .entity-cell { min-width: 0; }
  .data-table .entity-cell > div { min-width: 0; }
  .data-table .entity-cell small { max-width: 100%; }
  /* Keep the drawer's header controls below the iPhone sensor housing/status area. */
  .record-dialog { width: 100%; max-width: none; max-height: calc(100vh - env(safe-area-inset-top) - 8px); max-height: calc(100dvh - env(safe-area-inset-top) - 8px); margin: calc(env(safe-area-inset-top) + 8px) 0 0; border-radius: 17px 17px 0 0; }
  .dialog-frame { max-height: calc(100vh - env(safe-area-inset-top) - 8px); max-height: calc(100dvh - env(safe-area-inset-top) - 8px); }
  .dialog-header, .dialog-body { padding-left: 18px; padding-right: 18px; }
  .form-actions { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  [data-form="contact-rejection"] .form-actions { align-items: stretch; flex-direction: column; }
  [data-form="contact-rejection"] .form-actions button { width: 100%; min-height: 48px; }
  .approval-override-actions { align-items: stretch; flex-direction: column-reverse; }
  .approval-override-actions button { width: 100%; min-height: 48px; }
  .provisioning-actions { bottom: -24px; margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
}

@media (max-width: 430px) {
  .login-screen { padding: 16px; }
  .login-card { padding: 27px 22px; }
  .mobile-header { width: 100%; min-width: 0; height: calc(60px + env(safe-area-inset-top)); padding: calc(9px + env(safe-area-inset-top)) 14px 9px; }
  .mobile-header .brand { gap: 8px; }
  .mobile-header .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: .65rem; }
  .mobile-header .brand strong { font-size: .78rem; }
  .topbar { gap: 16px; padding: 21px 14px 18px; }
  #app-main { padding: 6px 14px 36px; }
  .warning-banner { align-items: flex-start; margin: 0 14px 14px; padding: 12px; font-size: .76rem; }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.28rem; }
  .panel, .record-card { padding: 16px; border-radius: 12px; }
  .metric-card { min-height: 116px; padding: 17px; }
  .metric-card strong { margin: 9px 0 4px; }
  .panel-header, .record-card-header { gap: 10px; }
  .record-card footer { align-items: flex-start; flex-direction: column; }
  .record-card footer > span { width: 100%; }
  .record-card .card-actions { width: 100%; }
  .record-card .card-actions .mini-button { flex: 1; }
  .detail-row { align-items: flex-start; flex-direction: column; }
  .detail-row span { text-align: left; }
  .lead-project-heading, .lead-project-row { align-items: stretch; flex-direction: column; }
  .lead-project-actions { justify-content: stretch; }
  .lead-project-actions button { flex: 1; }
  .contact-row .contact-actions { width: 100%; justify-content: stretch; }
  .contact-row .contact-actions .mini-button { flex: 1; }
  .contact-summary { width: 100%; }
  .score-component { grid-template-columns: 1fr 76px 26px; }
  .message-detail-actions { display: grid; grid-template-columns: 1fr; }
  .message-status-control { grid-template-columns: 1fr; gap: 7px; }
  .message-body { min-height: 180px; padding: 14px; font-size: .78rem; }
  .toast-region { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(100% - 28px); }
  .dialog-toast-region { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(100% - 28px); }
  .provisioning-hero { padding: 15px; }
  .provisioning-meta { display: grid; grid-template-columns: 1fr 1fr; }
  .provisioning-meta span:last-child { grid-column: 1 / -1; }
  .provisioning-actions { align-items: stretch; flex-direction: column-reverse; }
  .provisioning-actions button { width: 100%; }
  .pwa-install-hint { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(100% - 28px); }
}

@media (display-mode: standalone) {
  .mobile-header { position: sticky; }
}

/* Operational cockpit */
.nav-count { display: inline-grid; min-width: 21px; height: 21px; margin-left: auto; padding: 0 6px; place-items: center; border-radius: 999px; color: var(--teal-dark); background: var(--gold); font-size: .62rem; font-weight: 900; }
.mobile-bottom-nav { display: none; }
.metric-card { min-height: 108px; padding: 18px 19px; overflow: visible; border-left-width: 4px; }
.metric-card::after { display: none; }
.metric-card.overdue { border-left-color: var(--red); }
.metric-card.today { border-left-color: var(--gold); }
.metric-card.reply { border-left-color: #4e7898; }
.metric-card.priority { border-left-color: var(--teal); }
.metric-card.linkedin { border-left-color: #0a66c2; }
.metric-card strong { margin: 9px 0 4px; font-family: inherit; font-size: 1.85rem; font-weight: 780; }
.metric-card-action { width: 100%; color: inherit; text-align: left; cursor: pointer; appearance: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.metric-card-action:hover { border-color: #8ebae4; box-shadow: 0 8px 24px rgba(10,102,194,.1); transform: translateY(-1px); }
.metric-card-action:focus-visible { outline: 3px solid rgba(10,102,194,.24); outline-offset: 2px; }
.linkedin-review-queue { display: grid; gap: 16px; }
.linkedin-review-queue > .helper { margin: 0; }
.linkedin-review-list { display: grid; gap: 9px; }
.linkedin-review-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; width: 100%; padding: 14px 15px; border: 1px solid var(--line); border-radius: 11px; color: inherit; background: var(--surface); text-align: left; cursor: pointer; }
.linkedin-review-row:hover { border-color: #8ebae4; background: var(--blue-soft); }
.linkedin-review-row:focus-visible { outline: 3px solid rgba(10,102,194,.2); outline-offset: 1px; }
.linkedin-review-person { display: grid; min-width: 0; gap: 3px; }
.linkedin-review-person strong { overflow-wrap: anywhere; font-size: .8rem; }
.linkedin-review-person small { overflow-wrap: anywhere; color: var(--muted); font-size: .69rem; }
.linkedin-review-open { color: #0a66c2; font-size: .7rem; font-weight: 850; white-space: nowrap; }
.focus-panel { margin-top: 14px; padding-bottom: 10px; }
.focus-panel .panel-header { margin-bottom: 8px; }
.mail-review-panel { margin-top: 14px; border-color: #e5c77b; }
.mail-review-list { display: grid; gap: 10px; margin-top: 14px; }
.mail-review-item { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.mail-review-item header, .mail-review-item footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mail-review-item header div { display: grid; gap: 2px; }
.mail-review-item header span, .mail-review-item header time, .mail-review-item footer > span { color: var(--muted); font-size: .68rem; }
.mail-review-item h3 { font-size: .84rem; }
.mail-review-item p { max-height: 4.5em; overflow: hidden; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.compact-empty { display: grid; gap: 4px; padding: 22px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }
.compact-empty strong { color: var(--ink); font-size: .82rem; }
.compact-empty span { font-size: .72rem; }
.empty-state { padding: 34px 20px; }
.empty-state .empty-symbol { width: 40px; height: 40px; margin-bottom: 11px; }

.compact-intro { margin-bottom: 12px; }
.actions-toolbar { display: flex; justify-content: flex-end; grid-template-columns: none; }
.actions-toolbar select { width: min(230px, 100%); }
.actions-board { display: grid; gap: 16px; }
.action-group { overflow: visible; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.action-group > header { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.action-group > header h3 { font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
.action-group > header span, .research-action-group > summary b { display: inline-grid; min-width: 24px; height: 24px; place-items: center; border-radius: 999px; color: var(--muted); background: var(--paper); font-size: .65rem; }
.action-list { display: grid; }
.action-row { display: flex; min-width: 0; border-bottom: 1px solid #edf1ef; border-left: 4px solid var(--teal); background: var(--surface); }
.action-row:last-child { border-bottom: 0; }
.action-row.overdue { border-left-color: var(--red); }
.action-row.today { border-left-color: var(--gold); }
.action-row.waiting { border-left-color: #9aa5a5; }
.action-row.done { border-left-color: #4c927c; }
.action-row.completed { opacity: .72; }
.action-main { display: grid; grid-template-columns: 112px minmax(180px, 1fr) auto; flex: 1; gap: 15px; align-items: center; min-width: 0; min-height: 66px; padding: 11px 14px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.action-main:disabled { cursor: default; }
.action-main:not(:disabled):hover { background: rgba(12,91,91,.035); }
.action-due { color: var(--teal); font-size: .69rem; font-weight: 850; }
.action-row.overdue .action-due { color: var(--red); }
.action-row.today .action-due { color: #8a651e; }
.action-row.waiting .action-due { color: var(--muted); }
.action-row.done .action-due { color: #377662; }
.action-copy { display: grid; min-width: 0; gap: 4px; }
.action-copy strong { overflow: hidden; color: var(--ink); font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.action-copy small { overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.action-priority { padding: 4px 7px; border-radius: 6px; color: var(--muted); background: var(--paper); font-size: .61rem; font-weight: 800; }
.action-priority.high, .action-priority.urgent { color: #6e511a; background: var(--gold-soft); }
.action-controls { display: flex; align-items: center; gap: 6px; padding: 8px 12px 8px 0; }
.complete-action { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 7px 10px; border: 1px solid #a9d8d0; border-radius: 8px; color: #247168; background: #e7f5f1; font-size: .68rem; font-weight: 850; cursor: pointer; }
.complete-action:hover { background: #d8eee8; }
.action-menu, .entry-menu { position: relative; }
.action-menu summary, .entry-menu summary { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); font-size: .82rem; font-weight: 900; cursor: pointer; list-style: none; }
.action-menu summary::-webkit-details-marker, .entry-menu summary::-webkit-details-marker { display: none; }
.action-menu > div, .entry-menu > div { position: absolute; z-index: 18; top: calc(100% + 5px); right: 0; display: grid; min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.action-menu > div span { padding: 8px 9px 4px; color: #879393; font-size: .57rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.action-menu > div button, .entry-menu > div button { min-height: 36px; padding: 8px 9px; border: 0; border-radius: 6px; color: var(--ink); background: transparent; font-size: .7rem; font-weight: 700; text-align: left; cursor: pointer; }
.action-menu > div button:hover, .entry-menu > div button:hover { color: var(--teal); background: var(--teal-soft); }
.research-action-group { overflow: visible; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.research-action-group > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 10px 15px; color: var(--teal); font-size: .75rem; font-weight: 850; cursor: pointer; }
.research-action-group[open] > summary { border-bottom: 1px solid var(--line); }

.outreach-filters { grid-template-columns: minmax(220px, 1.6fr) repeat(6, minmax(115px, 1fr)); min-width: 0; max-width: 100%; }
.outreach-filters > * { min-width: 0; }
.outreach-state { display: inline-flex; min-height: 27px; align-items: center; padding: 5px 9px; border-radius: 999px; color: var(--muted); background: var(--paper); font-size: .64rem; font-weight: 850; white-space: nowrap; }
.outreach-state.ready, .outreach-state.reply, .outreach-state.meeting { color: var(--teal); background: var(--teal-soft); }
.outreach-state.approval { color: #77591d; background: var(--gold-soft); }
.outreach-state.due { color: var(--red); background: var(--red-soft); }
.outreach-state.today { color: #77591d; background: var(--gold-soft); }
.outreach-state.waiting { color: #596969; background: #edf0ef; }
.outreach-state.closed { color: #62706f; background: #edf0ef; }

.conversation-language { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; margin:12px 0; border:1px solid var(--line); border-radius:14px; background:var(--paper); }
.conversation-language div { display:grid; gap:3px; }
.conversation-language span { color:var(--muted); font-size:.78rem; }
.record-card h3 { font-family: inherit; font-size: .98rem; font-weight: 780; }
.message-subject strong, .provisioning-project-summary h3, .provisioning-hero h3 { font-family: inherit; font-weight: 750; }
.score-card strong { font-family: inherit; font-weight: 760; }
.score { font-family: inherit; font-weight: 750; }

.research-board { display: grid; gap: 18px; }
.research-section { display: grid; gap: 11px; }
.research-section > header { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 0 3px; }
.research-section > header h3 { font-size: .85rem; }
.research-section > header p { margin: 4px 0 0; color: var(--muted); font-size: .69rem; }
.research-section > header > span { color: var(--muted); font-size: .7rem; }
.research-progress { display: grid; gap: 8px; margin: 15px 0 4px; }
.research-progress > div:first-child { display: flex; align-items: baseline; justify-content: space-between; }
.research-progress strong { font-size: .78rem; }
.research-progress span { color: var(--muted); font-size: .65rem; }
.research-progress .progress-track { height: 7px; }
.research-archive { border-top: 1px solid var(--line); padding-top: 4px; }
.research-archive > summary { display: flex; align-items: center; justify-content: space-between; min-height: 46px; color: var(--muted); font-size: .75rem; font-weight: 800; cursor: pointer; }
.research-archive > summary b { font-size: .68rem; }
.research-archive > .card-grid { margin-top: 10px; }

.contact-next { color: var(--teal); font-size: .66rem; text-align: left !important; }
.conversation-heading { display: grid; gap: 3px; }
.conversation-heading small { color: var(--muted); font-size: .65rem; }
.conversation-entry-actions time { white-space: nowrap; }
.entry-menu > div { min-width: 120px; }
.entry-menu .danger-button { color: var(--red); }
.conversation-composer { position: sticky; z-index: 8; bottom: -24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px -24px -24px; padding: 13px 24px calc(13px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }

.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: auto; }
.toast button { min-height: 32px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.35); border-radius: 7px; color: white; background: rgba(255,255,255,.08); font-size: .69rem; font-weight: 850; cursor: pointer; }

html[data-theme="dark"] .action-row,
html[data-theme="dark"] .action-group,
html[data-theme="dark"] .research-action-group,
html[data-theme="dark"] .action-menu summary,
html[data-theme="dark"] .entry-menu summary,
html[data-theme="dark"] .action-menu > div,
html[data-theme="dark"] .entry-menu > div { background: var(--surface); }
html[data-theme="dark"] .action-row { border-bottom-color: var(--line); }
html[data-theme="dark"] .complete-action { color: #8bd0c9; border-color: #376f69; background: #193f3c; }
html[data-theme="dark"] .conversation-composer { background: rgba(23,44,45,.96); }

@media (max-width: 980px) {
  .outreach-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .outreach-filters .search-box { grid-column: 1 / -1; }
  .action-main { grid-template-columns: 96px minmax(150px, 1fr) auto; }
}

@media (max-width: 860px) {
  .sidebar { z-index: 45; }
  .mobile-header { height: calc(56px + env(safe-area-inset-top)); padding: calc(7px + env(safe-area-inset-top)) 14px 7px; }
  .mobile-header .brand-mark { width: 32px; height: 32px; }
  .mobile-header #mobile-menu { display: none; }
  .mobile-bottom-nav { position: fixed; z-index: 35; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); min-height: calc(60px + env(safe-area-inset-bottom)); padding: 5px 7px env(safe-area-inset-bottom); border-top: 1px solid rgba(255,255,255,.12); color: #a9c5c0; background: var(--teal-dark); transform: translate3d(0, 0, 0); }
  .mobile-bottom-nav button { position: relative; display: grid; min-height: 50px; place-items: center; align-content: center; gap: 2px; border: 0; color: inherit; background: transparent; font-size: .58rem; font-weight: 750; }
  .mobile-bottom-nav button > span { font-size: .98rem; }
  .mobile-bottom-nav button.active { color: white; }
  .mobile-bottom-nav button.active > span { color: var(--gold); }
  .mobile-bottom-nav .nav-count { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; margin: 0; padding: 0 5px; font-size: .55rem; }
  #app-main { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
}

@media (max-width: 620px) {
  .topbar { flex-direction: row; align-items: center; gap: 10px; padding: 14px 14px 10px; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 1.55rem; }
  .topbar-actions { width: auto; margin-left: auto; }
  .topbar-actions > * { flex: none; min-height: 38px; padding: 8px 11px; }
  #app-main { padding-top: 3px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 93px; padding: 13px 14px; border-radius: 11px; }
  .metric-card strong { margin: 6px 0 2px; font-size: 1.5rem; }
  .metric-card small { font-size: .62rem; line-height: 1.35; }
  .linkedin-review-row { grid-template-columns: 1fr; gap: 9px; }
  .linkedin-review-open { justify-self: start; }
  .focus-panel { padding: 13px 10px 6px; }
  .focus-panel .panel-header { padding: 0 4px; }
  .compact-intro { margin-bottom: 7px; padding: 0; }
  .compact-intro h2 { font-family: inherit; font-size: 1rem; font-weight: 780; }
  .compact-intro p { display: none; }
  .actions-toolbar { margin-bottom: 8px; }
  .actions-toolbar select { width: 100%; min-height: 39px; }
  .action-group > header { min-height: 40px; padding: 8px 11px; }
  .action-main { grid-template-columns: 82px minmax(0, 1fr); gap: 9px; min-height: 68px; padding: 9px 8px; }
  .action-priority { display: none; }
  .action-copy strong, .action-copy small { white-space: normal; }
  .action-controls { gap: 4px; padding: 6px 7px 6px 0; }
  .complete-action { width: 42px; min-height: 44px; justify-content: center; padding: 6px; }
  .complete-action b { display: none; }
  .action-menu summary, .entry-menu summary { width: 42px; height: 44px; }
  .action-menu > div { position: fixed; z-index: 60; top: auto; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom)); left: 14px; min-width: 0; padding: 8px; }
  .action-menu > div button { min-height: 43px; }
  .outreach-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .outreach-filters .search-box { grid-column: 1 / -1; }
  .research-section > header { align-items: start; }
  .conversation-entry { padding: 12px; }
  .conversation-entry header { align-items: flex-start; }
  .conversation-entry-actions { gap: 5px; }
  .conversation-composer { bottom: -24px; margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
  .conversation-composer .primary-button, .conversation-composer .secondary-button { min-height: 44px; padding: 8px 5px; font-size: .68rem; }
  .record-card h3 { font-size: .94rem; }
}

@media (max-width: 390px) {
  .mobile-header .brand strong { font-size: .72rem; }
  .action-main { grid-template-columns: 70px minmax(0, 1fr); }
  .action-due { font-size: .62rem; }
  .action-copy strong { font-size: .74rem; }
  .complete-action { width: 40px; }
  .action-menu summary { width: 40px; }
}

/* Phone-first commercial cockpit */
.filter-toggle, .filter-backdrop, .filter-panel > header { display: none; }
.filter-panel { display: contents; }

.metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.conversion-panel { order: 1; }
.priority-pipeline-panel { order: 2; }
.stage-panel, .pipeline-supply-panel { order: 3; }
.secondary-insight-panel { order: 4; }
.activity-panel { order: 5; }
.conversion-status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.bottleneck-pill { color: #6c5018; background: var(--gold-soft); }
#outreach-funnel { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#outreach-funnel small { color: var(--muted); font-size: .59rem; line-height: 1.35; }

.today-plan-card { overflow: hidden; border: 1px solid #a8cec6; border-radius: 15px; background: var(--surface); box-shadow: 0 12px 32px rgba(12,91,91,.07); }
.today-plan-card > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 20px 16px; }
.today-plan-card > header h2 { font-family: inherit; font-size: 1.18rem; font-weight: 800; }
.today-plan-card > header > div:first-child > span { display: block; margin-top: 5px; color: var(--muted); font-size: .7rem; }
.today-plan-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.today-progress { height: 7px; margin: 0 20px 15px; overflow: hidden; border-radius: 99px; background: #e8efec; }
.today-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #52a697); transition: width .35s ease; }
.today-plan-card > .action-list { border-top: 1px solid var(--line); }
.today-plan-card .action-row.in-today-plan { border-left-width: 5px; }
.today-completed { border-top: 1px solid var(--line); }
.today-completed > summary { min-height: 44px; padding: 12px 16px; color: var(--muted); font-size: .72rem; font-weight: 800; cursor: pointer; }

.backlog-action-group, .repair-action-group { overflow: visible; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.backlog-action-group > summary, .repair-action-group > summary, .research-action-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 10px 15px; cursor: pointer; list-style: none; }
.backlog-action-group > summary::-webkit-details-marker, .repair-action-group > summary::-webkit-details-marker, .research-action-group > summary::-webkit-details-marker { display: none; }
.backlog-action-group > summary > span, .repair-action-group > summary > span, .research-action-group > summary > span { display: grid; gap: 3px; color: var(--ink); }
.backlog-action-group > summary strong, .repair-action-group > summary strong, .research-action-group > summary strong { font-size: .76rem; letter-spacing: .045em; text-transform: uppercase; }
.backlog-action-group > summary small, .repair-action-group > summary small, .research-action-group > summary small { color: var(--muted); font-size: .66rem; font-weight: 650; }
.backlog-action-group > summary b, .repair-action-group > summary b, .research-action-group > summary b { display: inline-grid; min-width: 28px; height: 28px; padding: 0 7px; place-items: center; border-radius: 999px; color: var(--muted); background: var(--paper); font-size: .67rem; }
.backlog-action-group[open] > summary, .repair-action-group[open] > summary, .research-action-group[open] > summary { border-bottom: 1px solid var(--line); }
.repair-action-group { border-color: #e7c27b; }
.repair-action-group > summary b { color: #77591d; background: var(--gold-soft); }

.execution-banner { display: grid; gap: 12px; margin-bottom: 18px; padding: 17px; border: 1px solid #a8cec6; border-radius: 13px; background: linear-gradient(135deg, var(--teal-soft), var(--surface) 72%); }
.execution-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.execution-heading h3 { color: var(--ink); font-size: 1rem; line-height: 1.35; }
.execution-heading > div > span { display: block; margin-top: 4px; color: var(--muted); font-size: .7rem; }
.execution-heading .eyebrow { margin-bottom: 5px; }
.pin-button { flex: 0 0 auto; min-height: 38px; padding: 8px 10px; border: 1px solid #9bc8c0; border-radius: 8px; color: var(--teal); background: var(--surface); font-size: .68rem; font-weight: 800; cursor: pointer; }
.execution-primary, .execution-outcomes { display: flex; flex-wrap: wrap; gap: 8px; }
.execution-banner > p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.message-outcome-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px 13px; border: 1px dashed var(--line); border-radius: 10px; }
.message-outcome-actions > span { flex: 1 1 220px; color: var(--muted); font-size: .7rem; }

.commercial-focus-block { grid-column: 1 / -1; border-color: #a8cec6; background: linear-gradient(135deg, rgba(223,240,234,.65), var(--surface) 62%); }
.commercial-focus-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.commercial-focus-heading h3 { margin: 0; }
.commercial-focus-heading .eyebrow { margin-bottom: 4px; }
.qualification-disclosure { padding: 0; }
.qualification-disclosure > summary { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 13px 16px; cursor: pointer; list-style: none; }
.qualification-disclosure > summary::-webkit-details-marker { display: none; }
.qualification-disclosure > summary > span { display: grid; gap: 3px; }
.qualification-disclosure > summary strong { font-size: .84rem; }
.qualification-disclosure > summary small { color: var(--muted); font-size: .67rem; }
.qualification-disclosure > summary b { color: var(--teal); font-size: .78rem; }
.qualification-body { display: grid; gap: 13px; padding: 0 16px 16px; border-top: 1px solid var(--line); }
.qualification-body .score-components { padding-top: 15px; }

.system-status-content { display: grid; gap: 14px; }
.system-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.system-status-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.system-status-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #247168; background: #dff0ea; font-size: .72rem; font-weight: 900; }
.system-status-item.attention .system-status-icon { color: #77591d; background: var(--gold-soft); }
.system-status-item > div { display: grid; gap: 3px; }
.system-status-item strong { font-size: .76rem; }
.system-status-item span, .system-status-item small { color: var(--muted); font-size: .68rem; }
.automation-note { display: grid; gap: 4px; padding: 13px; border-left: 4px solid #6d8da5; border-radius: 8px; background: var(--blue-soft); }
.automation-note strong { font-size: .76rem; }
.automation-note span { color: var(--muted); font-size: .7rem; line-height: 1.5; }
.system-status-checked { margin: 0; text-align: right; }

.pwa-update-banner { position: fixed; z-index: 92; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 16px; width: min(470px, calc(100% - 40px)); padding: 14px; border: 1px solid #b9d5cf; border-radius: 13px; color: white; background: var(--teal-dark); box-shadow: 0 18px 45px rgba(5,40,40,.24); }
.pwa-update-banner > div:first-child { display: grid; flex: 1; gap: 3px; }
.pwa-update-banner strong { font-size: .8rem; }
.pwa-update-banner span { color: #bed6d2; font-size: .7rem; line-height: 1.4; }
.pwa-update-actions { display: flex; align-items: center; gap: 5px; }
.pwa-update-actions .primary-button { color: var(--teal-dark); background: var(--gold); box-shadow: none; }
.pwa-update-actions .icon-button { color: white; }

html[data-theme="dark"] .today-plan-card,
html[data-theme="dark"] .backlog-action-group,
html[data-theme="dark"] .repair-action-group,
html[data-theme="dark"] .execution-banner,
html[data-theme="dark"] .commercial-focus-block,
html[data-theme="dark"] .system-status-item { background: var(--surface); }
html[data-theme="dark"] .today-progress { background: #294544; }
html[data-theme="dark"] .pin-button { color: var(--ink); background: var(--surface-muted); }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  body.filter-sheet-open { overflow: hidden; }
  input, select, textarea { font-size: 16px !important; }
  .primary-button, .secondary-button, .danger-filled-button, .mini-button, .icon-button, .filter-toggle, .pin-button { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .mini-button { padding: 9px 11px; }
  .complete-action, .action-menu summary, .entry-menu summary { width: 44px; min-width: 44px; min-height: 44px; }
  .form-actions { padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
  .helper, .panel-copy, .section-intro p { font-size: .76rem; line-height: 1.5; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid .metric-card:last-child { grid-column: 1 / -1; }
  .conversion-panel .panel-header { align-items: stretch; flex-direction: column; }
  .conversion-status { justify-content: flex-start; }
  #outreach-funnel { grid-template-columns: 1fr 1fr; }
  #outreach-funnel > div:last-child { grid-column: 1 / -1; }

  .leads-toolbar, .outreach-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .leads-toolbar > .search-box, .outreach-filters > .search-box { grid-column: 1; min-width: 0; }
  .filter-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--teal); background: var(--surface); font-size: .78rem; font-weight: 800; cursor: pointer; }
  .filter-toggle b { display: inline-grid; min-width: 20px; height: 20px; padding: 0 5px; place-items: center; border-radius: 99px; color: var(--teal-dark); background: var(--gold); font-size: .62rem; }
  .filter-panel { position: fixed; z-index: 66; right: 0; bottom: 0; left: 0; display: none; grid-template-columns: 1fr; gap: 9px; max-height: min(82vh, 680px); max-height: min(82dvh, 680px); padding: 17px 17px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; border-radius: 18px 18px 0 0; background: var(--surface); box-shadow: 0 -18px 55px rgba(3,26,27,.25); }
  .filter-panel.open { display: grid; animation: filter-sheet-in .18s ease-out; }
  .filter-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
  .filter-panel > header h2 { font-family: inherit; font-size: 1.08rem; font-weight: 800; }
  .filter-panel > header .eyebrow { margin-bottom: 3px; }
  .filter-panel > select, .filter-panel > .search-box { width: 100%; min-height: 48px; grid-column: auto !important; }
  .filter-backdrop { position: fixed; z-index: 65; inset: 0; border: 0; background: rgba(3,26,27,.48); }
  body.filter-sheet-open .view.active .filter-backdrop { display: block; }
  @keyframes filter-sheet-in { from { transform: translateY(18px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }

  .today-plan-card > header { align-items: stretch; flex-direction: column; padding: 16px 14px 13px; }
  .today-plan-actions { display: grid; grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .today-plan-actions > :only-child { grid-column: 1 / -1; }
  .today-progress { margin: 0 14px 12px; }
  .backlog-action-group > summary, .repair-action-group > summary, .research-action-group > summary { min-height: 62px; }
  .backlog-action-group > summary small, .repair-action-group > summary small, .research-action-group > summary small { font-size: .7rem; }

  .execution-banner { margin: -4px -4px 16px; padding: 14px; }
  .execution-heading { flex-direction: column; }
  .execution-heading .pin-button { width: 100%; }
  .execution-primary, .execution-outcomes { display: grid; grid-template-columns: 1fr 1fr; }
  .execution-outcomes > :last-child { grid-column: 1 / -1; }
  .execution-banner > p { font-size: .75rem; }
  .message-outcome-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .message-outcome-actions > span { grid-column: 1 / -1; font-size: .76rem; }
  .commercial-focus-heading { align-items: stretch; flex-direction: column; }
  .commercial-focus-heading .primary-button { width: 100%; }
  .qualification-disclosure { grid-column: 1 / -1; }
  .system-status-grid { grid-template-columns: 1fr; }

  .pwa-update-banner { right: 14px; bottom: calc(75px + env(safe-area-inset-bottom)); align-items: stretch; flex-direction: column; width: calc(100% - 28px); }
  .pwa-update-actions { display: grid; grid-template-columns: 1fr 44px; }
  .pwa-update-actions .primary-button { width: 100%; }
}

/* Outreach is a scan-and-act surface on phones. Keep every intrinsic width
   inside the viewport and make the full draft available only after Open. */
@media (max-width: 620px) {
  #view-outreach { min-width: 0; max-width: 100%; overflow-x: hidden; }
  #view-outreach > .section-intro { display: none; }
  #view-outreach .outreach-filters,
  #view-outreach .message-grid,
  #view-outreach .message-card { width: 100%; min-width: 0; max-width: 100%; }
  #view-outreach .outreach-filters > *,
  #view-outreach .search-box,
  #view-outreach .search-box input { min-width: 0; max-width: 100%; }
  #view-outreach .message-grid { gap: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  #view-outreach .message-card { min-height: 0; padding: 14px; overflow: hidden; }
  #view-outreach .message-card .record-card-header { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #view-outreach .message-card .record-card-header > div { min-width: 0; max-width: 100%; }
  #view-outreach .message-card .record-card-header h3,
  #view-outreach .message-card > strong,
  #view-outreach .message-card blockquote,
  #view-outreach .message-card footer > span { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
  #view-outreach .message-card .record-card-header h3 { font-size: 1rem; line-height: 1.3; }
  #view-outreach .message-card .outreach-state { justify-self: start; max-width: 100%; white-space: normal; line-height: 1.3; }
  #view-outreach .message-card .record-meta { min-width: 0; gap: 5px; margin: 9px 0 10px; }
  #view-outreach .message-card .record-meta span { max-width: 100%; line-height: 1.25; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
  #view-outreach .message-card > strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.4; }
  #view-outreach .message-card blockquote { display: -webkit-box; flex: none; max-height: 6em; margin: 8px 0 12px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; font-size: .75rem; line-height: 1.5; }
  #view-outreach .message-card footer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: stretch; padding-top: 12px; }
  #view-outreach .message-card footer > span { font-size: .72rem; line-height: 1.4; }
  #view-outreach .message-card .card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  #view-outreach .message-card .card-actions .mini-button { width: 100%; min-width: 0; min-height: 44px; }
  #view-outreach .message-card .card-actions .mini-button:only-child { grid-column: 1 / -1; }
  #view-outreach .message-card [data-open-message] { order: -1; color: white; border-color: var(--teal); background: var(--teal); }
  #view-outreach .message-card [data-open-message]:hover { background: var(--teal-dark); }
}

/* V2 shared workbench and evidence-bound message review — 7 September 2026. */
.release-badge { align-self: center; padding: 7px 11px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--muted); font-size: .72rem; cursor: pointer; }
.workbench-hero { display: flex; justify-content: space-between; gap: 28px; padding: 28px 30px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(120deg, var(--teal-soft), var(--surface)); }
.workbench-hero h2 { margin: 5px 0 10px; max-width: 650px; font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.18; letter-spacing: -.025em; }
.workbench-hero p:not(.eyebrow) { max-width: 650px; margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.6; }
.workbench-controls { display: grid; align-content: center; gap: 10px; min-width: 195px; }
.workbench-controls label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .73rem; font-weight: 700; }
.workbench-controls select { max-width: 130px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); }
.workbench-controls > span { color: var(--muted); font-size: .69rem; text-align: right; }
.workbench-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.workbench-lane { min-width: 0; padding: 22px; }
.workbench-lane .panel-header { align-items: flex-start; gap: 16px; }
.workbench-lane .panel-header h2 { font-size: 1.1rem; }
.workbench-lane .eyebrow { line-height: 1.6; letter-spacing: .04em; font-size: .63rem; }
.lane-count { display: grid; flex-shrink: 0; place-items: center; min-width: 29px; height: 29px; padding: 0 6px; border-radius: 9px; background: var(--teal-soft); font-size: .8rem; font-weight: 800; }
.lane-repairs .lane-count { background: var(--gold-soft); }
.workbench-list { display: grid; }
.workbench-selection .workbench-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.workbench-selection .panel-header { align-items: flex-start; gap: 16px; }
.workbench-selection .panel-header .helper { margin-bottom: 0; }
.workbench-selection-rank { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; margin-right: 8px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-size: .72rem; font-variant-numeric: tabular-nums; vertical-align: middle; }
.workbench-row { min-width: 0; padding: 17px 0; border-top: 1px solid var(--line); }
.workbench-row:last-child { padding-bottom: 0; }
.workbench-row-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.workbench-row h3 { margin: 0 0 5px; font-size: .94rem; }
.workbench-row-top > div > span { display: block; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.workbench-row p { margin: 11px 0; font-size: .8rem; line-height: 1.6; }
.workbench-row blockquote { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 12px 0; padding: 12px 14px; border-left: 2px solid var(--teal); background: var(--paper); color: var(--muted); font-size: .78rem; line-height: 1.65; white-space: pre-line; }
.workbench-row footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.workbench-row footer small { color: var(--muted); font-size: .67rem; line-height: 1.45; }
.workbench-row footer button { flex-shrink: 0; padding: 8px 11px; min-height: 36px; font-size: .73rem; }
.workbench-more { margin-top: 18px; }
.workbench-more summary, .workbench-plan summary { cursor: pointer; font-size: .8rem; font-weight: 700; }
.workbench-plan summary > span { display: inline-grid; gap: 5px; vertical-align: middle; }
.workbench-plan summary small { font-weight: 400; color: var(--muted); }
.workbench-plan .action-list { margin-top: 20px; }
.workbench-learning h2 { font-size: 1.2rem; }
.v2-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 14px 0 21px; }
.v2-metrics > div { display: grid; align-content: start; gap: 7px; border-left: 1px solid var(--line); padding-left: 20px; }
.v2-metrics > div:first-child { border-left: 0; padding-left: 0; }
.v2-metrics strong { font-size: 1.9rem; letter-spacing: -.04em; color: var(--teal); }
.v2-metrics span { font-size: .78rem; font-weight: 650; }
.v2-metrics small { font-size: .66rem; color: var(--muted); }
.v2-notice { padding: 14px 16px; border: 1px solid var(--gold); border-radius: 10px; background: var(--gold-soft); font-size: .82rem; line-height: 1.6; }
.v2-notice p { margin: 5px 0 0; }
.v2-message-detail { display: grid; gap: 20px; }
.v2-queue-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.v2-recipient { display: flex; align-items: center; gap: 12px; }
.v2-recipient > div { display: grid; gap: 4px; min-width: 0; }
.v2-recipient > div strong { font-size: .96rem; }
.v2-recipient > div span, .v2-recipient > div small { color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.v2-recipient > .pill { margin-left: auto; flex-shrink: 0; }
.v2-recipient .entity-avatar { flex-shrink: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--teal-soft); font-size: .83rem; font-weight: 750; }
.v2-message-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 22px; align-items: start; }
.v2-message-copy { min-width: 0; }
.v2-message-copy .message-subject { margin: 0 0 13px; }
.v2-message-copy .message-body { margin: 0; padding: 23px; font-family: inherit; font-size: .88rem; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); }
.buyer-brief { min-width: 0; padding: 18px; border-radius: 12px; background: var(--paper); }
.buyer-brief > div + div { margin-top: 18px; }
.buyer-brief strong { font-size: .73rem; }
.buyer-brief p:not(.eyebrow) { margin: 5px 0 0; font-size: .77rem; color: var(--muted); line-height: 1.65; overflow-wrap: anywhere; }
.v2-review-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.v2-review-actions + .helper { margin: -8px 0 0; }
.v2-review-issues { padding: 13px 17px; border-left: 3px solid var(--gold); background: var(--gold-soft); font-size: .8rem; line-height: 1.6; }
.v2-review-issues strong { font-size: .79rem; }
.v2-review-issues ul { margin: 7px 0 0; padding-left: 18px; }
.v2-evidence { border-top: 1px solid var(--line); padding-top: 15px; }
.v2-evidence > summary { padding: 3px 0; cursor: pointer; font-size: .8rem; font-weight: 700; }
.v2-evidence > summary + * { margin-top: 16px; }
.v2-evidence .message-context { margin-bottom: 12px; }
.v2-evidence blockquote { margin: 12px 0; border-left: 2px solid var(--line); padding-left: 13px; font-size: .8rem; line-height: 1.6; }
.v2-evidence li p { margin: 5px 0 12px; }
.v2-evidence a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.v2-evidence .quality-review code { overflow-wrap: anywhere; }
.v2-edit-body { min-height: 330px; line-height: 1.75; }
.v2-form-error { margin: 13px 0; color: var(--red); font-size: .82rem; line-height: 1.6; }
.v2-form-error:empty { display: none; }
.v2-history-entry { padding: 15px 0; border-bottom: 1px solid var(--line); }
.v2-history-entry summary { cursor: pointer; font-size: .81rem; line-height: 1.65; overflow-wrap: anywhere; }
.v2-history-entry summary > span { padding-left: 9px; color: var(--muted); font-size: .72rem; }
.v2-history-entry p, .v2-history-entry li { font-size: .8rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.v2-history-entry ul { padding-left: 18px; }
.v2-json { max-width: 100%; padding: 15px; overflow: auto; border-radius: 9px; background: var(--paper); color: var(--ink); font-family: ui-monospace, SFMono-Regular, monospace; font-size: .71rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.v2-diff { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 16px 0; }
.v2-diff > div { min-width: 0; }
.v2-diff > div > span { color: var(--muted); font-size: .7rem; }
.v2-diff pre { margin: 7px 0; padding: 12px; border-radius: 8px; font-family: inherit; font-size: .77rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper); }
.v2-diff del { color: var(--red); text-decoration-thickness: 1px; }
.v2-diff ins { color: var(--teal); text-decoration: none; }
.v2-settings-grid { margin-bottom: 24px; align-items: start; }
.v2-release-current { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 20px 0 12px; }
#v2-playbook > p { font-size: .81rem; line-height: 1.65; }
#v2-playbook .button-row { margin-top: 18px; }
#v2-release-history { margin-bottom: 18px; }
.v2-playbook-editor { min-height: 400px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.v2-review-actions button:focus-visible, .workbench-row button:focus-visible, .release-badge:focus-visible, .v2-evidence summary:focus-visible, .v2-history-entry summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (max-width: 1100px) {
  .workbench-grid { grid-template-columns: minmax(0, 1fr); }
  .v2-message-layout { grid-template-columns: minmax(0, 1fr); }
  .buyer-brief { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .buyer-brief > .eyebrow { grid-column: 1 / -1; margin-bottom: 0; }
  .buyer-brief > div + div { margin-top: 0; }
}
@media (max-width: 700px) {
  #view-tasks .section-intro { display: flex; align-items: flex-start; }
  #view-tasks .section-intro > div { display: none; }
  .release-badge { margin-left: auto; min-height: 34px; }
  .workbench-hero { display: grid; padding: 22px 18px; gap: 20px; }
  .workbench-hero h2 { font-size: 1.5rem; }
  .workbench-controls { grid-template-columns: 1fr; }
  .workbench-controls label { justify-content: space-between; }
  .workbench-controls > span { text-align: center; }
  .workbench-controls select { min-height: 44px; }
  .workbench-grid { gap: 14px; }
  .workbench-selection .workbench-list { grid-template-columns: minmax(0, 1fr); }
  .workbench-lane { padding: 18px; }
  .workbench-row footer { align-items: flex-start; flex-direction: column; }
  .workbench-row footer button { width: 100%; min-height: 44px; }
  .workbench-row footer > span:empty { display: none; }
  .workbench-lane .panel-header h2 { font-size: 1.03rem; }
  .v2-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .v2-metrics > div { padding-left: 14px; }
  .v2-metrics > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .v2-metrics strong { font-size: 1.65rem; }
  .v2-metrics span { font-size: .71rem; }
  .v2-recipient { flex-wrap: wrap; }
  .v2-recipient > .pill { margin-left: 52px; }
  .v2-message-copy .message-body { padding: 18px; font-size: .89rem; }
  .buyer-brief { grid-template-columns: minmax(0, 1fr); }
  .buyer-brief > div + div { margin-top: 2px; }
  .v2-review-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .v2-review-actions .primary-button { grid-column: 1 / -1; }
  .v2-review-actions button { min-height: 46px; padding: 10px; }
  .v2-diff { grid-template-columns: minmax(0, 1fr); }
  .v2-queue-bar { font-size: .7rem; }
  .v2-queue-bar button { min-height: 44px; }
  .v2-history-entry summary > span { display: block; padding-left: 18px; }
  .v2-evidence > summary, .v2-history-entry summary, .workbench-more summary { min-height: 44px; padding-top: 10px; }
  [data-form="v2-review"] .form-actions, [data-form="v2-playbook"] .form-actions { display: flex; flex-direction: column-reverse; }
  [data-form="v2-review"] .form-actions button, [data-form="v2-playbook"] .form-actions button { width: 100%; min-height: 48px; }
}
.form-grid textarea.v2-edit-body { min-height: 330px; line-height: 1.75; }
.form-grid textarea.v2-playbook-editor { min-height: 400px; }
.v2-review-actions > .danger-button { min-height: 42px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--red); font-size: .78rem; font-weight: 750; cursor: pointer; }
@media (max-width: 700px) {
  .form-grid textarea.v2-edit-body { min-height: 280px; }
  .v2-review-actions > .danger-button { min-height: 46px; }
  [data-form="v2-evidence"] .form-actions { display: flex; flex-direction: column-reverse; }
  [data-form="v2-evidence"] .form-actions button { width: 100%; min-height: 48px; }
}
.v2-policy-list { padding-left: 18px; margin: 12px 0; }
.v2-policy-list > li { margin-bottom: 9px; }
.v2-policy-fields { margin: 15px 0; display: grid; gap: 13px; }
.v2-policy-fields dt { text-transform: capitalize; color: var(--ink); font-size: .75rem; font-weight: 700; }
.v2-policy-fields dd { margin: 5px 0 0; font-size: .8rem; line-height: 1.65; color: var(--muted); }
.v2-policy-fields dd .v2-policy-fields { padding-left: 12px; border-left: 1px solid var(--line); }
.v2-history-entry summary > .v2-policy-label { display: inline; color: var(--ink); font-size: .81rem; padding-left: 0; }
.workbench-ready summary { cursor: pointer; font-size: .83rem; line-height: 1.65; }
.workbench-ready summary > span { display: block; margin: 5px 0 0 16px; color: var(--muted); font-size: .75rem; }
.workbench-ready .workbench-list { margin-top: 16px; }
.v2-assessments { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 10px; color: var(--muted); font-size: .65rem; line-height: 1.5; }
.v2-assessments > span { padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; }
