/* Кабинет клиники: рабочий экран на компьютере, на телефоне тоже открывается. Цвета и шрифты из дневника. */
body{background:var(--bg)}
.k-top{position:sticky;top:0;z-index:4;display:flex;flex-wrap:wrap;align-items:center;gap:6px 18px;padding:12px max(20px,env(safe-area-inset-left));background:var(--bar);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);border-bottom:1px solid var(--line)}
.k-brand{display:flex;align-items:center;gap:10px;font:600 15px Geologica,Inter,sans-serif;white-space:nowrap}
.k-brand img{height:18px;width:auto}
.k-nav{display:flex;gap:2px;flex:1}
.k-nav a{padding:8px 13px;border-radius:11px;font-weight:600;font-size:14px;color:var(--mute)}
.k-nav a:hover{background:var(--bg)}
.k-nav a.on{background:var(--acc-soft);color:var(--acc)}
.k-user{display:flex;align-items:center;gap:12px;font-size:13px;color:var(--mute);white-space:nowrap}
.k-link{color:var(--acc);font-weight:600;font-size:13.5px}
.k-main{max-width:1180px;margin:0 auto;padding:24px max(20px,env(safe-area-inset-left)) 60px;display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.k-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px}
.k-head h1{font:700 30px/1.15 Geologica,Inter,sans-serif;letter-spacing:-.02em}
.k-btn{flex:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:14px;background:var(--plus);color:#fff;font-weight:600;font-size:14.5px;white-space:nowrap}
.k-btn.soft{background:var(--acc-soft);color:var(--acc)}
.k-btn.quiet{background:var(--bg);color:var(--ink)}
.k-btn.sm{min-height:36px;padding:0 12px;border-radius:11px;font-size:13px}
.k-btn[disabled]{opacity:.55}
.k-note{padding:11px 15px;border-radius:14px;background:var(--warm-soft);color:var(--warm);font-size:13.5px;font-weight:500}
.k-note.ok{background:var(--ok-soft);color:var(--ok)}
.k-tools{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.k-search{flex:1 1 260px;max-width:420px;height:44px;padding:0 15px;border:1px solid var(--line);border-radius:14px;background:var(--card);color:var(--ink);font:inherit;font-size:15px}
.k-filters{display:flex;flex-wrap:wrap;gap:6px}
.k-fc{min-height:38px;padding:0 13px;border-radius:19px;border:1px solid var(--line);background:var(--card);font-weight:600;font-size:13.5px;color:var(--mute)}
.k-fc.on{background:var(--ink);border-color:var(--ink);color:var(--card)}
.k-card{background:var(--card);border-radius:20px;box-shadow:var(--shadow);min-width:0}
.k-pad{padding:18px 20px}
.k-tw{overflow-x:auto}
table.k-t{border-collapse:collapse;width:100%;min-width:820px;font-size:14.5px}
.k-t th{font:600 12.5px/1.3 Geologica,Inter,sans-serif;color:var(--mute);text-align:left;padding:12px 16px;border-bottom:1px solid var(--line);white-space:nowrap}
.k-t td{padding:12px 16px;border-bottom:1px solid var(--line);vertical-align:middle}
.k-t tr:last-child td{border-bottom:0}
.k-t tr.go{cursor:pointer}
.k-t tr.go:hover td{background:var(--bg)}
.k-t a.name{font-weight:600}
.k-sub{display:block;font-size:12.5px;color:var(--mute)}
.k-acts{display:flex;gap:6px;justify-content:flex-end}
.k-pager{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-top:1px solid var(--line);font-size:13px;color:var(--mute)}
.k-empty{padding:42px 20px;text-align:center;color:var(--mute)}
.k-empty b{display:block;font:600 18px Geologica,Inter,sans-serif;color:var(--ink);margin-bottom:6px}
.chip.no{background:var(--bg);color:var(--mute)}
/* карта питомца */
.k-back{justify-self:start;color:var(--acc);font-weight:600;font-size:14px}
.k-pet{display:flex;flex-wrap:wrap;gap:16px;align-items:center}
.k-pet img{width:84px;height:84px;border-radius:24px;object-fit:cover;flex:none}
.k-pet .grow{flex:1 1 280px;min-width:0}
.k-pet h1{font:700 32px/1.1 Geologica,Inter,sans-serif;letter-spacing:-.02em}
.k-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
.k-grid .wide{grid-column:1/-1}
.k-card h2{font:600 17px/1.25 Geologica,Inter,sans-serif;margin-bottom:10px}
.k-rows{display:grid}
.k-row{display:flex;justify-content:space-between;gap:14px;padding:9px 0;border-top:1px solid var(--line);font-size:14px}
.k-row>*{min-width:0}
.k-row .r{flex:none;text-align:right}
.k-chart{display:block;width:100%;height:auto}
.k-chart .t{font:400 11.5px Inter,sans-serif;fill:var(--mute)}
.k-chart .v{font-weight:600;fill:var(--ink)}
.k-docs{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}
.k-docs img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:12px;background:var(--bg)}
.k-lock{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:13.5px;color:var(--mute)}
/* окна */
.k-back-d{position:fixed;inset:0;background:rgba(8,18,26,.5);z-index:8}
.k-modal{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(560px,calc(100vw - 24px));max-height:calc(100vh - 32px);overflow-y:auto;background:var(--card);border-radius:24px;padding:22px 24px;z-index:9}
.k-modal h2{font:600 22px/1.2 Geologica,Inter,sans-serif;margin-bottom:4px}
.k-x{position:absolute;right:14px;top:14px;width:40px;height:40px;border-radius:20px;color:var(--mute);font-size:22px}
.k-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 12px}
.k-err{margin-top:10px;padding:10px 13px;border-radius:12px;background:var(--warm-soft);color:var(--warm);font-size:13.5px;font-weight:500}
details.k-more{margin-top:14px;border-top:1px solid var(--line);padding-top:12px}
details.k-more summary{cursor:pointer;font-weight:600;font-size:14.5px;color:var(--acc)}
.k-url{word-break:break-all;font-size:13px;padding:11px 13px;background:var(--bg);border-radius:12px;margin:12px 0}
/* вход */
.k-auth{min-height:100vh;display:grid;grid-template-columns:minmax(0,1fr);align-items:center;justify-items:center;padding:32px 20px}
.k-authbox{width:100%;max-width:980px;display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:38px;align-items:center}
.k-authbox h1{font:700 40px/1.08 Geologica,Inter,sans-serif;letter-spacing:-.025em;margin:18px 0 12px}
.k-authbox .logo{height:22px;width:auto}
.k-points{margin:18px 0 0;padding:0;list-style:none;display:grid;gap:10px;font-size:15px;color:var(--mute)}
.k-points li{display:flex;gap:10px}
.k-points li::before{content:"✓";color:var(--ok);font-weight:700}
/* номер клиники */
.k-poster{text-align:center}
.k-code{font:700 44px/1.1 Geologica,Inter,sans-serif;letter-spacing:.04em;margin:6px 0 14px}
.k-poster .qr{margin:0 auto}
@media (max-width:760px){
  .k-authbox{grid-template-columns:minmax(0,1fr);gap:22px}
  .k-authbox h1{font-size:32px}
  .k-grid{grid-template-columns:minmax(0,1fr)}
  .k-user span{display:none}
  .k-nav{order:3;flex-basis:100%}
}
@media print{
  body{background:#fff}
  .k-top,.k-noprint,.k-back,.k-head{display:none!important}
  .k-poster{box-shadow:none}
}
.k-t .chip{white-space:nowrap}
@media (max-width:420px){
  .k-brand{font-size:13px;gap:8px}
  .k-brand img{height:15px}
  .k-top{padding-left:14px;padding-right:14px}
  .k-user{margin-left:auto}
}

/* длинные тексты: колонки держат ширину, строки переносятся, а не растягивают экран */
table.k-t{table-layout:fixed;min-width:940px}
.k-t td{overflow-wrap:anywhere}
.k-clip{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;max-height:2.9em}
.k-one{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.k-sub.k-one{display:block}
.k-t .k-sub{overflow-wrap:anywhere}
.k-head{flex-wrap:wrap}
.k-head h1,.k-pet h1{overflow-wrap:anywhere;min-width:0;max-width:100%}
.k-head>*{min-width:0}
.k-row>*{overflow-wrap:anywhere}
.k-row>span:first-child{flex:1 1 auto}
.k-row .r{flex:0 0 auto;max-width:60%}
.k-card h2{overflow-wrap:anywhere}
.k-brand{flex:none}
.k-user span{overflow:hidden;text-overflow:ellipsis;max-width:280px}
.k-pet .sub{overflow-wrap:anywhere}
.k-note{overflow-wrap:anywhere}
.k-modal{overflow-wrap:anywhere}

/* шкала самочувствия: на светлом темнее значит хуже, на темном ярче значит хуже */
:root{--f5:#dcebf6;--f4:#9cc6e4;--f3:#4a90c4;--f2:#174a75;--crit:#b23a2e;--warnc:#8f5f00;--goodc:#0f7a58}
[data-dark="1"]{--f5:#1f3a4f;--f4:#2f5f83;--f3:#5b9bd0;--f2:#b9dcf7;--crit:#f09a8f;--warnc:#e6bf6b;--goodc:#6bd3ad}
/* список пациентов */
table.k-pt{min-width:1000px}
.k-pt th:nth-child(1){width:19%}
.k-pt th:nth-child(2){width:19%}
.k-pt th:nth-child(3){width:130px}
.k-pt th:nth-child(5){width:130px}
.k-pt th:nth-child(6){width:178px}
.k-ch .chip{white-space:normal;display:inline-block;margin:0 4px 4px 0;line-height:1.25;text-align:left}
.chip.hard{background:var(--warm-soft);color:var(--crit)}
.chip.mid{background:var(--acc-soft);color:var(--acc)}
.k-next{font-size:13.5px}
.k-pt .k-acts{justify-content:flex-start;flex-wrap:wrap;margin-top:6px}
.k-filters+.k-tw,.k-filters+.k-empty{border-top:1px solid var(--line)}
/* сотрудники и журнал */
table.k-st{min-width:860px}
.k-st th:nth-child(2){width:170px}
.k-st th:nth-child(3){width:130px}
.k-st th:nth-child(4){width:160px}
.k-st th:nth-child(5){width:230px}
.k-sel{width:100%;height:38px;padding:0 10px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--ink);font:inherit;font-size:14px}
.k-mono{font-family:ui-monospace,Menlo,Consolas,monospace;letter-spacing:.02em}
.k-roles{font-size:13.5px;color:var(--mute);margin:0;padding-left:18px;display:grid;gap:4px}
.k-roles b{color:var(--ink);font-weight:600}
table.k-lg{min-width:640px}
.k-lg th:nth-child(1){width:160px}
.k-lg th:nth-child(2){width:220px}
.k-file{padding-top:13px}
.k-tools{min-width:0}
/* карта: главное за период */
.k-seg{flex:0 1 auto;min-width:0}
.k-seg button{padding:0 12px;white-space:nowrap}
.k-facts{list-style:none;margin:0;padding:0;display:grid}
.k-facts li{display:grid;grid-template-columns:128px minmax(0,1fr);gap:10px;padding:8px 0;border-top:1px solid var(--line);font-size:14.5px}
.k-facts .st{font:600 13px/1.5 Geologica,Inter,sans-serif;display:flex;gap:6px;align-items:baseline}
.k-facts .st i{font-style:normal;width:12px;text-align:center;flex:none}
.f-crit .st{color:var(--crit)}.f-warn .st{color:var(--warnc)}.f-good .st{color:var(--goodc)}.f-info .st{color:var(--mute)}
.k-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));gap:10px;margin-top:14px}
.k-tile{border:1px solid var(--line);border-radius:14px;padding:11px 13px;display:flex;flex-direction:column;gap:4px;min-width:0}
.k-tile b{font:700 21px/1.15 Geologica,Inter,sans-serif}
.k-tile .lb{font:600 12.5px/1.2 Geologica,Inter,sans-serif;color:var(--mute)}
.k-tile .sm{font-size:12.5px;color:var(--mute);line-height:1.3}
.k-tile.wide{grid-column:span 2}
.k-stack{display:flex;gap:2px;height:12px;margin:2px 0}
.k-stack i{display:block;border-radius:2px;min-width:3px}
.k-leg{display:inline-flex;flex-wrap:wrap;gap:3px 10px;font-size:12.5px;color:var(--mute);align-items:center}
.k-leg b{font:600 12.5px Geologica,Inter,sans-serif;color:var(--ink)}
.k-leg i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:4px;vertical-align:-1px}
.k-legs{display:flex;flex-wrap:wrap;gap:6px 18px;margin-top:10px}
i.lv5,.lv5{background:var(--f5);fill:var(--f5)}
i.lv4,.lv4{background:var(--f4);fill:var(--f4)}
i.lv3,.lv3{background:var(--f3);fill:var(--f3)}
i.lv2,.lv2{background:var(--f2);fill:var(--f2)}
i.lv0{background:transparent;box-shadow:inset 0 0 0 1px var(--line)}
.lv0{fill:transparent;stroke:var(--line);stroke-width:1}
i.dashk{height:0;width:16px;border-top:1px dashed var(--mute);border-radius:0;vertical-align:3px}
i.dashe{height:10px;width:0;border-left:1px dashed var(--ink);border-radius:0}
i.dotc{border-radius:50%;background:var(--ok)}
/* график на одной оси */
#k-tl{min-width:660px}
.k-tlbox{position:relative}
.k-chart .grid{stroke:var(--line);stroke-width:1}
.k-chart .axis{stroke:var(--mute);stroke-width:1;opacity:.5}
.k-chart .ref{stroke:var(--mute);stroke-width:1;stroke-dasharray:3 3}
.k-chart .wline{fill:none;stroke:var(--acc);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.k-chart .wdot{fill:var(--acc);stroke:var(--card);stroke-width:2}
.k-chart .wdot.c{fill:var(--ok)}
.k-chart .bar{fill:var(--f3)}
.k-chart .medbar{fill:var(--acc)}
.k-chart .dose{fill:var(--card)}
.k-chart .ev{stroke:var(--ink);stroke-width:1;stroke-dasharray:2 3}
.k-chart .cross{stroke:var(--acc);stroke-width:1}
.k-chart .t.m{font:600 12.5px Geologica,Inter,sans-serif;fill:var(--ink)}
#k-hit{cursor:crosshair}
.k-tip{position:absolute;top:30px;z-index:3;display:grid;gap:2px;min-width:130px;max-width:230px;padding:9px 11px;border-radius:12px;background:var(--card);box-shadow:0 2px 14px rgba(8,18,26,.22);font-size:13px;pointer-events:none}
.k-tip b{font:600 13px Geologica,Inter,sans-serif}
@media (max-width:760px){
  .k-facts li{grid-template-columns:minmax(0,1fr);gap:0}
  .k-tile.wide{grid-column:auto}
  .k-seg{width:100%}
  .k-seg button{flex:1;padding:0 4px;font-size:12.5px}
}
@media print{.k-seg,.k-tip{display:none!important}}
.k-tip[hidden]{display:none}
.k-pt th:nth-child(6){width:212px}
.k-nav{overflow-x:auto;scrollbar-width:none;flex-wrap:nowrap}
.k-nav::-webkit-scrollbar{display:none}
.k-nav a{flex:none;white-space:nowrap}

/* отчет PDF */
.k-pet-acts{flex:none;justify-content:flex-end}
.k-checks{display:grid;gap:6px;margin-top:10px}
.k-check{display:flex;gap:10px;align-items:flex-start;padding:9px 11px;border-radius:12px;background:var(--bg);cursor:pointer}
.k-check input{margin:3px 0 0;width:17px;height:17px;accent-color:var(--plus);flex:none}
.k-check b{font-weight:600;font-size:14px}
.k-check.off{opacity:.55;cursor:default}
.k-modal .k-filters{padding:0}
.k-modal .lbl{margin-top:14px}
.primary[disabled]{cursor:default}

.k-more-link{color:var(--acc);font-weight:600;text-decoration:none}
.k-more-link:hover{text-decoration:underline}
