/* Строй ОС — единый слой интерфейса. Сгенерирован из проверенных правил прежних override-файлов. */

/* Основные интерфейсные правила */
:where(button,a[href],input,select,textarea,[tabindex]):focus-visible{
  outline:2px solid currentColor;
  outline-offset:2px;
}
@media(max-width:768px){
  button,.btn,.btn-light,.btn-danger,input,select,textarea{min-height:44px;}
  input[type="checkbox"],input[type="radio"]{min-height:auto;}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;}
}


/* ===== Строй ОС v21.52 — изолированные экраны авторизации =====
   Авторизация имеет собственную светлую палитру и не наследует цвет полей/label
   из темы рабочего интерфейса. Это устраняет смешение light/dark на login/register. */
.stroy-auth-overlay{
  box-sizing:border-box!important;
  color:#101828!important;
  font-family:inherit!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
}
.stroy-auth-overlay{
  background:#f4f6f9!important;
}
.stroy-auth-overlay .stroy-auth-card{
  box-sizing:border-box!important;
  background:#fff!important;
  color:#101828!important;
  border:0!important;
}
.stroy-auth-overlay .stroy-auth-brand{
  color:#1769e0!important;
}
.stroy-auth-overlay .stroy-auth-card h1,
.stroy-auth-overlay .stroy-auth-card h2,
.stroy-auth-overlay .stroy-auth-card h3{
  color:#101828!important;
}
.stroy-auth-overlay .stroy-auth-card p{
  color:#667085!important;
}
.stroy-auth-overlay .stroy-auth-card label{
  display:block!important;
  color:#344054!important;
  font-weight:600!important;
  opacity:1!important;
}
.stroy-auth-overlay .stroy-auth-card input,
.stroy-auth-overlay .stroy-auth-card select,
.stroy-auth-overlay .stroy-auth-card textarea{
  box-sizing:border-box!important;
  width:100%!important;
  min-height:48px!important;
  background:#fff!important;
  background-color:#fff!important;
  color:#101828!important;
  -webkit-text-fill-color:#101828!important;
  caret-color:#1769e0!important;
  border:1px solid #cbd5e1!important;
  box-shadow:none!important;
  opacity:1!important;
}
.stroy-auth-overlay .stroy-auth-card input::placeholder,
.stroy-auth-overlay .stroy-auth-card textarea::placeholder{
  color:#98a2b3!important;
  -webkit-text-fill-color:#98a2b3!important;
  opacity:1!important;
}
.stroy-auth-overlay .stroy-auth-card input:focus,
.stroy-auth-overlay .stroy-auth-card select:focus,
.stroy-auth-overlay .stroy-auth-card textarea:focus{
  border-color:#1769e0!important;
  outline:0!important;
  box-shadow:0 0 0 3px rgba(23,105,224,.14)!important;
}
.stroy-auth-overlay .stroy-auth-card input:-webkit-autofill,
.stroy-auth-overlay .stroy-auth-card input:-webkit-autofill:hover,
.stroy-auth-overlay .stroy-auth-card input:-webkit-autofill:focus{
  -webkit-text-fill-color:#101828!important;
  -webkit-box-shadow:0 0 0 1000px #fff inset!important;
  box-shadow:0 0 0 1000px #fff inset!important;
  transition:background-color 9999s ease-out 0s!important;
}
.stroy-auth-overlay .stroy-auth-card button{
  min-height:46px;
}
.stroy-auth-overlay .stroy-auth-card #aSubmit,
.stroy-auth-overlay .stroy-auth-card #rSubmit,
.stroy-auth-overlay .stroy-auth-card #phSend,
.stroy-auth-overlay .stroy-auth-card #phVerify,
.stroy-auth-overlay .stroy-auth-card #resetSend,
.stroy-auth-overlay .stroy-auth-card #newResetSubmit{
  background:#1769e0!important;
  color:#fff!important;
  border-color:#1769e0!important;
}
.stroy-auth-overlay .stroy-auth-card #aPhone,
.stroy-auth-overlay .stroy-auth-card #aRegister{
  background:#fff!important;
  color:#1769e0!important;
  border-color:#1769e0!important;
}
.stroy-auth-overlay .stroy-auth-card #aTry,
.stroy-auth-overlay .stroy-auth-card #rTry{
  background:#eef5ff!important;
  color:#1769e0!important;
}
.stroy-auth-overlay .stroy-auth-card #aForgot,
.stroy-auth-overlay .stroy-auth-card #rBack,
.stroy-auth-overlay .stroy-auth-card #phBack{
  background:transparent!important;
  color:#1769e0!important;
}

/* Авторизация намеренно остаётся цельной светлой сценой даже если в рабочей
   части приложения ранее была выбрана тёмная тема. */
html[data-theme="dark"] .stroy-auth-overlay{
  background:#f4f6f9!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card{
  background:#fff!important;
  color:#101828!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card label,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card h1,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card h2{
  color:#101828!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card input{
  background:#fff!important;
  color:#101828!important;
  -webkit-text-fill-color:#101828!important;
  border-color:#cbd5e1!important;
}

/* На телефоне скроллится весь экран регистрации, а не маленькая карточка внутри.
   Это не даёт кнопкам уходить под нижнюю панель браузера. */
@media(max-width:680px){
  .stroy-auth-overlay{
    align-items:flex-start!important;
    justify-content:center!important;
    padding-top:max(18px,env(safe-area-inset-top))!important;
    padding-right:14px!important;
    padding-bottom:max(28px,calc(env(safe-area-inset-bottom) + 28px))!important;
    padding-left:14px!important;
  }
  .stroy-auth-overlay .stroy-auth-card{
    width:100%!important;
    margin:auto 0!important;
    padding:24px 20px!important;
    border-radius:22px!important;
  }
  .stroy-auth-register .stroy-auth-card{
    max-height:none!important;
    overflow:visible!important;
    margin:4px 0 24px!important;
  }
  .stroy-auth-overlay .stroy-auth-card h1{
    font-size:28px!important;
    line-height:1.15!important;
  }
}


/* ===== Строй ОС v21.53 — QA fixes ===== */
.ai-foreman-action-state{display:block;margin-top:7px;font-weight:700;color:#9a6700}
.ai-foreman-action-card.done .ai-foreman-action-state{color:#18794e}
.mobile-action-section.subscription-locked,
.export-menu-group.subscription-locked{opacity:.68}
.mobile-action-section.subscription-locked .mobile-export-row button:disabled,
.export-menu-group.subscription-locked button[data-format]:disabled{
  cursor:not-allowed!important;
  opacity:.55!important;
  filter:grayscale(1)!important;
}


/* ===== Строй ОС v21.54 — security hardening ===== */




/* ===== Строй ОС v21.55 — две вкладки входа ===== */
.stroy-auth-tabs{
  display:grid!important;
  grid-template-columns:1fr 1fr!important;
  gap:4px!important;
  padding:4px!important;
  margin:0 0 18px!important;
  background:#eef2f6!important;
  border-radius:13px!important;
}
.stroy-auth-tabs .stroy-auth-tab{
  min-height:42px!important;
  border:0!important;
  border-radius:10px!important;
  background:transparent!important;
  color:#667085!important;
  font-weight:800!important;
  cursor:pointer!important;
}
.stroy-auth-tabs .stroy-auth-tab.active{
  background:#fff!important;
  color:#1769e0!important;
  box-shadow:0 1px 4px rgba(16,24,40,.12)!important;
}
.stroy-auth-pane[hidden]{display:none!important}
.stroy-auth-secondary-actions{
  display:grid!important;
  gap:7px!important;
  margin-top:12px!important;
}
.stroy-auth-secondary-actions button{
  width:100%!important;
  border-radius:11px!important;
  padding:11px!important;
  font-weight:800!important;
}
.stroy-auth-secondary-actions #aTry{
  border:0!important;background:#eef5ff!important;color:#1769e0!important;
}
.stroy-auth-secondary-actions #aRegister{
  border:1px solid #1769e0!important;background:#fff!important;color:#1769e0!important;
}
.stroy-auth-secondary-actions #aForgot{
  border:0!important;background:transparent!important;color:#1769e0!important;
}


/* ===== Строй ОС v21.56 — theme consistency for app overlays/settings/API ===== */

/* Динамические окна приложения теперь используют тему приложения, а не auth-light palette. */















