:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --line: #e4e8f0;
    --primary: #2856d7;
    --primary-dark: #1e45b5;
    --accent: #f07a2b;
    --danger: #c9363e;
    --success: #178754;
    --shadow: 0 8px 28px rgba(24, 39, 75, .07);
    --radius: 14px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { height: 78px; background: #111827; color: #fff; display: flex; align-items: center; padding: 0 30px; gap: 36px; position: sticky; top: 0; z-index: 50; box-shadow: 0 3px 16px rgba(0,0,0,.18); }
.brand { position:relative; color: #fff; display: flex; align-items: center; min-width: 235px; padding-bottom:14px; }
.brand-home { display:flex;align-items:center;gap:11px;color:#fff; }
.brand-copy { display:block; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: inline-block; flex:0 0 auto; box-shadow: 0 4px 12px rgba(14,38,111,.3); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .04em; }
.brand small { color: #9aa6bc; font-size: 11px; margin-top: 2px; }
.release-version-link{position:absolute;left:51px;bottom:0;padding:0;border:0;background:transparent;color:#7f8da5;font-size:9px;font-weight:750;letter-spacing:.03em;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:3px;cursor:pointer}
.release-version-link:hover{color:#cbd5e1}
.topnav { display: flex; align-self: stretch; align-items: center; gap: 6px; flex: 1; }
.topnav a { color: #c6cfdd; padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.topnav a:hover, .topnav a.active { color: #fff; background: rgba(255,255,255,.09); }
.user-menu { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.user-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #334155; font-weight: 700; }
.user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { border: 0; background: transparent; color: #98a6bd; padding: 6px; }
.link-button:hover { color: #fff; }
.main-content { max-width: 1760px; margin: 0 auto; padding: 30px; }
.auth-content { max-width: none; padding: 0; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { font-size: 29px; margin: 4px 0 7px; letter-spacing: -.035em; }
.page-heading p { color: var(--muted); margin: 0; }
.compact-heading { align-items: center; }
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.heading-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; font-size: 13px; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(40,86,215,.22); }
.button-primary:hover { background: var(--primary-dark); color: #fff; }
.button-secondary { background: #fff; color: #344054; border-color: #d5dae4; }
.button-secondary:hover { background: #f7f8fb; color: #172033; }
.button-ghost { background: transparent; color: #475467; border-color: transparent; }
.button-accent { background: var(--accent); color: #fff; }
.button-danger { background: var(--danger); color: #fff; }
.button-danger-outline { color: var(--danger); border-color: #efc7ca; background: #fff; }
.button-full { width: 100%; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 17px 18px; min-height: 82px; box-shadow: 0 3px 14px rgba(24,39,75,.04); }
.metric-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 9px; }
.metric-card strong { font-size: 23px; letter-spacing: -.03em; }
.currency-metric-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.currency-metric-lines strong { margin-top: 0; font-size: 16px; letter-spacing: 0; }
.currency-metric-lines small { color: var(--muted); font-size: 10px; font-weight: 700; margin-left: 3px; }

.metric-action { background: linear-gradient(135deg, #eff4ff, #fff); }
.metric-action a { font-weight: 700; }
.filter-panel { padding: 15px; margin-bottom: 16px; }
.search-row { display: flex; gap: 9px; align-items: center; }
.search-box { height: 42px; border: 1px solid #d7dce6; border-radius: 9px; display: flex; align-items: center; gap: 9px; padding: 0 12px; flex: 1; background: #fff; }
.search-box:focus-within { border-color: #7b9cf0; box-shadow: 0 0 0 3px rgba(40,86,215,.09); }
.search-box span { font-size: 22px; color: #7c8799; }
.search-box input { border: 0; outline: 0; width: 100%; color: var(--text); }
.advanced-filters { display: none; grid-template-columns: repeat(5,minmax(150px,1fr)); gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 15px; }
.advanced-filters.open { display: grid; }
.field label, .calculated-field label { display: block; color: #344054; font-weight: 650; font-size: 12px; margin-bottom: 7px; }
.required { color: var(--danger); margin-left: 3px; }
.form-control, .login-card input { width: 100%; border: 1px solid #d4dae5; border-radius: 8px; background: #fff; color: var(--text); padding: 10px 11px; min-height: 41px; outline: none; }
textarea.form-control { resize: vertical; line-height: 1.45; }
.form-control:focus, .login-card input:focus { border-color: #7798eb; box-shadow: 0 0 0 3px rgba(40,86,215,.1); }
.field-error .form-control { border-color: #dc7d83; }
.help-text, .error-text { display: block; margin-top: 5px; font-size: 11px; }
.help-text { color: var(--muted); }
.error-text { color: var(--danger); font-weight: 600; }
.registry-panel { overflow: hidden; }
.table-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 12px; }
.muted { color: var(--muted); }
.table-scroll { overflow: auto; max-width: 100%; }
.registry-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.registry-table th { position: sticky; top: 0; z-index: 4; background: #f7f8fb; color: #596579; text-align: left; font-size: 10px; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); padding: 12px 11px; }
.registry-table th a { color: inherit; }
.registry-table td { padding: 11px; border-bottom: 1px solid #edf0f4; vertical-align: top; max-width: 230px; line-height: 1.35; background: #fff; }
.registry-table tbody tr { cursor: pointer; }
.registry-table tbody tr:hover td { background: #f6f9ff; }
.registry-table .sticky-number { position: sticky; left: 0; z-index: 2; min-width: 98px; box-shadow: 5px 0 9px rgba(26,43,77,.03); }
.registry-table th:nth-child(2) { left: 0; z-index: 6; }
.document-link { font-weight: 800; white-space: nowrap; }
.sticky-number small { display: block; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.wide-cell { min-width: 210px; }
.memo-cell { min-width: 180px; white-space: normal; }
.money-cell { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.company-pill { display: inline-block; border-radius: 6px; background: #edf2ff; color: #3153aa; padding: 4px 7px; min-width: 140px; }
.participants-compact { display: flex; flex-direction: column; gap: 4px; }
.participants-compact span { border-left: 2px solid #cdd8f6; padding-left: 6px; }
.participants-compact em { color: var(--muted); font-style: normal; font-size: 10px; white-space: nowrap; }
.status-badge { display: inline-block; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; background: #edf0f5; color: #485467; }
.status-paid { background: #e8f7ef; color: #147346; }
.status-unpaid { background: #fff0f0; color: #ac3036; }
.status-partially-paid { background: #fff6e6; color: #9b6409; }
.actions-column { min-width: 78px; }
.row-actions { display: flex; align-items: center; justify-content: center; gap: 5px; }
.row-actions form { margin: 0; }
.row-actions a { width: 28px; height: 28px; border-radius: 7px; display: inline-grid; place-items: center; background: #eef3ff; }
.generate-mini { width: 28px; height: 28px; border-radius: 7px; border: 0; display: grid; place-items: center; background: #fff0e7; color: #b85516; font-weight: 800; }
.sort-icon { color: var(--primary); margin-left: 4px; font-size: 13px; }
.empty-state { text-align: center; padding: 55px !important; cursor: default; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { font-size: 16px; margin-bottom: 6px; }
.empty-state span { color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 5px; padding: 15px; }
.pagination a, .pagination span { min-width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.messages { margin-bottom: 15px; }
.message { padding: 12px 15px; border-radius: 9px; border: 1px solid; background: #fff; }
.message-success { color: #166c45; border-color: #b9dfcb; background: #effaf4; }
.message-warning { color: #815608; border-color: #edd59d; background: #fff9e9; }
.message-info { color: #2451a3; border-color: #bdd0f4; background: #f0f5ff; }
.message-error { color: #9d2d34; border-color: #e7babc; background: #fff1f1; }
.form-section { padding: 22px; margin-bottom: 16px; }
.section-heading { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading > span { width: 29px; height: 29px; flex: 0 0 auto; border-radius: 8px; background: #edf2ff; color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.section-heading h2 { margin: 0 0 3px; font-size: 17px; }
.section-heading p { margin: 0; font-size: 12px; color: var(--muted); }
.form-grid { display: grid; gap: 16px; }
.cols-1 { grid-template-columns: 1fr; }
.cols-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.cols-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.span-2 { grid-column: span 2; }
.related-document-box { display: none; margin-top: 18px; padding: 16px; border: 1px solid #dbe3f4; border-radius: 10px; background: #f7f9fe; }
.related-document-box.visible { display: block; }
.hidden { display: none !important; }
.context-note { font-size: 12px; line-height: 1.5; color: #526075; border-left: 3px solid #99afea; padding: 8px 11px; background: #f5f8ff; margin: 13px 0 0; }
.document-number-chip { background: #111827; color: #fff; border-radius: 10px; padding: 11px 16px; font-weight: 800; font-size: 17px; min-width: 140px; text-align: center; }
.document-number-chip.preview { background: #e9eef9; color: #3e506d; }
.participant-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.participant-header, .participant-row { display: grid; grid-template-columns: minmax(260px,2fr) minmax(150px,1fr) 100px; gap: 10px; align-items: center; }
.participant-header { background: #f7f8fb; color: #667085; text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 10px 12px; }
.participant-row { padding: 10px 12px; border-top: 1px solid var(--line); }
.participant-row:first-of-type { border-top: 0; }
.participant-remove { text-align: center; font-size: 11px; color: var(--muted); }
.icon-button { width: 32px; height: 32px; border-radius: 7px; border: 0; font-size: 20px; }
.icon-button.danger { color: #ae343b; background: #fff0f1; }
.memo-top { margin-top: 17px; }
.calculated-field { align-self: start; }
.calculated-value { min-height: 41px; display: flex; align-items: center; padding: 10px 11px; background: #eef3fc; border: 1px solid #dbe4f6; border-radius: 8px; font-weight: 800; }
.calculated-field small { color: var(--muted); display: block; margin-top: 5px; }
.form-alert { background: #fff1f1; border: 1px solid #e7babc; color: #9d2d34; padding: 12px 14px; border-radius: 8px; margin-bottom: 15px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 20; padding: 12px; background: rgba(255,255,255,.93); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 35px rgba(20,35,65,.14); backdrop-filter: blur(8px); }
.detail-title-line { display: flex; align-items: center; gap: 12px; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 16px; align-items: start; }
.detail-main { padding: 24px; }
.detail-section + .detail-section { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 25px; }
.detail-section h2 { font-size: 17px; margin: 0 0 17px; }
.details-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px 24px; margin: 0; }
.details-grid div { min-width: 0; }
.details-grid dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.details-grid dd { margin: 0; line-height: 1.45; word-break: break-word; }
.missing-reference { color: #b06312; background: #fff6e8; border-radius: 6px; padding: 6px 8px; display: inline-block; }
.participant-detail-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.participant-detail-list > div { border: 1px solid var(--line); padding: 10px; border-radius: 9px; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; }
.person-icon { width: 27px; height: 27px; border-radius: 50%; background: #edf2ff; color: var(--primary); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.participant-detail-list em { font-style: normal; color: var(--muted); font-size: 11px; }
.memo-block { margin-top: 13px; padding: 13px; border-radius: 9px; background: #f8fafc; border-left: 3px solid #9baccc; }
.memo-block span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.memo-block p { margin: 0; }
.detail-sidebar { display: flex; flex-direction: column; gap: 14px; }
.detail-sidebar .panel { padding: 19px; }
.payment-card { background: linear-gradient(150deg, #172033, #293952); color: #fff; border: 0; }
.payment-card .eyebrow { color: #96b3ff; }
.payment-total { font-size: 33px; font-weight: 850; letter-spacing: -.04em; margin-top: 12px; }
.payment-total small { font-size: 19px; }
.payment-code { color: #b7c2d4; margin: 4px 0 20px; font-size: 12px; }
.payment-breakdown { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; margin-top: 12px; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.payment-breakdown span { color: #b7c2d4; }
.metadata-card h3, .related-list-card h3 { margin: 0 0 14px; font-size: 14px; }
.metadata-card div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 11px; }
.metadata-card span { color: var(--muted); }
.related-list-card a { display: block; padding: 9px 0; border-top: 1px solid var(--line); }
.related-list-card span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.import-layout { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 16px; align-items: start; }
.import-card, .import-help { padding: 22px; }
.stack-form { display: flex; flex-direction: column; gap: 15px; }
.checkbox-input { width: 17px; height: 17px; }
.import-help h2 { margin-top: 0; font-size: 17px; }
.import-help ol { padding-left: 21px; color: #475467; line-height: 1.6; }
.import-help code { background: #eef1f6; padding: 2px 5px; border-radius: 4px; }
.import-result { margin-top: 16px; padding: 20px; }
.result-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.result-heading h2 { margin: 5px 0 0; }
.result-metrics { display: flex; gap: 13px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.result-metrics strong { color: var(--text); font-size: 15px; margin-left: 3px; }
.result-metrics .danger strong { color: var(--danger); }
.result-metrics .success strong { color: var(--success); }
.result-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-table th, .result-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.import-status { padding: 3px 7px; border-radius: 999px; background: #edf0f5; }
.import-error { background: #ffeded; color: #a72c33; }
.import-created, .import-updated { background: #e9f8ef; color: #167347; }
.import-preview { background: #edf3ff; color: #2855af; }
.confirm-card { max-width: 550px; margin: 80px auto; padding: 30px; text-align: center; }
.confirm-card h1 { font-size: 23px; }
.confirm-card p { color: var(--muted); }
.danger-icon { width: 50px; height: 50px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: #ffeded; color: var(--danger); font-size: 24px; font-weight: 900; }
.confirm-summary { padding: 14px; border-radius: 9px; background: #f7f8fb; margin: 20px 0; }
.confirm-summary strong, .confirm-summary span { display: block; }
.confirm-summary span { color: var(--muted); margin-top: 4px; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.25fr) minmax(420px,.75fr); background: #101827; }
.login-intro { color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 9vw; background: radial-gradient(circle at 15% 20%, rgba(54,101,230,.34), transparent 35%), linear-gradient(135deg,#111b30,#17233b); }
.brand-large { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .05em; }
.login-intro h1 { max-width: 720px; font-size: clamp(36px,4vw,62px); letter-spacing: -.055em; line-height: 1.04; margin: 50px 0 22px; }
.login-intro > p { color: #b6c2d5; max-width: 620px; font-size: 17px; line-height: 1.55; }
.login-feature-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 50px; max-width: 650px; }
.login-feature-grid div { border-top: 1px solid rgba(255,255,255,.17); padding-top: 15px; }
.login-feature-grid strong, .login-feature-grid span { display: block; }
.login-feature-grid strong { font-size: 21px; }
.login-feature-grid span { color: #95a4ba; margin-top: 4px; font-size: 12px; }
.login-card { background: #fff; align-self: center; margin: 45px; border-radius: 18px; padding: 45px; box-shadow: 0 20px 70px rgba(0,0,0,.3); }
.login-card h2 { font-size: 26px; margin: 0 0 8px; }
.login-card .muted { margin-bottom: 27px; }
@media (max-width: 1100px) {
    .main-content { padding: 20px; }
    .topbar { padding: 0 18px; gap: 14px; }
    .brand { min-width: auto; }
    .brand > span:last-child, .user-name { display: none; }
    .metric-grid { grid-template-columns: repeat(2,1fr); }
    .advanced-filters { grid-template-columns: repeat(3,1fr); }
    .detail-layout, .import-layout { grid-template-columns: 1fr; }
    .detail-sidebar { display: grid; grid-template-columns: repeat(2,1fr); }
    .login-intro { padding: 6vw; }
}
@media (max-width: 760px) {
    html { font-size: 14px; }
    .topbar { height: auto; min-height: 62px; flex-wrap: wrap; padding: 10px 12px; }
    .topnav { order: 3; width: 100%; overflow-x: auto; }
    .topnav a { white-space: nowrap; padding: 8px 10px; }
    .user-menu { margin-left: auto; }
    .main-content { padding: 16px 10px; }
    .page-heading, .result-heading { align-items: flex-start; flex-direction: column; }
    .heading-actions { width: 100%; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .search-row { flex-wrap: wrap; }
    .search-box { flex-basis: 100%; }
    .advanced-filters { grid-template-columns: 1fr 1fr; }
    .cols-2, .cols-3, .cols-4, .details-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .participant-header { display: none; }
    .participant-row { grid-template-columns: 1fr 120px 45px; }
    .participant-detail-list { grid-template-columns: 1fr; }
    .detail-sidebar { display: flex; }
    .sticky-actions { bottom: 5px; }
    .login-layout { grid-template-columns: 1fr; }
    .login-intro { display: none; }
    .login-card { margin: 18px; padding: 30px 24px; }
}
@media (max-width: 480px) {
    .metric-grid, .advanced-filters { grid-template-columns: 1fr; }
    .participant-row { grid-template-columns: 1fr; }
    .participant-remove { text-align: right; }
    .button { padding: 10px 12px; }
}

/* === CRM 0.2: compact document register without horizontal scrolling === */
.heading-actions { display:flex; gap:9px; align-items:center; flex-wrap:wrap; }
.button-disabled { opacity:.65; }
.filter-actions { display:flex; align-items:flex-end; }
.period-field.hidden { display:none; }
.document-register { display:flex; flex-direction:column; gap:10px; }
.document-row-card {
    display:grid;
    grid-template-columns:minmax(145px,.75fr) minmax(220px,1.45fr) minmax(190px,1.1fr) minmax(170px,.9fr) minmax(170px,.9fr);
    gap:16px;
    align-items:center;
    padding:17px 18px;
    border:1px solid var(--line);
    border-radius:13px;
    background:#fff;
    box-shadow:0 2px 10px rgba(25,42,70,.035);
    cursor:pointer;
    transition:border-color .15s, box-shadow .15s, transform .15s;
    min-width:0;
}
.document-row-card:hover, .document-row-card:focus { border-color:#aebfe8; box-shadow:0 9px 28px rgba(33,61,112,.10); transform:translateY(-1px); outline:none; }
.document-row-card > div { min-width:0; }
.document-card-identity { display:flex; flex-direction:column; gap:7px; }
.document-number-line { display:flex; align-items:baseline; gap:9px; }
.document-number-line strong { font-size:21px; letter-spacing:.045em; }
.document-number-line span, .document-card-identity small, .compact-meta, .document-card-participants small, .document-card-payment span, .card-label { color:var(--muted); font-size:11px; }
.document-type-pill { display:inline-flex; align-self:flex-start; padding:4px 8px; border-radius:999px; background:#eef3ff; color:#2d55ad; font-size:11px; font-weight:750; }
.document-card-main h2 { margin:0 0 5px; font-size:15px; line-height:1.3; white-space:normal; overflow-wrap:anywhere; }
.document-card-main p, .document-card-participants p, .document-card-state p { margin:0; line-height:1.4; overflow-wrap:anywhere; }
.compact-meta { display:flex; flex-wrap:wrap; gap:5px 12px; margin-top:8px; }
.card-label { display:block; text-transform:uppercase; letter-spacing:.04em; font-weight:800; margin-bottom:5px; }
.document-card-participants p, .document-card-state p { font-size:12px; }
.document-card-participants small { display:block; margin-top:5px; }
.document-card-payment { display:flex; flex-direction:column; align-items:flex-start; gap:5px; }
.document-card-payment > strong { font-size:16px; }
.document-card-payment .status-badge { margin-top:3px; }
.row-open-link { font-size:12px; font-weight:750; margin-top:6px; display:inline-block; }
.bulk-participant-box { padding:15px; background:#f7f9fe; border:1px solid #dbe4f5; border-radius:11px; margin-bottom:16px; }
.bulk-participant-grid { grid-template-columns:minmax(0,1fr) 230px; }
.bulk-participant-side { display:flex; flex-direction:column; gap:9px; justify-content:flex-end; }
.bulk-participant-side .field { margin:0; }
.generation-layout { display:grid; grid-template-columns:minmax(360px, .78fr) minmax(480px,1.22fr); gap:18px; align-items:start; }
.generation-fields { padding:22px; min-width:0; }
.generation-field-list { display:flex; flex-direction:column; gap:14px; }
.generation-preview-panel { position:sticky; top:82px; height:calc(100vh - 105px); border:1px solid var(--line); border-radius:13px; background:#e7ebf2; overflow:hidden; box-shadow:0 8px 30px rgba(20,35,65,.10); }
.preview-toolbar { height:58px; display:flex; justify-content:space-between; align-items:center; gap:20px; padding:0 16px; background:#fff; border-bottom:1px solid var(--line); }
.preview-toolbar strong, .preview-toolbar span { display:block; }
.preview-toolbar > div span, .preview-file-name { color:var(--muted); font-size:11px; }
.preview-file-name { max-width:45%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.document-preview-scroll { height:calc(100% - 58px); overflow:auto; padding:28px; scroll-behavior:smooth; }
.document-preview-page { width:min(100%, 760px); min-height:980px; margin:0 auto; padding:72px 68px; background:#fff; box-shadow:0 8px 30px rgba(10,20,35,.16); font-family:"Times New Roman", serif; font-size:15px; line-height:1.55; color:#111; }
.document-preview-page h2 { text-align:center; font-size:19px; }
.document-preview-page p { min-height:1em; white-space:pre-wrap; }
.preview-table { width:100%; border-collapse:collapse; margin:12px 0; }
.preview-table td { border:1px solid #777; padding:7px; vertical-align:top; white-space:pre-wrap; }
.template-token { background:#fff2b8; border-radius:2px; padding:0 2px; transition:background .2s, box-shadow .2s; white-space:pre-wrap; }
.template-token.empty-token { color:#a06d00; min-width:35px; display:inline-block; }
.template-token.active-token { background:#bcd2ff; box-shadow:0 0 0 3px rgba(47,91,190,.18); }
.preview-text { white-space:pre-wrap; }

@media (max-width: 1280px) {
    .document-row-card { grid-template-columns:145px minmax(230px,1.45fr) minmax(180px,1fr) minmax(170px,.9fr); }
    .document-card-state { grid-column:2 / -1; display:grid; grid-template-columns:150px 1fr auto; gap:12px; align-items:center; border-top:1px solid var(--line); padding-top:10px; }
    .document-card-state .card-label { margin:0; }
    .generation-layout { grid-template-columns:minmax(330px,.72fr) minmax(430px,1.28fr); }
}
@media (max-width: 980px) {
    .document-row-card { grid-template-columns:135px 1fr 180px; }
    .document-card-participants { grid-column:2 / 3; }
    .document-card-payment { grid-column:3; grid-row:1 / span 2; }
    .document-card-state { grid-column:1 / -1; }
    .generation-layout { grid-template-columns:1fr; }
    .generation-preview-panel { position:relative; top:auto; height:720px; }
}
@media (max-width: 700px) {
    .document-row-card { grid-template-columns:1fr; gap:12px; }
    .document-card-payment, .document-card-participants, .document-card-state { grid-column:auto; grid-row:auto; }
    .document-card-payment { padding:11px; background:#f6f8fc; border-radius:9px; }
    .document-card-state { display:block; border-top:1px solid var(--line); padding-top:10px; }
    .bulk-participant-grid { grid-template-columns:1fr; }
    .document-preview-scroll { padding:12px; }
    .document-preview-page { padding:42px 28px; min-height:800px; }
}
.preview-document-header { margin:-36px 0 34px; padding-bottom:12px; border-bottom:1px solid #d8d8d8; color:#444; font-size:12px; }
.preview-document-footer { margin:42px 0 -38px; padding-top:12px; border-top:1px solid #d8d8d8; color:#555; font-size:12px; }

/* Служебные формы прежних версий */
.contractor-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px}.contractor-card{display:block;color:inherit;text-decoration:none;transition:.18s ease}.contractor-card:hover{transform:translateY(-2px);box-shadow:0 14px 34px rgba(20,32,60,.12)}.contractor-card>div:first-child{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.contractor-card h2{font-size:18px;margin:0}.contractor-card dl,.lookup-result dl{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:16px 0}.contractor-card dt,.lookup-result dt{font-size:11px;text-transform:uppercase;color:var(--muted)}.contractor-card dd,.lookup-result dd{margin:3px 0 0;font-weight:700}.source-badge{white-space:nowrap;background:#eef3ff;color:#2856d7;border-radius:999px;padding:5px 9px;font-size:11px}.compact-search,.lookup-form{display:flex;gap:10px;align-items:end;margin-bottom:18px}.compact-search input,.lookup-form .field-group{flex:1}.contractor-form{padding:24px}.contractor-form .section-heading{margin-top:22px}.field-action-cell{display:flex;align-items:end;padding-bottom:2px;gap:8px;flex-direction:column}.field-action-cell small{min-height:18px;color:var(--muted)}.lookup-results{display:grid;gap:12px}.lookup-result{display:grid;grid-template-columns:auto 1fr;gap:14px;cursor:pointer}.lookup-result input{margin-top:6px}.page-subheading{display:flex;justify-content:space-between;align-items:center}.warning-panel{border-left:4px solid #f0a000;margin:16px 0}.warning-panel a{display:block;margin-top:8px}.inline-field-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:8px}.button-small{padding:7px 10px;font-size:12px}.text-link{font-size:12px}.contractor-picker>.field-group{margin:0}@media(max-width:720px){.compact-search,.lookup-form{align-items:stretch;flex-direction:column}.contractor-card dl,.lookup-result dl{grid-template-columns:1fr 1fr}.page-subheading{align-items:stretch;flex-direction:column;gap:10px}}

/* === CRM 0.4: Excel-like compact table and historical archive === */
.compact-metrics { margin-bottom: 14px; }
.registry-toolbar { display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap; margin-top:12px; }
.preset-tabs { display:flex; gap:4px; padding:4px; border-radius:10px; background:#eef1f6; overflow-x:auto; }
.preset-tabs a { padding:7px 12px; border-radius:7px; color:#526078; font-size:12px; font-weight:700; white-space:nowrap; }
.preset-tabs a.active { background:#fff; color:var(--primary); box-shadow:0 2px 8px rgba(31,48,78,.10); }
.rows-select { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:11px; }
.rows-select select { border:1px solid var(--line); border-radius:7px; padding:5px 8px; background:#fff; }
.registry-table-panel { padding:0; overflow:hidden; }
.registry-table-wrap { width:100%; overflow:visible; }
.registry-table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:12px; }
.registry-table th { background:#f5f7fa; color:#647084; font-size:10px; text-transform:uppercase; letter-spacing:.045em; text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); }
.registry-table td { padding:11px 12px; border-bottom:1px solid var(--line); vertical-align:top; min-width:0; }
.registry-table tbody tr.registry-data-row:hover, .legacy-table tbody tr:hover { background:#fafcff; }
.registry-table td strong, .registry-table td span, .registry-table td small, .registry-table td time { display:block; overflow:hidden; text-overflow:ellipsis; }
.registry-table td strong { color:var(--text); line-height:1.35; }
.registry-table td span { margin-top:4px; color:#4d5b70; line-height:1.35; }
.registry-table td small, .registry-table td time { margin-top:4px; color:var(--muted); font-size:10px; }
.registry-table .col-id { width:12%; }
.registry-table .col-type { width:12%; }
.registry-table .col-contractor { width:24%; }
.registry-table .col-participants { width:19%; }
.registry-table .col-payment { width:15%; }
.registry-table .col-workflow { width:14%; }
.registry-table .col-actions { width:58px; text-align:right; white-space:nowrap; }
.icon-button { display:inline-grid; place-items:center; min-width:29px; height:29px; padding:0 7px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--primary); cursor:pointer; margin-left:3px; font-weight:800; }
.icon-button:hover { background:#edf3ff; border-color:#b9c9ee; }
.quick-edit-row td { background:#f6f9ff; padding:15px 18px; }
.quick-edit-form { display:grid; grid-template-columns:130px minmax(220px,1.4fr) minmax(190px,1.2fr) 130px 170px 145px; gap:10px; align-items:end; }
.quick-edit-form label { display:flex; flex-direction:column; gap:5px; color:var(--muted); font-size:10px; }
.quick-edit-form input, .quick-edit-form select { width:100%; border:1px solid #cfd8e7; border-radius:7px; padding:8px 9px; background:#fff; color:var(--text); }
.quick-edit-form .wide { grid-column:span 3; }
.quick-edit-actions { grid-column:span 3; display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.quick-edit-actions [data-save-state] { color:var(--success); font-size:11px; }
.quick-edit-actions [data-save-state].error { color:var(--danger); }
.empty-table { text-align:center; padding:35px !important; color:var(--muted); }
.preset-payment .col-participants { display:none; }
.preset-payment .col-workflow { width:22%; }
.preset-participants .col-payment, .preset-participants .col-workflow { display:none; }
.preset-participants .col-participants { width:34%; }
.preset-workflow .col-participants { display:none; }
.preset-workflow .col-workflow { width:28%; }
.legacy-table th:nth-child(1) { width:14%; } .legacy-table th:nth-child(2) { width:13%; }
.legacy-table th:nth-child(3) { width:23%; } .legacy-table th:nth-child(4) { width:21%; }
.legacy-table th:nth-child(5) { width:13%; } .legacy-table th:nth-child(6) { width:12%; }
.muted code { word-break:break-all; }
@media (max-width:1100px) {
  .registry-table { font-size:11px; }
  .registry-table th, .registry-table td { padding:9px 8px; }
  .registry-table .col-type { display:none; }
  .quick-edit-form { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .registry-table, .registry-table thead, .registry-table tbody, .registry-table tr, .registry-table td { display:block; }
  .registry-table thead { display:none; }
  .registry-data-row, .legacy-table tr { padding:12px; border-bottom:1px solid var(--line); }
  .registry-table td { border:0; padding:5px 0; width:auto !important; }
  .registry-table .col-type { display:block; }
  .registry-table .col-actions { text-align:left; }
  .quick-edit-row td { padding:10px; }
  .quick-edit-form { grid-template-columns:1fr; }
  .quick-edit-form .wide, .quick-edit-actions { grid-column:auto; }
}

/* 0.5.0 — единый исторический реестр */
.group-actions{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--line);background:#fbfcfe}.group-actions>span{margin-left:auto;color:var(--muted);font-size:11px}.year-divider td,.month-divider td{padding:0!important;border-bottom:1px solid var(--line)!important;background:#eef2f8!important}.month-divider td{background:#f7f9fc!important}.group-toggle{width:100%;border:0;background:transparent;display:flex;align-items:center;gap:10px;padding:11px 14px;cursor:pointer;text-align:left;color:var(--text)}.month-toggle{padding:8px 28px}.group-toggle strong{font-size:14px}.month-toggle strong{font-size:12px}.group-toggle small{margin:0!important;color:var(--muted)!important}.toggle-chevron{width:16px;font-size:18px;color:#567}.muted-badge{background:#f0f1f3;color:#657080}.main-history-table th:nth-child(1){width:14%}.main-history-table th:nth-child(2){width:13%}.main-history-table th:nth-child(3){width:23%}.main-history-table th:nth-child(4){width:20%}.main-history-table th:nth-child(5){width:14%}.main-history-table th:nth-child(6){width:12%}.totals-strip{display:flex;gap:10px;flex-wrap:wrap;margin:-6px 0 16px}.totals-strip>span{display:flex;gap:8px;align-items:baseline;background:#fff;border:1px solid var(--line);border-radius:10px;padding:8px 12px}.totals-strip small{color:var(--muted)}.rows-picker{display:flex;align-items:center;gap:8px;margin-left:auto}.rows-picker label{font-size:11px;color:var(--muted)}.rows-picker select{width:90px}.quick-edit-row td{background:#f7faff!important}.quick-edit-grid{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:10px}.quick-edit-grid label{font-size:10px;text-transform:uppercase;color:var(--muted)}.quick-edit-grid label .form-control{margin-top:5px;text-transform:none}.quick-edit-grid .span-2{grid-column:span 2}.quick-edit-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:10px}.quick-edit-actions [data-save-state]{margin-right:auto;color:var(--muted)}.quick-edit-actions [data-save-state].error{color:#b42318}.record-form input[type=checkbox].form-control{width:auto;min-height:auto}.confirm-panel{max-width:620px;margin:60px auto;padding:28px}.button-danger{background:#b42318;color:white;border-color:#b42318}
@media(max-width:1100px){.quick-edit-grid{grid-template-columns:repeat(3,minmax(140px,1fr))}.main-history-table th:nth-child(2){display:none}.main-history-table td:nth-child(2){display:none}.group-actions>span{display:none}}
@media(max-width:720px){.group-actions{flex-wrap:wrap}.rows-picker{margin-left:0}.year-divider,.month-divider{display:table-row!important}.year-divider td,.month-divider td{display:table-cell!important}.main-history-table td:nth-child(2){display:block}.quick-edit-grid{grid-template-columns:1fr}.quick-edit-grid .span-2{grid-column:auto}}


/* CRM 0.5.2: полноширинный реестр без горизонтальной прокрутки */
html, body, .app-shell { width:100%; max-width:100%; overflow-x:clip; }
.main-content { width:100%; max-width:none; min-width:0; padding-inline:clamp(14px,2.1vw,34px); }
.page-heading, .filter-panel, .metric-grid, .totals-strip, .registry-table-panel { min-width:0; max-width:100%; }
.registry-sheet-panel { overflow:visible; }
.registry-sheet { width:100%; min-width:0; }
.sheet-divider { width:100%; border-bottom:1px solid var(--line); }
.registry-record { position:relative; width:100%; min-width:0; padding:12px 58px 12px 12px; border-bottom:1px solid var(--line); background:#fff; }
.registry-record:hover { background:#fafcff; }
.record-grid { display:grid; grid-template-columns:minmax(138px,.8fr) minmax(160px,1.05fr) minmax(160px,1fr) minmax(210px,1.35fr) minmax(165px,1fr) minmax(175px,1.05fr); gap:10px; align-items:stretch; min-width:0; }
.record-block { min-width:0; padding:10px; border:1px solid #e7eaf0; border-radius:10px; background:#fbfcfe; }
.record-block-title { margin-bottom:7px; color:#667085; font-size:9px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.record-number-line { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin-bottom:8px; }
.record-number-line strong { font-size:17px; white-space:nowrap; }
.record-number-line time { color:var(--muted); font-size:10px; white-space:nowrap; }
.record-primary { font-weight:750; line-height:1.35; margin-bottom:8px; }
.record-block dl { display:grid; grid-template-columns:minmax(62px,.5fr) minmax(0,1.5fr); gap:4px 7px; margin:0; font-size:10px; }
.record-block dt { color:var(--muted); }
.record-block dd { min-width:0; margin:0; color:#344054; overflow-wrap:anywhere; word-break:break-word; }
.prewrap { white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; }
.record-long-value { max-height:none; overflow:visible; font-size:10px; line-height:1.35; }
.record-actions { position:absolute; top:12px; right:12px; display:flex; flex-direction:column; gap:6px; }
.record-actions .icon-button { display:grid; place-items:center; background:#eef3ff; color:var(--primary); }
.sheet-quick-edit { padding:14px; border-bottom:1px solid var(--line); background:#f7faff; }
.record-page { width:100%; max-width:1540px; margin:0 auto; padding-inline:clamp(4px,1vw,14px); }
.record-heading { padding-inline:clamp(8px,1.2vw,18px); }
.record-form { width:100%; min-width:0; overflow:hidden; padding:clamp(22px,2.5vw,38px); margin:0 auto; }
.record-form .section-heading:not(:first-of-type) { margin-top:30px; }
.form-grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.span-4 { grid-column:span 4; }
.source-meta { display:flex; flex-wrap:wrap; gap:8px 16px; margin:26px 0 0; padding:14px; border-radius:10px; background:#f7f9fc; color:var(--muted); font-size:11px; }
.source-meta strong { color:var(--text); }
@media (max-width:1450px) { .record-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:980px) { .record-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .form-grid-4 { grid-template-columns:repeat(2,minmax(0,1fr)); } .span-4 { grid-column:span 2; } }
@media (max-width:620px) { .main-content { padding-inline:10px; } .registry-record { padding:10px 48px 10px 10px; } .record-grid { grid-template-columns:1fr; } .record-form { padding:18px 14px; border-radius:10px; } .form-grid-4 { grid-template-columns:1fr; } .form-grid-4 .span-2, .span-4 { grid-column:auto; } .record-number-line { align-items:flex-start; flex-direction:column; } }
.topbar, .topnav, .user-menu { min-width:0; max-width:100%; }
@media (max-width:1200px) and (min-width:761px) { .topnav { flex-wrap:wrap; align-content:center; } .topnav a { padding:7px 9px; } }

/* CRM 0.5.3 — читаемый реестр, инфографика и графические сворачиватели */
.registry-insights { display:grid; gap:14px; margin-bottom:16px; }
.registry-kpis { grid-template-columns:repeat(4,minmax(0,1fr)); margin-bottom:0; }
.registry-kpis .metric-card { position:relative; min-height:116px; padding:17px 18px 15px; overflow:hidden; }
.registry-kpis .metric-card > span:not(.metric-icon) { font-size:12px; }
.registry-kpis .metric-card strong { margin-top:5px; font-size:28px; line-height:1.05; }
.registry-kpis .metric-card small { display:block; margin-top:7px; color:var(--muted); font-size:11px; }
.metric-icon { position:absolute; right:14px; top:13px; display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:#edf3ff; color:var(--primary); font-size:16px; font-weight:850; }
.metric-primary { border-color:#cbd8ff; background:linear-gradient(145deg,#fff 30%,#f1f5ff); }
.metric-danger { border-color:#f1c7c4; background:linear-gradient(145deg,#fff 30%,#fff3f2); }
.metric-danger .metric-icon { background:#fee4e2; color:#b42318; }
.insight-panels { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr); gap:14px; }
.insight-panel { min-width:0; padding:16px 18px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow:0 4px 15px rgba(31,48,78,.04); }
.insight-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.insight-heading strong, .insight-heading small { display:block; }
.insight-heading strong { font-size:14px; }
.insight-heading small { margin-top:2px; color:var(--muted); font-size:10px; }
.participation-stack { display:flex; width:100%; height:13px; overflow:hidden; border-radius:999px; background:#eef1f5; }
.participation-stack .segment { width:var(--segment-width); min-width:2px; height:100%; }
.segment-offline { background:#3068d9!important; }
.segment-online { background:#12a071!important; }
.segment-mixed { background:#8d5bd6!important; }
.segment-unknown { background:#a7afbd!important; }
.chart-legend { display:flex; flex-wrap:wrap; gap:9px 15px; margin-top:12px; color:#58657a; font-size:10px; }
.chart-legend span { display:flex; align-items:center; gap:5px; }
.chart-legend strong { color:var(--text); }
.legend-dot { width:8px; height:8px; border-radius:50%; }
.mini-bar-chart { display:grid; gap:8px; }
.mini-bar-row { display:grid; grid-template-columns:minmax(90px,1fr) minmax(100px,1.5fr) auto; align-items:center; gap:9px; font-size:10px; }
.mini-bar-row > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#58657a; }
.mini-bar-row > div { height:7px; overflow:hidden; border-radius:999px; background:#edf0f5; }
.mini-bar-row i { display:block; width:var(--bar-width); height:100%; border-radius:inherit; background:linear-gradient(90deg,#4775df,#75a2ff); }

/* Графический элемент сворачивания вместо текстового символа */
.toggle-chevron { display:none!important; }
.collapse-icon { position:relative; flex:0 0 22px; width:22px; height:22px; border:1px solid #c9d2df; border-radius:7px; background:#fff; box-shadow:0 1px 2px rgba(31,48,78,.06); }
.collapse-icon::before, .collapse-icon::after { content:""; position:absolute; left:5px; right:5px; top:10px; height:2px; border-radius:2px; background:#526078; transition:transform .18s ease, opacity .18s ease; }
.collapse-icon::after { transform:rotate(90deg); }
.group-toggle[aria-expanded="true"] .collapse-icon::after { opacity:0; transform:rotate(0); }
.group-toggle[aria-expanded="false"] .collapse-icon::after { opacity:1; transform:rotate(90deg); }
.group-toggle:hover .collapse-icon { border-color:#8fa6cc; background:#f2f6ff; }

/* Читаемость записей */
.registry-record { padding-top:14px; padding-bottom:14px; }
.record-grid { gap:12px; }
.record-block { padding:12px; }
.record-block-title { font-size:10px; }
.record-number-line strong { font-size:18px; }
.record-number-line time { font-size:11px; }
.record-primary { font-size:13px; line-height:1.42; }
.record-block dl { grid-template-columns:minmax(76px,.58fr) minmax(0,1.42fr); gap:6px 8px; font-size:11.5px; line-height:1.4; }
.record-long-value { font-size:11.5px; line-height:1.45; }
.format-badge, .review-badge { display:inline-flex; align-items:center; max-width:100%; padding:3px 7px; border-radius:999px; font-size:9px; font-weight:850; letter-spacing:.03em; }
.format-offline { background:#e8f0ff; color:#2658bd; }
.format-online { background:#ddf6ed; color:#087a56; }
.format-mixed { background:#efe7fb; color:#6d3fb2; }
.format-unknown { background:#eef0f3; color:#657080; }
.review-badge-neutral { background:#edf1f6; color:#596579; }
.review-badge-danger { background:#fee4e2; color:#b42318; border:1px solid #f7b8b2; }
.source-link { display:inline-flex; align-items:center; gap:4px; color:var(--primary); font-weight:700; text-decoration:none; }
.source-link:hover { text-decoration:underline; }
.calculation-formula, .calculation-result { display:block; overflow-wrap:anywhere; }
.calculation-result { margin-top:2px; color:#126a4d; font-weight:800; }

/* Карточка записи и исходная строка */
.formula-live-result { min-height:18px; margin-top:5px; color:#126a4d; font-size:11px; font-weight:750; }
.formula-live-result.error { color:#b42318; }
.record-form input[readonly] { background:#f3f5f8; color:#475467; cursor:not-allowed; }
.source-meta a { color:var(--primary); font-weight:700; }
.source-record-page { max-width:1250px; }
.source-record-summary, .source-record-data { padding:22px; margin-bottom:16px; }
.source-record-summary dl { display:grid; grid-template-columns:150px minmax(0,1fr); gap:9px 16px; margin:0; }
.source-record-summary dt { color:var(--muted); }
.source-record-summary dd { min-width:0; margin:0; overflow-wrap:anywhere; }
.source-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:10px; }
.source-table { width:100%; border-collapse:collapse; font-size:12px; }
.source-table th, .source-table td { padding:10px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
.source-table th { background:#f6f8fb; color:#667085; font-size:10px; text-transform:uppercase; }
.source-table tr:last-child td { border-bottom:0; }

@media (max-width:1100px) {
  .registry-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .insight-panels { grid-template-columns:1fr; }
}
@media (max-width:620px) {
  .registry-kpis { grid-template-columns:1fr; }
  .mini-bar-row { grid-template-columns:minmax(75px,1fr) minmax(80px,1fr) auto; }
  .source-record-summary dl { grid-template-columns:1fr; gap:3px; }
  .source-record-summary dd { margin-bottom:8px; }
}

/* CRM 0.6.0 — связанные документы, кликабельные показатели и исправленная инфографика */
.registry-kpis .metric-card-link {
  display:block;
  color:inherit;
  text-decoration:none;
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.registry-kpis .metric-card-link:hover {
  transform:translateY(-1px);
  border-color:#9fb4df;
  box-shadow:0 7px 22px rgba(31,48,78,.10);
}
.registry-kpis .metric-card-link.is-active {
  box-shadow:0 0 0 2px rgba(54,104,209,.14), 0 7px 20px rgba(31,48,78,.08);
}
.registry-kpis .metric-icon {
  margin:0!important;
  padding:0;
  line-height:0;
  overflow:hidden;
}
.registry-kpis .metric-icon svg {
  display:block;
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.preset-tabs .review-tab { color:#9d241d; }
.preset-tabs .review-tab.active { background:#b42318; color:#fff; border-color:#b42318; }

.relation-summary {
  margin-top:10px;
  padding:9px 10px;
  border:1px solid #d7deea;
  border-radius:9px;
  background:#f7f9fc;
  font-size:10.5px;
  line-height:1.4;
}
.relation-title { display:grid; gap:3px; }
.relation-title > strong { color:#26364f; font-size:11.5px; }
.relation-title a, .relation-linked a, .relation-candidates a { color:var(--primary); font-weight:800; text-decoration:none; }
.relation-title a:hover, .relation-linked a:hover, .relation-candidates a:hover { text-decoration:underline; }
.relation-missing { color:#b42318!important; font-weight:900!important; }
.relation-status-missing, .relation-status-not_found { border-color:#f0b7b2; background:#fff4f3; }
.relation-status-candidates { border-color:#e5c36d; background:#fffaf0; }
.relation-status-linked { border-color:#9bd5bf; background:#f0fbf6; }
.relation-linked { margin-top:6px; color:#087a56; font-weight:700; }
.relation-warning { margin-top:6px; color:#b42318; font-weight:850; }
.relation-candidates { display:flex; flex-wrap:wrap; align-items:center; gap:4px; margin-top:7px; }
.relation-candidates > span { flex-basis:100%; color:#7a5b11; font-weight:750; }
.relation-candidates a { padding:2px 5px; border:1px solid #d8c077; border-radius:5px; background:#fff; font-size:9.5px; }

.is-hidden { display:none!important; }
.form-grid-3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.relation-editor {
  margin-top:18px;
  padding:18px;
  border:1px solid #cbd7ed;
  border-radius:12px;
  background:linear-gradient(145deg,#fbfdff,#f4f7fd);
}
.relation-editor-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:10px; }
.relation-editor-heading h3 { margin:2px 0 0; font-size:20px; }
.relation-state { display:inline-flex; align-items:center; min-height:30px; padding:5px 9px; border-radius:999px; background:#edf1f6; color:#526078; font-size:10px; font-weight:850; }
.relation-state-missing, .relation-state-not_found { background:#fee4e2; color:#b42318; }
.relation-state-candidates { background:#fff0c7; color:#825c00; }
.relation-state-linked { background:#dcf7ec; color:#087a56; }
.relation-source-value { margin:0 0 14px; color:#667085; font-size:12px; white-space:pre-wrap; }
.relation-fields { margin-top:8px; }
.relation-readable { display:flex; flex-wrap:wrap; gap:7px 12px; align-items:baseline; margin-top:15px; padding:12px; border-radius:9px; background:#fff; border:1px solid #dbe2ed; font-size:13px; }
.relation-readable > strong { font-size:15px; }
.relation-readable a { color:var(--primary); font-weight:850; }
.relation-linked-card, .relation-warning-card { margin-top:12px; padding:11px 12px; border-radius:9px; font-weight:750; }
.relation-linked-card { background:#e8f8f1; color:#087a56; border:1px solid #a6dcc8; }
.relation-linked-card a { color:#076348; }
.relation-warning-card { background:#fff0ef; color:#b42318; border:1px solid #efb5b0; font-size:13px; font-weight:900; }
.relation-candidate-list { display:grid; gap:7px; margin-top:12px; }
.relation-candidate-list > strong { font-size:13px; }
.relation-candidate-list > p { margin:0 0 2px; color:#667085; font-size:11px; }
.relation-candidate-list > a { display:grid; grid-template-columns:minmax(90px,auto) 1fr; gap:10px; align-items:center; padding:9px 10px; border:1px solid #d8dfeb; border-radius:8px; background:#fff; color:inherit; text-decoration:none; }
.relation-candidate-list > a:hover { border-color:#91a8d2; background:#f8faff; }
.relation-candidate-list > a span { color:var(--primary); font-weight:900; }
.relation-candidate-list > a small { min-width:0; color:#596579; overflow-wrap:anywhere; }

.formula-live-result {
  min-height:44px;
  margin-top:8px;
  padding:10px 12px;
  border:1px solid #9bd5bf;
  border-radius:9px;
  background:#eefaf5;
  color:#087a56;
  font-size:19px;
  line-height:1.2;
  font-weight:900;
  letter-spacing:-.01em;
}
.formula-live-result:empty { display:none; }
.formula-live-result.error { border-color:#efb5b0; background:#fff1f0; color:#b42318; font-size:13px; }

@media (max-width:980px) {
  .form-grid-3 { grid-template-columns:1fr; }
  .relation-editor-heading { flex-direction:column; gap:8px; }
}
@media (max-width:620px) {
  .relation-editor { padding:13px; }
  .relation-candidate-list > a { grid-template-columns:1fr; gap:3px; }
}

/* 0.6.0: точное центрирование SVG внутри квадратов показателей */
.registry-kpis .metric-icon {
  box-sizing:border-box;
  display:flex!important;
  align-items:center;
  justify-content:center;
  flex:0 0 32px;
}
.registry-kpis .metric-icon svg {
  flex:0 0 19px;
  max-width:19px;
  max-height:19px;
  overflow:visible;
}
.contract-search-notice { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:0 0 14px; padding:11px 14px; border:1px solid #b9c9e8; border-radius:10px; background:#f2f6ff; color:#334968; font-size:12px; }
.contract-search-notice a { color:var(--primary); font-weight:800; white-space:nowrap; }
@media (max-width:620px) { .contract-search-notice { align-items:flex-start; flex-direction:column; } }

/* CRM 0.6.7: spreadsheet-style registry view */
.registry-view-switch{display:inline-flex;align-items:center;padding:3px;border:1px solid var(--line);border-radius:10px;background:#f4f6f9;gap:2px}
.view-switch-button{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:7px 11px;border-radius:7px;color:#475467;font-size:12px;font-weight:750;text-decoration:none;white-space:nowrap}
.view-switch-button:hover{background:#fff;color:var(--primary)}
.view-switch-button.is-active{background:#fff;color:var(--primary);box-shadow:0 1px 4px rgba(16,24,40,.12)}
.view-switch-button span{font-size:16px;line-height:1}

.spreadsheet-panel{position:relative;min-width:0;overflow:hidden}
.spreadsheet-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 12px;border-bottom:1px solid var(--line);background:#f8fafc}
.spreadsheet-toolbar>div:first-child{display:flex;align-items:baseline;gap:10px;min-width:0}
.spreadsheet-toolbar strong{font-size:13px}
.spreadsheet-toolbar span{color:var(--muted);font-size:11px}
.spreadsheet-tools{display:flex;gap:8px;flex-wrap:wrap}
.spreadsheet-scroll{position:relative;width:100%;max-height:70vh;overflow:auto;overscroll-behavior:contain;background:#fff;scrollbar-gutter:stable}
.spreadsheet-scroll:focus{outline:2px solid rgba(47,111,237,.22);outline-offset:-2px}
.spreadsheet-table{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:12px;color:var(--text)}
.spreadsheet-table th,.spreadsheet-table td{height:42px;padding:8px 10px;border-right:1px solid #dde3eb;border-bottom:1px solid #e3e8ef;vertical-align:top;background:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.spreadsheet-table th{position:sticky;top:0;z-index:20;height:44px;background:#eaf0f8;color:#344054;font-size:10px;font-weight:850;letter-spacing:.03em;text-align:left;text-transform:uppercase;box-shadow:0 1px 0 #cfd8e5}
.spreadsheet-table th a{display:flex;align-items:center;justify-content:space-between;gap:8px;color:inherit;text-decoration:none}
.spreadsheet-table th a:hover{color:var(--primary)}
.spreadsheet-table tbody tr:nth-child(even) td{background:#f9fbfd}
.spreadsheet-table tbody tr:hover td{background:#eef5ff}
.spreadsheet-table td small{display:block;margin-top:4px;color:#667085;font-size:10px;line-height:1.3}
.spreadsheet-table td a{position:relative;z-index:1}
.sheet-sort{color:#7b8798;font-size:11px}
.sheet-number{text-align:right;font-variant-numeric:tabular-nums}
.sheet-cell-main{display:block;font-weight:700}
.sheet-long-cell{max-width:320px}
.spreadsheet-table th:nth-child(1),.spreadsheet-table td:nth-child(1){width:145px;min-width:145px;max-width:145px}
.spreadsheet-table th:nth-child(2),.spreadsheet-table td:nth-child(2){width:105px;min-width:105px;max-width:105px}
.spreadsheet-table th:nth-child(3),.spreadsheet-table td:nth-child(3){width:210px;min-width:210px;max-width:210px}
.spreadsheet-table th:nth-child(4),.spreadsheet-table td:nth-child(4){width:230px;min-width:230px;max-width:230px}
.spreadsheet-table th:nth-child(5),.spreadsheet-table td:nth-child(5){width:260px;min-width:260px;max-width:260px}
.spreadsheet-table th:nth-child(6),.spreadsheet-table td:nth-child(6){width:190px;min-width:190px;max-width:190px}
.spreadsheet-table th:nth-child(7),.spreadsheet-table td:nth-child(7){width:190px;min-width:190px;max-width:190px}
.spreadsheet-table th:nth-child(8),.spreadsheet-table td:nth-child(8){width:125px;min-width:125px;max-width:125px}
.spreadsheet-table th:nth-child(9),.spreadsheet-table td:nth-child(9){width:150px;min-width:150px;max-width:150px}
.spreadsheet-table th:nth-child(10),.spreadsheet-table td:nth-child(10){width:210px;min-width:210px;max-width:210px}
.spreadsheet-table th:nth-child(11),.spreadsheet-table td:nth-child(11){width:100px;min-width:100px;max-width:100px}
.spreadsheet-table th:nth-child(12),.spreadsheet-table td:nth-child(12){width:320px;min-width:320px;max-width:320px}
.spreadsheet-table th:nth-child(13),.spreadsheet-table td:nth-child(13){width:160px;min-width:160px;max-width:160px}
.spreadsheet-table th:nth-child(14),.spreadsheet-table td:nth-child(14){width:190px;min-width:190px;max-width:190px}
.spreadsheet-table th:nth-child(15),.spreadsheet-table td:nth-child(15){width:130px;min-width:130px;max-width:130px}
.spreadsheet-table th:nth-child(16),.spreadsheet-table td:nth-child(16){width:90px;min-width:90px;max-width:90px}
.spreadsheet-table th:nth-child(17),.spreadsheet-table td:nth-child(17){width:125px;min-width:125px;max-width:125px}
.spreadsheet-table th:nth-child(18),.spreadsheet-table td:nth-child(18){width:165px;min-width:165px;max-width:165px}
.spreadsheet-table th:nth-child(19),.spreadsheet-table td:nth-child(19){width:120px;min-width:120px;max-width:120px}
.spreadsheet-table th:nth-child(20),.spreadsheet-table td:nth-child(20){width:180px;min-width:180px;max-width:180px}
.spreadsheet-table th:nth-child(21),.spreadsheet-table td:nth-child(21){width:180px;min-width:180px;max-width:180px}
.spreadsheet-table th:nth-child(22),.spreadsheet-table td:nth-child(22){width:300px;min-width:300px;max-width:300px}
.spreadsheet-table th:nth-child(23),.spreadsheet-table td:nth-child(23){width:130px;min-width:130px;max-width:130px}
.spreadsheet-table th:nth-child(24),.spreadsheet-table td:nth-child(24){width:180px;min-width:180px;max-width:180px}
.spreadsheet-table th:nth-child(25),.spreadsheet-table td:nth-child(25){width:150px;min-width:150px;max-width:150px}
.sheet-sticky-col{position:sticky!important;z-index:9}
.sheet-col-number{left:0}
.sheet-col-date{left:145px}
.spreadsheet-table thead .sheet-sticky-col{z-index:31;background:#dfe8f4}
.spreadsheet-table tbody .sheet-sticky-col{box-shadow:1px 0 0 #d8e0ea}
.spreadsheet-table tbody tr:nth-child(even) .sheet-sticky-col{background:#f9fbfd}
.spreadsheet-table tbody tr:hover .sheet-sticky-col{background:#eef5ff}
.sheet-action-col{position:sticky!important;right:0;z-index:10;background:#fff!important;box-shadow:-1px 0 0 #d8e0ea}
.spreadsheet-table thead .sheet-action-col{z-index:32;background:#dfe8f4!important}
.spreadsheet-table tbody tr:nth-child(even) .sheet-action-col{background:#f9fbfd!important}
.spreadsheet-table tbody tr:hover .sheet-action-col{background:#eef5ff!important}
.table-open-card{display:inline-flex;justify-content:center;width:100%;white-space:nowrap}
.spreadsheet-panel.is-wrapped .spreadsheet-table th,.spreadsheet-panel.is-wrapped .spreadsheet-table td{height:auto;min-height:42px;white-space:normal;overflow:visible;text-overflow:clip;line-height:1.35}
.spreadsheet-panel.is-wrapped .sheet-long-cell{max-width:none}
.spreadsheet-panel.is-fullscreen{position:fixed;inset:8px;z-index:1000;margin:0!important;border-radius:12px;background:#fff;box-shadow:0 22px 70px rgba(16,24,40,.3)}
.spreadsheet-panel.is-fullscreen .spreadsheet-scroll{max-height:calc(100vh - 66px);height:calc(100vh - 66px)}
body.spreadsheet-fullscreen-open{overflow:hidden}
@media(max-width:760px){.registry-view-switch{width:100%}.view-switch-button{flex:1;justify-content:center}.spreadsheet-toolbar{align-items:flex-start;flex-direction:column}.spreadsheet-tools{width:100%}.spreadsheet-tools .button{flex:1}.spreadsheet-scroll{max-height:68vh}}


/* CRM 0.6.8: Jspreadsheet CE 5 open-source spreadsheet */
.spreadsheet-statusbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:8px 12px;border-bottom:1px solid var(--line);background:#fff;color:#667085;font-size:11px}
.spreadsheet-status{display:inline-flex;align-items:center;gap:6px;min-width:max-content;padding:5px 9px;border-radius:999px;font-weight:800}
.spreadsheet-status::before{content:"";width:7px;height:7px;border-radius:50%;background:#98a2b3}
.spreadsheet-status.is-saved{background:#ecfdf3;color:#067647}.spreadsheet-status.is-saved::before{background:#12b76a}
.spreadsheet-status.is-saving{background:#eff8ff;color:#175cd3}.spreadsheet-status.is-saving::before{background:#2e90fa;animation:sheetPulse 1s infinite}
.spreadsheet-status.is-dirty{background:#fffaeb;color:#b54708}.spreadsheet-status.is-dirty::before{background:#f79009}
.spreadsheet-status.is-error{background:#fef3f2;color:#b42318}.spreadsheet-status.is-error::before{background:#f04438}
@keyframes sheetPulse{50%{opacity:.25}}
.spreadsheet-search{display:flex;align-items:center;gap:6px;color:#667085;font-size:11px;font-weight:700}.spreadsheet-search input{width:210px;min-height:32px;padding:5px 9px}
.spreadsheet-load-error{padding:18px;border-top:1px solid #fda29b;background:#fef3f2;color:#b42318;font-weight:700}.spreadsheet-load-error a{color:inherit;text-decoration:underline}
@media(max-width:900px){.spreadsheet-statusbar{align-items:flex-start;flex-direction:column;gap:7px}.spreadsheet-search{width:100%}.spreadsheet-search input{width:100%}}


/* CRM 0.6.10: separate RevoGrid 4.24.2 comparison view */
.revogrid-host{display:block;width:100%;height:68vh;min-height:480px;background:#fff;--rgRow-size:42px;--rgHeader-size:44px}
.revogrid-panel .sheet-open-card{display:inline-flex;align-items:center;justify-content:center;min-height:28px;text-decoration:none;white-space:nowrap}
.revogrid-panel .sheet-cell-link{display:inline-flex;align-items:center;min-height:28px}
.revogrid-panel.is-fullscreen .revogrid-host{height:calc(100vh - 150px);min-height:0}
@media(max-width:900px){.revogrid-host{height:66vh;min-height:420px}}

/* CRM 0.6.13: RevoGrid workspace with formatting, navigation and row tools */
.revogrid-heading-toolbar{min-height:50px}
.revogrid-format-toolbar{display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:8px 10px;border-bottom:1px solid var(--line);background:#f3f6fa}
.revogrid-tool-group{display:inline-flex;align-items:center;gap:3px;padding-right:7px;border-right:1px solid #d7dee8}
.grid-tool-button{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:30px;padding:0 7px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#344054;font-size:12px;font-weight:800;line-height:1;cursor:pointer}
.grid-tool-button:hover:not(:disabled){border-color:#8aa8d8;background:#eef5ff;color:#175cd3}
.grid-tool-button.is-active{border-color:#6d94d5;background:#dbeafe;color:#1849a9;box-shadow:inset 0 0 0 1px rgba(24,73,169,.1)}
.grid-tool-button:disabled{opacity:.42;cursor:not-allowed}
.grid-tool-bold{font-weight:900}.grid-tool-italic{font-family:Georgia,serif;font-style:italic}.grid-tool-underline{text-decoration:underline}.grid-tool-clear{min-width:auto;padding-inline:9px;font-size:10px}
.grid-color-control{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:30px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;overflow:hidden;cursor:pointer}
.grid-color-control span{font-size:12px;font-weight:900;text-decoration:underline;text-decoration-thickness:3px;text-decoration-color:#e11d48}
.grid-fill-control span{text-decoration:none;color:#eab308}
.grid-color-control input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.revogrid-formula-bar{display:flex;align-items:center;gap:6px;flex:1 1 430px;min-width:280px}
.formula-cell-address{display:inline-flex;align-items:center;justify-content:center;min-width:58px;height:30px;padding:0 7px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#475467;font-size:10px;font-weight:850;white-space:nowrap}
.revogrid-formula-bar input{height:30px;min-height:30px;min-width:180px;flex:1;padding:4px 8px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px}
.revogrid-formula-bar output{max-width:230px;color:#067647;font-size:10px;font-weight:750;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.revogrid-formula-bar output.is-invalid{color:#b42318}.revogrid-formula-bar output.is-valid{color:#067647}
.revogrid-panel .sheet-compact-action{display:inline-flex;align-items:center;justify-content:center;min-height:22px!important;height:22px;padding:2px 6px!important;border-radius:5px;font-size:9px!important;line-height:1;text-decoration:none;white-space:nowrap}
.revogrid-panel .sheet-compact-link{display:inline-flex;align-items:center;min-height:22px;font-size:9px;font-weight:800;white-space:nowrap}
.review-badge-compact{display:inline-flex!important;align-items:center;min-height:20px!important;max-width:108px;padding:2px 5px!important;border-radius:5px!important;font-size:8px!important;line-height:1.15!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.registry-pagination{display:flex;align-items:center;justify-content:center;gap:7px;flex-wrap:wrap;margin:16px 0 4px}
.registry-pagination>a,.pagination-jump{min-height:34px;border:1px solid var(--line);border-radius:8px;background:#fff}
.registry-pagination>a{display:inline-flex;align-items:center;justify-content:center;padding:6px 11px;color:var(--text);font-size:11px;font-weight:800;text-decoration:none}
.registry-pagination>a:hover{border-color:#97b6e7;color:var(--primary);background:#f4f8ff}
.registry-pagination>a.is-disabled{pointer-events:none;opacity:.45;background:#f5f7fa}
.pagination-step{min-width:34px;padding-inline:8px!important;font-size:18px!important}
.pagination-jump{display:flex;align-items:center;gap:6px;padding:4px 6px;color:#667085;font-size:11px;font-weight:700}
.pagination-jump label{display:flex;align-items:center;gap:6px}.pagination-jump input[type=number]{width:68px;height:26px;padding:2px 6px;border:1px solid #cbd5e1;border-radius:5px;text-align:center;font-weight:800}
.pagination-jump .button{min-height:26px;height:26px;padding:3px 8px;font-size:9px}
.source-field-name{display:flex;align-items:flex-start;gap:9px}.source-field-name code{flex:0 0 auto;min-width:28px;text-align:center}.source-field-name span{font-weight:750;color:#344054;line-height:1.35}
.revogrid-panel.is-fullscreen .revogrid-host{height:calc(100vh - 205px);min-height:0}
@media(max-width:900px){.revogrid-format-toolbar{align-items:stretch}.revogrid-formula-bar{flex-basis:100%}.registry-pagination{gap:5px}.pagination-edge{font-size:0!important}.pagination-edge:first-child::after{content:"«";font-size:16px}.pagination-edge:last-child::after{content:"»";font-size:16px}}

/* CRM 0.6.13: row actions, persistent selection and compact cell editor */
.grid-tool-row{min-width:38px;font-size:11px}
.grid-tool-delete-row:hover:not(:disabled){border-color:#fda29b;background:#fff1f0;color:#b42318}
.revogrid-highlight-tools{border-right:0;padding-right:0}
.grid-highlight-control span{color:#16803a;text-decoration:none}
.crm-cell-content{display:flex;align-items:center;width:100%;height:100%;padding:10px 8px;box-sizing:border-box;line-height:20px;white-space:inherit;overflow:hidden;text-overflow:ellipsis;cursor:default}.crm-cell-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:inherit}.crm-cell-content.has-calendar{padding-right:2px}.crm-cell-content.has-calendar .crm-cell-text{flex:1}.crm-calendar-button{display:grid;place-items:center;flex:0 0 28px;width:28px;height:30px;margin:-5px 0 -5px 4px;padding:0;border:0;border-left:1px solid rgba(100,116,139,.22);background:transparent;color:#526075;cursor:pointer}.crm-calendar-button:hover,.crm-calendar-button:focus{outline:0;background:#eaf2ff;color:#174ea6}.crm-calendar-icon{font-size:15px;line-height:1}
.crm-cell-content.is-editable{cursor:text}
.crm-cell-content:hover{background:rgba(22,128,58,.06)}
.cell-overflow-popup{position:fixed;z-index:10020;max-width:min(520px,calc(100vw - 24px));max-height:min(260px,calc(100vh - 24px));padding:9px 11px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#172033;box-shadow:0 12px 34px rgba(15,23,42,.2);font-size:12px;line-height:1.45;white-space:pre-wrap;overflow:auto;overflow-wrap:anywhere;pointer-events:auto}
.cell-editor-dialog{width:min(390px,calc(100vw - 28px));max-width:none;padding:0;border:0;border-radius:10px;box-shadow:0 20px 60px rgba(16,24,40,.3);overflow:hidden}
.cell-editor-dialog::backdrop{background:rgba(15,23,42,.36);backdrop-filter:blur(1px)}
.cell-editor-card{display:flex;flex-direction:column;gap:8px;padding:12px;background:#fff}
.cell-editor-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.cell-editor-heading h2{margin:2px 0 0;font-size:16px}
.cell-editor-close{flex:0 0 auto;font-size:21px;line-height:1}
.cell-editor-textarea{width:100%;min-height:112px;max-height:42vh;padding:9px 10px;resize:vertical;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.cell-editor-input,.cell-editor-select{width:100%;min-height:34px;padding:6px 8px;font-size:12px;text-align:left}
.cell-editor-hint{color:#667085;font-size:10px;line-height:1.35}
.cell-editor-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px}
@media(max-width:640px){.cell-editor-card{padding:12px}.cell-editor-actions .button{flex:1}.cell-overflow-popup{max-width:calc(100vw - 16px)}}

/* CRM 0.6.13: branding, compact filters and extended RevoGrid controls */
.brand-large{display:flex;align-items:center;gap:10px}.brand-large .brand-mark{width:44px;height:44px}
.release-dialog,.review-dialog{width:min(720px,calc(100vw - 28px));max-width:none;padding:0;border:0;border-radius:14px;box-shadow:0 24px 70px rgba(15,23,42,.32);overflow:hidden}
.release-dialog::backdrop,.review-dialog::backdrop{background:rgba(15,23,42,.42);backdrop-filter:blur(2px)}
.release-dialog-card,.review-dialog-card{padding:20px;background:#fff}.release-dialog-card{max-height:min(82vh,820px);overflow:auto}
.release-dialog-heading,.review-dialog-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.release-dialog-heading h2,.review-dialog-heading h2{margin:3px 0 0;font-size:21px}
.release-dialog-card>p{margin:14px 0 9px;color:var(--muted)}
.release-current-changes{margin-bottom:18px}.release-history{display:grid;gap:7px;border-top:1px solid var(--line);padding-top:14px}.release-history-item{border:1px solid var(--line);border-radius:9px;background:#fafbfc;overflow:hidden}.release-history-item summary{display:flex;align-items:center;gap:11px;padding:10px 12px;cursor:pointer;list-style:none}.release-history-item summary::-webkit-details-marker{display:none}.release-history-item summary::before{content:"›";font-size:18px;line-height:1;color:var(--primary);transition:transform .15s}.release-history-item[open] summary::before{transform:rotate(90deg)}.release-history-item summary strong{min-width:54px;color:var(--primary)}.release-history-item summary span{overflow:hidden;color:#475467;font-size:12px;text-overflow:ellipsis;white-space:nowrap}.release-history-content{padding:0 14px 12px 35px;border-top:1px solid var(--line);background:#fff}.release-history-content section{margin-top:12px}.release-history-content h3{margin:0 0 6px;font-size:12px}.release-history-content ul{margin:0;padding-left:18px}.release-history-content li{margin:4px 0;color:#475467;font-size:12px;line-height:1.4}
.release-change-list{display:grid;gap:8px;margin:0;padding:0;list-style:none}.release-change-list li{position:relative;padding:9px 10px 9px 34px;border:1px solid #e4e8f0;border-radius:9px;background:#f8fafc;font-size:12px;line-height:1.4}.release-change-list li::before{content:"✓";position:absolute;left:11px;top:9px;color:#0f9f70;font-weight:900}
.release-dialog-actions,.review-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}

.filter-panel{padding:10px 12px}.filter-panel .search-row{gap:7px}.filter-panel .search-box{height:36px}.filter-panel .button{min-height:36px;padding:7px 12px}.compact-registry-toolbar{margin-top:8px}.compact-registry-toolbar .preset-tabs a{padding:6px 9px;font-size:10px}.compact-registry-toolbar .rows-picker{display:flex;align-items:center;gap:6px}.compact-registry-toolbar .rows-picker label{margin:0;font-size:10px}.compact-registry-toolbar .rows-picker select{width:78px;min-height:30px;height:30px;padding:4px 7px;font-size:10px}
.advanced-filter-disclosure{margin-top:8px;border-top:1px solid var(--line)}.advanced-filter-disclosure summary{display:flex;align-items:center;gap:7px;width:max-content;padding:8px 2px 0;color:#475467;font-size:11px;font-weight:800;cursor:pointer;list-style:none}.advanced-filter-disclosure summary::-webkit-details-marker{display:none}.advanced-filter-disclosure summary::before{content:"›";font-size:17px;line-height:1;transition:transform .15s}.advanced-filter-disclosure[open] summary::before{transform:rotate(90deg)}.advanced-filter-disclosure summary span{display:inline-grid;place-items:center;min-width:19px;height:19px;padding:0 5px;border-radius:999px;background:#e8efff;color:#2451a3;font-size:9px}
.compact-advanced-filters{grid-template-columns:repeat(8,minmax(112px,1fr));gap:8px;padding-top:9px;margin-top:7px}.compact-advanced-filters .field label{margin-bottom:4px;font-size:10px}.compact-advanced-filters .form-control{min-height:32px;height:32px;padding:5px 7px;font-size:10px}.compact-advanced-filters .filter-actions{display:flex;align-items:flex-end}.compact-advanced-filters .filter-actions .button{width:100%;min-height:32px;height:32px;font-size:10px}
.registry-content-actions{display:flex;align-items:center;gap:8px;margin:-4px 0 10px}.registry-content-actions .button{min-height:34px;padding:7px 11px;font-size:11px}

.grid-zoom-control output{display:inline-flex;align-items:center;justify-content:center;min-width:43px;height:30px;padding:0 4px;color:#344054;font-size:10px;font-weight:850;font-variant-numeric:tabular-nums}
.grid-columns-menu{position:relative}.grid-columns-menu>summary{list-style:none;min-width:auto}.grid-columns-menu>summary::-webkit-details-marker{display:none}.grid-columns-popover{position:absolute;z-index:10015;top:36px;right:0;width:250px;max-height:360px;padding:12px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;box-shadow:0 14px 36px rgba(15,23,42,.2);overflow:auto}.grid-columns-popover>strong{display:block;margin-bottom:8px;font-size:11px}.grid-columns-popover [data-grid-columns-list]{display:grid;gap:2px;margin-bottom:9px}.grid-columns-popover label{display:flex;align-items:center;gap:8px;padding:6px 7px;border-radius:6px;color:#344054;font-size:11px;cursor:pointer}.grid-columns-popover label:hover{background:#f2f6ff}.grid-columns-popover input{margin:0;accent-color:var(--primary)}
.revogrid-top-scroll{width:100%;height:18px;overflow-x:auto;overflow-y:hidden;border-bottom:1px solid #dce3ed;background:#f8fafc;scrollbar-color:#98a7bd #edf1f6;scrollbar-width:auto}.revogrid-top-scroll>div{height:1px}.revogrid-top-scroll::-webkit-scrollbar{height:15px}.revogrid-top-scroll::-webkit-scrollbar-track{background:#edf1f6}.revogrid-top-scroll::-webkit-scrollbar-thumb{border:3px solid #edf1f6;border-radius:8px;background:#98a7bd}
.grid-context-menu{position:fixed;z-index:10030;min-width:225px;padding:6px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;box-shadow:0 16px 42px rgba(15,23,42,.24)}.grid-context-menu button{display:flex;width:100%;padding:8px 10px;border:0;border-radius:6px;background:transparent;color:#25324a;font-size:11px;text-align:left}.grid-context-menu button:hover,.grid-context-menu button:focus{outline:0;background:#eef4ff;color:#174ea6}.grid-context-menu button.danger{color:#b42318}.grid-context-menu button.danger:hover,.grid-context-menu button.danger:focus{background:#fff1f0}.grid-context-menu>span{display:block;height:1px;margin:4px;background:#e4e8f0}
.merge-row-dialog{width:min(430px,calc(100vw - 28px))}.merge-row-options{display:grid;gap:6px;max-height:260px;overflow:auto}.merge-row-options label{display:flex;align-items:flex-start;gap:8px;padding:8px;border:1px solid #d7deea;border-radius:7px;cursor:pointer;text-align:left}.merge-row-options label:hover{background:#f6f8fc}.merge-row-options input{margin-top:2px}.merge-row-options span{display:grid;gap:2px}.merge-row-options small{color:#667085}.review-badge-button{border:0;cursor:pointer}.review-badge-button:hover{filter:brightness(.96);box-shadow:0 0 0 2px rgba(201,54,62,.12)}
.crm-column-heading{display:flex;align-items:center;gap:5px;min-width:0;width:100%;height:100%}.crm-column-heading-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crm-color-filter-button{display:grid;place-items:center;flex:0 0 17px;width:17px;height:17px;padding:2px;border:1px solid transparent;border-radius:4px;background:transparent;cursor:pointer}.crm-color-filter-button:hover,.crm-color-filter-button:focus,.crm-color-filter-button.is-active{outline:0;border-color:#9fb3d9;background:#eef4ff}.crm-color-filter-swatch{display:block;width:9px;height:9px;border:1px solid #7c8799;border-radius:2px;background-image:linear-gradient(135deg,transparent 43%,#7c8799 45%,#7c8799 55%,transparent 57%)}.crm-color-filter-button.is-active .crm-color-filter-swatch{background-image:none}.grid-color-filter-menu{position:fixed;z-index:10040;min-width:190px;max-width:260px;padding:7px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;box-shadow:0 16px 42px rgba(15,23,42,.24)}.grid-color-filter-menu>strong{display:block;padding:5px 7px 7px;color:#344054;font-size:11px}.grid-color-filter-menu [data-grid-color-filter-options]{display:grid;gap:2px}.grid-color-filter-menu button{display:flex;align-items:center;gap:8px;width:100%;padding:7px;border:0;border-radius:6px;background:transparent;color:#25324a;font-size:11px;text-align:left;cursor:pointer}.grid-color-filter-menu button:hover,.grid-color-filter-menu button:focus,.grid-color-filter-menu button.is-active{outline:0;background:#eef4ff;color:#174ea6}.crm-color-filter-option-swatch{display:block;flex:0 0 15px;width:15px;height:15px;border:1px solid #9aa6b8;border-radius:3px}.crm-color-filter-option-swatch.is-empty{background:linear-gradient(135deg,#fff 44%,#c43d3d 46%,#c43d3d 54%,#fff 56%)}
revogr-edit .crm-multi-select-editor{position:absolute;left:0;top:100%;z-index:1100;display:grid;gap:7px;min-width:max(230px,100%);max-width:360px;max-height:300px;padding:7px;border:1px solid #9fb3d9;border-radius:7px;background:#fff;box-shadow:0 12px 28px rgba(15,23,42,.24);color:#172033;font:12px/1.35 Inter,system-ui,sans-serif}revogr-edit .crm-multi-select-options{display:grid;gap:2px;max-height:225px;overflow:auto}revogr-edit .crm-multi-select-option{display:flex;align-items:flex-start;gap:7px;padding:6px;border-radius:5px;cursor:pointer}revogr-edit .crm-multi-select-option:hover{background:#eef4ff}revogr-edit .crm-multi-select-option input{flex:0 0 auto;width:14px;height:14px;margin:1px 0 0}revogr-edit .crm-multi-select-actions{display:flex;justify-content:flex-end;gap:6px;padding-top:5px;border-top:1px solid #e4e8f0}revogr-edit .crm-multi-select-actions button{padding:5px 8px;border:1px solid #c8d1df;border-radius:5px;background:#fff;color:#344054;font:inherit;cursor:pointer}revogr-edit .crm-multi-select-actions button.is-primary{border-color:#2266cc;background:#2266cc;color:#fff}
.review-issues{display:grid;gap:8px;margin-top:15px}.review-issue{display:grid;gap:3px;padding:11px 12px;border:1px solid #f0c8c4;border-radius:9px;background:#fff6f5}.review-issue strong{color:#9f271f;font-size:12px}.review-issue span{color:#5f3b37;font-size:11px;line-height:1.4}.review-issue.is-error{color:#b42318;font-weight:750}
.record-review-alert{margin:0 0 18px;padding:13px 15px;border:1px solid #efb5b0;border-radius:10px;background:#fff1f0;color:#8f211a}.record-review-alert strong{display:block;margin-bottom:5px}.record-review-alert ul{margin:0;padding-left:19px;font-size:12px;line-height:1.5}.field-review-required{padding:9px;border:1px solid #efa8a4;border-radius:9px;background:#fff1f0}.field-review-required .form-control{border-color:#e07872;background:#fffafa}.field-review-required::after{content:"Требуется проверить";display:block;margin-top:5px;color:#b42318;font-size:10px;font-weight:800}

@media(max-width:1250px){.compact-advanced-filters{grid-template-columns:repeat(4,minmax(130px,1fr))}}
@media(max-width:760px){.topbar{height:auto;min-height:74px;padding:9px 14px;gap:12px;flex-wrap:wrap}.brand{min-width:210px}.compact-advanced-filters{grid-template-columns:repeat(2,minmax(120px,1fr))}.registry-content-actions{flex-wrap:wrap}.review-dialog-actions,.release-dialog-actions{flex-wrap:wrap}.review-dialog-actions .button,.review-dialog-actions a{flex:1 1 140px}.grid-columns-popover{left:0;right:auto}.revogrid-format-toolbar{overflow:visible}}

/* CRM 0.6.18: Google Sheets synchronization */
.inline-action-form{display:inline-flex;margin:0}.google-sync-heading{align-items:center}.google-sync-heading form{margin-left:auto}.google-sync-overview{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}.sync-status-card{display:flex;flex-direction:column;gap:7px;min-height:118px}.sync-status-card>span{color:var(--muted);font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase}.sync-status-card>strong{font-size:20px}.sync-status-card>small,.google-tabs-table td small,.google-sync-log td small{display:block;color:var(--muted);margin-top:4px}.status-good{color:#157347}.status-bad{color:#b42318}.google-source-settings,.google-tabs-panel,.google-sync-log{margin-bottom:18px}.google-source-form{display:flex;align-items:end;flex-wrap:wrap;gap:16px}.google-source-form>label:not(.toggle-field){display:grid;gap:6px;font-weight:700}.toggle-field{display:inline-flex;align-items:center;gap:9px;min-height:42px;font-weight:700}.toggle-field input,.google-tabs-table input[type=checkbox]{width:18px;height:18px;accent-color:var(--primary)}.security-note{margin:14px 0 0;padding:11px 13px;background:#f0f8f3;border:1px solid #cce8d5;border-radius:9px;color:#275d3d}.google-tabs-table th:first-child,.google-tabs-table td:first-child{width:120px;text-align:center}.google-tabs-table .header-row-input{width:88px}.google-tabs-table tr.is-muted{opacity:.58}.sync-run-status{display:inline-flex;padding:4px 8px;border-radius:999px;background:#eef2f7;font-weight:800;font-size:12px}.sync-run-status.status-success{color:#157347;background:#e9f7ef}.sync-run-status.status-partial,.sync-run-status.status-failed{color:#b42318;background:#fdecec}.sync-run-status.status-pending,.sync-run-status.status-running{color:#805b10;background:#fff4d6}.sync-error{color:#b42318;white-space:pre-wrap}.sync-issue{margin-top:5px;max-width:430px}.sync-issue summary{color:#b42318;cursor:pointer}.sync-issue pre{max-height:180px;overflow:auto;white-space:pre-wrap;font-size:11px;background:#f8fafc;padding:8px;border-radius:6px}@media(max-width:1100px){.google-sync-overview{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:680px){.google-sync-overview{grid-template-columns:1fr}.google-sync-heading{align-items:stretch}.google-sync-heading form{margin-left:0}}
