/* ═══════════════════════════════════════════════════════════════════════════
   Просмотр приёма (MnuAppointment, action View) — редизайн «синяя тема + табы».
   Раскладка-обёртка `.vetka-exam-layout` помечается доп. классом `av-view`,
   под который заскоуплены ВСЕ правила этого файла. Так вид перекрывает старые
   тёплые правила из warehouse.css по специфичности, НЕ задевая форму проведения
   приёма (CreateAppointmentOp), которая делит общие классы .vetka-exam-*/.vetka-pet.
   Палитра — дизайн-токены приложения (project-theme.css): --primary/--surface/--ink…
   Вкладки — CSS-only (radio + label), без JS.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── раскладка вида: прозрачная основная колонка (без фростед-панели формы) ── */
.av-view.vetka-exam-layout {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
    padding: 24px;
    animation: none;
    background: none;
}
.av-view .vetka-exam-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.av-view .vetka-exam-aside {
    position: sticky;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.av-view .vetka-appt-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    color: var(--ink);
    font-family: var(--font-ui);
    background: none;
    border: none;
    box-shadow: none;
    overflow: visible;
}

/* ── шапка ── */
.av-view .vetka-appt-view .av-head {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 22px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.av-view .av-head-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 0;
}
.av-view .av-title {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.2px;
    line-height: 1.15;
}
.av-view .av-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
}
.av-view .tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 5px 12px;
    border-radius: var(--r-pill);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.av-view .tag > [class^="vetka-"] {
    display: inline-block;
    font-size: 14px;
    color: var(--ink-3);
}

/* статус-чип (scope .av-view .vetka-appt-view — перебить .vetka-appt-view .chip*::before из warehouse.css) */
.av-view .vetka-appt-view .chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
}
.av-view .vetka-appt-view .chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 8px; animation: none; box-shadow: none; }
.av-view .vetka-appt-view .chip.is-wait     { background: var(--primary-tint);  color: var(--primary-ink); }
.av-view .vetka-appt-view .chip.is-progress { background: var(--info-tint);     color: var(--info); }
.av-view .vetka-appt-view .chip.is-done     { background: var(--success-tint);  color: var(--success); }
.av-view .vetka-appt-view .chip.is-cancel   { background: var(--danger-tint);   color: var(--danger); }

/* экшены: иконка + подпись */
.av-view .av-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.av-view .av-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    width: auto;
    padding: 0 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-2);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    background: var(--surface);
    color: var(--ink-2);
    text-decoration: none;
    transition: all var(--motion-fast) var(--ease);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
}
.av-view .av-btn > [class^="vetka-"] { font-size: 16px; }
.av-view .av-btn:hover { border-color: var(--primary); color: var(--primary-ink); transform: none; }
.av-view .av-btn--primary,
.av-view .av-btn--finish  { background: var(--primary); border-color: var(--primary); color: var(--ink-on-dark); }
.av-view .av-btn--primary:hover,
.av-view .av-btn--finish:hover { background: var(--primary-hover); color: var(--ink-on-dark); }
.av-view .av-btn--payment {
    background: var(--warn);
    border-color: var(--warn);
    color: var(--primary-ink);
}
.av-view .av-btn--payment:hover { filter: brightness(.95); color: var(--ink-on-dark); }
.av-view .av-btn--danger  { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 24%, var(--line)); background: var(--danger-tint); }
.av-view .av-btn--danger:hover { background: color-mix(in oklab, var(--danger) 12%, var(--surface)); color: var(--danger); }

/* ── баннер (приём не проведён / отменён) ── */
.av-view .av-banner {
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-tint-2);
    border-radius: var(--r-md);
    padding: 13px 16px;
    color: var(--primary-ink);
    font-size: 13.5px;
    font-weight: 500;
}
.av-view .av-banner > [class^="vetka-"] { font-size: 18px; flex: 0 0 auto; }
.av-view .av-banner--cancel { background: var(--danger-tint); border-color: color-mix(in oklab, var(--danger) 22%, var(--line)); color: var(--danger); }