html[data-theme="dark"] .mobile-company-create-form label{color:#f5f5f7!important}
html[data-theme="dark"] .mobile-company-create-form input{
  background:#2c2c2e!important;
  color:#f5f5f7!important;
  -webkit-text-fill-color:#f5f5f7!important;
  border-color:rgba(255,255,255,.14)!important;
}

/* Settings readability */





/* REST API: explicit theme palette */














/* Mobile settings tabs: lower height and avoid awkward two-line middle tab. */


/* ===== Строй ОС v21.63 — canonical mobile controls =====
   Единая актуальная override-точка для нижней навигации и переключателя темы.
   Нижние иконки — прямые SVG внутри button, без фоновых wrapper-элементов. */
@media(max-width:768px){
  #mobilePersistentTabs.foreman-five-tabs{
    position:fixed!important;left:0!important;right:0!important;bottom:0!important;z-index:10030!important;
    display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:0!important;
    margin:0!important;padding:6px max(5px,env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom))!important;
    min-height:70px!important;background:rgba(250,250,252,.94)!important;
    border-top:1px solid rgba(60,60,67,.15)!important;border-bottom:0!important;
    box-shadow:0 -5px 24px rgba(0,0,0,.06)!important;
    backdrop-filter:blur(24px)!important;-webkit-backdrop-filter:blur(24px)!important
  }
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs{
    background:rgba(20,20,22,.96)!important;border-color:rgba(255,255,255,.12)!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button,
  #mobilePersistentTabs.foreman-five-tabs>button:not(.context-hidden){
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:2px!important;
    width:100%!important;min-width:0!important;min-height:56px!important;padding:3px 1px!important;
    border:0!important;border-radius:10px!important;background:transparent!important;color:#77777d!important;
    box-shadow:none!important;font-size:9.5px!important;font-weight:570!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button.active{
    background:transparent!important;color:#0071e3!important;box-shadow:none!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button>.mobile-nav-svg{
    display:block!important;flex:0 0 auto!important;width:29px!important;height:29px!important;
    min-width:29px!important;min-height:29px!important;max-width:29px!important;max-height:29px!important;
    margin:0 0 2px!important;padding:0!important;border:0!important;border-radius:0!important;
    background:none!important;background-color:transparent!important;background-image:none!important;
    box-shadow:none!important;outline:0!important;overflow:visible!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button>.foreman-more-icon-svg{
    width:27px!important;height:27px!important;fill:none!important;stroke:currentColor!important;stroke-width:0!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button>.foreman-more-icon-svg circle{fill:currentColor!important;stroke:none!important}

  .mobile-theme-switch{min-height:44px!important;height:44px!important;gap:5px!important}
  button.mobile-theme-toggle{
    flex:0 0 38px!important;width:38px!important;min-width:38px!important;max-width:38px!important;
    height:22px!important;min-height:22px!important;max-height:22px!important;padding:0!important;
    align-self:center!important;border-radius:999px!important
  }
  .mobile-theme-toggle-knob{left:3px!important;top:3px!important;width:14px!important;height:14px!important}
  .mobile-theme-toggle.is-dark .mobile-theme-toggle-knob{transform:translateX(16px)!important}
}
@media(max-width:390px){
  #mobilePersistentTabs.foreman-five-tabs>button>.mobile-nav-svg{
    width:27px!important;height:27px!important;min-width:27px!important;min-height:27px!important;max-width:27px!important;max-height:27px!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button>.foreman-more-icon-svg{width:25px!important;height:25px!important}
  .mobile-theme-switch{min-height:44px!important;height:44px!important}
  button.mobile-theme-toggle{
    flex-basis:34px!important;width:34px!important;min-width:34px!important;max-width:34px!important;
    height:20px!important;min-height:20px!important;max-height:20px!important
  }
  .mobile-theme-toggle-knob{width:12px!important;height:12px!important}
  .mobile-theme-toggle.is-dark .mobile-theme-toggle-knob{transform:translateX(14px)!important}
}



/* v22.14: удаление сметы доступно и в мобильном списке */
@media(max-width:760px){
  #estimatesHubList .estimate-hub-actions .estimate-delete-btn{
    display:block!important;
    grid-column:1/-1!important;
    width:100%!important;
  }
}


/* ===== Строй ОС v22.18 — canonical mobile layout ===== */
@media(max-width:768px){
  #works .works-tree-card{overflow:visible!important;max-width:100%!important}
  #works .works-tree-table{
    display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;
    border:0!important;box-shadow:none!important;background:transparent!important
  }
  #works .works-tree-table tbody{display:block!important;width:100%!important}
  #works .works-tree-table tr{max-width:100%!important}
  #works .work-tree-section-head,
  #works .work-tree-child,
  #works .work-tree-material,
  #works .work-tree-section-add{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%!important;
    padding:8px!important;border-radius:12px!important;overflow:hidden!important
  }
  #works .work-tree-section-head>td,
  #works .work-tree-child>td,
  #works .work-tree-material>td,
  #works .work-tree-section-add>td{
    display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;
    border:0!important;padding:5px 6px!important
  }
  #works .work-tree-section-head>td:first-child,
  #works .work-tree-child>.work-tree-branch,
  #works .work-tree-material>.work-tree-branch,
  #works .work-tree-section-add>td:first-child{display:none!important}
  #works .work-tree-child input,
  #works .work-tree-material input,
  #works .work-tree-material select{width:100%!important;min-width:0!important}
  #works .work-tree-calc-line,
  #works .work-tree-rate-line{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)!important;
    width:100%!important;min-width:0!important
  }
  #works .work-tree-child-actions,
  #works .work-tree-material-actions,
  #works .work-tree-actions{display:flex!important;flex-wrap:wrap!important;gap:8px!important}

  #works .work-tree-actions button,
  #works .work-tree-child-actions button,
  #works .work-tree-material-actions button,
  #works .work-tree-action-icon{
    min-width:44px!important;min-height:44px!important;height:44px!important;
    padding:9px 10px!important;font-size:12px!important
  }

  #materials tbody tr:not(.material-category-row){
    grid-template-columns:minmax(0,1fr) auto!important;gap:3px 8px!important
  }
  #materials tbody tr:not(.material-category-row) td:nth-child(2),
  #materials tbody tr:not(.material-category-row) td:nth-child(3),
  #materials tbody tr:not(.material-category-row) td:nth-child(5),
  #materials tbody tr:not(.material-category-row) td:last-child{display:block!important}
  body.catalog-admin #materials tbody tr:not(.material-category-row) td:nth-child(4){display:block!important}
  #materials tbody tr:not(.material-category-row) td:nth-child(2){grid-column:1/-1!important}
  #materials tbody tr:not(.material-category-row) td:nth-child(3)::before{
    content:"Ед.: ";color:var(--muted);font-size:11px
  }
  #materials tbody tr:not(.material-category-row) td:nth-child(4),
  #materials tbody tr:not(.material-category-row) td:nth-child(5){font-size:13px}
  #materials tbody tr:not(.material-category-row) td:last-child{
    grid-column:1/-1!important;display:flex!important;flex-wrap:wrap!important;gap:8px!important
  }
  #materials tbody tr:not(.material-category-row) td:last-child button{min-height:44px!important}

  body{padding-bottom:calc(78px + env(safe-area-inset-bottom))!important}
  #mobilePersistentTabs.mobile-persistent-tabs,
  #mobilePersistentTabs.foreman-five-tabs,
  #mobilePersistentTabs.mobile-persistent-tabs.three-primary-tabs{
    position:fixed!important;left:0!important;right:0!important;top:auto!important;bottom:0!important;
    z-index:120!important;display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:0!important;width:100%!important;max-width:none!important;min-height:70px!important;margin:0!important;
    padding:6px max(5px,env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-right))!important;
    border:0!important;border-top:1px solid rgba(60,60,67,.15)!important;border-radius:0!important;
    background:rgba(250,250,252,.96)!important;box-shadow:0 -5px 24px rgba(0,0,0,.06)!important;
    backdrop-filter:blur(24px)!important;-webkit-backdrop-filter:blur(24px)!important
  }
  #mobilePersistentTabs.mobile-persistent-tabs>button,
  #mobilePersistentTabs.foreman-five-tabs>button,
  #mobilePersistentTabs.mobile-persistent-tabs.three-primary-tabs>button:not(.context-hidden){
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
    width:100%!important;min-width:0!important;min-height:56px!important;padding:3px 1px!important;gap:2px!important;
    border:0!important;border-radius:10px!important;background:transparent!important;box-shadow:none!important;
    color:#707078!important;font-size:11px!important;line-height:1.15!important;font-weight:620!important
  }
  #mobilePersistentTabs.mobile-persistent-tabs>button.active,
  #mobilePersistentTabs.foreman-five-tabs>button.active{
    background:transparent!important;color:#0071e3!important;box-shadow:none!important
  }
  #mobilePersistentTabs .ais-tab-icon{width:25px!important;height:25px!important}
  html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs,
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs{
    background:rgba(20,20,22,.96)!important;border-top-color:rgba(255,255,255,.12)!important
  }

  .ai-foreman-modal{padding:0!important}
  .ai-foreman-box,
  .ai-foreman-modal.foreman-fullscreen .ai-foreman-box{
    width:100vw!important;max-width:none!important;
    height:var(--stroy-visual-viewport-height,100dvh)!important;
    max-height:var(--stroy-visual-viewport-height,100dvh)!important;
    margin:0!important;border-radius:0!important;
    padding-bottom:max(12px,env(safe-area-inset-bottom))!important
  }
  .ai-foreman-messages{min-height:0!important;overflow-y:auto!important}
  .ai-foreman-compose{flex:0 0 auto!important}
}
@media(max-width:370px){
  #mobilePersistentTabs.mobile-persistent-tabs>button,
  #mobilePersistentTabs.foreman-five-tabs>button{font-size:10px!important}
}

