/* Clinic workspace: restrained operational UI; local IBM Plex Sans. */
@font-face { font-family: 'IBM Plex Sans'; src: url('/ibm-plex-sans-variable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }
:root {
  --ink: #242824; --ink-muted: #606660; --ink-subtle: #687068; --ink-inverse: #FBFCFA;
  --surface: #FFFFFF; --surface-raised: #FFFFFF; --surface-sunken: #F5F6F4; --surface-inverse: #193B2B;
  --line: #E8EAE6; --line-strong: #D6DBD3;
  --action: #31583D; --action-hover: #24462F; --action-soft: #E8F0E4; --action-on: #FFFFFF;
  --accent: #31583D; --accent-soft: #E8F0E4; --success: #31583D; --warning: #886326; --danger: #A44242;
  --danger-soft: #F8EBE8; --clinical-soft: #EFF0E9;
  --sidebar-bg: #F8F9F7; --sidebar-text: #474E46; --sidebar-muted: #687068; --sidebar-active: #E8EFE5;
  --font-text: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: var(--font-text); --font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --shadow-raised: none; --shadow-overlay: 0 10px 28px rgb(25 59 43 / 9%);
  --motion-fast: 0ms; --ease: cubic-bezier(.2,0,0,1); --gutter: 24px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 15px/1.55 var(--font-text); min-height: 100dvh; font-optical-sizing: auto; }
a { color: var(--action); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; margin: 0 0 12px; }
h1 { font-size: 1.9375rem; line-height: 1.2; } h2 { font-size: 1.5625rem; } h3 { font-size: 1.25rem; }
p { margin: 0 0 12px; }
small, .muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-size: 0.875rem; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-raised); }
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
label { display: grid; gap: 6px; font-size: 0.875rem; color: var(--ink-muted); }
label > input, label > select, label > textarea { font-size: 1rem; color: var(--ink); }
label.check { grid-template-columns: auto 1fr; align-items: center; }
label.check input { width: 20px; height: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-raised); cursor: pointer; transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease); text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--surface-sunken); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-on); }
.btn.primary:hover { background: var(--action-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
form.inline { display: grid; gap: 12px; }
.banner.pilot { background: #EAF0E6; color: #4C6050; font-weight: 500; }
.banner { background: var(--accent-soft); color: var(--ink); font-size: 0.8125rem; padding: 6px var(--gutter); text-align: center; border-bottom: 1px solid var(--line); }
header.top { display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter); border-bottom: 1px solid var(--line); background: var(--surface-raised); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
header.top .brand svg { width: 24px; height: 24px; }
header.top .spacer { flex: 1; }
header.top .who { font-size: 0.8125rem; color: var(--ink-muted); text-align: right; line-height: 1.3; }
header.top form { margin: 0; }
nav.primary { display: flex; gap: 4px; padding: 8px var(--gutter); border-bottom: 1px solid var(--line); background: var(--surface-raised); overflow-x: auto; }
nav.primary a { padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-muted); white-space: nowrap; }
nav.primary a.active { background: var(--action-soft); color: var(--action); font-weight: 600; }
main { padding: 20px var(--gutter) 96px; max-width: 1100px; margin: 0 auto; }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-160%); z-index: 30; background: var(--surface-raised); padding: 12px 18px; border: 2px solid var(--action); border-radius: var(--radius-md); }
.skip-link:focus { transform: none; }
.sidebar, .mobile-menu, .workspace-heading { display: none; }
.crm-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
.crm-shell > .banner, .crm-shell > #offline, .crm-shell > header.top, .crm-shell > main { grid-column: 2; }
.crm-shell > .sidebar { grid-column: 1; grid-row: 1 / span 4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; min-height: 0; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-bg); z-index: 6; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; min-height: 94px; padding: 22px; color: #FAFBFC; font-weight: 650; line-height: 1.25; text-decoration: none; }
.sidebar-brand svg { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-brand span { max-width: 140px; }
.sidebar nav.primary { display: block; overflow-y: auto; padding: 0 12px 20px; border: 0; min-height: 0; overscroll-behavior: contain; background: transparent; scrollbar-color: #53715A transparent; scrollbar-width: thin; }
.nav-group { margin: 0 0 18px; }
.nav-group:last-child { margin-bottom: 0; }
.nav-group h2 { font: 600 11px/1.4 var(--font-text); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-subtle); padding: 0 12px; margin: 0 0 6px; }
.nav-group a { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; margin: 2px 0; color: var(--ink-muted); border-radius: 2px; text-decoration: none; font-size: 14px; line-height: 1.35; }
.nav-group a { gap: 11px; }
.nav-icon, .menu-icon, .logout-icon, svg.bell-icon { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.6; }
.nav-label { min-width: 0; }
.sidebar nav.primary a { white-space: normal; }
.sidebar .nav-icon { color: var(--sidebar-muted); }
.sidebar nav.primary a.active .nav-icon { color: #DDE3E9; }
.sidebar nav.primary a:hover .nav-icon { color: #FAFBFC; }
.clinic-switch { min-width: 0; }
.language-switch { margin: 0; }
.language-switch label { gap: 5px; font-size: 12px; }
.language-switch select { min-height: 40px; padding: 7px 10px; font-size: 13px; }
.sidebar-context .language-switch { margin-bottom: 12px; }
.sidebar-context .language-switch label { color: var(--sidebar-muted); }
.sidebar-context .language-switch select { color: var(--sidebar-text); background: #244634; border-color: #53715A; }
.mobile-nav-panel .language-switch { margin: 0 0 22px; padding: 0 12px; }
.auth-shell header.top .language-switch { max-width: 160px; }
.bottom .nav-icon { width: 20px; height: 20px; }
.nav-group a:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-group a.active, .sidebar nav.primary a.active { background: var(--action-soft); color: var(--action); box-shadow: none; font-weight: 650; }
.sidebar .nav-group h2 { color: var(--sidebar-muted); font-size: 10px; letter-spacing: .1em; }
.sidebar nav.primary a { color: var(--sidebar-text); }
.sidebar nav.primary a:hover { color: #FAFBFC; background: #244634; }
.sidebar nav.primary a.active { color: #FAFBFC; background: var(--sidebar-active); box-shadow: none; }
.sidebar-context { margin-top: auto; padding: 16px 22px; border-top: 1px solid #375542; display: grid; gap: 2px; font-size: 12px; color: var(--sidebar-muted); }
.sidebar-context strong { font-size: 13px; color: var(--sidebar-text); overflow-wrap: anywhere; }
.crm-shell header.top { min-width: 0; padding: 14px 28px; min-height: 78px; gap: 18px; }
.crm-shell header.top .brand { display: none; }
.workspace-heading { display: grid; gap: 2px; min-width: 0; }
.workspace-heading small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); }
.workspace-heading strong { font-size: 15px; line-height: 1.3; font-weight: 600; }
.crm-shell > main { min-width: 0; width: 100%; max-width: 1560px; padding: 28px clamp(20px, 3vw, 44px) 60px; }
.crm-shell > main > h1 { font-family: var(--font-text); font-size: 28px; font-weight: 600; letter-spacing: -.015em; }
.crm-shell .board { min-width: 0; }
@media (min-width: 721px) and (max-width: 1050px) {
  .crm-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .crm-shell header.top { padding: 12px 20px; gap: 10px; }
  .crm-shell header.top .who { display: none; }
  .crm-shell .workspace-heading small { display: none; }
  .crm-shell header.top select { max-width: 190px; }
  .crm-shell .grid2 { grid-template-columns: 1fr; }
}
.pill { display: inline-block; padding: 2px 10px; border-radius: 2px; font-size: 0.8125rem; background: var(--surface-sunken); color: var(--ink-muted); white-space: nowrap; }
.pill.assigned { background: var(--action-soft); color: var(--action); }
.pill.in_progress { background: var(--action-soft); color: var(--action); }
.pill.waiting { background: #EDE7DC; color: var(--warning); }
.pill.in_review { background: var(--accent-soft); color: var(--accent); }
.pill.done { background: #E5EFE3; color: var(--success); }
.pill.cancelled { background: var(--surface-sunken); color: var(--ink-subtle); }
.pill.overdue { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.pill.clinical { background: var(--clinical-soft); color: #4E586C; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin: 16px 0 24px; border-block: 1px solid var(--line); }
.stat { background: transparent; border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 14px 16px; }
.stat:last-child { border-right: 0; }
.stat .label { font-size: 0.8125rem; color: var(--ink-muted); }
.stat .value { font-size: 1.9375rem; font-family: var(--font-display); line-height: 1.1; margin-top: 6px; }
.stat.warn .value { color: var(--danger); }
.card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; margin: 0 0 12px; box-shadow: var(--shadow-raised); }
.card h3 { margin-bottom: 8px; }
.task-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.task { display: grid; gap: 6px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; text-decoration: none; color: inherit; transition: border-color var(--motion-fast) var(--ease); }
.task:hover { border-color: var(--line-strong); }
.task .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.875rem; color: var(--ink-muted); }
.task .title { font-weight: 600; font-size: 1.0625rem; color: var(--ink); }
.task .next { color: var(--action); font-size: 0.9375rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8125rem; color: var(--ink-muted); font-weight: 600; }
.overflow { overflow-x: auto; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line-strong); display: grid; gap: 14px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--action); }
.timeline .when { font-size: 0.8125rem; color: var(--ink-muted); }
.timeline .what { font-weight: 600; }
.timeline .detail { font-size: 0.9375rem; color: var(--ink-muted); white-space: pre-wrap; }
.notice { padding: 12px 16px; border-radius: var(--radius-md); margin: 0 0 16px; border: 1px solid var(--line); background: var(--surface-sunken); }
.notice.ok { background: var(--action-soft); border-color: var(--action); }
.notice.err { background: var(--danger-soft); border-color: var(--danger); }
.notice.clinical { background: var(--clinical-soft); border-color: #4E586C; }
details { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 16px; margin: 0 0 12px; background: var(--surface-raised); }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details[open] > summary { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.9375rem; }
.meta dt { color: var(--ink-muted); } .meta dd { margin: 0; }
.login { max-width: 400px; margin: 48px auto; }
.demo-users { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 24px; }
.demo-users code { font-family: var(--font-mono); }
nav.bottom { display: none; }
@media (max-width: 720px) {
  .crm-shell { display: block; }
  .crm-shell > .sidebar { display: none; }
  .crm-shell > main { padding: 20px 16px 100px; }
  .crm-shell > main > h1 { font-size: 25px; }
  .crm-shell header.top { padding: 10px 12px; min-height: 64px; gap: 8px; }
  .crm-shell .workspace-heading { display: none; }
  .crm-shell .mobile-menu { display: block; padding: 0; margin: 0; border: 0; background: transparent; }
  .crm-shell .mobile-menu[open] > summary { margin-bottom: 0; }
  .mobile-menu > summary { min-height: 44px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
  .mobile-menu > summary::-webkit-details-marker { display: none; }
  .mobile-menu[open] > summary { background: var(--action-soft); border-color: var(--action); color: var(--action); }
  .mobile-nav-panel { position: absolute; top: calc(100% + 8px); left: 12px; right: 12px; max-height: min(65dvh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: 20px 12px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: none; border-color: var(--line-strong); }
  .crm-shell header.top .pill, .crm-shell header.top select { max-width: min(40vw, 180px); font-size: 13px; }
  .crm-shell header.top .spacer { display: none; }
  .crm-shell header.top .bell { margin-left: auto; }
  .crm-shell .bottom { overflow-x: auto; }
  .crm-shell .bottom a { flex: 1 0 0; min-width: 0; font-size: 11px; line-height: 1.25; flex-direction: column; gap: 4px; }
  .crm-shell header.top .clinic-switch { flex: 1; min-width: 0; }
  .crm-shell header.top .clinic-switch select { max-width: none; width: 100%; min-width: 0; }
  .crm-shell header.top .logout-icon { display: none; }
  .mobile-menu > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
  main { padding-bottom: 88px; }
  header.top .who { display: none; }
  header.top .brand-text { display: none; }
  header.top .pill, header.top select { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; }
  header.top { gap: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  nav.primary { display: none; }
  nav.bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface-raised); border-top: 1px solid var(--line); padding: 6px var(--gutter) calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
  nav.bottom a { flex: 1; text-align: center; padding: 8px 4px; font-size: 0.8125rem; text-decoration: none; color: var(--ink-muted); border-radius: var(--radius-sm); min-height: 44px; display: flex; align-items: center; justify-content: center; }
  nav.bottom a.active { color: var(--action); background: var(--action-soft); font-weight: 600; }
  .stat .value { font-size: 1.5625rem; }
  h1 { font-size: 1.5625rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { header.top, nav, .sidebar, .skip-link, .banner, .actions, form { display: none !important; } body.crm-shell { display: block; } body { background: #fff; } .crm-shell > main { padding: 0; max-width: none; } }

/* ---- Канбан воронки ---- */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 16px; align-items: flex-start; scroll-snap-type: x proximity; }
.ep-col { flex: 0 0 280px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-md); display: flex; flex-direction: column; max-height: 72vh; scroll-snap-align: start; }
.ep-col.drop-target { border-color: var(--action); background: var(--action-soft); }
.ep-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border-top: 0; border-bottom: 1px solid var(--line); font-weight: 600; position: sticky; top: 0; background: var(--surface-sunken); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.ep-col[data-kind="won"] .ep-col-head { color: var(--success); }
.ep-col[data-kind="lost"] .ep-col-head { color: var(--danger); }
.ep-col-body { overflow-y: auto; padding: 8px; display: grid; gap: 8px; }
.ep-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease); }
.ep-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-raised); }
.ep-card.dragging { opacity: .5; }
.ep-link { display: grid; gap: 6px; padding: 10px 12px; text-decoration: none; color: inherit; }
.ep-title { font-weight: 600; line-height: 1.3; }
.ep-card .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.8125rem; }
.ep-card .next { color: var(--action); font-size: 0.875rem; }
.funnel-row { display: grid; grid-template-columns: 180px 1fr 70px; gap: 12px; align-items: center; margin-bottom: 8px; }
.funnel-label { font-size: 0.9375rem; }
.funnel-bar { background: var(--surface-sunken); border-radius: var(--radius-sm); height: 22px; overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; background: var(--action); min-width: 2px; transition: width var(--motion-medium) var(--ease); }
.funnel-bar > span.kind-won { background: var(--success); }
.funnel-bar > span.kind-lost { background: var(--danger); }
.funnel-n { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .board { gap: 8px; }
  .ep-col { flex-basis: 84vw; max-height: none; }
  .funnel-row { grid-template-columns: 1fr; gap: 4px; }
  .funnel-n { text-align: left; }
}

/* ---- Колокольчик уведомлений ---- */
.bell { position: relative; border: 0; padding: 0; margin: 0; background: none; }
.bell > summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 4px; min-height: 44px; }
.bell > summary::-webkit-details-marker { display: none; }
.bell > summary:hover { background: var(--surface-sunken); }
.bell-icon { color: var(--ink-subtle); font-size: 1.1rem; }
.bell-count { background: var(--danger); color: #fff; border-radius: 2px; font-size: 0.75rem; padding: 1px 7px; font-weight: 600; }
.bell-panel { position: absolute; right: 0; top: 100%; width: min(340px, 92vw); background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: none; padding: 14px 16px; z-index: 20; }
.bell-panel h3 { font-size: 1rem; margin-bottom: 8px; }
.bell-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; max-height: 50vh; overflow-y: auto; }
.bell-list li { display: grid; gap: 2px; }
.bell-list a { font-size: 0.9375rem; }
.bell-list .when { font-size: 0.8125rem; color: var(--ink-muted); }

/* ---- Быстрые действия ---- */
.quick { margin: 0 0 20px; }
.quick h2 { font-size: 1.25rem; margin-bottom: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.quick-item { display: grid; gap: 8px; align-content: end; margin: 0; }
.quick-ask { font-size: 0.8125rem; }
.quick-ask input { padding: 8px 10px; }
.quick-btn { width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-raised); font-size: 1rem; font-weight: 600; cursor: pointer; text-align: left; transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease); }
.quick-btn:hover { background: var(--surface-sunken); border-color: var(--ink-subtle); }
.quick-btn:active { background: var(--surface-sunken); }
.tone-good .quick-btn { border-color: var(--action); color: var(--action); }
.tone-good .quick-btn:hover { background: var(--action-soft); }
.tone-bad .quick-btn { border-color: var(--danger); color: var(--danger); }
.tone-bad .quick-btn:hover { background: var(--danger-soft); }

/* ---- Экран «Сегодня» ---- */
.lead { color: var(--ink-muted); margin-bottom: 20px; }
.group { margin-bottom: 28px; }
.group h2 { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; }
.group.tone-bad h2 { color: var(--danger); }
.group.tone-review h2 { color: var(--accent); }
.empty-state { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 32px 24px; text-align: center; }
.empty-title { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 6px; }
.gear { text-decoration: none; font-size: 1.25rem; color: var(--ink-subtle); padding: 8px 10px; border-radius: var(--radius-sm); min-height: 44px; display: inline-flex; align-items: center; }
.gear:hover { background: var(--surface-sunken); }
@media (max-width: 720px) { .quick-grid { grid-template-columns: 1fr; } }

/* Быстрое действие — один блок: кнопка и уточняющее поле читаются как одно целое. */
.quick-item { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px; background: var(--surface-raised); align-content: start; }
.quick-item.tone-good { border-color: #A5AFBA; }
.quick-item.tone-bad { border-color: #C9A6AC; }
.quick-btn { border: 0; background: none; padding: 6px 4px; min-height: 40px; }
.quick-btn:hover { background: var(--surface-sunken); border-radius: var(--radius-sm); }
.quick-ask { margin-top: 2px; }
.patient-line { color: var(--ink-muted); font-size: 0.9375rem; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.why { font-size: 1.0625rem; max-width: 62ch; margin-bottom: 20px; }

/* ---- Расшифровка звонка ---- */
.transcript { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.seg { display: grid; grid-template-columns: 56px 110px 1fr; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); align-items: baseline; }
.seg.staff { background: var(--surface-sunken); }
.seg.caller { background: var(--surface-raised); border: 1px solid var(--line); }
.seg-time { color: var(--ink-subtle); font-size: 0.8125rem; }
.seg-who { color: var(--ink-muted); font-size: 0.8125rem; }
.seg-text { grid-column: 3; }
.seg-claim, .seg-finding { grid-column: 3; font-size: 0.8125rem; margin-top: 4px; padding: 3px 8px; border-radius: var(--radius-sm); display: inline-block; justify-self: start; }
.seg-claim { background: var(--action-soft); color: var(--action); }
.seg-finding { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.evidence { margin: 8px 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-sunken); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; display: grid; gap: 4px; }
.evidence .when { font-size: 0.8125rem; color: var(--ink-muted); }
.danger { color: var(--danger); }
tr.unlinked td { color: var(--ink-muted); font-style: italic; }
@media (max-width: 720px) { .seg { grid-template-columns: 50px 1fr; } .seg-who { grid-column: 2; } .seg-text, .seg-claim, .seg-finding { grid-column: 2; } }

/* Reception on small Android screens: independent controls, no nested paragraph/form. */
.callback-actions{display:flex;gap:12px;flex-wrap:wrap;align-items:stretch}
.callback-actions .btn{min-height:52px;display:inline-flex;align-items:center;justify-content:center;font-size:17px;padding:12px 16px}
.callback-actions form{margin:0}.callback-actions button{width:100%}
.callback-queue .card{overflow-wrap:anywhere}audio{width:100%;max-width:480px}
@media(max-width:480px){.callback-actions{display:grid;grid-template-columns:1fr}.callback-actions .btn{width:100%;box-sizing:border-box}.callback-queue .card{padding:16px}}

@media(max-width:480px){.queue-stats{gap:8px;margin-bottom:16px}.queue-stats .card{padding:10px 12px;margin:0}.queue-stats .card>div{font-size:24px!important;line-height:1.2}.queue-stats small{font-size:12px}}

/* Analytical sections form one report, rather than a grid of decorative tiles. */
.quality-period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 0; }
.quality-period .muted { margin-left: auto; font-size: 13px; }
.quality-report { background: var(--surface-raised); border: 1px solid var(--line); }
.quality-report .card { border: 0; border-radius: 0; box-shadow: none; background: transparent; margin: 0; padding: 24px; }
.quality-summary { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.quality-summary > .card + .card { border-left: 1px solid var(--line); }
.quality-report h3 { font-size: 18px; font-weight: 500; letter-spacing: -.01em; }
.quality-report th { font-weight: 400; }
.quality-summary td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.quality-detail { display: grid; grid-template-columns: minmax(180px, 28%) minmax(0, 1fr); gap: 24px; border-bottom: 1px solid var(--line) !important; }
.quality-detail h3 { margin: 0; }
.quality-detail p, .quality-detail ul { margin: 0; }
.quality-detail ul { padding-left: 18px; }
.quality-hour-bar { height: 6px; background: var(--action); }
.btn[disabled] { opacity: .65; cursor: progress; }
@media (max-width: 720px) {
 .quality-summary { grid-template-columns: 1fr; }
 .quality-summary > .card + .card { border-left: 0; border-top: 1px solid var(--line); }
 .quality-report .card { padding: 18px 16px; }
 .quality-detail { grid-template-columns: 1fr; gap: 10px; }
 .quality-period .muted { width: 100%; margin-left: 0; }
 .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .stat { border-bottom: 1px solid var(--line); }
}

.submit-status { font-size: 12px; font-weight: 400; margin-left: 4px; }

/* Automatic call context stays readable; exception forms are collapsed by default. */
.auto-signals { min-width: 160px; font-size: 13px; }
.auto-signals p { margin: 4px 0 8px; }
.call-action-panel .meta { margin-bottom: 16px; }
.call-action-panel details { margin-top: 16px; }
.call-visit-form { padding: 12px 0; border-bottom: 1px solid var(--line); }
@media(max-width:720px) { .call-action-panel .meta { grid-template-columns: 1fr; gap: 2px; } .call-action-panel dd { margin-bottom: 8px; } }

@media(max-width:720px) {
 .call-journal { display:block; }
 .call-journal thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
 .call-journal tbody, .call-journal tr { display:block; width:100%; }
 .call-journal tr { border-bottom:1px solid var(--line-strong); padding:16px 0; }
 .call-journal td { display:block; border:0; padding:4px 0; overflow-wrap:anywhere; }
 .call-journal td .btn { min-height:44px; margin:4px 8px 4px 0; }
}

@media(min-width:721px) { .call-journal td:first-child { white-space:nowrap; } .call-journal td:nth-child(4) { min-width:160px; } .call-journal td:nth-child(5) { min-width:220px; max-width:340px; } }

/* Contact queue: repeats remain accessible without filling the working list. */
.queue-history{margin-top:14px;border-top:1px solid var(--border,#d4d9df);padding-top:10px}.queue-history summary,.queue-older>summary{cursor:pointer;font-weight:500}.queue-history ul{padding-left:20px}.queue-history li{margin:8px 0}.queue-older{margin-top:24px}.queue-older>summary{padding:14px 0}.queue-contact .callback-actions{flex-wrap:wrap}

/* C7 — forest green workspace: one readable rhythm across operational screens. */
body { font-size: 15px; line-height: 1.55; font-weight: 400; }
h1 { font-weight: 550; letter-spacing: -.025em; }
h2 { line-height: 1.3; font-weight: 550; }
h3 { line-height: 1.4; }
.crm-shell { grid-template-columns: 232px minmax(0,1fr); }
.crm-shell > main { max-width: 1480px; padding: 28px clamp(20px,2.6vw,38px) 64px; }
.crm-shell > main > h1 { font-size: 28px; line-height: 1.25; font-weight: 550; margin-bottom: 20px; }
.crm-shell header.top { min-height: 74px; padding-inline: 30px; }
.banner.pilot { font-weight: 400; font-size: 11px; padding-block: 4px; }
.workspace-heading small { font-size: 10px; letter-spacing: .08em; }
.workspace-heading strong { font-weight: 550; }
.sidebar-brand { min-height: 88px; padding: 24px 20px; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand svg rect { fill: #DBE9CE; rx: 12px; }
.sidebar-brand svg path { stroke: #254B32; }
.sidebar .nav-group h2 { font-size: 10px; letter-spacing: .09em; margin-bottom: 8px; }
.sidebar nav.primary { padding-inline: 12px; }
.sidebar nav.primary a { min-height: 42px; padding-block: 10px; border-radius: 9px; font-weight: 450; }
.sidebar nav.primary a.active { color: #F8FCF5; font-weight: 550; }
.nav-group { margin-bottom: 22px; }
.sidebar-context { padding: 18px 22px; }
.btn { font-weight: 500; min-height: 42px; border-radius: 9px; }
.btn.small { min-height: 34px; padding: 6px 11px; line-height: 1.4; }
.btn.primary { border-color: var(--action); }
input,select,textarea { border-radius: 8px; }
.pill { border-radius: 6px; padding: 3px 8px; line-height: 1.35; font-size: 12px; font-weight: 500; }
.card { padding: 22px; margin-bottom: 16px; }
.grid2 { gap: 20px; }
.task { border-radius: 12px; padding: 18px 20px; gap: 8px; }
.ep-col { border-radius: 14px; background: #EDF1EA; }
.ep-col-head { padding: 16px; background: #EDF1EA; }
.ep-col-body { padding: 10px; gap: 10px; }
.ep-card { border-radius: 10px; }
.ep-link { padding: 14px; gap: 9px; }
.notice { border-radius: 10px; line-height: 1.55; }
main > p.muted { max-width: 76ch; font-size: 13px; }
.call-pages { font-size: 13px; }
main > nav:has(a[href$='?view=calls']) { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 11px; }
main > nav:has(a[href$='?view=calls']) .btn { border: 0; background: transparent; }
.overflow:has(.call-journal) { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); }
.call-journal { font-size: 14px; line-height: 1.5; min-width: 990px; }
.call-journal th { padding: 13px 16px; background: #EDF2E9; font-size: 11px; font-weight: 550; letter-spacing: .025em; }
.call-journal td { padding: 19px 16px; border-color: #E5EAE2; }
.call-journal tr:last-child td { border-bottom: 0; }
.call-journal th:first-child,.call-journal td:first-child { width: 138px; }
.call-journal td:first-child>a { color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.call-journal td:nth-child(2) { width: 100px; white-space: nowrap; font-size: 13px; }
.call-journal td:nth-child(3) { width: 174px; font-family: var(--font-text); font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 500; }
.call-journal td:nth-child(3)>p { font-weight: 400; font-size: 11px; margin-top: 8px; }
.call-journal td:nth-child(4) { min-width: 310px; max-width: 500px; }
.call-journal td:nth-child(5) { width: 200px; font-size: 13px; }
.call-journal td:nth-child(6) { width: 64px; font-variant-numeric: tabular-nums; text-align: center; font-weight: 550; }
.call-journal td>p { margin-top: 8px; margin-bottom: 0; }
.call-journal td .btn { white-space: normal; text-align: center; }
.call-journal td:nth-child(5)>.btn { margin-top: 9px; }
.call-journal details { background: #F4F7F0; border-color: transparent; border-radius: 9px; margin-bottom: 12px; padding: 8px 12px; }
.call-journal details>summary { font-size: 12px; line-height: 1.5; font-weight: 500; color: var(--action); }
.call-journal details[open] { border-color: var(--line); }
.call-journal details ul { list-style: none; margin: 0; padding: 0; }
.call-journal details li { padding: 13px 0; border-top: 1px solid var(--line); font-size: 13px; }
.call-journal details li>.btn { margin: 6px 3px 6px 0; }
.call-journal .pill { margin: 5px 0; white-space: normal; }
.call-facts { display: grid; gap: 7px; margin: 8px 0 12px !important; }
.call-fact { display: grid; grid-template-columns: 110px minmax(0,1fr); column-gap: 12px; font-size: 13px; }
.call-fact-label { font-size: 12px; line-height: 1.6; color: var(--ink-muted); font-weight: 400; }
.call-fact-value { color: var(--ink); line-height: 1.5; }
.auto-signals p { font-size: 12px; line-height: 1.55; margin-bottom: 9px; }
.queue-contact { padding: 22px 24px; border-radius: 14px; }
.queue-contact>p { max-width: 82ch; }
.queue-contact .callback-actions { margin-top: 16px; gap: 8px; }
.queue-stats { gap: 14px; margin-bottom: 26px; }
.queue-stats .card { margin: 0; }
.queue-stats .card small { font-size: 13px; }
.transcript { max-width: 80ch; }
.transcript .seg { line-height: 1.7; }
@media(max-width:1050px) and (min-width:721px) { .crm-shell { grid-template-columns: 208px minmax(0,1fr); } }
@media(max-width:720px) {
 .crm-shell { display: block; }
 .crm-shell > main { padding: 22px 16px 100px; }
 .crm-shell header.top { padding-inline: 12px; }
 .crm-shell > main > h1 { font-size: 25px; }
 .grid2 { gap: 14px; }
 .card,.queue-contact { padding: 18px; }
 .call-pages { gap: 8px !important; }
}

/* C7 revision: ElevenLabs-inspired neutral workspace, green action accents. */
.crm-shell > .sidebar { border-right-color: var(--line); }
.sidebar-brand { color: var(--ink); min-height: 76px; font-weight: 550; }
.sidebar-brand svg { width: 28px; height: 28px; }
.sidebar-brand svg rect { fill: var(--action); }
.sidebar-brand svg path { stroke: #fff; }
.sidebar nav.primary { scrollbar-color: #D1D8CD transparent; }
.sidebar nav.primary a { min-height: 36px; padding-block: 8px; font-size: 14px; }
.sidebar nav.primary a:hover { background: #EEF1EB; color: var(--ink); }
.sidebar nav.primary a.active { color: var(--action); background: var(--sidebar-active); }
.sidebar nav.primary a.active .nav-icon,.sidebar nav.primary a:hover .nav-icon { color: var(--action); }
.sidebar .nav-group h2 { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 400; }
.nav-group { margin-bottom: 18px; }
.sidebar-context { border-top-color: var(--line); }
.sidebar-context .language-switch select { background: var(--surface); border-color: var(--line-strong); }
.crm-shell header.top { min-height: 62px; }
.workspace-heading small { display: none; }
.workspace-heading strong { font-size: 14px; font-weight: 450; }
.btn { border-radius: 22px; }
.btn.small { border-radius: 18px; }
h1,.crm-shell > main > h1 { font-weight: 500; font-size: 27px; }
.call-journal th { background: #F8F9F7; }
.auto-refresh-status { gap: 8px !important; }
.auto-refresh-status > span:empty { display: none; }
.auto-refresh-status > time { display: none; }
@media(max-width:760px) { .crm-shell > main { padding-inline: 16px; } }

/* ElevenLabs reference revision3: neutral type, restrained borders and dense navigation. */
@font-face { font-family: 'Inter'; src: url('/inter-variable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }
:root { --font-text: 'Inter', system-ui, sans-serif; --font-display: var(--font-text); --ink: #171719; --ink-muted: #66676A; --ink-subtle: #6D6E70; --sidebar-bg: #FAFAFA; --sidebar-text: #5D5E60; --sidebar-muted: #717275; --line: #E7E7E8; --line-strong: #DADADC; }
body { font-size: 14px; line-height: 1.5; }
h1,.crm-shell > main > h1 { font-size: 24px; font-weight: 400; letter-spacing: -.035em; }
.crm-shell { grid-template-columns: 256px minmax(0,1fr); }
.crm-shell > main { padding: 36px clamp(24px,3.3vw,56px) 64px; }
.sidebar-brand { min-height: 64px; padding: 18px 20px; font-size: 16px; font-weight: 550; }
.sidebar nav.primary a { min-height: 32px; padding: 6px 10px; border-radius: 8px; font-weight: 400; }
.sidebar nav.primary a.active { background: #EDEEEB; color: #252B25; font-weight: 450; }
.sidebar .nav-group h2 { font-size: 13px; margin-bottom: 9px; }
.nav-group { margin-bottom: 24px; }
.sidebar .nav-icon { width: 16px; height: 16px; }
.sidebar-context { padding: 14px 18px; font-size: 12px; }
.sidebar-context .language-switch label { font-size: 11px; }
.sidebar-context .language-switch select { padding: 7px 10px; font-size: 12px; }
.crm-shell header.top { min-height: 56px; padding-inline: 20px; }
header.top .who { font-size: 12px; }
.btn,.btn.small { border-radius: 8px; min-height: 32px; padding: 6px 11px; font-weight: 450; font-size: 13px; }
input,select,textarea { border-radius: 9px; }
.card,.task { border-radius: 14px; }
.call-journal { font-size: 13px; }
.call-journal th { background: #FAFAFA; font-weight: 450; }
.call-journal td { border-color: var(--line); }
@media(max-width:760px) { .crm-shell { display: block; } .crm-shell > main { padding: 24px 16px 90px; } }

.sidebar-brand span { max-width: 172px; font-size: 15px; letter-spacing: -.025em; }

.preview-caption { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-subtle); font-size: 11px; }
