/* LiBro · «Связь» - общий стиль страниц врача и пациента.
   Цвета и шрифты - те же, что на librot.ru: четыре темы сайта (тёмная, светлая, персиковая, сиреневая).
   Значения сняты с переменных --lb-* сайта; color-mix в новых правилах не используется (старый Safari). */
@font-face{font-family:"LiBro Manrope";font-style:normal;font-weight:200 800;font-display:swap;src:url(/fonts/manrope-cyr.woff2) format("woff2");unicode-range:u+0301,u+0400-045f,u+0490-0491,u+04b0-04b1,u+2116}
@font-face{font-family:"LiBro Manrope";font-style:normal;font-weight:200 800;font-display:swap;src:url(/fonts/manrope-lat.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}
@font-face{font-family:"LiBro Cormorant";font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/cormorant-cyr.woff2) format("woff2");unicode-range:u+0301,u+0400-045f,u+0490-0491,u+04b0-04b1,u+2116}
@font-face{font-family:"LiBro Cormorant";font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/cormorant-lat.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}
:root{
  --font:"LiBro Manrope",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --display:"LiBro Manrope",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --serif:"LiBro Cormorant","Times New Roman",serif;
  --r:20px; --r-sm:12px;
}
/* Тёмная - тема сайта по умолчанию: графит и изумруд */
:root,:root[data-theme="dark"]{
  --bg:#21212d; --bg2:#1c1c27; --card:#2a2a37; --card2:#252532; --ink:#f4f6f5; --ink2:#c9d1ce; --muted:#a9b2af; --line:rgba(169,178,175,.25);
  --em-950:#043b30; --em-900:#c4e0d6; --em-800:#c4e0d6; --em-700:#0d6b52; --em-600:#157b60; --em-500:#3fae8c; --em-300:#0d6b52; --em-100:rgba(13,107,82,.34); --em-50:rgba(13,107,82,.16);
  --gold:#c9b27a; --red:#f4a5b5; --red-bg:rgba(244,165,181,.12); --amber:#edce91; --amber-bg:rgba(237,206,145,.12);
  --glow1:rgba(13,107,82,.42); --glow2:rgba(201,178,122,.08); --hi:#6ee7b7; --hi-a:rgba(110,231,183,.85); --hi-0:rgba(110,231,183,0);
  --stage:#16161f; --stage2:#0d3d31; --on-stage:#f4f6f5; --on-stage2:#c4e0d6; --shade:rgba(10,10,16,.72);
  --doc1:#0d6b52; --doc2:#043b30; --on-btn:#fff;
  --shadow:0 2px 4px rgba(0,0,0,.09),0 10px 26px rgba(0,0,0,.18); --shadow-lg:0 16px 36px rgba(0,0,0,.26);
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#edf4f0; --bg2:#e6f0eb; --card:#f8fbfa; --card2:#f2f8f5; --ink:#12201b; --ink2:#2f423a; --muted:#4e605a; --line:rgba(78,96,90,.25);
  --em-950:#043b30; --em-900:#054f40; --em-800:#047857; --em-700:#0d6b52; --em-600:#107c5e; --em-500:#0d6b52; --em-300:#0f8c6b; --em-100:rgba(13,107,82,.14); --em-50:rgba(13,107,82,.07);
  --gold:#9a7a2c; --red:#af2648; --red-bg:#f9e4ea; --amber:#885c13; --amber-bg:#f8edd5;
  --glow1:rgba(13,107,82,.12); --glow2:rgba(201,178,122,.10); --hi:#6ee7b7; --hi-a:rgba(110,231,183,.85); --hi-0:rgba(110,231,183,0);
  --stage:#12201b; --stage2:#0d4a3b; --on-stage:#f4f6f5; --on-stage2:#c4e0d6; --shade:rgba(10,20,16,.72);
  --doc1:#0d6b52; --doc2:#054f40; --on-btn:#fff;
  --shadow:0 2px 5px rgba(35,62,51,.08),0 10px 24px rgba(35,62,51,.06); --shadow-lg:0 12px 28px rgba(35,62,51,.12);
  color-scheme:light;
}
:root[data-theme="peach"]{
  --bg:#fdf2ec; --bg2:#faebe2; --card:#fffaf6; --card2:#fef5ef; --ink:#2a1812; --ink2:#52382e; --muted:#705448; --line:rgba(112,84,72,.25);
  --em-950:#4a1d0f; --em-900:#622714; --em-800:#843619; --em-700:#a84726; --em-600:#b8532e; --em-500:#a84726; --em-300:#c2603a; --em-100:rgba(168,71,38,.14); --em-50:rgba(168,71,38,.07);
  --gold:#9a7a2c; --red:#af2648; --red-bg:#f9e4ea; --amber:#885c13; --amber-bg:#f8edd5;
  --glow1:rgba(194,96,58,.12); --glow2:rgba(201,178,122,.10); --hi:#ffb48f; --hi-a:rgba(255,180,143,.85); --hi-0:rgba(255,180,143,0);
  --stage:#2a1812; --stage2:#622714; --on-stage:#fff4ee; --on-stage2:#ffd2bd; --shade:rgba(30,15,10,.72);
  --doc1:#a84726; --doc2:#622714; --on-btn:#fff;
  --shadow:0 2px 5px rgba(80,40,25,.08),0 10px 24px rgba(80,40,25,.06); --shadow-lg:0 12px 28px rgba(80,40,25,.12);
  color-scheme:light;
}
:root[data-theme="lilac"]{
  --bg:#14101e; --bg2:#1a1526; --card:#221b30; --card2:#1d1729; --ink:#f4f1fc; --ink2:#cec8e2; --muted:#aaa2c4; --line:rgba(170,162,196,.25);
  --em-950:#2a1a52; --em-900:#c4a6ff; --em-800:#c4a6ff; --em-700:#6d4ac4; --em-600:#7f5bd8; --em-500:#9b7bf0; --em-300:#6d4ac4; --em-100:rgba(109,74,196,.36); --em-50:rgba(109,74,196,.18);
  --gold:#c9b27a; --red:#f4a5b5; --red-bg:rgba(244,165,181,.12); --amber:#edce91; --amber-bg:rgba(237,206,145,.12);
  --glow1:rgba(109,74,196,.40); --glow2:rgba(201,178,122,.06); --hi:#c4a6ff; --hi-a:rgba(196,166,255,.85); --hi-0:rgba(196,166,255,0);
  --stage:#0e0b16; --stage2:#2a1a52; --on-stage:#f4f1fc; --on-stage2:#d9c8ff; --shade:rgba(8,6,14,.72);
  --doc1:#6d4ac4; --doc2:#2a1a52; --on-btn:#fff;
  --shadow:0 2px 4px rgba(0,0,0,.12),0 10px 26px rgba(0,0,0,.22); --shadow-lg:0 16px 36px rgba(0,0,0,.3);
  color-scheme:dark;
}
/* Без выбора человека - по системе: светлая система получает светлую тему сайта */
@media (prefers-color-scheme:light){
  :root:not([data-theme]){
    --bg:#edf4f0; --bg2:#e6f0eb; --card:#f8fbfa; --card2:#f2f8f5; --ink:#12201b; --ink2:#2f423a; --muted:#4e605a; --line:rgba(78,96,90,.25);
    --em-950:#043b30; --em-900:#054f40; --em-800:#047857; --em-700:#0d6b52; --em-600:#107c5e; --em-500:#0d6b52; --em-300:#0f8c6b; --em-100:rgba(13,107,82,.14); --em-50:rgba(13,107,82,.07);
    --gold:#9a7a2c; --red:#af2648; --red-bg:#f9e4ea; --amber:#885c13; --amber-bg:#f8edd5;
    --glow1:rgba(13,107,82,.12); --glow2:rgba(201,178,122,.10);
    --stage:#12201b; --stage2:#0d4a3b; --shade:rgba(10,20,16,.72); --doc1:#0d6b52; --doc2:#054f40;
    --shadow:0 2px 5px rgba(35,62,51,.08),0 10px 24px rgba(35,62,51,.06); --shadow-lg:0 12px 28px rgba(35,62,51,.12);
    color-scheme:light;
  }
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font);font-size:16px;line-height:1.45}
body{min-height:100vh;min-height:100dvh;background:radial-gradient(1200px 520px at 12% -10%,var(--glow1),transparent 60%),radial-gradient(900px 480px at 110% 0%,var(--glow2),transparent 55%),var(--bg);background-attachment:fixed}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
:focus-visible{outline:3px solid var(--em-500);outline-offset:2px;border-radius:8px}
.hide{display:none!important}
.muted{color:var(--muted);font-size:.84rem}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* шапка */
.top{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding:.9rem 1.1rem}
.brand{display:flex;align-items:center;gap:.7rem;min-width:0}
.word{flex:none;font:500 1.9rem/1 var(--serif);letter-spacing:-.01em;color:var(--ink);padding-right:.15rem}
.libri{display:block;width:5.5rem;height:5.5rem;object-fit:contain;flex:none}
.brand h1{min-width:0;margin:0;padding-left:.75rem;border-left:1px solid var(--line);font:600 1.05rem/1.2 var(--display);letter-spacing:0}
.brand small{display:block;margin-top:.1rem;font:400 .8rem/1.35 var(--font);color:var(--muted);letter-spacing:0}
.top .grow{flex:1}
.pill{display:inline-flex;align-items:center;gap:.5rem;max-width:100%;padding:.42rem .8rem;border-radius:999px;background:var(--card);border:1px solid var(--line);font-size:.84rem;box-shadow:var(--shadow)}
.dot{width:.62rem;height:.62rem;border-radius:50%;background:#e0a526;flex:none}
.dot.on{background:var(--em-500);box-shadow:0 0 0 4px var(--em-50)}
.dot.off{background:#d9574c}
.icon-btn{width:2.5rem;height:2.5rem;border-radius:.8rem;display:grid;place-items:center;background:var(--card);border:1px solid var(--line);box-shadow:var(--shadow);font-size:1.05rem}
.icon-btn:hover{border-color:var(--em-500)}
.icon-btn svg{width:1.2rem;height:1.2rem;fill:currentColor}
.ic{width:1.15em;height:1.15em;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* карточки и кнопки */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);padding:1rem}
.card h2{margin:0 0 .6rem;font:700 .95rem var(--display);letter-spacing:.01em;display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;max-width:100%;white-space:nowrap;min-height:2.75rem;padding:.55rem 1.05rem;border-radius:.9rem;font-weight:600;
  background:linear-gradient(180deg,var(--em-600),var(--em-700));color:var(--on-btn);box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 4px 12px var(--em-50);transition:transform .12s,box-shadow .12s,filter .12s}
.btn:hover{filter:brightness(1.06)}.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.5;cursor:not-allowed;filter:none}
.btn.ghost{background:var(--em-50);color:var(--em-900);border:1px solid var(--em-500);border:1px solid color-mix(in srgb,var(--em-500) 35%,var(--line));box-shadow:none}
.btn.quiet{background:transparent;color:var(--ink2);border:1px solid var(--line);box-shadow:none}
.btn.warn{background:transparent;color:var(--red);border:1px solid var(--red);border:1px solid color-mix(in srgb,var(--red) 40%,var(--line));box-shadow:none}
.btn.big{min-height:3.4rem;font-size:1.08rem;border-radius:1.1rem;padding:.7rem 1.3rem}
.seg{display:inline-flex;flex-wrap:wrap;max-width:100%;gap:.2rem;padding:.22rem;border-radius:.95rem;background:var(--bg2);border:1px solid var(--line)}
.seg button{flex:1 1 auto;min-width:0;white-space:normal;overflow-wrap:anywhere;min-height:2.4rem;padding:.4rem .8rem;border-radius:.75rem;font-weight:600;font-size:.88rem;color:var(--ink2)}
.seg button[aria-pressed="true"]{background:var(--card);color:var(--em-900);box-shadow:var(--shadow)}
@media (max-width:380px){.seg button{padding:.4rem .4rem;font-size:.8rem}}
select.sel{max-width:100%;min-height:2.4rem;padding:.35rem .6rem;border-radius:.75rem;border:1px solid var(--line);background:var(--card)}
.row{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;min-width:0}
.row>*{min-width:0;max-width:100%}