/* ===== Строй ОС v22.19 — Mobile UX Simplification ===== */
.mobile-work-context{display:none}
.mobile-menu-group{margin-top:16px}
.mobile-menu-group:first-of-type{margin-top:0}
.mobile-menu-group-title{margin:0 2px 7px;color:var(--muted,#6e6e73);font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.catalog-purpose{margin-top:4px}
@media(max-width:768px){
  .ai-foreman-fab{
    width:80px!important;height:80px!important;min-width:80px!important;min-height:80px!important;
    max-width:80px!important;max-height:80px!important
  }
  .ai-foreman-fab-icon{width:52px!important;height:52px!important}
  .mobile-work-context{
    display:block;margin-top:6px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    color:var(--muted,#6e6e73);font-size:12px;font-weight:650
  }

  /* Первый экран: объект → сегодня → три действия. */
  #foremanDashboard{display:flex!important;flex-direction:column!important;gap:10px!important}
  #foremanDashboard .foreman-desktop-secondary{display:contents!important}
  #foremanDashboard .foreman-desktop-primary{display:contents!important}
  #foremanDashboard .ai-home-greeting{order:1!important;margin-bottom:2px!important}
  #foremanDashboard .today-command-center{order:2!important}
  #foremanDashboard .ai-home-tasks-head{order:3!important}
  #foremanDashboard .ai-home-tasks{order:4!important}

  /* Второстепенные данные не конкурируют с задачами первого экрана. */
  #foremanDashboard .ai-home-dictate,
  #foremanDashboard .ai-home-secondary{order:10!important}
  #foremanDashboard .ai-home-current-card{order:11!important}
  #foremanDashboard .ai-home-stats{order:12!important}
  #foremanDashboard .ai-home-resource-panel{order:13!important}

  .today-command-grid{display:none!important}
  .today-command-head>button{display:none!important}
  .today-command-center{padding:12px!important}
  .today-quick-actions{
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;margin-top:0!important
  }
  .today-quick-actions>button{min-height:48px!important;padding:8px 5px!important;font-size:12px!important}
  .today-quick-actions>.primary{display:none!important}

  .ai-home-tasks-head{margin-top:2px!important}
  .ai-home-current-card{margin-top:8px!important}
  .ai-home-resource-title b{font-size:15px!important}
}
@media(max-width:370px){
  .ai-foreman-fab{width:72px!important;height:72px!important;min-width:72px!important;min-height:72px!important}
  .ai-foreman-fab-icon{width:46px!important;height:46px!important}
  .today-quick-actions>button{font-size:11px!important}
}

/* ===== Строй ОС v22.19 — Mobile UX Simplification ===== */
.mobile-home-quick-actions,.mobile-dashboard-context,.ai-foreman-drag-hint{display:none}
.mobile-menu-group-title{grid-column:1/-1;font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);padding:10px 4px 2px}
@media(max-width:768px){
  /* Главный мобильный контекст: объект · смета */
  .mobile-dashboard-context{
    display:flex;align-items:center;gap:5px;min-width:0;margin:0 0 10px;
    padding:8px 10px;border-radius:11px;background:var(--soft,#f5f5f7);
    font-size:12px;white-space:nowrap;overflow:hidden
  }
  .mobile-dashboard-context strong{overflow:hidden;text-overflow:ellipsis}
  .mobile-context-label{color:var(--muted);font-weight:600}

  /* Три главных действия первого экрана */
  .mobile-home-quick-actions{
    display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 12px
  }
  .mobile-home-quick-actions button{
    min-width:0;min-height:48px;padding:8px 4px;border:1px solid var(--line,#d2d2d7);
    border-radius:13px;background:var(--card,#fff);color:var(--text,#1d1d1f);
    font-size:12px;font-weight:750
  }
  .mobile-home-quick-actions button span{font-size:16px;margin-right:2px}

  /* AI остаётся заметным, но не закрывает четверть экрана */
  #aiForemanFab.ai-foreman-fab{
    width:80px!important;height:80px!important;min-width:80px!important;min-height:80px!important;
    max-width:80px!important;max-height:80px!important
  }
  #aiForemanFab .ai-foreman-fab-icon{width:54px!important;height:54px!important}
  .ai-foreman-drag-hint{
    position:fixed;right:14px;bottom:calc(158px + env(safe-area-inset-bottom));z-index:1590;
    max-width:190px;padding:8px 10px;border-radius:11px;background:rgba(28,28,30,.92);
    color:#fff;font-size:11px;font-weight:650;box-shadow:0 8px 24px rgba(0,0,0,.18)
  }
  .ai-foreman-drag-hint:not([hidden]){display:block}

  /* Первый экран — сводка. Детали текущей сметы не доминируют. */
  #foremanDashboard .ai-home-greeting{margin-bottom:8px!important}
  #foremanDashboard .ai-home-greeting p{display:none!important}
  #foremanDashboard .ai-home-dictate{min-height:50px!important}
  #foremanDashboard .ai-home-current-card{margin-top:10px!important}
  #foremanDashboard .ai-home-current-body{padding-top:10px!important}
  #foremanDashboard .ai-home-rename-estimate{display:none!important}

  /* Длинные объектные заголовки короче на телефоне; контекст уже виден сверху. */
  #workers .tasks-head h1,#tools .tasks-head h1,#tasks .tasks-head h1{font-size:24px!important}
  #workers .tasks-head .small,#tools .tasks-head .small,#tasks .tasks-head .small{display:none!important}

  /* Меню «Ещё»: смысловые группы, а не сплошная сетка равнозначных действий. */
  .mobile-menu-grid{grid-template-columns:1fr 1fr!important;gap:8px!important}
  .mobile-menu-group-title{display:block}
}

/* ===== Строй ОС v22.20 — collapsible estimates + repaired mobile More ===== */
.estimates-list-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px
}
.estimates-list-toggle{
  flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0;
  display:grid;place-items:center;border:1px solid var(--line,#d2d2d7);border-radius:50%;
  background:var(--card,#fff);color:var(--text,#1d1d1f);font-size:27px;font-weight:400;line-height:1;
  cursor:pointer
}
.estimates-list-toggle:hover{background:var(--soft,#f5f5f7)}
.estimates-list-collapsible[hidden]{display:none!important}
.estimates-list-collapsible{margin-top:10px}
.mobile-menu-list{display:grid;gap:0;overflow:hidden;border:1px solid var(--line,#d2d2d7);border-radius:14px;background:var(--card,#fff)}
.mobile-menu-list>button{
  width:100%;min-height:50px;padding:11px 14px;border:0;border-bottom:1px solid var(--line,#e5e5ea);
  border-radius:0;background:transparent;color:var(--text,#1d1d1f);
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  text-align:left;font-size:15px;font-weight:650
}
.mobile-menu-list>button:last-child{border-bottom:0}
.mobile-menu-list>button:active{background:var(--soft,#f5f5f7)}
.mobile-menu-list>button>span{color:var(--muted,#8e8e93);font-size:20px;font-weight:400}
@media(max-width:768px){
  .estimates-list-head{padding:2px 0}
  .estimates-list-head h1{font-size:23px!important;margin:0}
  .estimates-list-toggle{width:44px!important;min-width:44px!important;height:44px!important}
  .mobile-menu-grid{display:none!important}
  .mobile-menu-group{margin-top:18px!important}
  .mobile-menu-group:first-of-type{margin-top:0!important}
  .mobile-menu-group-title{margin:0 4px 7px!important;font-size:11px!important}
  .mobile-logout-standalone{width:100%!important;min-height:50px!important;margin-top:18px!important}
}

/* ===== Строй ОС v22.21 — canonical 3-tab mobile nav ===== */
@media(max-width:768px){
  #mobilePersistentTabs.foreman-three-tabs{
    position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;z-index:10030!important;
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:0!important;
    margin:0!important;padding:6px max(5px,env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom))!important;
    min-height:70px!important;background:rgba(250,250,252,.94)!important;
    border-top:1px solid rgba(60,60,67,.15)!important;box-shadow:0 -5px 24px rgba(0,0,0,.06)!important;
    backdrop-filter:blur(24px)!important;-webkit-backdrop-filter:blur(24px)!important
  }
  html[data-theme="dark"] #mobilePersistentTabs.foreman-three-tabs{
    background:rgba(20,20,22,.96)!important;border-color:rgba(255,255,255,.12)!important
  }
  #mobilePersistentTabs.foreman-three-tabs>button{
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;
    width:100%!important;min-width:0!important;min-height:56px!important;padding:3px 4px!important;
    border:0!important;border-radius:10px!important;background:transparent!important;color:#77777d!important;
    box-shadow:none!important;font-size:12px!important;font-weight:600!important
  }
  #mobilePersistentTabs.foreman-three-tabs>button.active{color:#0071e3!important;background:transparent!important}
  #mobilePersistentTabs.foreman-three-tabs>button>.mobile-nav-svg{
    display:block!important;width:29px!important;height:29px!important;min-width:29px!important;min-height:29px!important;
    max-width:29px!important;max-height:29px!important;margin:0 0 2px!important;background:none!important;border:0!important;box-shadow:none!important
  }
  #mobilePersistentTabs.foreman-three-tabs>button>.foreman-more-icon-svg circle{fill:currentColor!important;stroke:none!important}
}
@media(max-width:370px){#mobilePersistentTabs.foreman-three-tabs>button{font-size:11px!important}}

/* ===== Строй ОС v22.22 — inline collapsible estimates in object card ===== */
.dashboard-estimates-panel{
  border:1px solid var(--line,#d2d2d7);
  border-radius:18px;
  background:var(--card,#fff);
  overflow:hidden;
}
.dashboard-estimates-toggle{
  width:100%;min-height:72px;padding:13px 16px;border:0;background:transparent;color:var(--text,#1d1d1f);
  display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left;cursor:pointer
}
.dashboard-estimates-title{display:flex;flex-direction:column;gap:3px;min-width:0}
.dashboard-estimates-title b{font-size:18px}
.dashboard-estimates-title small{font-size:13px;color:var(--muted,#8e8e93)}
.dashboard-estimates-plus{
  flex:0 0 44px;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;
  background:var(--soft,#f2f2f7);font-size:28px;font-weight:400;line-height:1
}
.dashboard-estimates-body{padding:0 12px 12px}
.dashboard-estimates-list{display:grid;gap:8px}
.dashboard-estimate-row{
  display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:stretch;
  border:1px solid var(--line,#e5e5ea);border-radius:13px;overflow:hidden;background:var(--soft,#f7f7f8)
}
.dashboard-estimate-row.current{border-color:rgba(10,132,255,.45);background:rgba(10,132,255,.08)}
.dashboard-estimate-main{
  min-width:0;min-height:54px;padding:9px 12px;border:0;background:transparent;color:inherit;text-align:left;
  display:flex;flex-direction:column;justify-content:center;gap:3px
}
.dashboard-estimate-name{font-size:14px;font-weight:750;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dashboard-estimate-meta{font-size:12px;color:var(--muted,#8e8e93)}
.dashboard-estimate-open{
  width:44px;min-width:44px;min-height:54px;border:0;border-left:1px solid var(--line,#e5e5ea);
  background:transparent;color:#0a84ff;font-size:27px
}
.dashboard-estimates-create{
  width:100%;min-height:46px;margin-top:9px;border:1px dashed var(--line,#d2d2d7);border-radius:12px;
  background:transparent;color:#0a84ff;font-size:14px;font-weight:700
}
.dashboard-estimates-empty{padding:14px 8px;color:var(--muted,#8e8e93);font-size:13px;text-align:center}
html[data-theme="dark"] .dashboard-estimates-panel{background:#1c1c1e;border-color:rgba(255,255,255,.11)}
html[data-theme="dark"] .dashboard-estimates-plus{background:#2c2c2e;color:#f5f5f7}
html[data-theme="dark"] .dashboard-estimate-row{background:#242426;border-color:rgba(255,255,255,.09)}
html[data-theme="dark"] .dashboard-estimate-row.current{background:rgba(10,132,255,.14);border-color:rgba(10,132,255,.45)}
html[data-theme="dark"] .dashboard-estimate-open{border-color:rgba(255,255,255,.09)}

@media(max-width:768px){
  #foremanDashboard .dashboard-estimates-panel{order:13!important;margin-top:2px!important}
  #foremanDashboard .ai-home-resource-panel{order:14!important}
  /* На телефоне основной список смет находится прямо в карточке объекта. */
  #estimates:not(.company-estimates-mode) > .estimates-list-head,
  #estimates:not(.company-estimates-mode) > .estimates-list-collapsible{display:none!important}
}

/* ===== Строй ОС v22.23 — no mobile bottom navigation ===== */
#mobilePersistentTabs{display:none!important}

.mobile-object-back-row{display:none}
@media(max-width:768px){
  /* Нижней панели больше нет: освобождаем нижнюю часть экрана. */
  body{
    padding-bottom:max(12px,env(safe-area-inset-bottom))!important;
  }
  .layout,main,.content,.view{
    padding-bottom:max(12px,env(safe-area-inset-bottom))!important;
  }

  .mobile-object-back-row{
    display:flex!important;
    align-items:center;
    justify-content:flex-start;
    margin:0 0 10px;
  }
  .mobile-object-back{
    min-height:44px;
    padding:7px 10px 7px 4px;
    border:0;
    background:transparent;
    color:#0a84ff;
    display:inline-flex;
    align-items:center;
    gap:5px;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
  }
  .mobile-object-back span{font-size:15px}

  /* Сама карточка объекта начинается сразу после кнопки назад. */
  #estimates>.object-card-tabs{margin-top:0!important}
}

/* ===== Строй ОС v22.24 — estimate works/materials as read-only info ===== */
.ai-home-current-buttons .estimate-info{
  background:var(--soft,#f2f2f7)!important;
  color:var(--text,#1d1d1f)!important;
  border:1px solid var(--line,#d2d2d7)!important;
}
html[data-theme="dark"] .ai-home-current-buttons .estimate-info{
  background:#2c2c2e!important;color:#f5f5f7!important;border-color:rgba(255,255,255,.12)!important;
}

.estimate-info-modal-box{width:min(720px,calc(100vw - 24px));max-height:min(86dvh,820px);overflow:hidden;display:flex;flex-direction:column}

/* v23.35: FAQ и форма обращений в поддержку */
.support-view{max-width:980px}
.support-view .section-title{margin-bottom:18px}
.support-faq-card,.support-ticket-card,.support-history-card{margin-bottom:18px}
.support-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px}
.support-card-head h2{margin:0 0 5px}
.support-faq-mark{display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;border-radius:50%;background:var(--accent,#168cf2);color:#fff;font-size:22px;font-weight:800}
.support-faq-list{display:grid;gap:8px}
.support-faq-list details{border:1px solid var(--line);border-radius:12px;background:color-mix(in srgb,var(--card) 78%,var(--bg) 22%);overflow:hidden}
.support-faq-list summary{cursor:pointer;list-style:none;padding:14px 44px 14px 16px;font-weight:700;position:relative}
.support-faq-list summary::-webkit-details-marker{display:none}
.support-faq-list summary::after{content:'＋';position:absolute;right:16px;top:12px;color:var(--muted);font-size:20px}
.support-faq-list details[open] summary::after{content:'−'}
.support-faq-list details p{margin:0;padding:0 16px 16px;color:var(--muted);line-height:1.55}
.support-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-bottom:14px}
.support-ticket-card label{display:grid;gap:7px;font-weight:700}
.support-ticket-card label .small{font-weight:400}
.support-ticket-card textarea{resize:vertical;min-height:130px}
.support-form-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:14px}
.support-form-actions .small{min-height:22px}
.support-ticket-row{padding:14px 0;border-bottom:1px solid var(--line)}
.support-ticket-row:last-child{border-bottom:0}
.support-ticket-row-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.support-ticket-row p{margin:8px 0 4px;white-space:pre-wrap;overflow-wrap:anywhere}
.support-ticket-status{display:inline-flex;align-items:center;border-radius:999px;padding:4px 9px;font-size:12px;font-weight:700;background:color-mix(in srgb,var(--accent,#168cf2) 18%,transparent);color:var(--text)}
.support-ticket-status.answered{background:#daf5e6;color:#167744}.support-ticket-status.closed{background:color-mix(in srgb,var(--muted) 18%,transparent)}
.support-empty,.support-error{padding:8px 0}.support-error{color:#c34b4b}
@media(max-width:680px){.support-form-grid{grid-template-columns:1fr}.support-ticket-row-head{display:grid;gap:8px}.support-ticket-status{justify-self:start}.support-card-head{gap:9px}}
.estimate-info-search-wrap{padding:0 0 10px}
.estimate-info-search-wrap input{width:100%;min-height:46px;padding:10px 13px;font-size:16px}
.estimate-info-summary{display:flex;justify-content:space-between;gap:12px;padding:4px 2px 10px;color:var(--muted,#8e8e93);font-size:13px}
.estimate-info-list{display:grid;gap:8px;overflow:auto;min-height:0;padding:2px}
.estimate-info-row{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;
  padding:12px 13px;border:1px solid var(--line,#e5e5ea);border-radius:13px;background:var(--soft,#f7f7f8)
}
.estimate-info-row-main{min-width:0;display:flex;flex-direction:column;gap:4px}
.estimate-info-row-main b{font-size:14px;overflow:hidden;text-overflow:ellipsis}
.estimate-info-row-main small{font-size:12px;color:var(--muted,#8e8e93)}
.estimate-info-row-value{font-size:14px;font-weight:800;white-space:nowrap}
.estimate-info-empty{padding:24px 12px;text-align:center;color:var(--muted,#8e8e93)}
html[data-theme="dark"] .estimate-info-row{background:#242426;border-color:rgba(255,255,255,.10)}
@media(max-width:768px){
  .estimate-info-modal-box{width:100vw!important;height:100dvh!important;max-height:100dvh!important;border-radius:0!important}
  .estimate-info-summary{font-size:12px}
  .estimate-info-row{grid-template-columns:minmax(0,1fr) auto}
  .ai-home-current-buttons{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}
  .ai-home-current-buttons .danger{grid-column:1/-1}
}

/* ===== Строй ОС v22.25 — estimate action layout ===== */
.estimate-card-info-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:10px;
}
.estimate-card-info-actions>button{
  width:100%;
  min-width:0;
  min-height:48px;
  padding:10px 12px;
  border:1px solid var(--line,#d2d2d7);
  border-radius:14px;
  background:var(--card,#fff);
  color:var(--text,#1d1d1f);
  font:inherit;
  font-size:14px;
  font-weight:750;
  line-height:1.15;
  white-space:normal;
  text-align:center;
  overflow-wrap:anywhere;
}
html[data-theme="dark"] .estimate-card-info-actions>button{
  background:#242426;
  color:#f5f5f7;
  border-color:rgba(255,255,255,.11);
}
@media(max-width:768px){
  /* В самой карточке остаются только три действия: открыть, документы, удалить. */
  #foremanDashboard .ai-home-current-buttons{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    width:100%!important;
    max-width:100%!important;
  }
  #foremanDashboard .ai-home-current-buttons>button{
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    padding:10px 8px!important;
    font-size:14px!important;
    line-height:1.15!important;
  }
  #foremanDashboard .ai-home-current-buttons>.danger{
    grid-column:1/-1!important;
  }

  /* Информационные кнопки живут отдельной строкой под карточкой сметы. */
  #foremanDashboard .estimate-card-info-actions{
    order:12!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    width:100%!important;
    max-width:100%!important;
    gap:8px!important;
    margin:0!important;
  }
  #foremanDashboard .estimate-card-info-actions>button{
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    min-height:50px!important;
    padding:9px 6px!important;
    font-size:13px!important;
  }

  /* Сдвигаем последующие блоки ниже двух информационных кнопок. */
  #foremanDashboard .ai-home-stats{order:13!important}
  #foremanDashboard .dashboard-estimates-panel{order:14!important}
  #foremanDashboard .ai-home-resource-panel{order:15!important}
}
@media(max-width:370px){
  #foremanDashboard .ai-home-current-buttons>button{font-size:13px!important}
  #foremanDashboard .estimate-card-info-actions>button{font-size:12px!important}
}

/* ===== Строй ОС v22.26 — workers/tools/files inside estimate card ===== */
.ai-home-files-panel .ai-home-resource-icon.file{
  display:grid;place-items:center;font-size:18px;font-weight:800
}
.ai-home-files-list{display:grid;gap:8px}
.ai-home-file-item{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;
  background:var(--soft,#f7f7f8);border-radius:12px;padding:7px 8px
}
.ai-home-file-main{
  min-width:0;min-height:44px;border:0;background:transparent;color:inherit;
  display:flex;align-items:center;gap:9px;text-align:left
}
.ai-home-file-icon{
  flex:0 0 38px;width:38px;height:38px;border-radius:10px;
  display:grid;place-items:center;background:var(--card,#fff);font-size:11px;font-weight:850;color:#0a84ff
}
.ai-home-file-info{min-width:0;display:flex;flex-direction:column;gap:3px}
.ai-home-file-info b{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-home-file-info small{font-size:11px;color:var(--muted,#8e8e93);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-home-file-actions{display:flex;gap:5px}
.ai-home-file-actions button{
  width:38px;height:38px;min-width:38px;min-height:38px;padding:0;border:0;border-radius:10px;
  background:var(--card,#fff);color:#0a84ff;font-size:17px
}
.ai-home-file-actions button.danger{color:#ff3b30}
html[data-theme="dark"] .ai-home-file-item{background:#242426}
html[data-theme="dark"] .ai-home-file-icon,
html[data-theme="dark"] .ai-home-file-actions button{background:#333336}

@media(max-width:768px){
  /* Порядок верхней рабочей зоны: Сегодня -> Задачи -> Работники -> Инструменты -> Файлы. */
  #foremanDashboard .today-command-center{order:2!important}
  #foremanDashboard .ai-home-tasks-head{order:3!important}
  #foremanDashboard .ai-home-tasks{order:4!important}
  #foremanDashboard #aiHomeWorkersPanel{order:5!important}
  #foremanDashboard #aiHomeToolsPanel{order:6!important}
  #foremanDashboard #aiHomeFilesPanel{order:7!important}

  /* Вторичные показатели и список смет идут после оперативных разделов. */
  #foremanDashboard .ai-home-stats{order:13!important}
  #foremanDashboard .dashboard-estimates-panel{order:14!important}

  .ai-home-resource-actions>button{min-height:44px!important}
  .ai-home-file-item{grid-template-columns:minmax(0,1fr) auto}
}
@media(max-width:390px){
  .ai-home-file-actions{gap:3px}
  .ai-home-file-actions button{width:36px;min-width:36px;height:36px;min-height:36px}
}

/* ===== Строй ОС v22.28 — карточка сметы по утверждённому мобильному макету ===== */
#estimates .object-card-tabs{
  width:100%!important;max-width:none!important;
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:0!important;padding:0!important;overflow:hidden!important;
  border:1px solid rgba(255,255,255,.10)!important;border-radius:18px!important;
}
#estimates .object-card-tabs>button{
  width:100%!important;min-width:0!important;min-height:58px!important;
  margin:0!important;border-radius:0!important;border:0!important;
  border-right:1px solid rgba(255,255,255,.08)!important;
  white-space:normal!important;text-align:center!important;
}
#estimates .object-card-tabs>button:last-child{border-right:0!important}
#estimates .object-card-tabs>button.active,
#estimates .object-card-tabs>button:first-child{background:#0a84ff!important;color:#fff!important}

#foremanDashboard .mobile-work-context{display:none!important}
#foremanDashboard .today-quick-actions{display:none!important}

#foremanDashboard .ai-home-current-card{
  border-radius:22px!important;padding:18px!important;
  border:1px solid rgba(255,255,255,.12)!important;
}
#foremanDashboard .ai-home-current-title-row{align-items:flex-start!important}
#foremanDashboard .ai-home-current-title-row>div{min-width:0}
#foremanDashboard .ai-home-current-title-row h2{margin:0!important;font-size:22px!important;line-height:1.12!important}
#foremanDashboard .ai-home-current-object{margin-top:4px;color:var(--muted,#8e8e93);font-size:14px}
#foremanDashboard .ai-home-rename-estimate{font-size:0!important;width:38px!important;min-width:38px!important;padding:0!important}
#foremanDashboard .ai-home-rename-estimate::after{content:"⋮";font-size:26px!important;line-height:1}

#foremanDashboard .ai-home-current-body{align-items:center!important}
#foremanDashboard .ai-home-current-buttons{
  display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;
}
#foremanDashboard .ai-home-current-buttons>.danger{grid-column:1/-1!important;background:transparent!important;border:0!important;color:#ff453a!important}
#foremanDashboard .ai-home-stats{
  border:1px solid rgba(255,255,255,.09)!important;border-radius:16px!important;padding:12px!important;
}

#foremanDashboard .estimate-card-info-actions{
  display:grid!important;grid-template-columns:1fr!important;gap:8px!important;margin-top:10px!important;
}
#foremanDashboard .estimate-card-info-actions>button,
#foremanDashboard .ai-home-resource-toggle,
#foremanDashboard .dashboard-estimates-toggle{
  min-height:72px!important;width:100%!important;
  display:grid!important;grid-template-columns:48px minmax(0,1fr) auto 28px!important;
  align-items:center!important;gap:8px!important;padding:10px 14px!important;
  border-radius:16px!important;text-align:left!important;
  border:1px solid rgba(255,255,255,.10)!important;
  background:var(--card,#fff)!important;color:var(--text,#1d1d1f)!important;
}
html[data-theme="dark"] #foremanDashboard .estimate-card-info-actions>button,
html[data-theme="dark"] #foremanDashboard .ai-home-resource-toggle,
html[data-theme="dark"] #foremanDashboard .dashboard-estimates-toggle{
  background:#17191d!important;color:#f5f5f7!important;
}
#foremanDashboard .estimate-section-icon{font-size:26px;color:#0a84ff;text-align:center}
#foremanDashboard .estimate-section-copy{min-width:0;display:flex;flex-direction:column;gap:3px}
#foremanDashboard .estimate-section-copy b{font-size:15px}
#foremanDashboard .estimate-section-copy small{font-size:11px;color:var(--muted,#8e8e93);font-weight:500}
#foremanDashboard .estimate-section-count{font-size:16px;font-weight:700}
#foremanDashboard .estimate-section-chevron{font-size:22px;color:var(--muted,#8e8e93)}

#foremanDashboard .ai-home-resource-panel{margin:8px 0!important}
#foremanDashboard .ai-home-resource-toggle{
  grid-template-columns:48px minmax(0,1fr) auto 28px!important;
}
#foremanDashboard .ai-home-resource-title{min-width:0}
#foremanDashboard .ai-home-resource-title b{font-size:15px}
#foremanDashboard .ai-home-resource-title small{font-size:11px!important}
#foremanDashboard .ai-home-resource-chevron{font-size:22px!important}

#foremanDashboard .dashboard-estimates-panel{margin-top:14px!important}
#foremanDashboard .dashboard-estimates-toggle{
  grid-template-columns:48px minmax(0,1fr) 28px!important;
}
#foremanDashboard .dashboard-estimates-toggle::before{
  content:"☷";font-size:28px;color:#0a84ff;text-align:center;
}
#foremanDashboard .dashboard-estimates-title{min-width:0}
#foremanDashboard .dashboard-estimates-title b{font-size:15px}
#foremanDashboard .dashboard-estimates-title small{font-size:11px!important}
#foremanDashboard .dashboard-estimates-plus{font-size:0!important}
#foremanDashboard .dashboard-estimates-plus::after{content:"⌄";font-size:24px!important;color:var(--muted,#8e8e93)}

@media(max-width:768px){
  #estimates{padding-left:10px!important;padding-right:10px!important}
  #estimates .object-card-tabs{margin-left:0!important;margin-right:0!important}
  #foremanDashboard{display:flex!important;flex-direction:column!important;gap:8px!important}
  #foremanDashboard .foreman-desktop-columns{display:contents!important}
  #foremanDashboard .foreman-desktop-column{display:contents!important}

  /* Оперативные разделы идут над основной карточкой сметы. */
  #foremanDashboard .ai-home-tasks-head{order:1!important}
  #foremanDashboard .ai-home-tasks{order:2!important}
  #foremanDashboard #aiHomeWorkersPanel{order:3!important}
  #foremanDashboard #aiHomeToolsPanel{order:4!important}

  #foremanDashboard .ai-home-greeting{order:5!important}
  #foremanDashboard .ai-home-dictate{order:6!important}
  #foremanDashboard .ai-home-secondary{order:7!important}
  #foremanDashboard .ai-home-current-card{order:8!important}
  #foremanDashboard .estimate-card-info-actions{order:9!important}
  #foremanDashboard #aiHomeFilesPanel{order:10!important}
  #foremanDashboard .ai-home-stats{order:11!important}
  #foremanDashboard .dashboard-estimates-panel{order:12!important}

  /* Старый большой блок Сегодня не нужен в новой карточке. */
  #foremanDashboard .ai-home-label,
  #foremanDashboard .today-command-center{display:none!important}

  #foremanDashboard .ai-home-current-body{
    display:grid!important;grid-template-columns:38% minmax(0,1fr)!important;gap:14px!important;
  }
  #foremanDashboard .foreman-progress{width:min(32vw,150px)!important;height:min(32vw,150px)!important}
  #foremanDashboard .ai-home-current-value{min-width:0!important}
  #foremanDashboard .ai-home-current-value>strong{font-size:25px!important;white-space:nowrap!important}
  #foremanDashboard .ai-home-current-buttons>button{min-height:52px!important;font-size:14px!important}
}
@media(max-width:390px){
  #estimates .object-card-tabs>button{font-size:13px!important;padding:8px 4px!important}
  #foremanDashboard .ai-home-current-card{padding:14px!important}
  #foremanDashboard .ai-home-current-title-row h2{font-size:19px!important}
  #foremanDashboard .ai-home-current-body{grid-template-columns:36% minmax(0,1fr)!important;gap:10px!important}
  #foremanDashboard .ai-home-current-value>strong{font-size:21px!important}
}

/* ===== Строй ОС v22.29 — приветствие наверху карточки ===== */
@media(max-width:768px){
  #foremanDashboard .ai-home-greeting{order:0!important;margin-top:0!important}
  #foremanDashboard .ai-home-tasks-head{order:1!important}
  #foremanDashboard .ai-home-tasks{order:2!important}
  #foremanDashboard #aiHomeWorkersPanel{order:3!important}
  #foremanDashboard #aiHomeToolsPanel{order:4!important}
}

/* ===== Строй ОС v22.31 — green completion checks in estimate info ===== */
.estimate-info-row{
  grid-template-columns:38px minmax(0,1fr) auto!important;
}
.estimate-complete-check{
  width:32px;height:32px;min-width:32px;min-height:32px;padding:0;
  border:2px solid #8e8e93;border-radius:9px;background:transparent;
  color:#fff;font-size:20px;font-weight:900;line-height:1;display:grid;place-items:center;
}
.estimate-complete-check.done{
  background:#30d158!important;border-color:#30d158!important;color:#fff!important;
}
.estimate-info-row.completed .estimate-info-row-main b{
  color:#30d158;
}
@media(max-width:768px){
  .estimate-info-row{grid-template-columns:38px minmax(0,1fr) auto!important}
  .estimate-complete-check{width:34px;height:34px;min-width:34px;min-height:34px}
}

/* ===== Строй ОС v22.33 — единый вид верхних вкладок карточки объекта ===== */
.object-card-tabs{
  width:100%!important;
  max-width:none!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:0!important;
  padding:0!important;
  overflow:hidden!important;
  border:1px solid rgba(255,255,255,.10)!important;
  border-radius:18px!important;
  background:rgba(44,44,46,.92)!important;
}
.object-card-tabs>button{
  width:100%!important;
  min-width:0!important;
  min-height:58px!important;
  margin:0!important;
  padding:8px 10px!important;
  border:0!important;
  border-radius:0!important;
  border-right:1px solid rgba(255,255,255,.08)!important;
  background:transparent!important;
  color:var(--muted,#a1a1a6)!important;
  font-weight:700!important;
  white-space:normal!important;
  text-align:center!important;
}
.object-card-tabs>button:last-child{border-right:0!important}
.object-card-tabs>button.active{
  background:#0a84ff!important;
  color:#fff!important;
}
/* Убираем старое правило, которое делало первую вкладку синей независимо от active. */
#estimates .object-card-tabs>button:first-child:not(.active){
  background:transparent!important;
  color:var(--muted,#a1a1a6)!important;
}
@media(max-width:768px){
  .view>.object-card-tabs{
    margin-left:0!important;
    margin-right:0!important;
    margin-bottom:16px!important;
  }
}
@media(max-width:390px){
  .object-card-tabs>button{
    min-height:58px!important;
    padding:8px 4px!important;
    font-size:13px!important;
  }
}

/* ===== Строй ОС v22.38 — нормальные чекбоксы задач ===== */
.task-check,
.ai-home-task-check{
  box-sizing:border-box!important;
  width:30px!important;
  height:30px!important;
  min-width:30px!important;
  min-height:30px!important;
  max-width:30px!important;
  max-height:30px!important;
  padding:0!important;
  margin:0!important;
  flex:0 0 30px!important;
  aspect-ratio:1/1!important;
  align-self:center!important;
  border-radius:50%!important;
  border:2px solid #8e8e93!important;
  background:transparent!important;
  color:#fff!important;
  display:grid!important;
  place-items:center!important;
  font-size:18px!important;
  font-weight:900!important;
  line-height:1!important;
  overflow:hidden!important;
}
.task-card.done .task-check,
.ai-home-task.done .ai-home-task-check,
.task-check:not(:empty),
.ai-home-task-check:not(:empty){
  background:#30d158!important;
  border-color:#30d158!important;
}
.task-card,
.ai-home-task{align-items:center!important}
@media(max-width:768px){
  .task-check,
  .ai-home-task-check{
    width:30px!important;height:30px!important;
    min-width:30px!important;min-height:30px!important;
    max-width:30px!important;max-height:30px!important;
    flex-basis:30px!important;
  }
}
/* v22.43-stages: keep the current-stage card out of a single 12-column cell. */
@media(min-width:1101px){
  #foremanDashboard.foreman-dashboard{grid-template-rows:repeat(8,auto)!important}
  #foremanDashboard .stage-dashboard-card{grid-column:1/13!important;grid-row:3!important;width:100%!important;min-width:0!important;box-sizing:border-box!important}
  #foremanDashboard .ai-home-current-card{grid-row:4/6!important}
  #foremanDashboard>.foreman-desktop-secondary>.ai-home-label{grid-row:4!important}
  #foremanDashboard .today-command-center{grid-row:5!important}
  #foremanDashboard .ai-home-stats{grid-row:6!important}
  #foremanDashboard #aiHomeWorkersPanel{grid-row:6!important}
  #foremanDashboard .ai-home-tasks-head{grid-row:7!important}
  #foremanDashboard #aiHomeTasks{grid-row:8!important}
  #foremanDashboard #aiHomeToolsPanel{grid-row:7/9!important}
}
@media(max-width:768px){
  #foremanDashboard .stage-dashboard-card{order:2!important;width:100%!important;min-width:0!important;box-sizing:border-box!important}
  #foremanDashboard .today-command-center{order:3!important}
  #foremanDashboard .ai-home-tasks-head{order:4!important}
  #foremanDashboard .ai-home-tasks{order:5!important}
}
/* v22.44-stages: unified, single-row object tabs in light and dark themes. */
.view>.object-card-tabs{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  width:100%!important;
  gap:0!important;
  overflow:hidden!important;
  padding:0!important;
  border:1px solid #d8dee8!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 5px 18px rgba(25,45,75,.08)!important;
}
.view>.object-card-tabs>button{
  min-width:0!important;
  width:100%!important;
  min-height:54px!important;
  margin:0!important;
  padding:7px 5px!important;
  border:0!important;
  border-right:1px solid #e2e7ee!important;
  border-radius:0!important;
  background:#fff!important;
  color:#344054!important;
  font-size:clamp(11px,2.8vw,14px)!important;
  font-weight:750!important;
  line-height:1.15!important;
  white-space:normal!important;
  text-align:center!important;
}
.view>.object-card-tabs>button:last-child{border-right:0!important}
.view>.object-card-tabs>button.active{
  background:#0a84ff!important;
  color:#fff!important;
}
html[data-theme="dark"] .view>.object-card-tabs{
  border-color:rgba(255,255,255,.13)!important;
  background:#242426!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .view>.object-card-tabs>button{
  border-right-color:rgba(255,255,255,.10)!important;
  background:#242426!important;
  color:#c5c7ce!important;
}
html[data-theme="dark"] .view>.object-card-tabs>button.active{background:#0a84ff!important;color:#fff!important}
@media(max-width:420px){
  .view>.object-card-tabs{border-radius:14px!important}
  .view>.object-card-tabs>button{min-height:50px!important;padding:6px 2px!important;font-size:10.5px!important}
}

/* v22.46-stages: final light/dark theme isolation. */
:root{
  --border:var(--line,#d2d2d7);
}
html[data-theme="light"] #foremanDashboard .ai-home-stats{
  border-color:rgba(60,60,67,.12)!important;
}
html[data-theme="dark"]{
  --border:var(--ais-border,rgba(255,255,255,.12));
}
html[data-theme="dark"] .stage-status{
  background:#2c2c2e!important;
  color:#c7c7cc!important;
}
html[data-theme="dark"] .stage-status.active{
  background:rgba(10,132,255,.18)!important;
  color:#75baff!important;
}
html[data-theme="dark"] .stage-status.done{
  background:rgba(48,209,88,.16)!important;
  color:#72df91!important;
}
html[data-theme="dark"] .stage-status.paused{
  background:rgba(255,159,10,.17)!important;
  color:#ffbd57!important;
}
html[data-theme="dark"] .stage-timeline-step,
html[data-theme="dark"] .stage-template-list button,
html[data-theme="dark"] .auto-stage-row{
  background:#1c1c1e!important;
  color:#f5f5f7!important;
  border-color:rgba(255,255,255,.12)!important;
}
html[data-theme="dark"] .stage-order-actions,
html[data-theme="dark"] .stage-linked span,
html[data-theme="dark"] .auto-stage-row>em{
  background:rgba(255,255,255,.065)!important;
}
html[data-theme="dark"] .auto-stages-summary{
  background:rgba(10,132,255,.13)!important;
  color:#f5f5f7!important;
}
html[data-theme="dark"] .auto-stage-row>i{
  background:rgba(10,132,255,.18)!important;
  color:#75baff!important;
}
html[data-theme="dark"] .auto-stage-row>button,
html[data-theme="dark"] .stage-dashboard-card>button{
  color:#75baff!important;
}

/* v22.53: expandable estimate works inside every stage card */
.stage-works-disclosure{
  margin-top:12px;
  border:1px solid var(--border,#dbe2ea);
  border-radius:14px;
  overflow:hidden;
  background:var(--card,#fff);
}
.stage-works-disclosure>summary{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:46px;
  padding:10px 13px;
  cursor:pointer;
  list-style:none;
  color:inherit;
}
.stage-works-disclosure>summary::-webkit-details-marker{display:none}
.stage-works-disclosure>summary span{font-weight:750;flex:1}
.stage-works-disclosure>summary b{min-width:28px;padding:3px 8px;border-radius:999px;text-align:center;background:rgba(10,132,255,.11);color:#0877d1}
.stage-works-disclosure>summary i{font-style:normal;transition:transform .18s ease;color:var(--muted,#64748b)}
.stage-works-disclosure[open]>summary i{transform:rotate(180deg)}
.stage-works-list{border-top:1px solid var(--border,#dbe2ea)}
.stage-work-row{display:grid;grid-template-columns:28px 1fr;gap:9px;padding:10px 13px;border-bottom:1px solid var(--border,#e4e8ee)}
.stage-work-row:last-child{border-bottom:0}
.stage-work-row>em{font-style:normal;color:var(--muted,#64748b);font-size:12px;padding-top:2px}
.stage-work-row>span{display:grid;gap:2px;min-width:0}
.stage-work-row b{font-size:14px;overflow-wrap:anywhere}
.stage-work-row small,.stage-works-empty{color:var(--muted,#64748b)}
.stage-works-empty{padding:13px}
html[data-theme="dark"] .stage-works-disclosure{background:#1c1c1e!important;border-color:rgba(255,255,255,.12)!important}
html[data-theme="dark"] .stage-works-list,html[data-theme="dark"] .stage-work-row{border-color:rgba(255,255,255,.1)!important}
html[data-theme="dark"] .stage-works-disclosure>summary b{background:rgba(10,132,255,.18);color:#75baff}
@media(max-width:700px){.stage-works-disclosure>summary{min-height:44px;padding:9px 10px}.stage-work-row{padding:9px 10px;grid-template-columns:22px 1fr}}
html[data-theme="dark"] .stage-blocked-label{color:#ffbd57!important}
html[data-theme="dark"] #foremanDashboard .ai-home-stats{
  border-color:rgba(255,255,255,.09)!important;
}

/* The sign-in flow follows the saved application theme too. */
html[data-theme="dark"] .stroy-auth-overlay{
  background:#000!important;
  color:#f5f5f7!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card{
  background:#1c1c1e!important;
  color:#f5f5f7!important;
  border:1px solid rgba(255,255,255,.12)!important;
  box-shadow:0 24px 70px rgba(0,0,0,.46)!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card h1,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card h2,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card h3,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card label{
  color:#f5f5f7!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card p{color:#a1a1a6!important}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card input,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card select,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card textarea{
  background:#2c2c2e!important;
  background-color:#2c2c2e!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
  caret-color:#0a84ff!important;
  border-color:rgba(255,255,255,.16)!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card input::placeholder,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card textarea::placeholder{
  color:#8e8e93!important;
  -webkit-text-fill-color:#8e8e93!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card input:-webkit-autofill,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card input:-webkit-autofill:hover,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card input:-webkit-autofill:focus{
  -webkit-text-fill-color:#fff!important;
  -webkit-box-shadow:0 0 0 1000px #2c2c2e inset!important;
  box-shadow:0 0 0 1000px #2c2c2e inset!important;
}
html[data-theme="dark"] .stroy-auth-tabs{background:#2c2c2e!important}
html[data-theme="dark"] .stroy-auth-tabs .stroy-auth-tab{color:#a1a1a6!important}
html[data-theme="dark"] .stroy-auth-tabs .stroy-auth-tab.active{
  background:#48484a!important;
  color:#75baff!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card #aPhone,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card #aRegister{
  background:#1c1c1e!important;
  color:#75baff!important;
  border-color:#0a84ff!important;
}
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card #aTry,
html[data-theme="dark"] .stroy-auth-overlay .stroy-auth-card #rTry{
  background:rgba(10,132,255,.16)!important;
  color:#75baff!important;
}

/* v22.48-stages: stable desktop composition and a single object tab row. */
.view>.object-card-tabs~.object-card-tabs{display:none!important}
.stage-progress-wrap{display:grid;justify-items:center;gap:5px}.stage-progress-wrap>small{font-size:11px;font-weight:700;letter-spacing:.02em}
@media(min-width:1101px){
  #foremanDashboard.foreman-dashboard{
    display:grid!important;
    grid-template-columns:minmax(0,1.08fr) minmax(420px,.92fr)!important;
    grid-template-rows:auto auto!important;
    grid-auto-flow:row!important;
    gap:18px 24px!important;
    align-items:start!important;
  }
  #foremanDashboard>.stage-dashboard-card{
    grid-column:1/-1!important;
    grid-row:1!important;
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  #foremanDashboard>.foreman-desktop-primary,
  #foremanDashboard>.foreman-desktop-secondary{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    min-width:0!important;
    grid-row:2!important;
  }
  #foremanDashboard>.foreman-desktop-primary{grid-column:1!important}
  #foremanDashboard>.foreman-desktop-secondary{grid-column:2!important}
  #foremanDashboard>.foreman-desktop-column>*{
    grid-column:auto!important;
    grid-row:auto!important;
    min-width:0!important;
    width:100%!important;
    box-sizing:border-box!important;
  }
  #foremanDashboard #aiHomeFilesPanel,
  #foremanDashboard .dashboard-estimates-panel,
  #foremanDashboard #aiHomeWorkersPanel,
  #foremanDashboard #aiHomeToolsPanel{
    width:100%!important;
    min-width:0!important;
  }
}
@media(max-width:1100px){
  #foremanDashboard>.stage-dashboard-card{width:100%!important;min-width:0!important;box-sizing:border-box!important}
}

/* v22.49-stages: identical four-column tabs on Estimates and spaced creation actions. */
#estimates.view>.object-card-tabs{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  grid-template-rows:1fr!important;
  width:100%!important;
  max-width:none!important;
  gap:0!important;
  overflow:hidden!important;
}
#estimates.view>.object-card-tabs>button{
  min-width:0!important;
  width:100%!important;
  margin:0!important;
}
#foremanDashboard>.foreman-desktop-primary>.ai-home-dictate{
  margin:0 0 14px!important;
}
#foremanDashboard>.foreman-desktop-primary>.ai-home-secondary{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:14px!important;
  margin:0 0 18px!important;
}
#foremanDashboard>.foreman-desktop-primary>.ai-home-secondary>button{
  min-width:0!important;
  width:100%!important;
  border-radius:15px!important;
}
@media(max-width:430px){
  #estimates.view>.object-card-tabs>button{
    padding:6px 2px!important;
    font-size:10.5px!important;
  }
  #foremanDashboard>.foreman-desktop-primary>.ai-home-dictate{margin-bottom:12px!important}
  #foremanDashboard>.foreman-desktop-primary>.ai-home-secondary{gap:10px!important;margin-bottom:16px!important}
}

/* v22.50-stages: visible return navigation and guaranteed modal close control. */
.object-return-row{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  width:100%!important;
  margin:0 0 12px!important;
}
.object-return-button{
  display:inline-flex!important;
  align-items:center!important;
  gap:7px!important;
  min-height:42px!important;
  padding:8px 13px!important;
  border:1px solid var(--line,#d2d2d7)!important;
  border-radius:12px!important;
  background:var(--card,#fff)!important;
  color:#0a72df!important;
  font:inherit!important;
  font-weight:750!important;
  cursor:pointer!important;
  box-shadow:0 3px 12px rgba(25,45,75,.06)!important;
}
.object-return-button:hover{background:var(--soft,#f2f2f7)!important}
html[data-theme="dark"] .object-return-button{
  background:#242426!important;
  color:#75baff!important;
  border-color:rgba(255,255,255,.12)!important;
  box-shadow:none!important;
}
.modal-box,.modal-card{position:relative}
.modal-universal-close{
  position:absolute!important;
  top:12px!important;
  right:12px!important;
  z-index:12!important;
  display:grid!important;
  place-items:center!important;
  width:42px!important;
  min-width:42px!important;
  height:42px!important;
  min-height:42px!important;
  padding:0!important;
  border:1px solid var(--line,#d2d2d7)!important;
  border-radius:50%!important;
  background:var(--card,#fff)!important;
  color:var(--text,#1d1d1f)!important;
  font-size:27px!important;
  line-height:1!important;
  cursor:pointer!important;
}
html[data-theme="dark"] .modal-universal-close{
  background:#2c2c2e!important;
  color:#f5f5f7!important;
  border-color:rgba(255,255,255,.14)!important;
}
@media(max-width:768px){
  .object-return-row{margin-bottom:10px!important}
  .object-return-button{min-height:44px!important;padding:8px 12px!important}
  .modal-universal-close{top:10px!important;right:10px!important}
}

/* Карточка сметы */
@media(max-width:768px){
  #foremanDashboard .ai-home-current-card{padding:16px!important;overflow:hidden!important}
  #foremanDashboard .ai-home-current-head{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:start!important;gap:10px!important}
  #foremanDashboard .ai-home-current-title-row,#foremanDashboard .ai-home-current-title-row>div{min-width:0!important}
  #foremanDashboard .ai-home-current-title-row h2,#foremanDashboard .ai-home-current-object{overflow-wrap:normal!important;word-break:normal!important;hyphens:none!important}
  #foremanDashboard .ai-home-current-body{display:grid!important;grid-template-columns:112px minmax(0,1fr)!important;grid-template-rows:auto auto auto!important;align-items:center!important;column-gap:14px!important;row-gap:3px!important;margin-top:16px!important;padding-top:0!important}
  #foremanDashboard .ai-home-current-value{display:contents!important}
  #foremanDashboard .ai-home-current-value>small{grid-column:1/-1!important;grid-row:1!important;margin:0!important;font-size:13px!important;line-height:1.25!important}
  #foremanDashboard .ai-home-current-value>strong{grid-column:1/-1!important;grid-row:2!important;margin:2px 0 13px!important;max-width:100%!important;font-size:clamp(25px,8vw,34px)!important;line-height:1.08!important;letter-spacing:-.035em!important;white-space:nowrap!important}
  #foremanDashboard .foreman-progress{grid-column:1!important;grid-row:3!important;width:112px!important;height:112px!important;max-width:100%!important;align-self:center!important}
  #foremanDashboard .foreman-progress span{font-size:28px!important;line-height:1!important}
  #foremanDashboard .ai-home-current-buttons{grid-column:2!important;grid-row:3!important;align-self:stretch!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:1fr 1fr auto!important;gap:8px!important;margin:0!important;min-width:0!important}
  #foremanDashboard .ai-home-current-buttons>button{width:100%!important;min-width:0!important;min-height:46px!important;height:auto!important;margin:0!important;padding:9px 12px!important;font-size:15px!important;line-height:1.15!important;white-space:normal!important;overflow-wrap:normal!important;word-break:normal!important;hyphens:none!important}
  #foremanDashboard .ai-home-current-buttons>.danger{grid-column:1!important;min-height:34px!important;padding:5px 8px!important;font-size:13px!important}
  #foremanDashboard .estimate-card-info-actions>button{grid-template-columns:42px minmax(0,1fr) 38px 18px!important;min-width:0!important;padding:12px!important}
  #foremanDashboard .estimate-section-copy b,#foremanDashboard .estimate-section-copy small{overflow-wrap:normal!important;word-break:normal!important;hyphens:none!important}
}
@media(max-width:390px){
  #foremanDashboard .ai-home-current-card{padding:14px!important}
  #foremanDashboard .ai-home-current-body{grid-template-columns:102px minmax(0,1fr)!important;column-gap:10px!important}
  #foremanDashboard .foreman-progress{width:102px!important;height:102px!important}
  #foremanDashboard .foreman-progress span{font-size:25px!important}
  #foremanDashboard .ai-home-current-value>strong{font-size:25px!important}
  #foremanDashboard .ai-home-current-buttons>button{font-size:14px!important;padding:8px!important}
}


/* Компоновка карточки сметы и этапов */
@media(max-width:768px){
  #foremanDashboard .ai-home-current-body{
    grid-template-columns:112px minmax(0,1fr)!important;
    grid-template-rows:auto auto auto!important;
    align-items:center!important;
    column-gap:14px!important;
    row-gap:4px!important;
  }
  #foremanDashboard .ai-home-current-value{display:contents!important}
  #foremanDashboard .ai-home-current-value>small{
    grid-column:2!important;
    grid-row:1!important;
    align-self:end!important;
    margin:0!important;
  }
  #foremanDashboard .ai-home-current-value>strong{
    grid-column:2!important;
    grid-row:2!important;
    align-self:start!important;
    margin:2px 0 0!important;
  }
  #foremanDashboard .foreman-progress{
    grid-column:1!important;
    grid-row:1/3!important;
  }
  #foremanDashboard .ai-home-current-buttons{
    grid-column:1/-1!important;
    grid-row:3!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-rows:auto auto!important;
    gap:9px!important;
    margin-top:12px!important;
  }
  #foremanDashboard .ai-home-current-buttons>button{
    min-height:48px!important;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:normal!important;
    hyphens:none!important;
  }
  #foremanDashboard .ai-home-current-buttons>.danger{
    grid-column:1/-1!important;
    grid-row:2!important;
    min-height:36px!important;
  }
}
@media(max-width:390px){
  #foremanDashboard .ai-home-current-body{grid-template-columns:102px minmax(0,1fr)!important}
  #foremanDashboard .ai-home-current-buttons{gap:8px!important}
}

/* Производственное управление этапами */
.stage-view-modes{display:flex;gap:6px;margin:0 0 14px;padding:4px;width:max-content;border:1px solid var(--border,#dbe2ea);border-radius:13px;background:var(--card,#fff)}
.stage-view-modes button{border:0;border-radius:9px;padding:8px 14px;background:transparent;color:inherit;font-weight:700;cursor:pointer}.stage-view-modes button.active{background:#1387ef;color:#fff}
.stage-object-kpis{display:grid;grid-template-columns:repeat(4,minmax(90px,1fr));gap:8px;flex:1}.stage-object-kpis span{display:grid;padding:8px 10px;border-radius:12px;background:rgba(255,255,255,.1);font-size:11px}.stage-object-kpis b{font-size:16px;color:#fff}
.stage-card-v2266 .stage-card-head small{display:block;margin-top:5px;color:var(--muted,#64748b)}
.stage-kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin-top:14px}.stage-kpi-grid>div{display:grid;align-content:start;gap:3px;min-height:88px;padding:11px;border:1px solid var(--border,#dbe2ea);border-radius:13px;background:rgba(128,145,166,.055)}.stage-kpi-grid span,.stage-kpi-grid small{font-size:11px;color:var(--muted,#64748b)}.stage-kpi-grid b{font-size:17px}.stage-kpi-grid b.danger,.stage-kpi-grid b.danger-text{color:#d52f4d}.stage-kpi-grid b.warning{color:#b86b00}.stage-kpi-grid b.ok{color:#16865d}.stage-kpi-grid i,.stage-row-progress{display:block;height:5px;border-radius:99px;background:rgba(128,145,166,.18);overflow:hidden}.stage-kpi-grid i em,.stage-row-progress i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#0a84ff,#27c889)}
.stage-blockers{display:grid;gap:5px;margin-top:12px;padding:11px 13px;border:1px solid rgba(230,139,0,.25);border-radius:12px;background:rgba(245,158,11,.1);color:#925800}.stage-blockers span{font-size:12px}
.stage-workspace-section{margin-top:10px;border:1px solid var(--border,#dbe2ea);border-radius:14px;overflow:hidden;background:var(--card,#fff)}.stage-workspace-section>summary{display:flex;align-items:center;gap:9px;min-height:46px;padding:10px 12px;cursor:pointer;list-style:none}.stage-workspace-section>summary::-webkit-details-marker{display:none}.stage-workspace-section>summary span{font-weight:800;flex:1}.stage-workspace-section>summary b{padding:3px 8px;border-radius:99px;background:rgba(10,132,255,.11);color:#0877d1;font-size:12px}.stage-workspace-section>summary i{font-style:normal;transition:.2s}.stage-workspace-section[open]>summary i{transform:rotate(180deg)}.stage-workspace-body{border-top:1px solid var(--border,#dbe2ea);padding:10px}
.stage-production-row{display:grid;gap:8px;padding:11px 2px;border-bottom:1px solid var(--border,#e8edf2)}.stage-production-row:last-child{border-bottom:0}.stage-production-title{display:grid;grid-template-columns:26px minmax(0,1fr) auto;gap:8px;align-items:center}.stage-production-title em{display:grid;place-content:center;width:24px;height:24px;border-radius:50%;background:rgba(10,132,255,.1);color:#0877d1;font-style:normal;font-size:11px}.stage-production-title span{display:grid}.stage-production-title small,.stage-material-row small{color:var(--muted,#64748b);font-size:11px}.stage-production-controls{display:grid;grid-template-columns:1.1fr .7fr 1.1fr;gap:8px}.stage-production-controls label{display:grid;gap:3px;color:var(--muted,#64748b);font-size:10px}.stage-production-controls select,.stage-production-controls input,.stage-material-row select{width:100%;min-width:0;padding:7px 8px;border:1px solid var(--border,#dbe2ea);border-radius:9px;background:var(--card,#fff);color:inherit}
.stage-material-row,.stage-issue{display:grid;grid-template-columns:minmax(0,1fr) minmax(130px,auto);gap:10px;align-items:center;padding:9px 2px;border-bottom:1px solid var(--border,#e8edf2)}.stage-material-row span,.stage-issue span{display:grid}.stage-material-row select{max-width:170px}.stage-material-row select.material-delivered,.stage-material-row select.material-used{color:#11835b;border-color:rgba(17,131,91,.35)}
.stage-checklist{display:grid;gap:5px}.stage-checklist label{display:flex;align-items:center;gap:9px;padding:8px;border-radius:9px}.stage-checklist label:hover{background:rgba(128,145,166,.07)}.stage-checklist input{width:19px;height:19px}.stage-checklist span{display:grid}.stage-checklist small{font-size:10px;color:var(--muted,#64748b)}
.stage-issue.resolved{opacity:.58}.stage-issue em{color:#16865d;font-style:normal;font-weight:700}.danger-text{color:#d52f4d!important}.stage-empty-block{padding:12px;color:var(--muted,#64748b);text-align:center}
.stage-file-actions,.stage-document-create{display:flex;flex-wrap:wrap;gap:8px}.stage-upload-button{position:relative;overflow:hidden}.stage-upload-button input{position:absolute;inset:0;opacity:0;cursor:pointer}.stage-photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:8px;margin-top:10px}.stage-photo-grid button{border:0;padding:0;border-radius:10px;overflow:hidden;background:rgba(128,145,166,.1);color:inherit}.stage-photo-grid img{width:100%;height:88px;object-fit:cover}.stage-photo-grid span{display:block;padding:5px;font-size:10px}.stage-doc-list{display:grid;gap:5px;margin-top:10px}.stage-doc-list button{display:flex;gap:8px;padding:9px;border:1px solid var(--border,#dbe2ea);border-radius:9px;background:transparent;color:inherit;text-align:left}.stage-document-create{margin-top:12px}.stage-document-create button{padding:8px 10px;border:1px solid var(--border,#dbe2ea);border-radius:9px;background:transparent;color:inherit;font-weight:700}
.stage-gantt{padding:14px;border:1px solid var(--border,#dbe2ea);border-radius:17px;background:var(--card,#fff);overflow-x:auto}.stage-gantt[hidden]{display:none}.gantt-scale{display:flex;justify-content:space-between;gap:15px;min-width:650px;margin-bottom:10px;color:var(--muted,#64748b);font-size:11px}.gantt-row{display:grid;grid-template-columns:170px minmax(480px,1fr);align-items:center;min-width:650px;min-height:43px;border-top:1px solid var(--border,#edf0f4)}.gantt-row>span{padding-right:10px;font-size:12px;font-weight:700}.gantt-row>div{position:relative;height:22px;background:repeating-linear-gradient(90deg,transparent 0,transparent 9.8%,rgba(128,145,166,.12) 10%)}.gantt-row i{position:absolute;top:2px;height:18px;border-radius:6px;background:#a6b2c2;overflow:hidden}.gantt-row i.active{background:#167fe8}.gantt-row i.done{background:#18a66a}.gantt-row i.paused{background:#e89a17}.gantt-row i em{display:block;height:100%;background:rgba(255,255,255,.28)}.gantt-row i b{position:absolute;inset:2px 5px;color:#fff;font-size:10px;font-style:normal}
html[data-theme="dark"] .stage-workspace-section,html[data-theme="dark"] .stage-kpi-grid>div,html[data-theme="dark"] .stage-gantt,html[data-theme="dark"] .stage-view-modes{background:#1c1c1e!important;border-color:rgba(255,255,255,.12)!important}html[data-theme="dark"] .stage-production-controls select,html[data-theme="dark"] .stage-production-controls input,html[data-theme="dark"] .stage-material-row select{background:#252529;border-color:rgba(255,255,255,.14);color:#f5f7fa}html[data-theme="dark"] .stage-blockers{color:#ffc866}
@media(max-width:760px){.stage-object-summary{display:grid!important}.stage-object-kpis{grid-template-columns:1fr 1fr;width:100%}.stage-progress-ring{position:absolute;right:16px;top:16px}.stage-object-summary{position:relative;padding-right:98px!important}.stage-object-kpis{padding-right:0}.stage-kpi-grid{grid-template-columns:1fr 1fr}.stage-production-controls{grid-template-columns:1fr 1fr}.stage-production-controls label:last-child{grid-column:1/-1}.stage-material-row,.stage-issue{grid-template-columns:1fr}.stage-material-row select{max-width:none}.stage-document-create{display:grid;grid-template-columns:1fr 1fr}.stage-view-modes{width:100%}.stage-view-modes button{flex:1}.stage-card-v2266 .stage-card-main{padding:12px 10px!important}}
@media(max-width:430px){.stage-object-summary{padding-right:16px!important;padding-top:104px!important}.stage-progress-ring{left:16px;top:16px}.stage-kpi-grid{grid-template-columns:1fr}.stage-production-controls{grid-template-columns:1fr}.stage-production-controls label:last-child{grid-column:auto}.stage-object-kpis{grid-template-columns:1fr 1fr}}
.stage-card-compatible{width:100%;min-width:0;box-sizing:border-box}.stage-card-compatible .stage-card-main{min-width:0}.stage-card-compatible h2{word-break:normal;overflow-wrap:anywhere}.stage-card-compatible .stage-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}

/* ===== Каноническая система компоновки ===== */
:root{
  --ui-content:1440px;
  --ui-gap:16px;
  --ui-radius:20px;
  --ui-control-height:46px;
  --ui-card-padding:20px;
}
html,body{max-width:100%;overflow-x:hidden}
.view{width:min(100%,var(--ui-content));min-width:0;margin-inline:auto}
.view>*,.card,.modal-box,.modal-card,.stage-card,.stage-card-main{min-width:0;box-sizing:border-box}

/* Единые вкладки объекта на каждом экране. */
.view>.object-card-tabs{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  width:100%!important;
  max-width:none!important;
  gap:0!important;
  margin:0 0 18px!important;
  overflow:hidden!important;
  border-radius:18px!important;
}
.view>.object-card-tabs>button{
  width:100%!important;
  min-width:0!important;
  min-height:56px!important;
  padding:10px 8px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:normal!important;
  text-align:center!important;
}

/* Единая геометрия действий и карточек. */
.stage-head-actions,.stage-empty-actions,.stage-card-actions,.item-modal-actions,.modal-footer,.ai-home-current-buttons{
  gap:10px!important;
}
.stage-card,.stage-card-compatible{width:100%!important;max-width:100%!important}
.stage-card-main{width:100%!important}
.stage-card-head h2,.ai-home-current-title-row h2{word-break:normal!important;overflow-wrap:anywhere!important;hyphens:none!important}
.stage-card-actions>button,.item-modal-actions>button,.modal-footer>button{min-height:var(--ui-control-height)}

/* Модальные окна используют одну модель размеров и прокрутки. */
.modal{padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom))!important}
.modal>.modal-box,.modal>.modal-card{
  width:min(720px,100%)!important;
  max-width:100%!important;
  max-height:calc(100dvh - 32px)!important;
  overflow:auto!important;
  border-radius:var(--ui-radius)!important;
}
.modal-head{position:sticky;top:0;z-index:3}
.ais-tour-video-controls{display:flex;align-items:center;gap:10px;margin:14px 0 4px;padding:10px 12px;border-radius:12px;background:rgba(23,105,224,.09);color:var(--muted,#667085);font-size:12px}
.ais-tour-video-controls[hidden]{display:none!important}.ais-tour-video-controls button{min-height:36px;padding:7px 12px;border:0;border-radius:999px;background:var(--accent,#1769e0);color:#fff;font-weight:800}.ais-training-video{border-color:rgba(23,105,224,.35)!important;background:linear-gradient(135deg,rgba(23,105,224,.10),rgba(107,85,223,.10))!important}

@media(max-width:760px){
  :root{--ui-gap:12px;--ui-card-padding:14px}
  .view>.object-card-tabs{border-radius:16px!important}
  .view>.object-card-tabs>button{min-height:58px!important;font-size:13px!important;padding:8px 5px!important}
  .stage-card{grid-template-columns:38px minmax(0,1fr)!important}
  .stage-order-actions{padding-inline:3px!important}
  .stage-card-main{padding:14px 12px!important}
  .stage-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .stage-head-actions,.stage-card-actions,.item-modal-actions,.modal-footer{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .stage-head-actions>*:only-child,.stage-card-actions>*:only-child,.item-modal-actions>*:only-child,.modal-footer>*:only-child{grid-column:1/-1}
  .modal{align-items:flex-end!important;padding:0!important}
  .modal>.modal-box,.modal>.modal-card{width:100%!important;max-height:94dvh!important;border-radius:22px 22px 0 0!important}
}
@media(max-width:430px){
  .stage-kpi-grid{grid-template-columns:1fr!important}
  .stage-document-create{grid-template-columns:1fr!important}
}

/* ===== Мобильная карточка этапа: отдельная компоновка без десктопной боковой рейки ===== */
@media(max-width:520px){
  #stages .stages-list{gap:14px!important}
  #stages .stage-card,#stages .stage-card-compatible{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    border-left-width:4px!important;
    overflow:hidden!important;
  }
  #stages .stage-order-actions{
    order:0!important;
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) 44px!important;
    align-items:center!important;
    width:100%!important;
    min-height:42px!important;
    padding:3px 8px!important;
    border-bottom:1px solid var(--border,#e4e8ee)!important;
    background:rgba(128,145,166,.07)!important;
  }
  #stages .stage-order-actions button{
    display:grid!important;
    place-items:center!important;
    width:40px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0!important;
    border-radius:10px!important;
    font-size:20px!important;
  }
  #stages .stage-order-actions span{font-size:12px!important;text-align:center!important}
  #stages .stage-card-main{order:1!important;width:100%!important;padding:14px!important}
  #stages .stage-card-head{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:start!important;
    gap:10px!important;
  }
  #stages .stage-card-head>div{min-width:0!important}
  #stages .stage-card-head h2{
    margin:7px 0 4px!important;
    max-width:100%!important;
    font-size:clamp(21px,6.4vw,26px)!important;
    line-height:1.12!important;
    word-break:normal!important;
    overflow-wrap:break-word!important;
    hyphens:none!important;
  }
  #stages .stage-card-head .btn-light{
    width:auto!important;
    min-width:96px!important;
    min-height:42px!important;
    padding:8px 12px!important;
    font-size:14px!important;
    white-space:nowrap!important;
  }
  #stages .stage-card-head small{font-size:12px!important;line-height:1.35!important}
  #stages .stage-kpi-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    margin-top:12px!important;
  }
  #stages .stage-kpi-grid>div{min-height:94px!important;padding:12px!important}
  #stages .stage-kpi-grid b{font-size:20px!important;line-height:1.12!important;overflow-wrap:anywhere!important}
  #stages .stage-kpi-grid span,#stages .stage-kpi-grid small{font-size:11px!important}
  #stages .stage-meta{gap:6px!important;margin:10px 0!important;font-size:12px!important;line-height:1.35!important}
  #stages .stage-blockers{margin-top:10px!important;padding:10px!important;font-size:12px!important}
  #stages .stage-workspace-section{width:100%!important;margin-top:8px!important;border-radius:14px!important}
  #stages .stage-workspace-section>summary{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto 18px!important;
    align-items:center!important;
    gap:8px!important;
    min-height:52px!important;
    padding:10px 12px!important;
  }
  #stages .stage-workspace-section>summary span{min-width:0!important;font-size:15px!important;line-height:1.2!important;word-break:normal!important;overflow-wrap:break-word!important}
  #stages .stage-workspace-section>summary b{min-width:30px!important;text-align:center!important;font-size:13px!important}
  #stages .stage-workspace-body{padding:10px!important}
  #stages .stage-production-title{grid-template-columns:24px minmax(0,1fr) auto!important}
  #stages .stage-production-title b,#stages .stage-material-row b,#stages .stage-issue b{font-size:14px!important;word-break:normal!important;overflow-wrap:break-word!important}
  #stages .stage-production-controls{grid-template-columns:1fr!important}
  #stages .stage-production-controls label:last-child{grid-column:auto!important}
  #stages .stage-card-actions{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    margin-top:12px!important;
  }
  #stages .stage-card-actions>button{width:100%!important;min-width:0!important;min-height:44px!important;padding:9px 8px!important;font-size:13px!important;white-space:normal!important}
  #stages .stage-document-create{grid-template-columns:1fr!important}
}
@media(max-width:360px){
  #stages .stage-card-head{grid-template-columns:1fr!important}
  #stages .stage-card-head .btn-light{width:100%!important}
  #stages .stage-kpi-grid{grid-template-columns:1fr!important}
}

/* ===== v22.71: этапы на телефоне как широкий раскрывающийся список ===== */
.stage-mobile-summary{display:none}
@media(max-width:760px){
  #stages .stages-list{display:block!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important}
  #stages .stage-card,#stages .stage-card-compatible{
    display:block!important;
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    margin:0 0 10px!important;
    padding:0!important;
    overflow:hidden!important;
    border-left-width:4px!important;
  }
  #stages .stage-mobile-summary{
    display:grid!important;
    grid-template-columns:34px minmax(0,1fr) 28px!important;
    align-items:center!important;
    gap:10px!important;
    width:100%!important;
    min-height:72px!important;
    padding:12px 14px!important;
    border:0!important;
    background:var(--card,#fff)!important;
    color:var(--text,#172033)!important;
    text-align:left!important;
  }
  #stages .stage-mobile-order{display:grid!important;place-items:center!important;width:32px!important;height:32px!important;border-radius:50%!important;background:rgba(23,105,224,.12)!important;color:var(--accent,#1769e0)!important;font-weight:900!important}
  #stages .stage-mobile-title{display:block!important;min-width:0!important}
  #stages .stage-mobile-title b{display:block!important;font-size:18px!important;line-height:1.2!important;word-break:normal!important;overflow-wrap:break-word!important}
  #stages .stage-mobile-title small{display:block!important;margin-top:5px!important;color:var(--muted,#667085)!important;font-size:12px!important;line-height:1.3!important}
  #stages .stage-mobile-chevron{font-size:22px!important;text-align:center!important;transition:transform .2s ease!important}
  #stages .stage-card.mobile-open>.stage-mobile-summary .stage-mobile-chevron{transform:rotate(180deg)!important}
  #stages .stage-card:not(.mobile-open)>.stage-order-actions,
  #stages .stage-card:not(.mobile-open)>.stage-card-main{display:none!important}
  #stages .stage-card.mobile-open>.stage-order-actions{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) 44px!important;
    width:100%!important;
    min-height:42px!important;
    padding:3px 10px!important;
  }
  #stages .stage-card.mobile-open>.stage-card-main{display:block!important;width:100%!important;padding:12px!important}
  #stages .stage-card-head{grid-template-columns:minmax(0,1fr) auto!important}
  #stages .stage-card-head h2{font-size:22px!important;word-break:normal!important;overflow-wrap:break-word!important}
  #stages .stage-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #stages .stage-workspace-section>summary{grid-template-columns:minmax(0,1fr) auto 18px!important}
  #stages .stage-workspace-section>summary span{word-break:normal!important;overflow-wrap:break-word!important}
}
html[data-theme="dark"] #stages .stage-mobile-summary{background:#1c1c1e!important;color:#f5f7fa!important}

/* v22.72: мобильная карточка изолирована от всех старых правил .stage-card */
@media(max-width:760px){
  #stages .stage-mobile-card{
    display:block!important;
    position:relative!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0 0 10px!important;
    padding:0!important;
    overflow:hidden!important;
    border:1px solid var(--border,#dbe2ea)!important;
    border-left:4px solid #aab5c4!important;
    border-radius:16px!important;
    background:var(--card,#fff)!important;
    box-sizing:border-box!important;
  }
  #stages .stage-mobile-card.active{border-left-color:#3278e8!important}
  #stages .stage-mobile-card.done{border-left-color:#18a66a!important}
  #stages .stage-mobile-card.paused{border-left-color:#f59e0b!important}
  #stages .stage-mobile-card>.stage-mobile-summary{
    display:grid!important;
    grid-template-columns:34px minmax(0,1fr) 28px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  #stages .stage-mobile-card:not(.mobile-open)>.stage-order-actions,
  #stages .stage-mobile-card:not(.mobile-open)>.stage-card-main{display:none!important}
  #stages .stage-mobile-card.mobile-open>.stage-order-actions{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) 44px!important;
    align-items:center!important;
    width:100%!important;
    padding:3px 10px!important;
    box-sizing:border-box!important;
  }
  #stages .stage-mobile-card.mobile-open>.stage-card-main{display:block!important;width:100%!important;min-width:0!important;padding:12px!important;box-sizing:border-box!important}
  #stages .stage-mobile-card .stage-card-head{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;min-width:0!important}
  #stages .stage-mobile-card .stage-card-head>div{min-width:0!important}
  #stages .stage-mobile-card .stage-card-head h2{word-break:normal!important;overflow-wrap:break-word!important;hyphens:none!important}
}
html[data-theme="dark"] #stages .stage-mobile-card{background:#1c1c1e!important;border-color:rgba(255,255,255,.12)!important}

/* v22.73: компактный счётчик материалов на телефоне */
.stage-materials-alert{margin:0 0 10px;padding:9px 11px;border-radius:10px;background:rgba(245,158,11,.12);color:#9a6100;font-size:13px}
@media(max-width:760px){
  #stages .stage-mobile-card .stage-workspace-section>summary{
    grid-template-columns:minmax(0,1fr) 42px 18px!important;
  }
  #stages .stage-mobile-card .stage-workspace-section>summary>b{
    display:block!important;
    width:42px!important;
    min-width:42px!important;
    padding:4px 5px!important;
    overflow:hidden!important;
    white-space:nowrap!important;
    text-align:center!important;
    box-sizing:border-box!important;
  }
  #stages .stage-mobile-card .stage-count-extra{display:none!important}
  #stages .stage-mobile-card .stage-materials-section>summary>span{white-space:normal!important;word-break:normal!important;overflow-wrap:normal!important}
}
html[data-theme="dark"] .stage-materials-alert{background:rgba(245,158,11,.16);color:#ffc866}

/* v22.75: общий график строится даже без ручных дат */
.gantt-auto-note{margin:0 0 12px;padding:10px 12px;border-radius:11px;background:rgba(23,105,224,.09);color:var(--muted,#667085);font-size:12px;line-height:1.4}
.gantt-row>span small{display:block;margin-top:3px;color:var(--muted,#667085);font-size:10px;font-weight:500}
.gantt-row.estimated>div>i{outline:2px dashed rgba(23,105,224,.28);outline-offset:2px}
html[data-theme="dark"] .gantt-auto-note{background:rgba(72,144,255,.14);color:#b8c4d5}
.customer-reports-view{max-width:1180px;margin:0 auto}.customer-reports-head,.customer-report-history-head,.customer-editor-title{display:flex;align-items:center;justify-content:space-between;gap:18px}.customer-report-create,.customer-editor-actions,.customer-report-row-actions{display:flex;gap:10px;flex-wrap:wrap}.customer-report-editor{display:grid;grid-template-columns:minmax(300px,.85fr) minmax(360px,1.15fr);gap:24px;margin:20px 0}.customer-report-editor[hidden]{display:none}.customer-report-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.customer-report-fields label{display:flex;flex-direction:column;gap:6px;font-weight:700}.customer-report-fields .wide{grid-column:1/-1}.customer-report-fields input,.customer-report-fields textarea{width:100%;box-sizing:border-box}.customer-report-form fieldset{border:1px solid var(--line,#d9e0e8);border-radius:16px;margin:18px 0;padding:14px}.customer-section-options{display:grid;grid-template-columns:1fr 1fr;gap:10px}.customer-section-options label{display:flex;align-items:center;gap:8px}.customer-report-preview{background:var(--card,#fff);border:1px solid var(--line,#dce3eb);border-radius:18px;padding:22px}.customer-preview-brand{color:var(--accent,#168cf0);font-weight:800;font-size:13px}.customer-report-preview section{border-top:1px solid var(--line,#e1e6ec);padding-top:15px;margin-top:15px}.customer-preview-kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.customer-preview-kpis span{background:var(--panel,#f4f7fa);border-radius:12px;padding:12px}.customer-preview-kpis b{display:block;font-size:22px}.customer-progress{height:9px;display:block;background:#e8edf3;border-radius:8px;overflow:hidden}.customer-progress em{display:block;height:100%;background:var(--accent,#168cf0)}.customer-report-history-head{margin-top:26px}.customer-reports-list{display:grid;gap:12px}.customer-report-row{display:flex;align-items:center;justify-content:space-between;gap:18px}.customer-report-row h3{margin:7px 0 2px}.customer-report-row p{margin:0;color:var(--muted,#707b89)}.customer-report-status{display:inline-flex;border-radius:99px;padding:5px 10px;background:#edf1f5;color:#596474;font-size:12px;font-weight:800}.customer-report-status.published{background:#e4f7eb;color:#218647}.customer-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:38px}.customer-empty span{color:var(--muted,#707b89)}
.object-customer-report-entry{width:100%;display:flex;align-items:center;gap:14px;margin:14px 0 18px;padding:16px 20px;border:1px solid color-mix(in srgb,var(--accent,#168cf0) 35%,transparent);border-radius:18px;background:color-mix(in srgb,var(--accent,#168cf0) 9%,var(--card,#fff));color:var(--text,#162033);text-align:left;cursor:pointer}.object-customer-report-entry>span:first-child{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border-radius:13px;background:var(--accent,#168cf0);color:#fff;font-size:22px}.object-customer-report-entry>span:nth-child(2){display:flex;flex-direction:column;gap:3px;min-width:0}.object-customer-report-entry b{font-size:18px}.object-customer-report-entry small{color:var(--muted,#707b89)}.object-customer-report-entry i{margin-left:auto;color:var(--accent,#168cf0);font-size:30px;font-style:normal}.customer-report-stage-button{white-space:nowrap}
@media(max-width:760px){.customer-reports-head,.customer-report-row{align-items:stretch;flex-direction:column}.customer-report-create>*{flex:1}.customer-report-editor{grid-template-columns:1fr;padding:14px}.customer-report-fields,.customer-section-options{grid-template-columns:1fr}.customer-report-fields .wide{grid-column:auto}.customer-report-row-actions>*{flex:1;min-width:120px}.customer-preview-kpis{grid-template-columns:1fr}.customer-report-preview{padding:16px}.object-customer-report-entry{padding:13px 14px}.object-customer-report-entry b{font-size:16px}.object-customer-report-entry small{font-size:12px}.customer-report-stage-button{order:-1;flex-basis:100%}}
.stage-worker-submission{display:flex;align-items:center;gap:10px;padding:12px 14px;margin:10px 0;border-radius:14px;background:#e9f7ef;color:#173e29;border:1px solid #bfe7ce}.stage-worker-submission span{display:flex;flex-direction:column;gap:3px;flex:1}.stage-worker-submission small{color:#536c5d}@media(max-width:560px){.stage-worker-submission{align-items:stretch;flex-direction:column}.stage-worker-submission button{width:100%}}

/* v22.93: explicit paired colors for foreman review and report panels. */
html[data-theme="dark"] #stages .stage-worker-submission{background:#16332b!important;color:#e8f7ee!important;border-color:#32634d!important}
html[data-theme="dark"] #stages .stage-worker-submission span,
html[data-theme="dark"] #stages .stage-worker-submission b{color:#e8f7ee!important}
html[data-theme="dark"] #stages .stage-worker-submission small{color:#b5d8c4!important}
html[data-theme="light"] #stages .stage-worker-submission span,
html[data-theme="light"] #stages .stage-worker-submission b{color:#173e29!important}
html[data-theme="light"] #stages .stage-worker-submission small{color:#536c5d!important}
html[data-theme="dark"] .customer-preview-kpis span{background:#18263c!important;color:#e8eef8!important}
html[data-theme="dark"] .customer-report-status{background:#263650!important;color:#dce7f7!important}
html[data-theme="dark"] .customer-report-status.published{background:#16332b!important;color:#b5edca!important}
@media(max-width:760px){
 #stages .stage-kpi-grid>div{min-width:0!important}
 #stages .stage-kpi-grid b{font-size:clamp(12px,3.8vw,18px)!important;white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important}
 #stages .stage-worker-submission{min-width:0;box-sizing:border-box}
 #stages .stage-worker-submission span{min-width:0;overflow-wrap:break-word}
}

.worker-review-notifications{margin:12px;padding:14px;border:1px solid #bfe7ce;border-radius:14px;background:#e9f7ef;color:#173e29}
.worker-review-notifications[hidden]{display:none!important}.worker-review-notifications>div{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px}.worker-review-notifications span{min-width:0;overflow-wrap:break-word}
html[data-theme="dark"] .worker-review-notifications{background:#16332b!important;color:#e8f7ee!important;border-color:#32634d!important}
@media(max-width:560px){.worker-review-notifications>div{align-items:stretch;flex-direction:column}}

/* v22.94: upload labels must be real boxes, not fragmented inline text. */
#stages .stage-work-result{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0;padding-top:8px}
#stages .stage-upload-choice{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0}
#stages .stage-upload-choice .stage-upload-button{width:100%!important}
#stages .stage-upload-button{display:flex!important;align-items:center!important;justify-content:center!important;position:relative!important;box-sizing:border-box!important;min-width:0!important;max-width:100%!important;min-height:48px!important;height:auto!important;padding:12px 16px!important;line-height:1.35!important;white-space:normal!important;text-align:center!important;overflow:hidden!important;isolation:isolate;cursor:pointer}
#stages .stage-work-result>.stage-upload-button{width:100%!important;margin:0!important}
#stages .stage-upload-button input[type="file"]{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-width:none!important;margin:0!important;padding:0!important;opacity:0!important;cursor:pointer;z-index:1}
#stages .stage-upload-button:focus-within{outline:2px solid var(--accent,#168cf0);outline-offset:3px}
#stages .stage-work-result>.stage-photo-grid{margin-top:0!important;min-width:0}
#stages .stage-photo-grid button{min-width:0}
#stages .stage-photo-grid span{overflow-wrap:anywhere}
#stages .stage-photo-card{display:grid;gap:6px;min-width:0}
#stages .stage-photo-card .stage-photo-preview{min-width:0;width:100%}
#stages .stage-photo-delete{width:100%;padding:7px 9px;border:1px solid rgba(220,80,80,.55);border-radius:9px;background:transparent;color:var(--danger,#d94b4b);font-weight:700;cursor:pointer}
#stages .stage-kpi-grid>div:only-child{grid-column:1/-1}

#stages .stage-review-target{scroll-margin-top:90px;outline:2px solid var(--accent,#168cf0)!important;outline-offset:4px;border-radius:12px;background:rgba(22,140,240,.08)}
