/* TeleContacts — Asana-подобный интерфейс в цветах de factum */
:root {
  --bg: #F7F8F8;
  --surface: #FFFFFF;
  --surface-2: #F6F7F7;
  --sidebar: #1D2829;
  --sidebar-2: #253233;
  --sidebar-text: #C6D0CF;
  --sidebar-muted: #7F8E8D;
  --text: #1E1F21;
  --text-2: #5F6466;
  --text-3: #9AA0A3;
  --border: #E5E8E9;
  --border-strong: #CDD3D5;
  --brand: #3AAA8C;
  --brand-hover: #2E9479;
  --brand-ink: #1F7A62;
  --brand-tint: #E8F6F1;
  --brand-tint-2: #D3EFE6;
  --lime: #A9CF38;
  --teal: #0096A8;
  --grad: linear-gradient(135deg, #A9CF38 0%, #4CB386 52%, #0096A8 100%);
  --danger: #DC4C4C;
  --danger-tint: #FCEDED;
  --warn: #C97A16;
  --warn-tint: #FFF3E0;
  --info-tint: #EEF1F3;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(30, 31, 33, .06);
  --shadow: 0 4px 16px rgba(30, 31, 33, .10);
  --shadow-lg: 0 16px 48px rgba(30, 31, 33, .18);
  --font: "Onest", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }
a { color: var(--brand-ink); }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 20px; height: 20px; }

/* ---------------- каркас ---------------- */
.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }

/* ---------------- сайдбар ---------------- */
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  gap: 4px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 30px; height: 30px; }
.brand-name { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.2px; line-height: 1.1; }
.brand-sub { color: var(--sidebar-muted); font-size: 12px; }

.btn-create {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 4px 12px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: transparent;
  color: #fff; font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn-create .plus { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grad); }
.btn-create .plus .icon { stroke: #fff; width: 14px; height: 14px; stroke-width: 2.4; }
.btn-create:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.3); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(58,170,140,.22); color: #fff; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--sidebar-muted); }
.nav-item .badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.nav-section { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--sidebar-muted); display: flex; align-items: center; }
.nav-section button { margin-left: auto; border: 0; background: none; color: var(--sidebar-muted); padding: 0 2px; font-size: 11px; text-transform: none; letter-spacing: 0; }
.nav-section button:hover { color: #fff; }
.sidebar-spacer { flex: 1; }

.me-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px;
  background: var(--sidebar-2);
  border: 0; color: #fff; text-align: left; width: 100%;
}
.me-card:hover { background: #2C3B3C; }
.me-card .me-hint { font-size: 12px; color: var(--sidebar-muted); }
.demo-badge { margin: 0 8px 8px; padding: 6px 10px; border-radius: 6px; background: rgba(169,207,56,.15); color: #D6EC8F; font-size: 12px; }

/* ---------------- аватары ---------------- */
.av {
  --s: 28px; --c: #9AA0A3;
  width: var(--s); height: var(--s); flex: none;
  border-radius: 50%;
  background: var(--c);
  color: #fff; font-weight: 600;
  font-size: calc(var(--s) * .4);
  display: inline-grid; place-items: center;
  overflow: hidden; position: relative;
  letter-spacing: -.3px;
}
.av img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------- шапка ---------------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px 0;
  min-height: 64px;
}
.page-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; flex: none; }
.page-icon .icon { stroke: #fff; width: 20px; height: 20px; }
.page-title h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.3px; }
.page-title .sub { font-size: 13px; color: var(--text-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search {
  display: flex; align-items: center; gap: 8px;
  width: 300px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-3);
  transition: border-color .15s, box-shadow .15s, width .2s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); width: 360px; }
.search input { border: 0; outline: 0; background: none; flex: 1; color: var(--text); min-width: 0; }
.search kbd { font: 11px var(--font); color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; }

