:root { --accent: #1f3a5f; --bg: #f4f6f8; --card: #ffffff; --text: #1d2630; --muted: #5b6776; --line: #d9dee5; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
body { padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--accent); color: #fff; }
.top h1 { font-size: 18px; margin: 0; flex: 1; }
main { padding: 12px 16px 24px; max-width: 900px; margin: 0 auto; }
.btn { display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 10px 14px; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn.primary { background: #fff; color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); background: var(--card); }
#search { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; margin-bottom: 12px; background: var(--card); }
.hint { color: var(--muted); font-size: 14px; line-height: 1.45; }
.reports { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.card { display: flex; align-items: stretch; gap: 4px; }
.card-main { flex: 1; min-width: 0; }
.card-remove { align-self: center; margin: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: #8a3540; cursor: pointer; font: inherit; font-size: 13px; }
.project-tools { display: grid; gap: 8px; margin: 0 0 12px; }
.project-create { display: flex; gap: 8px; }
.project-create input, #projectFilter { min-width: 0; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
.project-create input { flex: 1; }
.project-create .btn { white-space: nowrap; }
#projectFilter { font-size: 14px; }
.section-tools { display: grid; gap: 8px; }
#sectionFilter, .section-create input { min-width: 0; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
.section-create { display: flex; gap: 8px; }
.section-create input { flex: 1; }
.section-create .btn { white-space: nowrap; }
.section-create .btn:disabled, .section-create input:disabled { opacity: .5; cursor: not-allowed; }
.card-project { align-self: center; max-width: 34%; min-width: 105px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--text); font-size: 12px; }
.card-section { align-self: center; max-width: 25%; min-width: 95px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--text); font-size: 12px; }
.card-project:disabled, .card-section:disabled { opacity: .55; }
.storage-status { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 8px 0 14px; }
.card-main { width: 100%; text-align: left; background: none; border: 0; padding: 14px; cursor: pointer; color: inherit; font: inherit; }
.card-title { font-weight: 600; word-break: break-word; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.viewbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.view-title { font-weight: 600; word-break: break-word; }
.pdf-wrap { display: grid; gap: 10px; }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 8px; padding-bottom: 4px; }
.tab { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 12px; font-size: 14px; cursor: pointer; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-wrap { overflow: auto; max-height: 70vh; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0; }
table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #eef2f6; position: sticky; top: 0; }
.classification-note { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.card-classification { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 12px 12px; font-size: 12px; color: var(--muted); }
.classification-approve { border: 1px solid #b9c8d8; border-radius: 6px; background: #eef4fa; color: var(--accent); padding: 5px 9px; cursor: pointer; font: inherit; font-weight: 600; }

.registry-summary { margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); font-size: 12px; line-height: 1.5; }
.classification-filter { width: 100%; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-size: 14px; }
\n.requirements-panel { margin: 8px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }\n.requirements-panel h2 { margin: 0 0 6px; font-size: 16px; }\n.requirement-create { display: grid; gap: 8px; }\n.requirement-create select { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }\n.requirement-create button:disabled, .requirement-create select:disabled { opacity: .5; }\n.requirement-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }\n.requirement-complete { color: #26734d; white-space: nowrap; }\n.requirement-missing { color: #a34c32; white-space: nowrap; }\n.requirement-remove { border: 1px solid var(--line); border-radius: 6px; background: transparent; padding: 5px 7px; color: var(--muted); }\n.requirement-summary { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }\n@media (min-width: 640px) { .requirement-create { grid-template-columns: 1.3fr 1fr auto; } }\n
.document-metadata { flex: 1 0 100%; margin: 0 12px 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; font-size: 13px; }
.document-metadata summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 3px 0; }
.metadata-field { display: grid; gap: 4px; margin-top: 9px; color: var(--muted); }
.metadata-field input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font: inherit; }
.metadata-save { margin-top: 10px; padding: 8px 11px; border: 1px solid #b9c8d8; border-radius: 7px; background: #eef4fa; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.metadata-duplicate { margin: 9px 0 0; color: #a34c32; font-size: 12px; line-height: 1.4; }
@media (min-width: 640px) { .document-metadata { display: block; } .document-metadata[open] { display: block; } .document-metadata .metadata-field { grid-template-columns: 220px minmax(0,1fr); align-items: center; } }

.metadata-validation { margin: 9px 0 0; color: #a34c32; font-size: 12px; line-height: 1.45; }
.metadata-valid { margin: 9px 0 0; color: #26734d; font-size: 12px; line-height: 1.45; }

.aosr-audit-result { margin-top: .75rem; padding: .75rem; border: 1px solid var(--line, #d8dee8); border-radius: 10px; background: var(--panel, #f7f9fc); font-size: .9rem; }
.aosr-audit-result p { margin: .45rem 0; }
.aosr-ok { color: #18794e; }
.aosr-critical, .aosr-warning { color: #9a5b00; }
.aosr-info { color: var(--muted, #667085); }
.aosr-audit-result .aosr-warning { color: #9a5b00; font-weight: 600; }

/* Связи документов в отчёте АОСР */
.aosr-audit-result strong { display:block; margin-top:.7rem; }

/* Unified Stroy Vector product identity */
.brand-subtitle { display:block; margin-top:3px; color:var(--muted); font-size:12px; font-weight:500; letter-spacing:.02em; }


/* SYNC-11: explicit, manual server synchronization controls */
.sync-panel { margin: 8px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.sync-panel h2 { margin: 0 0 6px; font-size: 16px; }
.sync-status { margin: 6px 0; font-size: 14px; font-weight: 650; }
.sync-details { margin: 4px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.sync-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sync-actions .btn { font-size: 13px; }
.sync-actions .btn:disabled { opacity: .55; cursor: wait; }


.sync-queue { display: grid; gap: 5px; margin: 8px 0 10px; padding: 0; list-style: none; }
.sync-queue-item, .sync-queue-empty { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.sync-queue-conflict, .sync-queue-rejected { border-color: #d8b6a5; color: #8c4934; }


/* SYNC-12: server inbox is displayed separately from local editable documents */
.sync-inbox { display: grid; gap: 5px; margin: 8px 0 10px; padding: 0; list-style: none; }
.sync-inbox-item, .sync-inbox-empty { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }


/* SYNC-13: human-reviewed, field-level metadata choices; no implicit merge. */
.sync-review-list { display: grid; gap: 8px; margin: 8px 0 10px; padding: 0; list-style: none; }
.sync-review-item, .sync-review-empty { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.sync-review-item > strong { display: block; margin-bottom: 7px; }
.sync-review-fields { display: grid; gap: 6px; margin: 8px 0; }
.sync-review-field { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: start; gap: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.sync-review-field input { margin-top: 2px; }
.sync-review-save { margin-top: 6px; font-size: 12px !important; }
.sync-review-prepared { margin: 7px 0 0; color: var(--muted); }
.sync-review-item p { margin: 6px 0 0; color: var(--muted); }


/* SYNC-14: explicit application controls and a compact local audit trail. */
.sync-review-apply { margin: 8px 0 4px; }
.sync-review-undo { margin: 8px 0 4px; }
.sync-review-audit { display: grid; gap: 5px; margin: 8px 0 10px; padding: 0; list-style: none; }
.sync-review-audit-item, .sync-review-audit-empty { padding: 7px 9px; border-left: 2px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }

/* Estimate execution report: keep wide engineering tables readable on mobile. */
.sync-execution-view { margin-top: 10px; max-width: 100%; overflow-x: auto; }
.sync-execution-heading, .sync-execution-totals { margin: 8px 0; font-size: 13px; font-weight: 650; }
.sync-execution-table { width: 100%; min-width: 920px; border-collapse: collapse; font-size: 12px; }
.sync-execution-table th, .sync-execution-table td { padding: 7px 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.sync-execution-table th { background: var(--bg); white-space: nowrap; }
.sync-execution-table td:nth-child(2) { min-width: 220px; }
.sync-execution-overrun { background: #fff0ed; color: #8f2f20; font-weight: 650; }
.sync-execution-warning { background: #fff9e8; }


/* SV Sync integrity: read-only result from the local/server snapshot comparison. */
.sync-integrity-report { margin: 9px 0 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.sync-integrity-heading { display: block; margin-bottom: 7px; font-size: 13px; }
.sync-integrity-line { margin: 4px 0; color: var(--muted); }
.sync-integrity-line strong { color: var(--text); }
.sync-integrity-findings { display: grid; gap: 4px; margin: 8px 0; padding-left: 18px; color: var(--muted); }
.sync-integrity-report .classification-note { margin: 8px 0 0; font-size: 11px; }
