/* ============================================================
   CRM (crm.uxhero.design · admin.html) - адаптив + полірування.
   Шар поверх styles.css та інлайн-стилів admin.html: ті самі токени,
   жодного нового візуального світу. Брейкпоінти:
     ≤720px      телефон: меню-шухляда, таблиці-картки / скрол зі sticky 1-ю колонкою,
                 модалки = шторки знизу, поля 16px (без зуму iOS), цілі ≥44px
     721-1199px  планшет / вузький десктоп: бокова панель лише з іконками
     ≥1200px     широкий десктоп: бокова панель з підписами, ширший контейнер
   ============================================================ */

/* токени, які admin.html використовує, але styles.css не визначає (фон шапок груп, приглушений текст) */
:root{--soft:var(--surface-2);--ink-3:var(--text-3);--focus:color-mix(in srgb,var(--purple) 55%,transparent);--danger:#E5484D}
[data-theme="dark"]{--danger:#FF6369}

/* ---------- поверхні браузера: виділення, курсор, чекбокси, цифри ---------- */
::selection{background:color-mix(in srgb,var(--purple) 26%,transparent)}
input,textarea{caret-color:var(--purple)}
input[type="checkbox"],input[type="radio"]{accent-color:var(--purple)}
td,.kpi .v,.paytotals,.chip b,.bk .big{font-variant-numeric:tabular-nums}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

/* ---------- фокус з клавіатури: видимий і однаковий скрізь ---------- */
:is(.crm,.topbar,.modal,.side) :is(button,a,select,summary,[role="button"],.chip.clk):focus-visible,
.nav-toggle:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.toolbar input:focus,.toolbar select:focus,.lsel:focus-visible,.lin:focus-visible,.lfn:focus-visible{
  border-color:var(--purple);box-shadow:0 0 0 3px color-mix(in srgb,var(--purple) 20%,transparent)}
.toolbar input,.toolbar select{transition:border-color .15s,box-shadow .15s}

/* ---------- таблиці: рамка на обгортці, щоб 1-ша колонка могла бути sticky ---------- */
.tablewrap{border:1px solid var(--line);border-radius:var(--r);background:var(--surface);box-shadow:var(--shadow-sm);scrollbar-width:thin;scrollbar-color:var(--line-2) transparent}
.tablewrap>table{border:0;border-radius:0;overflow:visible;box-shadow:none}
.tablewrap::-webkit-scrollbar{height:8px}
.tablewrap::-webkit-scrollbar-thumb{background:var(--line-2);border-radius:8px}
.coh-tbl tbody tr,.coh-tbl tbody tr:hover{cursor:default}
.coh-tbl tr.coh-off td{opacity:.5}
.coh-tbl td{vertical-align:top}
.coh-h{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 0 10px;font-size:14px}
.coh-h .muted{font-size:12px}
.coh-h input{height:34px;width:300px;max-width:100%;border:1px solid var(--line-2);border-radius:8px;background:var(--bg);color:var(--text);font:inherit;font-size:13px;padding:0 10px;outline:none}
.coh-sched{margin-bottom:6px}
.coh-sched table{min-width:820px}
.coh-in{width:100%;min-width:120px;height:32px;border:1px solid var(--line-2);border-radius:8px;background:var(--bg);color:var(--text);font:inherit;font-size:13px;padding:0 8px;outline:none}
.coh-in:focus,.coh-ans:focus,.coh-h input:focus{border-color:var(--purple)}
.coh-at{width:136px;min-width:136px;font-family:ui-monospace,Menlo,monospace;font-size:12px}
.coh-tbl tr.coh-next td{background:color-mix(in srgb,var(--green) 10%,var(--surface))}
.coh-tbl tr.coh-next td:first-child{box-shadow:inset 3px 0 0 var(--green)}
.coh-tbl tr.coh-past td{opacity:.6}
.coh-q{padding:12px 16px;border-top:1px solid var(--line)}
.coh-q:first-child{border-top:0}
.coh-q.done{background:var(--soft)}
.coh-q.done .coh-qm,.coh-q.done summary{opacity:.75}
.coh-qm{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.coh-qt{font-size:13.5px;line-height:1.5;white-space:pre-wrap;word-break:break-word;margin:6px 0 8px}
.coh-q summary{cursor:pointer;list-style:none;font-size:13px;margin-top:4px}
.coh-q summary::-webkit-details-marker{display:none}
.coh-q details[open] .coh-qt1{display:none}
.coh-qt1{display:inline-block;max-width:70ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
.coh-ans{width:100%;min-height:64px;border:1px solid var(--line-2);border-radius:10px;background:var(--bg);color:var(--text);font:inherit;font-size:13.5px;line-height:1.5;padding:8px 10px;outline:none;resize:vertical}

/* перша колонка лишається на місці, коли широку таблицю гортають убік (ім'я / канал завжди видно) */
.tablewrap th:first-child,.tablewrap td:first-child{position:sticky;left:0;z-index:1;background:var(--surface)}
.tablewrap th:first-child{background:var(--surface-2);z-index:2}
.tablewrap tbody tr:hover td:first-child{background:var(--surface-2)}
.tablewrap tbody tr[tabindex]:focus-visible td:first-child{background:color-mix(in srgb,var(--purple) 10%,var(--surface))}
.tablewrap tfoot td:first-child{background:var(--surface-2)}
.tablewrap :is(th,td):first-child{box-shadow:inset -1px 0 0 var(--line)}
.tablewrap tr.pay-refunded td:first-child{box-shadow:inset 2px 0 0 var(--danger),inset -1px 0 0 var(--line)}
.tablewrap tbody tr[tabindex]:focus-visible td:first-child{box-shadow:inset 3px 0 0 var(--purple),inset -1px 0 0 var(--line)}
@media (min-width:1200px){ th,td{padding:10px 12px} }

/* ---------- групові картки (реферали, задачі запуску, повідомлення бота) ---------- */
.grp-h{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;background:var(--soft)}
.grp-h-start{justify-content:flex-start}
.grp-sum{font-weight:800;color:var(--green);font-variant-numeric:tabular-nums;white-space:nowrap}
.grp-b{padding:4px 16px 10px}
.ref-row,.task-row,.msg-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--line);font-size:13px}
.ref-row:first-child,.task-row:first-child,.msg-row:first-child{border-top:0}
.ref-buyer{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ref-course{width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ref-amt{width:84px;text-align:right}
.ref-comm{width:80px;text-align:right;font-weight:700;color:var(--text-3)}
.ref-comm.paid{color:var(--green)}
.ref-st{width:76px;text-align:right}
.ref-date{width:76px;text-align:right;font-size:11px}
.task-t{flex:1;min-width:0}
.task-row.done .task-t{opacity:.5;text-decoration:line-through}
.task-own{background:var(--surface-2)}
.task-due{width:82px;text-align:right;font-size:11px}
.task-row .ltx{padding:0 9px}
.task-row input[type="checkbox"]{width:18px;height:18px;flex:none;cursor:pointer}
.msg-who{width:150px;flex:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.msg-txt{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}
.msg-when{font-size:11px;white-space:nowrap}

/* ---------- дошки (контент / блог / YouTube): кількість колонок через --cols ---------- */
.kan{grid-template-columns:repeat(var(--cols,5),minmax(0,1fr))}

/* ---------- стан «завантажується» для розділів, що вантажаться при відкритті ---------- */
:is(#contentArea,#blogArea,#ytArea,#refArea,#cohArea,#subArea,#lcArea,#ltArea,#lfArea,#lbArea,#fnArea):empty{min-height:120px;border:1px dashed var(--line-2);border-radius:var(--r);display:flex;align-items:center;justify-content:center}
:is(#contentArea,#blogArea,#ytArea,#refArea,#cohArea,#subArea,#lcArea,#ltArea,#lfArea,#lbArea,#fnArea):empty::before{content:'Завантаження…';font-size:13px;color:var(--text-3)}

/* ---------- графік: підписи осі читаються при будь-якому масштабі ---------- */
.gridlbl{font-size:10px}

/* ---------- бокова навігація: іконка + підпис (підпис ховаємо, де він не влазить) ---------- */
.side-item,.side-link{gap:10px}
.side-ic{display:inline-flex;align-items:center;justify-content:center;width:24px;flex:none;font-size:20px;line-height:1}
.side-lbl{display:none;font:600 13.5px/1.2 var(--font);letter-spacing:-.01em;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.side-item.on .side-lbl{color:var(--ink-on)}
.side-head,.side-foot,.nav-toggle,.nav-scrim{display:none}
.side-item:focus-visible,.side-link:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.side-link .side-lbl::after{content:' ↗';color:var(--text-3)}

@media (min-width:1200px){
  .crm{max-width:1400px}
  .topbar .wrap{max-width:1400px}
  .side{width:216px;align-items:stretch;gap:2px;max-height:calc(100vh - 92px);overflow-y:auto;scrollbar-width:none}
  .side-item,.side-link{width:100%;height:40px;justify-content:flex-start;padding:0 12px;border-radius:10px}
  .side-ic{font-size:17px}
  .side-lbl{display:block}
  .side-item:hover .side-lbl,.side-link:hover .side-lbl{color:var(--text)}
  .side-item.on:hover .side-lbl{color:var(--ink-on)}
  .side-link{margin-top:10px;border-top:1px solid var(--line);border-radius:0 0 10px 10px;height:auto;min-height:48px;padding:6px 12px}
  .side-link .side-lbl{white-space:normal;line-height:1.25}
  .side-item #certBadge{top:50%;right:10px;transform:translateY(-50%)}
}

/* ============================================================
   ТЕЛЕФОН
   ============================================================ */
@media (max-width:720px){
  body{overflow-x:hidden}
  /* поля 16px - інакше iOS Safari зумить сторінку при фокусі */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),select,textarea{font-size:16px!important}

  /* --- шапка: кнопка меню з поточним розділом + 3 швидкі дії --- */
  .topbar .wrap{height:56px;padding:0 max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));gap:8px}
  .topbar .wrap>div{gap:4px!important}
  body:has(#dash:not(.hidden)) .topbar .logo{display:none}
  body:has(#dash:not(.hidden)) :is(#themeBtn,#logBtn,#logoutBtn){display:none!important}
  .topbar .btn.sm{height:44px;min-width:44px;padding:0 10px;font-size:17px}
  #grantOpen{width:44px;padding:0}
  .nav-toggle{display:inline-flex;align-items:center;gap:8px;height:44px;min-width:0;max-width:62vw;padding:0 14px 0 12px;border:1px solid var(--line-2);border-radius:var(--r);background:var(--surface);color:var(--text);font:600 15px/1 var(--font);letter-spacing:-.01em;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .nav-toggle:active{background:var(--surface-2)}
  .nav-toggle svg{flex:none}
  .nt-ic{font-size:17px;line-height:1}
  .nt-lbl{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  body:has(#dash.hidden) .nav-toggle{display:none}

  /* --- меню-шухляда зліва (сама .side, без дублювання розмітки) --- */
  .crm-layout{display:block}
  .crm-main{width:100%;min-width:0}
  .side{position:fixed;top:0;bottom:0;left:0;z-index:60;width:min(300px,86vw);display:flex;flex-direction:column;align-items:stretch;gap:2px;
    padding:max(10px,env(safe-area-inset-top)) 10px max(12px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
    background:var(--surface);border-right:1px solid var(--line);box-shadow:var(--shadow-lg);overflow-y:auto;overscroll-behavior:contain;
    transform:translateX(-104%);visibility:hidden;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s}
  body.nav-open .side{transform:none;visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s}
  body.nav-open{overflow:hidden}
  .nav-scrim{display:block;position:fixed;inset:0;z-index:55;background:rgba(0,0,0,.42);opacity:0;pointer-events:none;transition:opacity .2s ease}
  body.nav-open .nav-scrim{opacity:1;pointer-events:auto}
  .side-head{display:flex;align-items:center;justify-content:space-between;padding:4px 4px 10px 12px;margin-bottom:4px;border-bottom:1px solid var(--line)}
  .side-head .logo{font-size:18px}
  .side-x{width:44px;height:44px;border:0;background:transparent;border-radius:10px;font-size:18px;color:var(--text-2);cursor:pointer}
  .side-x:active{background:var(--surface-2)}
  .side-item,.side-link,.side-act{display:flex;width:100%;height:48px;justify-content:flex-start;align-items:center;gap:12px;padding:0 12px;border-radius:12px;margin:0;flex:none}
  .side-lbl{display:block;font-size:15px}
  .side-link{margin-top:6px;position:relative}
  .side-link::before{content:'';position:absolute;left:12px;right:12px;top:-4px;border-top:1px solid var(--line)}
  .side-item #certBadge{top:50%;right:12px;transform:translateY(-50%)}
  .side-foot{display:flex;flex-direction:column;gap:2px;margin-top:auto;padding-top:8px;border-top:1px solid var(--line)}
  .side-act{border:0;background:transparent;font:inherit;color:var(--text);cursor:pointer;text-align:left}
  .side-act:active,.side-item:active{background:var(--surface-2)}
  .side-act .side-ic{font-size:17px;color:var(--text-2)}

  /* --- загальний ритм --- */
  .crm{padding:14px 16px calc(64px + env(safe-area-inset-bottom))}
  .btn{min-height:44px}
  .btn.sm{height:auto;min-height:44px;padding:0 14px}
  [data-cp].btn{min-width:40px;min-height:40px!important}

  /* --- період: сегменти скролом в один рядок, дати видно (не ховаємо функцію) --- */
  .filters>span:first-child{display:none}
  .filters .seg{display:flex;width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .filters .seg::-webkit-scrollbar{display:none}
  .filters .seg button{flex:none;min-height:40px;padding:0 13px;font-size:13.5px}
  .daterange{display:flex;width:100%;gap:8px}
  .daterange input{flex:1;min-width:0;height:44px!important}
  .filters .btn{flex:1 1 auto}

  /* --- KPI / графіки --- */
  .kpis{gap:8px}
  .kpi .v{font-size:21px}
  .tax-hint{margin:0 0 14px}
  .charts{grid-template-columns:minmax(0,1fr)}
  .chart-card{padding:13px 12px 10px;min-width:0}
  .lg{flex-wrap:wrap;row-gap:0}
  .lg .nm{flex:1;min-width:0}
  .lg .vl{flex-basis:100%;margin-left:17px;font-size:11px}

  /* --- чипи, вкладки, тулбари --- */
  .chips{gap:6px}
  .chip.clk{min-height:44px;display:inline-flex;align-items:center;flex-wrap:wrap;gap:0 4px}
  .tabs{overflow-x:auto;scrollbar-width:none;flex-wrap:nowrap;-webkit-overflow-scrolling:touch}
  .tabs::-webkit-scrollbar{display:none}
  .tabs button{flex:none;min-height:44px;padding:0 14px}
  .toolbar{gap:8px}
  .toolbar>b{flex:1 1 100%;font-size:16px!important;letter-spacing:-.01em}
  .toolbar>span[style*="flex:1"]{display:none}
  .toolbar>.muted{flex:1 1 100%;font-size:12.5px!important;line-height:1.45}
  .toolbar input:not([type="checkbox"]){flex:1 1 100%;width:100%!important;min-width:0;height:44px}
  .toolbar select{flex:1 1 calc(50% - 4px);min-width:0;height:44px!important}
  .toolbar .btn{flex:1 1 auto}
  .wknav{flex:1 1 100%;justify-content:space-between}
  .wknav .btn{width:44px;font-size:20px}
  .segmented{flex:1 1 auto}
  .segmented button{flex:1;min-height:44px}

  /* --- сегменти періоду в тулбарах (Воронка): на всю ширину, великі цілі --- */
  .toolbar .seg{display:flex;flex:1 1 100%}
  .toolbar .seg button{flex:1;min-height:40px}
  .fn-cust.open{display:flex;flex:1 1 100%;flex-wrap:wrap}
  .fn-cust input{flex:1 1 40%;height:44px!important}
  .fn-cust .btn{flex:1 1 100%}
  .fn-in{height:40px}
  .fn-row{flex-wrap:wrap}
  .fn-x{min-width:40px;min-height:40px}
  #fnArea td:first-child{max-width:130px}

  /* --- таблиці-картки: «Учні» і «Продажі» (рядок відкриває картку - важливо бачити головне) --- */
  :is(#studentsTable,#paymentsTable) .tablewrap{border:0;background:none;box-shadow:none;overflow:visible}
  :is(#studentsTable,#paymentsTable) table:not(.skel-tbl){min-width:0;display:block;background:none;border:0}
  :is(#studentsTable,#paymentsTable) table:not(.skel-tbl) thead{display:none}
  :is(#studentsTable,#paymentsTable) table:not(.skel-tbl) tbody{display:flex;flex-direction:column;gap:8px}
  :is(#studentsTable,#paymentsTable) table:not(.skel-tbl) tr{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:12px;row-gap:4px;align-items:center;padding:12px 14px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow-sm)}
  :is(#studentsTable,#paymentsTable) table:not(.skel-tbl) tr:active{background:var(--surface-2)}
  :is(#studentsTable,#paymentsTable) table:not(.skel-tbl) td{display:block;padding:0;border:0;font-size:13px;min-width:0;background:none!important;box-shadow:none!important}
  :is(#studentsTable,#paymentsTable) tbody tr[tabindex]:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
  #studentsTable table:not(.skel-tbl) td:nth-child(1),#paymentsTable table:not(.skel-tbl) td:nth-child(2){grid-area:1/1;font-size:15px!important;font-weight:700;letter-spacing:-.01em}
  #studentsTable table:not(.skel-tbl) td:nth-child(7),#paymentsTable table:not(.skel-tbl) td:nth-child(5){grid-area:1/2;font-size:15px!important;font-weight:800;text-align:right;white-space:nowrap}
  #studentsTable table:not(.skel-tbl) td:nth-child(2),#paymentsTable table:not(.skel-tbl) td:nth-child(3){grid-area:2/1;color:var(--text-2)}
  #studentsTable table:not(.skel-tbl) td:nth-child(6),#paymentsTable table:not(.skel-tbl) td:nth-child(7){grid-area:2/2;justify-self:end}
  #studentsTable table:not(.skel-tbl) td:nth-child(5){grid-area:3/1/4/3;white-space:normal}
  #studentsTable table:not(.skel-tbl) td:nth-child(3){grid-area:4/1}
  #studentsTable table:not(.skel-tbl) td:nth-child(4){grid-area:4/2;text-align:right}
  #studentsTable table:not(.skel-tbl) td:nth-child(3):not(:has(a)),#studentsTable table:not(.skel-tbl) td:nth-child(4):not(:has(a)){display:none}
  #studentsTable table:not(.skel-tbl) td:nth-child(10){grid-area:5/1}
  #studentsTable table:not(.skel-tbl) td:nth-child(9){grid-area:5/2;text-align:right;font-size:11.5px!important}
  #studentsTable table:not(.skel-tbl) td:nth-child(9):has(b)::before{content:'вхід ';color:var(--text-3);font-family:var(--font)}
  #studentsTable table:not(.skel-tbl) td:nth-child(9):not(:has(b)){font-size:0!important}
  #studentsTable table:not(.skel-tbl) td:nth-child(9):not(:has(b))::after{content:'не заходив';font:500 11.5px var(--font);color:var(--text-3)}
  #studentsTable table:not(.skel-tbl) td:nth-child(10):not(:has(.pbar)){font-size:0!important}
  #studentsTable table:not(.skel-tbl) td:nth-child(10):not(:has(.pbar))::after{content:'прогресу ще немає';font:500 11.5px var(--font);color:var(--text-3)}
  #studentsTable table:not(.skel-tbl) td:nth-child(10) .pbar{width:80px!important}
  #studentsTable table:not(.skel-tbl) td:nth-child(8),#studentsTable table:not(.skel-tbl) td:nth-child(11){display:none}
  #paymentsTable table:not(.skel-tbl) td:nth-child(4){grid-area:3/1}
  #paymentsTable table:not(.skel-tbl) td:nth-child(1){grid-area:3/2;text-align:right;font-size:11.5px!important}
  #paymentsTable table:not(.skel-tbl) td:nth-child(6){display:none}
  #paymentsTable tr.pay-refunded td{color:var(--text-3)}
  .paytotals{gap:6px 14px;padding:12px 14px}

  /* --- решта таблиць (інлайн-редагування, багато колонок): горизонтальний скрол, 1-ша колонка тримається --- */
  .tablewrap{overscroll-behavior-x:contain}
  .tablewrap td:first-child{max-width:150px;white-space:normal}
  #sdArea .sd-ch b{max-width:130px}
  .lsel,.lin,.lfn{height:40px}
  .lin{width:180px}
  #lfArea .lfn[type="number"]{width:84px!important}

  /* --- дошки: колонки свайпом, як у нативних канбанах --- */
  .kan{display:grid;grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:84%;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding:0 16px;margin:0 -16px;padding:0 16px 6px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .kan::-webkit-scrollbar{display:none}
  .kan .kcol{scroll-snap-align:start;min-width:0}

  /* --- календар контенту --- */
  .cal-day{gap:10px}
  .cal-day .dlbl{width:44px}
  .cpost{padding:10px 12px}

  /* --- групові картки --- */
  .grp-h{padding:12px 14px;flex-wrap:wrap}
  .grp-b{padding:2px 14px 8px}
  .ref-row{flex-wrap:wrap;gap:2px 10px;padding:10px 0}
  .ref-buyer{flex:1 1 100%;font-weight:600}
  .ref-course{flex:1 1 auto;width:auto}
  .ref-amt,.ref-comm,.ref-st,.ref-date{width:auto}
  .task-row{flex-wrap:wrap;gap:6px 10px;padding:10px 0}
  .task-t{flex:1 1 calc(100% - 40px)}
  .task-own{margin-left:28px}
  .task-due{width:auto;flex:1;text-align:left}
  .task-row .ltx{min-width:44px}
  .msg-row{flex-wrap:wrap;gap:4px 10px;padding:10px 0}
  .msg-who{width:auto;flex:1 1 auto;font-weight:600}
  .msg-txt{flex:1 1 100%;order:2}
  .msg-row .lreply{order:3}
  .msg-when{order:1}

  /* --- автопост-картки (YouTube / LinkedIn / Instagram) --- */
  .chg{grid-template-columns:1fr}
  .ch-row,.ch-rule{min-height:36px}
  .ch a.st{padding:8px 0}
  .ch .lnk{padding:10px 4px;font-size:12.5px}
  .ch-more{min-height:40px}
  .ch-a .btn{flex:1 1 auto}
  .bk-row summary{min-height:44px;align-items:center}
  .bk-past details{flex-basis:100%}
  .bk-more{min-height:44px}
  .bk-ppl a,.bk-ppl span{padding:6px 10px;font-size:12.5px}
  .bk-past summary,.bk details>summary.sub{display:flex;align-items:center;min-height:40px}

  /* --- посіви: форма додавання двома колонками --- */
  .sd-add.open{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .sd-add input,.sd-add select{width:100%!important;height:44px}
  #sdNId,#sdNTitle,#sdNSave,#sdNMsg{grid-column:1/-1}

  /* --- сертифікати --- */
  .crm .sub-row{padding:14px;grid-template-columns:minmax(0,1fr)}
  .crm .sub-row>*{min-width:0}
  .sub-act .btn{flex:1 1 auto}

  /* --- iframe-розділи --- */
  #machineFrame,#launchFrame{height:calc(100dvh - 150px)!important}

  /* --- модалки = шторка знизу на всю ширину --- */
  .scrim{align-items:flex-end;padding:0;z-index:70}
  .modal{width:100%;max-height:calc(100dvh - 12px);border-radius:20px 20px 0 0;border-bottom:0;padding:22px 16px max(18px,env(safe-area-inset-bottom));animation:crmSheet .3s cubic-bezier(.22,1,.36,1)}
  .modal::before{content:'';display:block;width:36px;height:4px;border-radius:4px;background:var(--line-2);margin:-12px auto 12px}
  .modal.editor{height:calc(100dvh - 12px);padding:0}
  .modal.editor::before{margin:8px auto 0;flex:none}
  .modal.editor .ed-body{padding:12px 16px 14px}
  .modal.editor .ed-foot{padding:10px 12px max(10px,env(safe-area-inset-bottom))}
  .statset{display:flex;width:100%}
  .statset button{flex:1;min-height:44px;padding:0 6px}
  .ed-foot-row .btn{flex:1 1 auto}
  .ed-foot-row>span[style*="flex:1"]{display:none}
  .ed-msg{flex:1 1 100%;order:-1}
  .ed-msg:not(.show){display:none}
  .crow{flex-direction:column;gap:0}
  .modal .field{height:46px}
  .modal textarea.field{height:auto}
  .modal .kv{flex-wrap:wrap;gap:4px 12px}
  .modal .kv .btn{min-height:40px!important}
  .modal h3{padding-right:4px}
  .cimg-prev img{max-width:100%}
}

@keyframes crmSheet{from{transform:translateY(24px);opacity:.4}to{transform:none;opacity:1}}

@media (prefers-reduced-motion:reduce){
  .side,.nav-scrim{transition:none!important}
  .modal{animation:none!important}
}