.tabs { display: flex; gap: 20px; padding: 10px 24px 0; border-bottom: 1px solid var(--border); }
.tab { border: 0; background: none; padding: 8px 0 10px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-color: var(--text); }
.tab .n { font-size: 12px; color: var(--text-3); }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 24px; }
.toolbar .grow { flex: 1; }

/* ---------------- кнопки ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
a.btn, a.icon-btn { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 15px; }
.btn.pill { border-radius: 999px; }

.chip-filter {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 6px 0 8px;
  border-radius: 999px; border: 1px solid var(--brand-tint-2);
  background: var(--brand-tint); color: var(--brand-ink);
  font-weight: 500; font-size: 13px;
}
.chip-filter button { border: 0; background: none; color: inherit; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.chip-filter button:hover { background: var(--brand-tint-2); }

/* ---------------- список пациентов ---------------- */
.content { flex: 1; overflow: auto; position: relative; }
.list { min-width: 760px; padding: 0 24px 80px; }
.list-head, .row {
  display: grid;
  grid-template-columns: minmax(240px, 2.4fr) 160px minmax(150px, 1.1fr) 130px 170px 110px;
  align-items: center;
}
.list-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-2); font-size: 12px; font-weight: 500;
}
.list-head > div { padding: 8px 10px; border-left: 1px solid var(--border); }
.list-head > div:first-child { border-left: 0; padding-left: 4px; }
.row { border-bottom: 1px solid var(--border); min-height: 46px; cursor: pointer; transition: background .08s; }
.row:hover { background: #F9FAFA; }
.row.selected { background: var(--brand-tint); }
.row > div { padding: 6px 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row > div:first-child { padding-left: 4px; }
.cell-name { display: flex; align-items: center; gap: 10px; }
.cell-name .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.cell-name .nm.empty { color: var(--text-3); font-weight: 400; }
.cell-name .extra { font-size: 12px; color: var(--text-3); flex: none; }
.cell-muted { color: var(--text-2); font-size: 13px; }
.mgr { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

.tg { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; max-width: 100%; }
.tg .icon { width: 14px; height: 14px; }
.tg.ok { color: var(--brand-ink); }
.tg.nouser { color: var(--text-2); }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--info-tint); color: var(--text-2);
  white-space: nowrap;
}
.pill.ok { background: var(--brand-tint); color: var(--brand-ink); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.pill.err { background: var(--danger-tint); color: var(--danger); }

.due { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); }
.due.today { color: var(--brand-ink); font-weight: 500; }
.due.overdue { color: var(--danger); font-weight: 500; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-2); }
.empty-state .art { width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 24px; background: var(--brand-tint); display: grid; place-items: center; }
.empty-state .art img { width: 52px; height: 52px; }
.empty-state h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.empty-state p { margin: 0 0 18px; }

/* ---------------- правая панель пациента ---------------- */
.pane {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(620px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(30,31,33,.08);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.2,.7,.3,1);
  z-index: 20;
}
.pane.open { transform: none; }
.pane-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 54px; }
.pane-bar .saved { margin-left: auto; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity .2s; }
.pane-bar .saved.show { opacity: 1; }
.pane-body { flex: 1; overflow-y: auto; overflow-x: hidden; }
.pane-inner { padding: 22px 28px 28px; }

.p-head { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.p-photo { position: relative; cursor: pointer; border-radius: 50%; }
.p-photo .av { --s: 76px; }
.p-photo .over { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.p-photo:hover .over { opacity: 1; }
.p-names { display: flex; flex-wrap: wrap; gap: 0 6px; flex: 1; min-width: 0; }
.p-names input {
  field-sizing: content;
  min-width: 2.5em; max-width: 100%;
  font-size: 24px; font-weight: 600; letter-spacing: -.4px;
  border: 1px solid transparent; border-radius: 6px;
  padding: 2px 6px; margin-left: -7px;
  background: none; outline: 0;
  width: auto;
}
.p-names input:hover { border-color: var(--border-strong); }
.p-names input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.p-names .tg-name { width: 100%; font-size: 13px; color: var(--text-2); }

.fields { display: grid; grid-template-columns: 130px 1fr; gap: 2px 12px; align-items: center; margin-bottom: 8px; }
.fields .lbl { color: var(--text-2); font-size: 13px; padding: 7px 0; }
.fields .val { min-height: 34px; display: flex; align-items: center; }

.inline {
  width: 100%;
  border: 1px solid transparent; border-radius: 6px;
  padding: 6px 8px; margin-left: -9px;
  background: none; outline: 0;
  resize: none;
}
.inline:hover { border-color: var(--border-strong); }
.inline:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); background: var(--surface); }
textarea.inline { min-height: 64px; line-height: 1.5; }