/* сцена: человек в кадре */
.frame{position:relative;border-radius:calc(var(--r) - 4px) calc(var(--r) - 4px) 0 0;overflow:hidden;background:var(--stage);aspect-ratio:4/3;box-shadow:inset 0 0 0 1px rgba(255,255,255,.06)}
.frame video{width:100%;height:100%;object-fit:contain;display:block;transform:scaleX(-1)}
.frame canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
.frame .ph{position:absolute;inset:0;display:grid;place-items:center;text-align:center;padding:1.4rem;color:var(--on-stage2);font-size:1rem;line-height:1.5;
  background:radial-gradient(60% 60% at 50% 40%,var(--glow1),transparent 70%)}
.frame .badge{position:absolute;left:.6rem;top:.6rem;display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .6rem;border-radius:999px;font-size:.76rem;font-weight:600;color:var(--on-stage);background:var(--shade);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);border:1px solid rgba(255,255,255,.12)}
.frame .badge i{width:.5rem;height:.5rem;border-radius:50%;background:var(--hi)}
.frame .badge.warn i{background:#f2c14e}.frame .badge.off i{background:#ff8a80}
.frame .ring{position:absolute;inset:0;border-radius:inherit;pointer-events:none;box-shadow:inset 0 0 0 0 var(--hi-0);transition:box-shadow .35s}
.frame.hot .ring{box-shadow:inset 0 0 0 3px var(--hi-a)}
.frame .count{position:absolute;inset:0;display:grid;place-items:center;font:800 clamp(2rem,9vw,5rem) var(--display);color:#fff;text-shadow:0 4px 30px rgba(0,0,0,.6);background:var(--shade);text-align:center;padding:1rem}
/* подпись под кадром: текст не закрывает руки и лицо */
.cap{min-height:3.5rem;padding:.7rem .95rem;background:linear-gradient(180deg,var(--stage),var(--stage2));color:var(--on-stage);border-radius:0 0 calc(var(--r) - 4px) calc(var(--r) - 4px);
  font:650 clamp(1.15rem,2.3vw,1.6rem)/1.3 var(--display);display:flex;flex-wrap:wrap;gap:.15rem .5rem;align-items:baseline}
.cap span{animation:pop .28s cubic-bezier(.2,.9,.3,1.2)}
.cap .p{opacity:.55;font-weight:500;animation:none}
.cap .e{opacity:.6;font:500 .92rem var(--font)}
@keyframes pop{from{transform:translateY(.4em);opacity:0}to{transform:none;opacity:1}}

/* черновик сообщения */
.draft{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;min-height:3.3rem;padding:.55rem;border-radius:1rem;background:var(--card2);border:1px solid var(--line)}
.tk{display:inline-flex;align-items:center;max-width:100%;overflow-wrap:anywhere;text-align:left;min-height:2.5rem;padding:.3rem .8rem;border-radius:.8rem;font:650 1.15rem var(--display);background:var(--card);color:var(--ink);border:1.5px solid var(--em-500);border:1.5px solid color-mix(in srgb,var(--em-500) 45%,var(--line));box-shadow:none}
.tk.new{animation:pop .28s cubic-bezier(.2,.9,.3,1.2)}
.tk.spell{letter-spacing:.04em}
.tk.open{border-style:solid;border-color:var(--gold);background:var(--card);background:color-mix(in srgb,var(--gold) 9%,var(--card))}
.tk.open::after{content:"";width:2px;height:1.2em;margin-left:.2rem;background:var(--gold);animation:blink 1s steps(2) infinite}
.tk.fixed::after{content:"✓";margin-left:.35rem;font-size:.75em;color:var(--em-600)}
.tk.unsure{border-style:dashed;border-color:var(--amber);background:var(--amber-bg)}
.tk.unsure::after{content:"?";margin-left:.35rem;font-weight:800;color:var(--amber)}
.tk.prov{border:1.5px dashed var(--line);background:transparent;color:var(--muted);font-weight:500;box-shadow:none}
.tk-empty{color:var(--muted);font-size:.92rem;padding:0 .4rem}
@keyframes blink{50%{opacity:0}}
.tk-menu{position:absolute;z-index:50;min-width:11rem;max-width:min(22rem,calc(100vw - 1rem));padding:.35rem;border-radius:1rem;background:var(--card);border:1px solid var(--line);box-shadow:var(--shadow-lg);display:flex;flex-direction:column;gap:.15rem}
.tk-menu button{text-align:left;min-height:2.75rem;padding:.45rem .8rem;border-radius:.7rem;font:600 1.05rem var(--display)}
.tk-menu button:hover,.tk-menu button:focus-visible{background:var(--em-50)}
.tk-menu .lit{color:var(--amber);font:600 .95rem var(--font)}
.tk-menu .del{color:var(--red);font:600 .92rem var(--font)}
.note{display:none;margin-top:.45rem;padding:.5rem .7rem;border-radius:.8rem;font-size:.86rem;background:var(--amber-bg);color:var(--amber)}
.note.show{display:block}

/* переписка */
.chat{display:flex;flex-direction:column;gap:.5rem;overflow:auto;padding:.2rem;scroll-behavior:smooth}
.m{max-width:86%;padding:.6rem .85rem;border-radius:1.1rem;line-height:1.38;word-break:break-word;animation:pop .25s ease-out}
.m small{display:block;margin-top:.2rem;font-size:.7rem;color:var(--muted);font-weight:400}
.m.d{align-self:flex-end;background:var(--em-100);border-bottom-right-radius:.35rem}
.m.p{align-self:flex-start;background:var(--card);border:1.5px solid var(--em-500);border:1.5px solid color-mix(in srgb,var(--em-500) 55%,var(--line));border-bottom-left-radius:.35rem;font:650 1.2rem/1.35 var(--display)}
.m.sys{align-self:center;background:transparent;color:var(--muted);font-size:.8rem;padding:.2rem}
textarea.inp,input.inp{width:100%;border:1px solid var(--line);border-radius:.95rem;padding:.65rem .8rem;background:var(--card);font-size:1.05rem;outline:none;resize:vertical}
textarea.inp:focus,input.inp:focus{border-color:var(--em-500);box-shadow:0 0 0 3px var(--em-50)}
.chips{display:flex;flex-wrap:wrap;gap:.35rem}
.chips button{min-height:2.2rem;padding:.3rem .7rem;border-radius:999px;font-size:.82rem;background:var(--em-50);border:1px solid var(--line);border:1px solid color-mix(in srgb,var(--em-500) 28%,var(--line));color:var(--em-900)}
.chips button:hover{background:var(--em-100)}
details.more{border-top:1px dashed var(--line);margin-top:.8rem;padding-top:.6rem}
details.more>summary{cursor:pointer;color:var(--muted);font-size:.86rem;font-weight:600;list-style:none}
details.more>summary::before{content:"▸ ";}details.more[open]>summary::before{content:"▾ "}
.kv{display:grid;grid-template-columns:repeat(auto-fit,minmax(9.5rem,1fr));gap:.4rem;margin-top:.5rem}
.kv div{padding:.45rem .6rem;border-radius:.7rem;background:var(--card2);border:1px solid var(--line);font-size:.78rem;color:var(--muted)}
.kv b{display:block;font:700 1rem var(--display);color:var(--ink)}
.tag{display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .6rem;border-radius:.7rem;background:var(--em-50);border:1px solid var(--line);font-size:.86rem}
.tag button{color:var(--red);font-weight:800;min-width:1.6rem;min-height:1.6rem}
.err{color:var(--red);background:var(--red-bg);padding:.5rem .7rem;border-radius:.8rem;font-size:.88rem}
.ok{color:var(--em-800)}

@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
