/* OncoSmart — минимальные, чистые стили */
:root {
    --bg: #f7f9fb;
    --fg: #1a2233;
    --muted: #6b7280;
    --accent: #1f6feb;
    --accent-dark: #1148a8;
    --border: #e5e7eb;
    --card-bg: #ffffff;
    --error-bg: #fee2e2;
    --error-fg: #991b1b;
    --success-bg: #ecfdf5;
    --success-fg: #065f46;
    --info-bg: #eff6ff;
    --info-fg: #1e40af;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg); color: var(--fg); line-height: 1.5; }
.topbar { display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; background: white; border-bottom: 1px solid var(--border); }
.brand { font-weight: 600; font-size: 18px; color: var(--fg); text-decoration: none; }
.topbar nav a { color: var(--fg); text-decoration: none; margin-left: 18px; }
.topbar nav a:hover { color: var(--accent); }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px;
    border-top: 1px solid var(--border); margin-top: 48px; background: white; }

h1 { font-size: 28px; margin: 0 0 16px 0; }
h2 { font-size: 20px; margin: 24px 0 12px 0; }
h3 { font-size: 16px; margin: 12px 0 8px 0; }

.muted { color: var(--muted); }

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 16px 20px; margin-bottom: 16px; }
.card.info { background: var(--info-bg); border-color: #bfdbfe; color: var(--info-fg); }
.card.success { background: var(--success-bg); border-color: #a7f3d0; color: var(--success-fg); }
.card.narrow { max-width: 460px; margin: 32px auto; }

.error { background: var(--error-bg); color: var(--error-fg); padding: 10px 14px;
    border-radius: 8px; margin-bottom: 16px; }

.form label { display: block; margin-bottom: 14px; font-weight: 500; }
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form input[type="tel"], .form input[type="date"], .form select, .form textarea {
    display: block; width: 100%; padding: 8px 10px; margin-top: 4px;
    border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
    font-family: inherit; background: white; color: var(--fg);
}
.form textarea { resize: vertical; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .hint { color: var(--muted); font-size: 13px; }

.file-drop { display: block; padding: 28px; border: 2px dashed #cbd5e1; border-radius: 10px;
    text-align: center; background: #f8fafc; cursor: pointer; }
.file-drop input { display: block; margin: 0 auto; }
.file-drop span { display: block; color: var(--muted); margin-top: 8px; font-size: 13px; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.checkbox input { margin-top: 4px; }

button, .button { background: white; border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 16px; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--fg);
    display: inline-block; font-family: inherit; }
button:hover, .button:hover { border-color: var(--accent); color: var(--accent); }
button.primary, .primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover, .primary:hover { background: var(--accent-dark); color: white; border-color: var(--accent-dark); }
button.small { padding: 4px 10px; font-size: 13px; }

.big-code { font-size: 24px; font-family: ui-monospace, monospace; background: white;
    padding: 12px 20px; border-radius: 8px; border: 1px solid var(--border);
    display: inline-block; letter-spacing: 2px; }

.table { width: 100%; border-collapse: collapse; background: white;
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: #f8fafc; font-weight: 600; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px;
    background: #e5e7eb; font-size: 12px; margin-right: 4px; }
.badge-new { background: #fef3c7; }
.badge-processing { background: #dbeafe; }
.badge-completed { background: #d1fae5; }
.badge-failed { background: #fee2e2; }

.artifacts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px; margin-top: 12px; }
.artifacts-grid .card { display: flex; flex-direction: column; }

details summary { cursor: pointer; padding: 6px 0; color: var(--accent); }

code { font-family: ui-monospace, monospace; background: #f1f5f9; padding: 2px 6px;
    border-radius: 4px; font-size: 13px; }

/* ============================================================
   Clinic-style document type system
   Группы: diag (teal) · clin (blue) · ther (amber) · misc (gray)
   ============================================================ */

.section-head { display: flex; align-items: baseline; justify-content: space-between;
    margin: 24px 0 12px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
.section-head .meta { font-size: 12px; color: var(--muted); }

.group-label { font-size: 11px; font-weight: 500; color: var(--muted);
    letter-spacing: 0.06em; text-transform: uppercase; margin: 12px 2px 8px; }

/* Палитра типов (легенда) */
.type-palette { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px; margin-bottom: 8px; }
.type-chip { display: flex; align-items: center; gap: 10px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 12px; min-width: 0; }
.type-chip .label { font-size: 13px; font-weight: 500; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-chip .code { font-size: 11px; color: var(--muted); line-height: 1.25;
    font-family: ui-monospace, monospace; }

/* Иконочная плашка типа — общий компонент для палитры и рядов */
.doc-icon { width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 17px; line-height: 1; }
.doc-icon.diag { background: #E1F5EE; color: #0F6E56; }
.doc-icon.clin { background: #E6F1FB; color: #185FA5; }
.doc-icon.ther { background: #FAEEDA; color: #854F0B; }
.doc-icon.misc { background: #F1EFE8; color: #5F5E5A; }

/* Компактный список документов */
.doc-list { background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden; }
.doc-row { display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto auto auto 28px;
    gap: 12px; align-items: center; padding: 10px 14px;
    border-bottom: 1px solid var(--border); }
.doc-row:last-child { border-bottom: none; }
.doc-row .name { font-size: 13px; font-weight: 500; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .sub { font-size: 12px; color: var(--muted); line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .date { font-size: 12px; color: var(--muted); white-space: nowrap;
    font-variant-numeric: tabular-nums; }
.doc-row .dl { color: var(--muted); text-decoration: none; font-size: 17px;
    text-align: center; }
.doc-row .dl:hover { color: var(--accent); }

/* Pill (универсальная пилюля) */
.pill { display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; padding: 2px 8px; border-radius: 999px;
    white-space: nowrap; line-height: 1.5; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pill.ok      { background: #EAF3DE; color: #27500A; }
.pill.ok      .dot { background: #639922; }
.pill.warn    { background: #FAEEDA; color: #854F0B; }
.pill.warn    .dot { background: #BA7517; }
.pill.info    { background: #E6F1FB; color: #0C447C; }
.pill.info    .dot { background: #185FA5; }
.pill.err     { background: #FCEBEB; color: #791F1F; }
.pill.err     .dot { background: #A32D2D; }
.pill.neutral { background: #F1EFE8; color: #444441; }
.pill.neutral .dot { background: #888780; }

/* Артефакты — карточки готовых документов */
.artifact-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px; margin-top: 12px; }
.artifact-card { background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px; display: flex; flex-direction: column;
    gap: 10px; }
.artifact-card .head { display: flex; align-items: center; gap: 10px; }
.artifact-card .icon { width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 18px; }
.artifact-card .icon.anamn { background: #EEEDFE; color: #3C3489; }
.artifact-card .icon.long  { background: #E6F1FB; color: #0C447C; }
.artifact-card .icon.short { background: #E1F5EE; color: #085041; }
.artifact-card .title { flex: 1; min-width: 0; }
.artifact-card .title b { font-size: 14px; font-weight: 500; line-height: 1.2;
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-card .title .ver { font-size: 11px; color: var(--muted); line-height: 1.2; }
.artifact-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.artifact-card .actions .button,
.artifact-card .actions button { flex: 1; min-width: 0;
    font-size: 12px; padding: 6px 10px; text-align: center; }
.artifact-card .actions .icon-btn { flex: 0 0 auto; padding: 6px 10px; }
.artifact-card details { margin: 0; }
.artifact-card details summary { font-size: 12px; padding: 0; }
.artifact-card textarea { width: 100%; font-family: ui-monospace, monospace;
    font-size: 13px; margin-top: 8px; padding: 8px;
    border: 1px solid var(--border); border-radius: 6px; }

/* ============================================================
   Picker «Кто загружает документы» на пациентской форме
   ============================================================ */
.role-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px; margin: 4px 0 16px; }
.role-card { display: flex; gap: 10px; padding: 12px 14px;
    background: var(--card-bg); border: 1.5px solid var(--border);
    border-radius: 10px; cursor: pointer; font-weight: 400; margin: 0;
    transition: border-color .12s ease, background .12s ease; }
.role-card:hover { border-color: var(--accent); }
.role-card input[type="radio"] { margin-top: 4px; accent-color: var(--accent); flex-shrink: 0; }
.role-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.role-card-title { font-size: 14px; font-weight: 500; color: var(--fg); display: flex;
    align-items: center; gap: 6px; }
.role-card-title i { color: var(--accent); }
.role-card-sub { font-size: 12px; color: var(--muted); }
.role-card:has(input:checked) { border-color: var(--accent); background: #f0f7ff; }

.relative-block { background: #f8fafc; border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; }
.relative-block .row { margin-bottom: 4px; }
.relative-block .checkbox.proxy-consent { background: #fff7ed;
    border: 1px solid #fed7aa; border-radius: 8px; padding: 10px 12px;
    margin-top: 10px; font-size: 13px; }
.relative-block[hidden] { display: none; }

/* Бейдж «загружено родственником» в кабинете врача */
.submitter-badge { display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; padding: 4px 10px; border-radius: 999px;
    background: #FAEEDA; color: #854F0B; font-weight: 500; }
.submitter-badge.self { background: #E1F5EE; color: #0F6E56; }
.submitter-badge i { font-size: 14px; }