.select-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: 6px;
  padding: 4px 8px; margin-left: -9px;
  background: none;
}
.select-chip:hover { border-color: var(--border-strong); }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head .n { color: var(--text-3); font-size: 13px; }
.section-head .btn { margin-left: auto; }

.contact {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 14px; margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.contact:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.contact-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.contact-top .label-input { font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -7px; background: none; outline: 0; width: 160px; }
.contact-top .label-input:hover { border-color: var(--border-strong); }
.contact-top .label-input:focus { border-color: var(--brand); }
.contact-top .acts { margin-left: auto; display: flex; gap: 2px; }
.contact-top .icon-btn { width: 30px; height: 30px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.contact-grid label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 0; }
.contact-grid .inline { margin-left: -9px; }
.with-prefix { display: flex; align-items: center; }
.with-prefix span { color: var(--text-3); margin-right: -6px; z-index: 1; }
.tg-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-2); }
.tg-line .pill { white-space: normal; height: auto; min-height: 22px; padding: 3px 8px; }
.tg-line .about { flex-basis: 100%; color: var(--text-2); font-style: italic; }

.add-row {
  display: flex; gap: 8px; align-items: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 10px;
}
.add-row input, .add-row select { height: 32px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; outline: 0; background: var(--surface); min-width: 0; }
.add-row input:focus, .add-row select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* напоминания */
.rem { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.rem:last-child { border-bottom: 0; }
.rem .txt { flex: 1; min-width: 0; }
.rem .txt .t { word-break: break-word; }
.rem .txt .meta { display: flex; gap: 10px; align-items: center; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.rem.done .t { color: var(--text-3); text-decoration: line-through; }
.check {
  width: 20px; height: 20px; flex: none; margin-top: 1px;
  border-radius: 50%; border: 1.5px solid var(--border-strong);
  background: var(--surface); color: transparent;
  display: grid; place-items: center; padding: 0;
  transition: all .15s;
}
.check .icon { width: 12px; height: 12px; stroke-width: 3; }
.check:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.check.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.check.pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.3); } }

.rem-form { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; background: var(--surface-2); }
.rem-form input[type=text], .rem-form input[type=datetime-local] { height: 34px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; outline: 0; background: var(--surface); width: 100%; }
.rem-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.preset { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; }
.preset:hover { border-color: var(--brand); color: var(--brand-ink); }
.preset.on { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-ink); font-weight: 500; }
.rem-form .row2 { display: flex; gap: 8px; align-items: center; }