/* ── вкладки (CSS-only) ── */
.av-view .av-tabs-wrap { display: block; }
.av-view .av-tab-radio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.av-view .av-tabs {
    display: flex;
    gap: 4px;
    padding: 6px 12px 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.av-view .av-tabs::-webkit-scrollbar { display: none; }
.av-view .av-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 14px;
    border: none;
    border-bottom: 2.5px solid transparent;
    background: none;
    position: relative;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-3);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--motion-fast) var(--ease);
}
/* анимированное подчёркивание активной вкладки — растёт от центра (CSS-only, без JS) */
.av-view .av-tab::after {
    content: "";
    position: absolute;
    left: 14px; right: 14px; bottom: -1px;
    height: 2.5px; border-radius: 2px;
    background: var(--primary);
    transform: scaleX(0); transform-origin: center;
    transition: transform var(--motion-base) var(--ease);
}
.av-view .av-tab > [class^="vetka-"] { font-size: 16px; }
.av-view .av-tab:hover { color: var(--ink); }
.av-view .av-tab__cnt {
    font-size: 11px;
    font-weight: 700;
    background: var(--surface-3);
    color: var(--ink-2);
    padding: 1px 7px;
    border-radius: var(--r-pill);
}
.av-view .av-panes {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.av-view .av-pane { display: none; flex-direction: column; gap: 18px; }

/* активная вкладка + её панель */
.av-view #av-tab-1:checked ~ .av-tabs label[for="av-tab-1"],
.av-view #av-tab-2:checked ~ .av-tabs label[for="av-tab-2"],
.av-view #av-tab-3:checked ~ .av-tabs label[for="av-tab-3"],
.av-view #av-tab-4:checked ~ .av-tabs label[for="av-tab-4"] {
    color: var(--primary-ink);
}
.av-view #av-tab-1:checked ~ .av-tabs label[for="av-tab-1"]::after,
.av-view #av-tab-2:checked ~ .av-tabs label[for="av-tab-2"]::after,
.av-view #av-tab-3:checked ~ .av-tabs label[for="av-tab-3"]::after,
.av-view #av-tab-4:checked ~ .av-tabs label[for="av-tab-4"]::after {
    transform: scaleX(1);
}
.av-view #av-tab-1:checked ~ .av-tabs label[for="av-tab-1"] .av-tab__cnt,
.av-view #av-tab-2:checked ~ .av-tabs label[for="av-tab-2"] .av-tab__cnt,
.av-view #av-tab-3:checked ~ .av-tabs label[for="av-tab-3"] .av-tab__cnt,
.av-view #av-tab-4:checked ~ .av-tabs label[for="av-tab-4"] .av-tab__cnt {
    background: var(--primary-tint-2); color: var(--primary-ink);
}
.av-view #av-tab-1:checked ~ .av-panes .av-pane--1,
.av-view #av-tab-2:checked ~ .av-panes .av-pane--2,
.av-view #av-tab-3:checked ~ .av-panes .av-pane--3,
.av-view #av-tab-4:checked ~ .av-panes .av-pane--4 { display: flex; animation: avPaneIn var(--motion-base) var(--ease) both; }
@keyframes avPaneIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── поля / документный текст ── */
.av-view .av-fld { min-width: 0; }
.av-view .av-fld__k {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 8px;
}
.av-view .av-doc {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px;
    font-size: 14px;
    color: var(--ink);
    line-height: 1.6;
}
.av-view .av-doc > :first-child { margin-top: 0; }
.av-view .av-doc > :last-child  { margin-bottom: 0; }
.av-view .av-doc p,
.av-view .av-doc div { margin: 0 0 10px; }
.av-view .av-doc b { color: var(--ink); font-weight: 700; }
.av-view .av-doc i { color: var(--ink-2); }
.av-view .av-doc a { color: var(--primary-ink); text-decoration: none; border-bottom: 1px solid var(--primary-tint-2); }
.av-view .av-doc ul,
.av-view .av-doc ol { margin: 0 0 10px; padding-left: 20px; }
.av-view .av-doc li { margin: 2px 0; }
.av-view .av-doc img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    margin: 6px 0;
}
.av-view .av-doc iframe {
    width: 100%;
    max-width: 560px;
    height: 640px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    margin: 6px 0;
}
.av-view .av-doc table { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 13px; }
.av-view .av-doc td, .av-view .av-doc th { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.av-view .av-doc th { background: var(--surface-3); font-weight: 600; }

.av-view .av-empty {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1px dashed var(--line-2);
    color: var(--ink-3);
    font-size: 13.5px;
}

/* ── витальные показатели ── */
.av-view .av-vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.av-view .av-vital {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
}
.av-view .av-vital__i {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--primary-tint);
    color: var(--primary);
    font-size: 18px;
}
.av-view .av-vital__k { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.av-view .av-vital__v { font-size: 16px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.av-view .av-vital__v.empty { color: var(--ink-3); font-weight: 500; }

/* ── диагнозы-чипы ── */
.av-view .av-dx-list { display: flex; flex-wrap: wrap; gap: 8px; }
.av-view .av-dx {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: 600;
}
.av-view .av-dx::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.av-view .av-dx--final { color: var(--primary-ink); background: var(--primary-tint); }
.av-view .av-dx--diff  { color: var(--ink-2); background: var(--surface-3); border: 1px dashed var(--line-2); }

/* ── вложения (фото / PDF) ── */
.av-view .av-atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.av-view .av-att {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface-2);
    text-decoration: none;
    color: inherit;
    transition: all var(--motion-fast) var(--ease);
}
.av-view .av-att:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.av-view .av-att__thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-3); }
.av-view .av-att__pdf {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, var(--danger-tint), var(--surface-2));
    color: var(--danger);
    font-size: 34px;
}
.av-view .av-att__cap { display: flex; align-items: center; gap: 7px; padding: 9px 11px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.av-view .av-att__cap > [class^="vetka-"] { font-size: 15px; color: var(--ink-3); }
.av-view .av-att__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-view .av-att__tag { margin-left: auto; font-size: 10px; font-weight: 800; letter-spacing: .05em; color: var(--ink-3); background: var(--surface-3); padding: 2px 7px; border-radius: var(--r-xs); }
.av-view .av-pdfframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--r-md); margin-top: 12px; background: var(--surface); }

