:root {
  --ink: #102538;
  --muted: #667685;
  --line: #dfe7ed;
  --brand: #c74a00;
  --soft: #f6f8fa;
  --bg: #eef3f6;
  --surface: #fff;
  --green: #16723a;
  --red: #b94100;
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); margin: 0; min-height: 100vh; }
a { color: var(--brand); font-weight: 650; text-decoration: none; }
.od-icon { display: inline-flex; flex: 0 0 auto; font-size: 1em; line-height: 1; }

.shell { margin: 0 auto; max-width: 1540px; padding: 22px 24px 48px; width: 100%; }
.topbar { align-items: center; background: #102538; border-radius: 10px; color: #fff; display: flex; gap: 14px; justify-content: space-between; margin-bottom: 14px; padding: 12px 14px; }
.brand { color: #fff; display: grid; gap: 2px; min-width: 118px; }
.brand strong { font-size: 20px; font-weight: 750; line-height: 1; }
.brand span { color: rgba(255,255,255,.72); font-size: 12px; font-weight: 650; }
.topnav { align-items: center; display: flex; flex: 1; gap: 6px; }
.topnav a { align-items: center; border-radius: 7px; color: rgba(255,255,255,.78); display: inline-flex; font-size: 13px; font-weight: 700; gap: 7px; padding: 9px 10px; }
.topnav a:hover, .topnav a.is-active { background: rgba(255,255,255,.12); color: #fff; }
.account { align-items: center; display: flex; gap: 10px; }
.avatar { align-items: center; background: #c74a00; border-radius: 50%; color: #fff; display: flex; font-size: 12px; font-weight: 750; height: 34px; justify-content: center; width: 34px; }
.account__name { font-weight: 700; line-height: 1.1; }
.account__role { color: rgba(255,255,255,.72); font-size: 12px; }
.logout { align-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); border-radius: 7px; color: #fff; cursor: pointer; display: inline-flex; font: 700 12px "Segoe UI", Arial, sans-serif; gap: 7px; padding: 8px 10px; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(16,37,56,.08); padding: 16px; }
.card--wide { grid-column: span 2; }
.label { align-items: center; color: var(--muted); display: inline-flex; font-size: 11px; font-weight: 700; gap: 6px; letter-spacing: .05em; text-transform: uppercase; }
.value { font-size: 32px; font-weight: 750; line-height: 1; margin-top: 8px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 8px; }
.source-list { display: grid; gap: 8px; margin-top: 10px; }
.source { align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; display: flex; justify-content: space-between; padding: 9px 10px; }
.badge { border-radius: 999px; font-size: 11px; font-weight: 700; padding: 4px 7px; }
.badge.ok { background: #e9f8ef; color: var(--green); }

.login-page { align-items: center; display: grid; min-height: 100vh; padding: 22px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 70px rgba(16,37,56,.14); margin: 0 auto; max-width: 430px; padding: 24px; width: 100%; }
.login-card h1 { font-size: 42px; line-height: 1; margin: 8px 0; }
.login-card p { color: var(--muted); line-height: 1.55; margin: 0 0 18px; }
.field { display: grid; gap: 6px; margin-top: 12px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
input[type="text"], input[type="password"] { border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font: 500 15px "Segoe UI", Arial, sans-serif; min-height: 44px; padding: 10px 12px; width: 100%; }
input:focus { border-color: var(--brand); outline: 3px solid rgba(199,74,0,.16); }
.check { align-items: center; color: var(--muted); display: flex; gap: 8px; font-size: 13px; font-weight: 650; margin: 14px 0; }
.field-control { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: #82909c; display: flex; gap: 8px; min-height: 44px; padding: 0 11px; }
.field .field-control, .filter-field .field-control { letter-spacing: 0; text-transform: none; }
.field-control:focus-within { border-color: var(--brand); outline: 3px solid rgba(199,74,0,.14); }
.field-control input[type="text"], .field-control input[type="password"] { background: transparent; border: 0; border-radius: 0; min-height: 42px; outline: 0; padding: 9px 0; }
.field-control input:focus { border-color: transparent; outline: 0; }
.button { align-items: center; background: var(--brand); border: 1px solid var(--brand); border-radius: 8px; color: #fff; cursor: pointer; display: inline-flex; font: 700 14px "Segoe UI", Arial, sans-serif; gap: 8px; justify-content: center; min-height: 44px; padding: 10px 14px; text-align: center; width: 100%; }
.button--fit { display: inline-flex; justify-content: center; width: auto; }
.error { background: #fff0e8; border: 1px solid #ffd2bc; border-radius: 8px; color: var(--red); font-weight: 650; margin-bottom: 12px; padding: 10px 11px; }
code { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); display: inline-block; font-family: Consolas, monospace; margin-top: 10px; padding: 7px 9px; }

.page-head, .detail-head { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(16,37,56,.07); display: flex; gap: 16px; justify-content: space-between; margin-bottom: 12px; padding: 16px; }
.page-head h1, .detail-head h1 { font-size: 28px; font-weight: 650; line-height: 1.08; margin: 6px 0 4px; }
.page-head p, .detail-head p { color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.45; margin: 0; }
.page-head__meta { align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; display: grid; justify-items: center; min-width: 92px; padding: 10px; }
.page-head__meta strong { font-size: 26px; font-weight: 750; line-height: 1; }
.page-head__meta span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }

.filters { align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 10px; grid-template-columns: minmax(270px, 1.6fr) 126px 126px minmax(150px, .85fr) minmax(150px, .85fr) minmax(170px, 1fr) auto 110px auto auto; margin-bottom: 12px; padding: 12px; }
.filter-field { display: grid; gap: 6px; }
.filter-field--small { min-width: 96px; }
.filter-field span, .filter-check { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.filter-field input, .filter-field select { background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font: 500 14px "Segoe UI", Arial, sans-serif; min-height: 42px; padding: 9px 10px; width: 100%; }
.filter-field .field-control { min-height: 42px; }
.filter-field .field-control input { min-height: 40px; }
.filter-field input:focus, .filter-field select:focus { border-color: var(--brand); outline: 3px solid rgba(199,74,0,.14); }
.filter-check { align-items: center; display: flex; gap: 8px; min-height: 42px; }
.ghost-button { align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); display: inline-flex; font-size: 13px; font-weight: 650; gap: 8px; justify-content: center; min-height: 44px; padding: 9px 12px; }

.empty-state { background: var(--surface); border: 1px dashed #cbd7df; border-radius: 10px; color: var(--muted); padding: 34px 18px; text-align: center; }
.empty-state h1, .empty-state h2 { color: var(--ink); font-size: 28px; margin: 0 0 8px; }
.empty-state p { line-height: 1.55; margin: 0 auto 14px; max-width: 560px; }

.lead-list { display: grid; gap: 8px; }
.lead-row { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 12px; grid-template-columns: 136px minmax(320px, 1.35fr) minmax(190px, .8fr) 92px 132px; padding: 12px; transition: border-color .16s ease, box-shadow .16s ease; }
.lead-row:hover { border-color: #c7d4de; box-shadow: 0 10px 28px rgba(16,37,56,.07); }
.lead-row__number { color: var(--ink); display: grid; gap: 4px; min-width: 0; }
.lead-row__number span { font-size: 18px; font-weight: 900; line-height: 1; }
.lead-row__number small { color: var(--muted); font-size: 10px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__main, .lead-row__client, .lead-row__files { min-width: 0; }
.lead-row__title { color: var(--ink); display: block; font-size: 15px; font-weight: 900; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; font-weight: 800; margin-top: 5px; }
.lead-row__client { display: grid; gap: 3px; }
.lead-row__client strong, .lead-row__files strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__client span, .lead-row__files span { color: var(--muted); font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__files { text-align: right; }
.status-pill { border-radius: 999px; display: inline-flex; font-size: 12px; font-weight: 650; justify-content: center; line-height: 1; padding: 8px 10px; white-space: nowrap; }
.status-pill--new { background: #fff3dc; color: #a55400; }
.status-pill--accepted { background: #eaf3ff; color: #1b5fa6; }
.status-pill--in_work { background: #edf7ff; color: #006c94; }
.status-pill--called { background: #e9f8ef; color: var(--green); }
.status-pill--closed { background: #eef2f5; color: #536270; }

.lead-table { display: grid; gap: 6px; }
.lead-table-head, .lead-row-v2 { display: grid; grid-template-columns: 64px 124px minmax(150px,.8fr) minmax(210px,1.25fr) minmax(185px,.9fr) minmax(128px,.7fr) 116px 72px 136px; }
.lead-table-head { background: #102538; border-radius: 8px; color: #fff; font-size: 11px; font-weight: 650; text-transform: uppercase; }
.lead-table-head > *, .lead-row-v2 > * { min-width: 0; padding: 10px 12px; position: relative; }
.lead-table-head > *:not(:last-child)::after, .lead-row-v2 > *:not(:last-child)::after { background: #e7edf2; bottom: 50%; content: ""; height: 62px; opacity: .95; position: absolute; right: 0; transform: translateY(50%); width: 1px; }
.lead-table-head > *:not(:last-child)::after { background: rgba(255,255,255,.16); height: 24px; }
.lead-row-v2 { align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid transparent; border-radius: 8px; box-shadow: 0 8px 24px rgba(16,37,56,.05); color: var(--ink); font-size: 13px; }
.lead-row-v2.status-row-new { border-left-color: #c74a00; }
.lead-row-v2.status-row-accepted, .lead-row-v2.status-row-in_work { border-left-color: #7d5ce3; }
.lead-row-v2.status-row-called { border-left-color: #25a65a; }
.lead-row-v2.status-row-closed { border-left-color: #59636d; opacity: .78; }
.row-link { color: inherit; display: block; min-width: 0; text-decoration: none; }
.row-link:hover .order-id, .row-link:hover .human-no__badge { color: #c74a00; }
.human-no { align-items: center; color: #c74a00; display: grid; gap: 5px; justify-items: center; text-align: center; }
.human-no__badge { align-items: center; background: #fff3eb; border: 1px solid #ffd2bc; border-radius: 999px; color: #b94100; display: inline-flex; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 700; justify-content: center; line-height: 1; max-width: 58px; min-height: 26px; min-width: 34px; overflow: hidden; padding: 0 7px; text-overflow: ellipsis; white-space: nowrap; }
.thumb { align-items: center; background-color: #fff; background-image: linear-gradient(45deg,#d9e0e6 25%,transparent 25%),linear-gradient(-45deg,#d9e0e6 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d9e0e6 75%),linear-gradient(-45deg,transparent 75%,#d9e0e6 75%); background-position: 0 0,0 8px,8px -8px,-8px 0; background-size: 16px 16px; border: 1px solid #edf2f5; border-radius: 6px; display: flex; height: 76px; justify-content: center; overflow: hidden; }
.thumb img { display: block; max-height: 72px; max-width: 116px; }
.thumb span { color: #9aa8b2; font-size: 12px; text-align: center; }
.thumb-link:hover .thumb { border-color: #c74a00; }
.order-id-line { align-items: center; display: grid; gap: 6px; grid-template-columns: minmax(0,1fr) 24px; }
.order-id { border-radius: 5px; display: inline; font-size: 11px; font-weight: 550; line-height: 1.25; overflow-wrap: anywhere; padding: 2px 4px; transition: background .16s ease,color .16s ease,box-shadow .16s ease; word-break: break-word; }
.order-id-link:hover .order-id, .order-id-link:focus-visible .order-id { background: #fff3eb; box-shadow: 0 0 0 1px #ffd2bc; color: #b94100; }
.order-date { font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
.title { color: var(--ink); font-size: 13px; font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-small { color: #667685; font-size: 12px; line-height: 1.35; margin-top: 3px; max-height: 34px; overflow: hidden; }
.client-cell { display: grid; gap: 5px; }
.client-cell strong { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-cell .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-contact-actions { align-items: center; display: flex; gap: 5px; margin-top: 2px; }
.contact-send { align-items: center; border: 0; border-radius: 7px; color: #fff; cursor: pointer; display: inline-flex; font: 700 9px "Segoe UI",Arial,sans-serif; height: 28px; justify-content: center; overflow: hidden; padding: 0; width: 28px; }
.contact-send--telegram { background: #229ed9; }
.contact-send--max { background: #6f7b8a; }
.contact-send.is-disabled { background: #e7edf2; color: #9aa8b2; cursor: not-allowed; opacity: .78; }
.worklog { color: #667685; display: grid; font-size: 12px; gap: 6px; }
.worklog__item { align-items: center; display: grid; gap: 6px; grid-template-columns: 46px 20px 24px; min-width: 0; }
.worklog__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worklog__state { align-items: center; border-radius: 999px; color: #fff; display: inline-flex; height: 18px; justify-content: center; justify-self: center; width: 18px; }
.worklog__state--accepted, .worklog__state--in_work { background: #7d5ce3; }
.worklog__state--called { background: #25a65a; }
.worklog__state--closed { background: #59636d; }
.actor-avatar { align-items: center; background: #102538; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; color: #fff; display: inline-flex; flex: 0 0 24px; font-size: 9px; font-weight: 750; height: 24px; justify-content: center; line-height: 1; overflow: hidden; text-transform: uppercase; width: 24px; }
.count { color: #667685; font-size: 12px; text-align: center; }
.file-count-cell { display: grid; gap: 3px; justify-items: center; text-align: center; }
.file-count-cell strong { color: var(--ink); font-size: 12px; font-weight: 650; white-space: nowrap; }
.file-count-cell span { color: #667685; font-size: 11px; white-space: nowrap; }
.status { border-radius: 999px; display: inline-flex; font-size: 12px; font-weight: 650; padding: 5px 9px; white-space: nowrap; }
.status-new { --status-strip: #075ea8; background: #e7f1ff; color: #075ea8; }
.status-accepted { --status-strip: #996000; background: #fff2d7; color: #996000; }
.status-called { --status-strip: #16723a; background: #e9f8ef; color: #16723a; }
.status-in_work { --status-strip: #5c35a4; background: #f1ebff; color: #5c35a4; }
.status-closed { --status-strip: #59636d; background: #eef0f2; color: #59636d; }
.status-tip { display: inline-flex; position: relative; }
.status-tip .status::after { background: var(--status-strip,#59636d); border-radius: 999px; content: ""; display: inline-block; height: 18px; margin-left: 8px; width: 4px; }
.status-tip::after { background: #102538; border-radius: 7px; bottom: calc(100% + 8px); box-shadow: 0 12px 28px rgba(16,37,56,.2); color: #fff; content: attr(data-status-tooltip); font-size: 11px; font-weight: 500; left: 50%; line-height: 1.35; max-width: 280px; min-width: 210px; opacity: 0; padding: 8px 10px; pointer-events: none; position: absolute; text-align: left; transform: translate(-50%,4px); transition: opacity .16s ease, transform .16s ease; white-space: normal; z-index: 40; }
.status-tip:hover::after { opacity: 1; transform: translate(-50%,0); }
.row-actions { display: grid; gap: 6px; justify-items: stretch; }
.row-actions__quick { display: grid; gap: 5px; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; }
.quick-btn, .row-action-open { align-items: center; background: #fff; border: 1px solid #d8e2e8; border-radius: 6px; color: #667685; cursor: pointer; display: inline-flex; font: 650 10px "Segoe UI",Arial,sans-serif; height: 30px; justify-content: center; padding: 0 5px; text-decoration: none; width: 100%; }
.row-action-open { background: #102538; border-color: #102538; color: #fff; font-size: 11px; gap: 6px; height: 32px; padding: 0 8px; }
.quick-btn .od-icon { font-size: 13px; }
.quick-btn.is-on { background: #e9f8ef; border-color: #bfe8cf; color: #16723a; }
.quick-btn.is-off { background: #fff3eb; border-color: #ffd2bc; color: #d44d00; }
.quick-btn.is-close { background: #eef0f2; border-color: #d8e2e8; color: #59636d; }
.copy-btn { align-items: center; background: transparent; border: 0; border-radius: 4px; color: #8a98a6; cursor: pointer; display: inline-flex; height: 22px; justify-content: center; padding: 0; width: 22px; }
.copy-btn .od-icon { font-size: 13px; }
.copy-btn:hover { background: #fff3eb; color: #c74a00; }
.copy-btn .copy-icon--done { display: none; }
.copy-btn.is-copied { background: #eaf8ef; color: #16723a; }
.copy-btn.is-copied .copy-icon--copy { display: none; }
.copy-btn.is-copied .copy-icon--done { display: inline-block; }
.ui-icon { display: inline-block; height: 14px; position: relative; width: 14px; }
.ui-icon--copy::before, .ui-icon--copy::after { border: 1.8px solid currentColor; border-radius: 2px; content: ""; height: 8px; position: absolute; width: 7px; }
.ui-icon--copy::before { left: 2px; top: 4px; }
.ui-icon--copy::after { left: 5px; top: 1px; }
.ui-icon--check::before { border-bottom: 2px solid currentColor; border-right: 2px solid currentColor; content: ""; height: 8px; left: 5px; position: absolute; top: 1px; transform: rotate(45deg); width: 4px; }
.ui-icon--phone::before { border: 2px solid currentColor; border-left-width: 4px; border-radius: 7px 7px 7px 3px; content: ""; height: 9px; left: 3px; position: absolute; top: 2px; transform: rotate(-35deg); width: 6px; }
.ui-icon--work::before { border: 2px solid currentColor; border-radius: 2px; content: ""; height: 8px; left: 2px; position: absolute; top: 4px; width: 10px; }
.ui-icon--work::after { border: 2px solid currentColor; border-bottom: 0; border-radius: 3px 3px 0 0; content: ""; height: 4px; left: 5px; position: absolute; top: 1px; width: 4px; }
.ui-icon--open::before { border-right: 2px solid currentColor; border-top: 2px solid currentColor; content: ""; height: 8px; position: absolute; right: 2px; top: 2px; width: 8px; }
.ui-icon--open::after { background: currentColor; content: ""; height: 2px; left: 3px; position: absolute; top: 8px; transform: rotate(-45deg); width: 10px; }

.pagination { align-items: center; display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.pagination a, .pagination span { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 650; padding: 9px 12px; }

.detail-head { justify-content: flex-start; }
.detail-head > div { flex: 1; min-width: 0; }
.detail-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-card--wide { grid-column: span 2; }
.crm-context-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.lead-detail-top { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 34px rgba(16,37,56,.07); padding: 16px; }
.lead-detail-topline { align-items: flex-start; display: flex; gap: 14px; justify-content: space-between; }
.lead-detail-title { min-width: 0; }
.eyebrow { color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.lead-detail-title h1 { font-size: 23px; font-weight: 650; line-height: 1.18; margin: 5px 0 8px; }
.lead-meta { align-items: flex-start; color: var(--muted); display: flex; flex-wrap: wrap; gap: 7px 10px; }
.lead-meta__item { align-items: center; display: inline-flex; gap: 6px; min-width: 0; }
.lead-meta__order { max-width: 100%; }
.lead-meta__order-code { color: var(--ink); font-size: 12px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; word-break: break-word; }
.lead-meta .copy-btn { height: 28px; width: 28px; }
.lead-actions { align-items: flex-end; display: grid; gap: 8px; justify-items: end; min-width: 360px; }
.stage-form, .admin-stage-form { align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; margin: 0; padding: 6px; }
.admin-stage-form { justify-content: flex-end; }
.admin-stage-form select { background: #fff; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: 500 12px "Segoe UI", Arial, sans-serif; min-height: 34px; padding: 7px; }
.btn { align-items: center; appearance: none; background: var(--brand); border: 1px solid var(--brand); border-radius: 6px; color: #fff; cursor: pointer; display: inline-flex; font: 650 12px "Segoe UI", Arial, sans-serif; gap: 7px; justify-content: flex-start; min-height: 34px; padding: 8px 11px; text-align: left; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.lead-info-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 14px; }
.info-box { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; min-width: 0; padding: 10px 11px; }
.info-box strong { color: var(--muted); display: block; font-size: 11px; font-weight: 700; margin-bottom: 4px; text-transform: uppercase; }
.contact-line { align-items: center; display: flex; gap: 8px; min-width: 0; }
.contact-line a { color: var(--ink); font-weight: 600; min-width: 0; overflow: hidden; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.contact-send-row { align-items: center; display: flex; gap: 6px; margin-top: 8px; }
.lead-alerts { background: #fff8eb; border: 1px solid #f5d6a4; border-radius: 8px; color: #845200; display: grid; gap: 6px; margin-top: 14px; padding: 12px 14px; }
.lead-alerts strong { color: #5f3900; }
.lead-workbench { align-items: start; display: grid; gap: 14px; grid-template-columns: minmax(360px, .9fr) minmax(0, 1.35fr); margin-top: 14px; }
.detail-section { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(16,37,56,.05); padding: 14px; }
.detail-section h2 { font-size: 17px; font-weight: 650; line-height: 1.2; margin: 0 0 10px; }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { border-bottom: 1px solid #edf2f5; padding: 6px 0; }
.summary-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.summary-list .sub { color: var(--muted); padding-left: 18px; }
.source-link { margin-top: 14px; }
.files-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.file-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.file-preview { align-items: center; background-color: #fff; background-image: linear-gradient(45deg,#d9e0e6 25%,transparent 25%),linear-gradient(-45deg,#d9e0e6 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d9e0e6 75%),linear-gradient(-45deg,transparent 75%,#d9e0e6 75%); background-position: 0 0,0 10px,10px -10px,-10px 0; background-size: 20px 20px; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; height: 168px; justify-content: center; overflow: hidden; padding: 10px; width: 100%; }
.file-preview:disabled { cursor: default; }
.file-preview img { display: block; max-height: 150px; max-width: 100%; }
.file-preview span { color: var(--muted); }
.file-card__body { padding: 14px; }
.file-badge { background: #eef3f6; border-radius: 999px; color: #526474; display: inline-flex; font-size: 11px; font-weight: 650; margin-bottom: 7px; padding: 4px 8px; }
.file-card__title { font-weight: 650; line-height: 1.25; word-break: break-word; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.detail-timeline { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.detail-timeline li { align-items: flex-start; border-left: 3px solid var(--brand); display: grid; gap: 8px; grid-template-columns: 28px minmax(0, 1fr); padding: 2px 0 2px 10px; }
.timeline__body { min-width: 0; }
.timeline-more { margin-top: 10px; }
.timeline-more summary { color: var(--brand); cursor: pointer; font-weight: 650; }
.kv { display: grid; gap: 8px 14px; grid-template-columns: 110px minmax(0, 1fr); margin: 12px 0 0; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 650; }
.kv dd { font-size: 14px; font-weight: 500; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.summary-text { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font: 400 13px/1.55 Consolas, monospace; max-height: 420px; overflow: auto; padding: 12px; white-space: pre-wrap; }
.inline-link { align-items: center; display: inline-flex; gap: 6px; margin-top: 10px; }
.section-title { align-items: end; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 12px; }
.section-title h2 { font-size: 20px; font-weight: 650; line-height: 1.15; margin: 4px 0 0; }
.section-title > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.files-panel { padding-bottom: 18px; }
.file-preview-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.file-preview-card { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-rows: minmax(190px, 1fr) auto; min-width: 0; overflow: hidden; }
.file-preview-card__media { align-items: center; background-color: #fff; background-image: linear-gradient(45deg,#d8e0e6 25%,transparent 25%),linear-gradient(-45deg,#d8e0e6 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d8e0e6 75%),linear-gradient(-45deg,transparent 75%,#d8e0e6 75%); background-position: 0 0,0 10px,10px -10px,-10px 0; background-size: 20px 20px; border: 0; border-bottom: 1px solid var(--line); cursor: zoom-in; display: flex; justify-content: center; min-height: 190px; overflow: hidden; padding: 14px; width: 100%; }
.file-preview-card__media:disabled { cursor: default; }
.file-preview-card__media img { display: block; max-height: 300px; max-width: 100%; object-fit: contain; }
.file-preview-card__media span { color: #8a98a6; font-size: 13px; }
.file-preview-card__body { display: grid; gap: 4px; padding: 10px 12px 12px; }
.file-preview-card__body strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-card__body span { color: var(--muted); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-card__body .inline-link { font-size: 12px; margin-top: 2px; }
.timeline { display: grid; gap: 8px; margin-top: 10px; }
.timeline__item { border-left: 3px solid var(--brand); display: grid; gap: 3px; padding: 4px 0 4px 10px; }
.timeline__item strong { font-size: 14px; font-weight: 650; }
.timeline__item span { color: var(--muted); font-size: 12px; font-weight: 500; }

.has-preview-modal { overflow: hidden; }
.preview-modal { align-items: center; background: rgba(16,37,56,.72); inset: 0; justify-content: center; padding: 24px; position: fixed; z-index: 1000; }
.preview-modal:not([hidden]) { display: flex; }
.preview-modal__dialog { background: #fff; border-radius: 10px; box-shadow: 0 28px 90px rgba(0,0,0,.32); display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: min(900px, 92vh); max-width: min(1280px, 94vw); overflow: hidden; width: 100%; }
.preview-modal__head { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 10px 12px; }
.preview-modal__head strong { font-size: 14px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-modal__close { align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 7px; color: var(--ink); cursor: pointer; display: inline-flex; font: 650 13px "Segoe UI", Arial, sans-serif; gap: 7px; padding: 8px 10px; }
.preview-modal__stage { align-items: center; background-color: #fff; background-image: linear-gradient(45deg,#d8e0e6 25%,transparent 25%),linear-gradient(-45deg,#d8e0e6 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d8e0e6 75%),linear-gradient(-45deg,transparent 75%,#d8e0e6 75%); background-position: 0 0,0 12px,12px -12px,-12px 0; background-size: 24px 24px; display: flex; justify-content: center; min-height: 420px; overflow: auto; padding: 22px; }
.preview-modal__stage img { display: block; max-height: none; max-width: none; min-height: 260px; min-width: 260px; object-fit: contain; }

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--wide { grid-column: span 2; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filter-field--search { grid-column: span 2; }
  .lead-table-head { display: none; }
  .lead-row-v2 { align-items: start; grid-template-columns: 72px 126px minmax(0,1fr); }
  .lead-row-v2 > * { padding: 8px; }
  .lead-row-v2 > *::after { display: none; }
  .lead-row-v2 .id-cell, .lead-row-v2 .type-cell, .lead-row-v2 .client-cell, .lead-row-v2 .worklog, .lead-row-v2 .row-actions { grid-column: 3; }
  .lead-row-v2 .count, .lead-row-v2 .file-count-cell { justify-items: start; text-align: left; }
  .lead-row { grid-template-columns: 94px minmax(0, 1fr); }
  .lead-row__client, .lead-row__files, .lead-row .status-pill { grid-column: 2; justify-self: start; text-align: left; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card--wide { grid-column: span 1; }
  .file-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-detail-topline { display: grid; }
  .lead-actions { justify-items: start; min-width: 0; }
  .lead-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-workbench { grid-template-columns: 1fr; }
  .files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .shell { padding: 12px; }
  .topbar { align-items: flex-start; display: grid; }
  .topnav { order: 3; width: 100%; }
  .grid, .card--wide { grid-template-columns: 1fr; grid-column: span 1; }
  .account { justify-content: space-between; width: 100%; }
  .page-head, .detail-head { align-items: flex-start; display: grid; }
  .filters, .filter-field--search { grid-template-columns: 1fr; grid-column: auto; }
  .lead-row-v2 { grid-template-columns: 1fr; }
  .lead-row-v2 .id-cell, .lead-row-v2 .type-cell, .lead-row-v2 .client-cell, .lead-row-v2 .worklog, .lead-row-v2 .row-actions { grid-column: auto; }
  .human-no { justify-items: start; }
  .thumb { max-width: 128px; }
  .lead-row { grid-template-columns: 1fr; }
  .lead-row__client, .lead-row__files, .lead-row .status-pill { grid-column: auto; }
  .lead-row__files { text-align: left; }
  .kv { grid-template-columns: 1fr; }
  .file-preview-grid { grid-template-columns: 1fr; }
  .file-preview-card { grid-template-rows: minmax(160px, 1fr) auto; }
  .file-preview-card__media { min-height: 160px; }
  .preview-modal { padding: 10px; }
  .preview-modal__stage { min-height: 320px; padding: 12px; }
  .lead-info-grid, .files-grid { grid-template-columns: 1fr; }
  .stage-form, .admin-stage-form { align-items: stretch; display: grid; width: 100%; }
  .stage-form .btn, .admin-stage-form .btn { width: 100%; }
}

.service-footer { align-items: center; color: #7a8793; display: flex; font-size: 11px; gap: 10px; justify-content: center; padding: 0 20px 22px; }
.service-footer a { color: #7a8793; font-weight: 500; text-decoration: underline; text-decoration-color: rgba(122,135,147,.35); text-underline-offset: 3px; }