/* лента активности */
.activity { margin-top: 28px; background: var(--surface-2); border-top: 1px solid var(--border); padding: 18px 28px 30px; }
.activity h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.act { display: flex; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.act .av { --s: 22px; margin-top: 1px; }
.act .when { color: var(--text-3); font-size: 12px; }

/* ---------------- модальное окно ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 28, 29, .45); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(660px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: rise .2s cubic-bezier(.2,.7,.3,1); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 18px 22px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 10px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
.modal-foot .hint { color: var(--text-3); font-size: 12px; margin-right: auto; }

.finder { display: flex; gap: 8px; }
.finder .field { flex: 1; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1.5px solid var(--border-strong); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
.finder .field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.finder .field input { border: 0; outline: 0; flex: 1; font-size: 16px; min-width: 0; background: none; }
.finder .field .kind { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.finder-hint { font-size: 12px; color: var(--text-3); margin: 6px 2px 0; }

.result { margin-top: 14px; border-radius: var(--radius-lg); padding: 14px; display: flex; gap: 14px; align-items: center; animation: rise .2s; }
.result .av { --s: 56px; }
.result.found { background: var(--brand-tint); }
.result.not_found { background: var(--info-tint); }
.result.limited { background: var(--warn-tint); }
.result.error { background: var(--danger-tint); }
.result .r-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.result .r-sub { font-size: 13px; color: var(--text-2); }
.result .status-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.7); flex: none; }
.skeleton { margin-top: 14px; border-radius: var(--radius-lg); height: 84px; background: linear-gradient(90deg, #F1F3F3 25%, #E7EBEB 50%, #F1F3F3 75%); background-size: 200% 100%; animation: shimmer 1.1s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

.dupe { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-tint); color: #7A4A0B; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dupe a { font-weight: 600; cursor: pointer; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.f label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.f input, .f select, .f textarea { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; outline: 0; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.f textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.f input.filled { background: #F4FBF8; }
.f input[type=color] { padding: 0; border: 0; width: 36px; height: 36px; border-radius: 50%; box-shadow: none; }
.f .with-at { position: relative; }
.f .with-at span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.f .with-at input { padding-left: 24px; }

/* ---------------- меню ---------------- */
.menu { position: fixed; z-index: 60; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; animation: fade .1s; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .on .check-mark { color: var(--brand); margin-left: auto; }

/* ---------------- уведомления ---------------- */
.toasts { position: fixed; left: 264px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 70; }
.toast { display: flex; align-items: center; gap: 12px; background: #1E1F21; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 440px; animation: rise .2s; font-size: 14px; }
.toast .icon { stroke: var(--lime); }
.toast.err .icon { stroke: #FF8A8A; }
.toast > button { margin-left: auto; border: 0; background: none; color: var(--lime); font-weight: 600; }
.toast.reminder { flex-direction: column; align-items: stretch; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--brand); box-shadow: var(--shadow-lg); width: 380px; }
.toast.reminder .rt-head { display: flex; align-items: center; gap: 10px; }
.toast.reminder .rt-acts { display: flex; gap: 6px; margin-top: 10px; }


/* ---------------- напоминания (страница) ---------------- */
.group { margin-top: 6px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 14px 0 8px; border: 0; background: none; font-weight: 600; font-size: 15px; width: 100%; text-align: left; }
.group-head .icon { transition: transform .15s; }
.group-head.collapsed .icon { transform: rotate(-90deg); }
.group-head .n { color: var(--text-3); font-weight: 400; font-size: 13px; }
.rem-row { display: grid; grid-template-columns: 28px 1fr 220px 150px 40px; align-items: center; gap: 8px; min-height: 46px; border-bottom: 1px solid var(--border); padding: 4px 4px; }
.rem-row:hover { background: #F9FAFA; }
.rem-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-row.done .t { color: var(--text-3); text-decoration: line-through; }
.patient-link { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 3px 8px 3px 3px; border-radius: 999px; max-width: 100%; overflow: hidden; }
.patient-link:hover { background: var(--brand-tint); }
.patient-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--brand-tint); margin: 4px 0 8px; font-size: 13px; }
.notice .btn { margin-left: auto; }

/* ---------------- настройки ---------------- */
.settings { max-width: 860px; padding: 8px 24px 80px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px; background: var(--surface); }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card .desc { color: var(--text-2); font-size: 13px; margin: 0 0 14px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row .muted { color: var(--text-2); font-size: 13px; }
.set-row input[type=text], .set-row input[type=time], .set-row input[type=number], .set-row select { height: 32px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; outline: 0; background: var(--surface); }
.set-row input:focus, .set-row select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.color-dot { width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; }
input[type=color].color-dot { -webkit-appearance: none; appearance: none; background: none; cursor: pointer; }
input[type=color].color-dot::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color].color-dot::-webkit-color-swatch { border: 0; border-radius: 50%; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.login-box { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.login-box input { height: 34px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; outline: 0; }
.login-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* ---------------- выбор менеджера ---------------- */
.picker {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(169,207,56,.18), transparent 60%),
    radial-gradient(900px 600px at 90% 90%, rgba(0,150,168,.16), transparent 60%),
    #F4FAF7;
  padding: 20px;
}
.picker-box { text-align: center; animation: rise .3s; }
.picker-box .logo { height: 32px; margin: 0 auto 36px; }
.picker-box h1 { font-size: 30px; font-weight: 600; letter-spacing: -.6px; margin: 0 0 6px; }
.picker-box p { color: var(--text-2); margin: 0 0 32px; }
.picker-list { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.picker-card {
  width: 168px; padding: 26px 16px 20px;
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.picker-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.picker-card .av { --s: 84px; font-size: 32px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--brand-tint-2); }
.picker-card .nm { font-size: 17px; font-weight: 600; }
.picker-card .cnt { font-size: 12px; color: var(--text-3); margin-top: -10px; }

/* ---------------- адаптив ---------------- */
@media (max-width: 1240px) {
  .list-head, .row { grid-template-columns: minmax(220px, 2.2fr) 150px minmax(140px, 1fr) 120px 160px; }
  .list-head > :nth-child(6), .row > :nth-child(6) { display: none; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 64px 1fr; }
  .brand div, .btn-create span:not(.plus), .nav-item span:not(.badge), .nav-item .count, .nav-section, .me-card div, .demo-badge { display: none; }
  .btn-create { justify-content: center; padding: 8px 0; }
  .nav-item { justify-content: center; }
  .toasts { left: 80px; }
  .search { width: 200px; }
  .search:focus-within { width: 240px; }
}
@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar, .toolbar, .tabs { padding-left: 16px; padding-right: 16px; }
  .list { padding: 0 16px 80px; }
  .search { display: none; }
  .toasts { left: 16px; right: 16px; }
  .form-grid, .contact-grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 100px 1fr; }
  .pane-inner { padding: 18px 16px; }
}

/* ================= вход ================= */
.login-panel { margin: 24px auto 0; width: min(360px, 100%); text-align: left; animation: rise .2s; }
.login-panel .f + .f { margin-top: 10px; }
.login-panel .f input { height: 42px; font-size: 15px; }
.login-panel .hint { font-size: 12px; color: var(--text-3); margin-top: 10px; text-align: center; }
.login-panel .err { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--danger-tint); color: var(--danger); font-size: 13px; }
.login-panel .link { border: 0; background: none; color: var(--brand-ink); font-size: 13px; padding: 0; text-decoration: underline; }
.picker-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint-2); transform: translateY(-3px); }
.picker-card .pos { font-size: 12px; color: var(--text-3); margin-top: -10px; min-height: 16px; }