/* ── таблица лечения ── */
.av-view .av-inv { width: 100%; border-collapse: collapse; font-size: 13px; }
.av-view .av-inv th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 9px 8px; border-bottom: 1.5px solid var(--line-2); }
.av-view .av-inv td { padding: 10px 8px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.av-view .av-inv td.num { text-align: right; font-family: var(--font-mono); }

/* ── боковая панель: карточка питомца (синяя — перебивает тёплую warehouse.css только для вида) ── */
.av-view .vetka-pet {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.av-view .vetka-pet__photo { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 16px; object-fit: cover; display: block; background: linear-gradient(135deg, var(--primary-tint), var(--primary-tint-2)); box-shadow: none; }
.av-view .vetka-pet__main { min-width: 0; flex: 1; }
.av-view .vetka-pet__name { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -.2px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-view .vetka-pet__meta { font-size: 12px; color: var(--ink-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-view .vetka-pet__meta b { color: var(--ink); font-weight: 700; }
.av-view .vetka-pet__owner { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── боковая панель: заметка владельца ── */
.av-view .vetka-owner-note {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    color: var(--ink);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.av-view .vetka-owner-note__head { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.av-view .vetka-owner-note__head > [class^="vetka-"] { display: inline-grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; background: var(--primary-tint); color: var(--primary); font-size: 18px; border: none; }
.av-view .vetka-owner-note__title { font-size: 14px; font-weight: 650; color: var(--ink); }
.av-view .vetka-owner-note__phone { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.av-view .vetka-owner-note__body { padding: 14px 16px; }
.av-view .vetka-owner-note__label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.av-view .vetka-owner-note__text { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.av-view .vetka-owner-note__empty { font-size: 13px; color: var(--ink-3); }

/* ── боковая панель: формирование чека ── */
.av-view .vetka-bill {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    color: var(--ink);
    font-family: var(--font-ui);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.av-view .vetka-bill__head { padding: 14px 16px; border-bottom: 1px solid var(--line); background: none; }
.av-view .vetka-bill__title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.av-view .vetka-bill__title > [class^="vetka-"] { font-size: 18px; color: var(--primary); }
.av-view .vetka-bill__sub { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.av-view .vetka-bill__body { padding: 6px 16px 14px; }
.av-view .vetka-bill .inv { width: 100%; border-collapse: collapse; font-size: 13px; }
.av-view .vetka-bill .inv th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 9px 6px; border-bottom: 1.5px solid var(--line-2); }
.av-view .vetka-bill .inv td { padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.av-view .vetka-bill .inv td.num { text-align: right; font-family: var(--font-mono); }
.av-view .vetka-bill .inv-total { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1.5px solid var(--line-2); }
.av-view .vetka-bill .inv-total + .inv-total { margin-top: 6px; padding-top: 0; border-top: none; }
.av-view .vetka-bill .inv-total-k { font-size: 12.5px; color: var(--ink-2); }
.av-view .vetka-bill .inv-total-v { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--primary-ink); }
.av-view .vetka-bill .inv-total-pay { font-size: 11.5px; font-weight: 700; padding: 3px 11px; border-radius: var(--r-pill); }
.av-view .vetka-bill .inv-total-pay.is-paid   { background: var(--success-tint); color: var(--success); }
.av-view .vetka-bill .inv-total-pay.is-unpaid { background: var(--danger-tint); color: var(--danger); }

/* ── адаптив ── */
@media (max-width: 900px) {
    .av-view.vetka-exam-layout { grid-template-columns: 1fr; padding: 16px; }
    .av-view .vetka-exam-aside { position: static; }
    .av-view .av-vitals { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .av-view .av-vitals { grid-template-columns: 1fr; }
}

/* ── кликабельные карточки питомца/владельца в сайдбаре (ведут на их страницы) ── */
.av-view a.vetka-pet,
.av-view a.vetka-owner-note { color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.av-view a.vetka-pet:hover,
.av-view a.vetka-owner-note:hover { border-color: var(--primary); box-shadow: 0 8px 22px -14px oklch(0.28 0.04 260 / .35); }

/* ── печать: раскрыть все вкладки, спрятать панель табов и кнопки ── */
@media print {
    .av-view .av-tabs, .av-view .av-actions, .av-view .vetka-print-trigger { display: none !important; }
    .av-view .av-panes { border-radius: var(--r-lg); }
    .av-view .av-pane { display: flex !important; }
    .av-view .av-pane + .av-pane { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
    .av-view .av-pdfframe { height: 400px; }
}