/* ================= права и запросы ================= */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--info-tint); color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
.banner .icon { margin-top: 2px; }
.banner b { color: var(--text); font-weight: 600; }
.pending { border: 1px solid #F3D9A8; background: var(--warn-tint); border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 14px; }
.pending h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: #7A4A0B; display: flex; align-items: center; gap: 6px; }
.pending-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid #F3D9A8; }
.pending-item:first-of-type { border-top: 0; }
.pending-item .grow { flex: 1; min-width: 0; font-size: 13px; }
.pending-item .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.req-lines { margin: 4px 0 0; padding-left: 18px; color: var(--text); }
.req-lines li { margin: 2px 0; word-break: break-word; }

.req-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 10px; display: flex; gap: 12px; background: var(--surface); }
.req-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.req-card .grow { flex: 1; min-width: 0; }
.req-card .head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.req-card .head .when { color: var(--text-3); font-size: 12px; margin-left: auto; }
.req-card .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.req-card .reason { margin-top: 6px; font-size: 13px; color: var(--text-2); font-style: italic; }

/* ================= заметки ================= */
.note { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.note.pinned { background: #FFFBEA; border-color: #F1E3A6; }
.note-text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.note-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.note-meta .acts { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.note:hover .note-meta .acts { opacity: 1; }
.note-meta .icon-btn { width: 26px; height: 26px; }
.note-meta .icon-btn.on { color: #B8860B; }
.note textarea, .note-add textarea, .comment-box textarea {
  width: 100%; min-height: 60px; padding: 8px 10px; resize: vertical;
  border: 1px solid var(--border-strong); border-radius: 8px; outline: 0; background: var(--surface); line-height: 1.5;
}
.note textarea:focus, .note-add textarea:focus, .comment-box textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.note-add { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.note-add textarea { min-height: 42px; }
.note .edit-acts { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }

/* ================= фото и файлы ================= */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.thumb { position: relative; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; padding: 0; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.thumb:hover img { transform: scale(1.05); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; }
.file-row:hover { border-color: var(--border-strong); }
.file-ext { width: 36px; height: 36px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: #8A9499; text-transform: uppercase; }
.file-ext.pdf { background: #E5484D; }
.file-ext.doc { background: #3B82F6; }
.file-ext.xls { background: #22A06B; }
.file-row .grow { flex: 1; min-width: 0; }
.file-row .name { font-weight: 500; color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .name:hover { color: var(--brand-ink); text-decoration: underline; }
.file-row .meta { font-size: 12px; color: var(--text-3); }
.dropzone { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-3); font-size: 13px; cursor: pointer; transition: all .15s; text-align: center; }
.dropzone:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-tint); }
.pane.dragging::after { content: "Отпустите, чтобы прикрепить к пациенту"; position: absolute; inset: 8px; border: 2px dashed var(--brand); border-radius: 14px; background: rgba(232, 246, 241, .92); display: grid; place-items: center; font-size: 16px; font-weight: 600; color: var(--brand-ink); z-index: 5; pointer-events: none; }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(12, 16, 17, .92); display: flex; flex-direction: column; animation: fade .15s; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: #fff; }
.lb-title { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-title span { display: block; font-size: 12px; font-weight: 400; color: rgba(255,255,255,.6); }
.lb-bar .icon-btn { color: #fff; }
.lb-bar .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; min-height: 0; padding: 0 64px 24px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 26px; line-height: 1; }
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }

/* ================= комментарии ================= */
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment > .av { --s: 30px; }
.comment .bubble { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 8px 12px; }
.comment .who { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.comment .who b { font-weight: 600; }
.comment .who .when { color: var(--text-3); font-size: 12px; }
.comment .who .icon-btn { margin-left: auto; width: 24px; height: 24px; opacity: 0; }
.comment:hover .who .icon-btn { opacity: 1; }
.comment .text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.comment.mine .bubble { background: #F2FAF7; border-color: var(--brand-tint-2); }
.act.small { font-size: 12px; color: var(--text-2); margin-bottom: 8px; align-items: center; }
.act.small .av { --s: 18px; }
.comment-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; }
.comment-box > .av { --s: 30px; margin-top: 4px; }
.comment-box .grow { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.comment-box textarea { min-height: 44px; }
.history-toggle { border: 0; background: none; color: var(--text-2); font-size: 12px; padding: 0 0 12px; text-decoration: underline; }

/* ================= профиль ================= */
.profile { display: flex; gap: 20px; align-items: flex-start; }
.profile-avatar { position: relative; cursor: pointer; border-radius: 50%; flex: none; }
.profile-avatar .over { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.profile-avatar:hover .over { opacity: 1; }
.profile .grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.pass-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.pass-row input { height: 34px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; outline: 0; width: 170px; }
.pass-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
@media (max-width: 640px) {
  .profile { flex-direction: column; }
  .profile .grid { grid-template-columns: 1fr; }
}
