/* ===== v16.99 — light / dark themes ===== */
:root{color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="dark"] body,
body[data-theme="dark"]{
  background:#0b1220!important;color:#e8eef8!important;
}
html[data-theme="dark"] .app,
html[data-theme="dark"] .main,
html[data-theme="dark"] .content,
html[data-theme="dark"] .view{background:#0b1220!important;color:#e8eef8}
html[data-theme="dark"] .card, html[data-theme="dark"] .ais-dialog, html[data-theme="dark"] .onboarding-card, html[data-theme="dark"] .onboarding-help-card, html[data-theme="dark"] .estimate-work-category, html[data-theme="dark"] .estimate-work-option{
  background:#111b2d!important;color:#e8eef8!important;border-color:#263650!important;
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:#0d1728!important;color:#f3f6fb!important;border-color:#34445e!important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#8493aa}
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td{border-color:#293a54!important;color:#e8eef8}
html[data-theme="dark"] th{background:#17243a!important}
html[data-theme="dark"] tr:hover td{background:#142137}
html[data-theme="dark"] .small,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .label{color:#9eacc0!important}
html[data-theme="dark"] .btn-light, html[data-theme="dark"] .icon-btn{
  background:#18263c!important;color:#dce7f7!important;border-color:#30435f!important;
}

html[data-theme="dark"] .work-tree-parent td,
html[data-theme="dark"] .work-tree-section-head td{background:#20283a!important}
html[data-theme="dark"] .work-tree-child td,
html[data-theme="dark"] .work-tree-material td{background:#111b2d!important}
html[data-theme="dark"] .estimate-work-category-head{background:#17243a!important;color:#eef4ff!important}
html[data-theme="dark"] .estimate-work-option:hover{background:#1b2d49!important}
html[data-theme="dark"] .mobile-persistent-tabs, html[data-theme="dark"] .header{background:#0f192a!important;border-color:#263650!important}
html[data-theme="dark"] .mobile-persistent-tab:not(.active){background:#17243a!important;color:#dce7f7!important}

html[data-theme="dark"] .ais-dialog-overlay{background:rgba(2,7,16,.72)}
html[data-theme="dark"] a{color:#72a7ff}
.custom-estimate-item-modal{max-width:680px}
.custom-estimate-item-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
@media(max-width:700px){.custom-estimate-item-actions{display:grid;grid-template-columns:1fr 1fr}.custom-estimate-item-actions button{width:100%}}


/* ===== v16.100 — prominent theme selector ===== */
.ui-theme-card{margin-bottom:16px;padding:18px!important}
.ui-theme-card-title{font-size:18px;font-weight:800;color:var(--text,#172033);margin-bottom:3px}
.ui-theme-card-subtitle{margin-bottom:14px}
.ui-theme-choice{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.ui-theme-choice-btn{min-height:62px;border:1px solid #d7e1ef;border-radius:15px;background:#fff;color:#24344d;font:inherit;font-weight:800;display:flex;align-items:center;justify-content:center;gap:9px;cursor:pointer;box-shadow:0 4px 14px rgba(31,74,125,.07)}
.ui-theme-choice-btn:hover{border-color:#8db5ef;background:#f6faff}
.ui-theme-choice-btn.active{border-color:#2774df;background:#eaf3ff;color:#1459bd;box-shadow:0 0 0 2px rgba(39,116,223,.12)}
.ui-theme-choice-icon{font-size:22px;line-height:1}
html[data-theme="dark"] .ui-theme-card-title{color:#eef4ff}
html[data-theme="dark"] .ui-theme-choice-btn{background:#121e31;border-color:#30425e;color:#dce7f7;box-shadow:none}
html[data-theme="dark"] .ui-theme-choice-btn:hover{background:#182841;border-color:#4775b6}
html[data-theme="dark"] .ui-theme-choice-btn.active{background:#17345f;border-color:#5c9cff;color:#fff;box-shadow:0 0 0 2px rgba(92,156,255,.14)}
@media(max-width:700px){.ui-theme-card{padding:16px!important}.ui-theme-choice{grid-template-columns:1fr 1fr;gap:10px}.ui-theme-choice-btn{min-height:68px;font-size:16px;flex-direction:column;gap:4px}.ui-theme-choice-icon{font-size:25px}}


/* v16.101 — сметы администратора по пользователям */
.admin-estimate-groups{display:grid;gap:12px}
.admin-estimate-group{padding:0!important;overflow:hidden}
.admin-estimate-group-head{width:100%;border:0;background:transparent;color:inherit;display:grid;grid-template-columns:minmax(0,1fr) auto 38px;align-items:center;gap:12px;padding:16px 18px;text-align:left;cursor:pointer}
.admin-estimate-group-head:hover{background:rgba(47,111,237,.055)}
.admin-estimate-group-person{display:flex;flex-direction:column;gap:3px;min-width:0}
.admin-estimate-group-person b{font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.admin-estimate-group-count{font-weight:800;color:var(--muted,#667085);white-space:nowrap}
.admin-estimate-group-plus{width:32px;height:32px;border-radius:10px;background:rgba(47,111,237,.1);color:#2f6fed;display:grid;place-items:center;font-size:23px;font-weight:700;line-height:1}
.admin-estimate-group-body{padding:0 12px 12px;display:grid;gap:10px}
.admin-estimate-group-body[hidden]{display:none!important}
.admin-estimate-group-body .estimate-hub-card{margin:0}
.admin-estimate-readonly{padding:0 16px 14px;color:var(--muted,#667085)}
.admin-estimate-empty-user{padding:14px 8px 18px}
@media(max-width:700px){.admin-estimate-group-head{grid-template-columns:minmax(0,1fr) auto 34px;padding:14px 12px;gap:8px}.admin-estimate-group-count{font-size:12px}.admin-estimate-group-plus{width:30px;height:30px}.admin-estimate-group-body{padding:0 8px 8px}}

/* ===== v16.102 — complete dark shell / primary navigation theme ===== */
html[data-theme="dark"] body{
  background:linear-gradient(180deg,#0b1220 0,#0d1626 210px,#09111d 100%)!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] header{
  background:rgba(10,18,31,.98)!important;
  border-bottom-color:#263650!important;
  box-shadow:0 5px 20px rgba(0,0,0,.24)!important;
}
html[data-theme="dark"] .brand, html[data-theme="dark"] .mobile-brand{color:#f2f6fc!important}
html[data-theme="dark"] .brand small,
html[data-theme="dark"] .mobile-brand small{color:#9aabc1!important}
html[data-theme="dark"] .mobile-topbar,
html[data-theme="dark"] .mobile-topbar-main{
  background:#0a121f!important;color:#eef4ff!important;border-color:#263650!important;
}
html[data-theme="dark"] .mobile-company-tariff,
html[data-theme="dark"] .mobile-menu-button{
  background:#121f32!important;color:#e8eef8!important;border-color:#30435f!important;
}
html[data-theme="dark"] .mobile-save-status{color:#91a3ba!important}
html[data-theme="dark"] header .btn-light,
html[data-theme="dark"] header .file-menu-button,
html[data-theme="dark"] #currentUserButton,
html[data-theme="dark"] #currentCompanyButton{
  background:#121f32!important;color:#8dbbff!important;border-color:#30435f!important;box-shadow:none!important;
}
html[data-theme="dark"] .file-menu-dropdown{
  background:#111b2d!important;border-color:#30435f!important;color:#e8eef8!important;
}
html[data-theme="dark"] .file-menu-dropdown button,
html[data-theme="dark"] .export-format-menu button{color:#e5edf8!important;background:transparent!important}
html[data-theme="dark"] .file-menu-dropdown button:hover,
html[data-theme="dark"] .export-format-menu button:hover{background:#1a2a43!important;color:#fff!important}
html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs{
  background:#0f192a!important;border-color:#263650!important;box-shadow:0 8px 24px rgba(0,0,0,.22)!important;
}
html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs > button:not(.active){
  background:#17243a!important;border-color:#2b3b54!important;color:#dce7f7!important;box-shadow:none!important;
}

html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs > button.active{
  background:linear-gradient(135deg,#0758da 0%,#0787f3 64%,#1db7ff 100%)!important;
  border-color:#218bf2!important;color:#fff!important;box-shadow:0 9px 22px rgba(5,104,226,.25)!important;
}

html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs > button,
html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs > button span:not(.mobile-tab-icon){color:inherit!important}
html[data-theme="dark"] aside{background:#101a2b!important;border-color:#263650!important;box-shadow:0 10px 28px rgba(0,0,0,.18)!important}
html[data-theme="dark"] nav button{color:#aebdd0!important}
html[data-theme="dark"] nav button:hover{background:#17263d!important;color:#8dbbff!important}
html[data-theme="dark"] nav button.active{background:#18345d!important;color:#8dbbff!important}
html[data-theme="dark"] .layout,
html[data-theme="dark"] main{background:transparent!important}
html[data-theme="dark"] .view h1,
html[data-theme="dark"] .view h2,
html[data-theme="dark"] .view h3,
html[data-theme="dark"] .estimates-hub-head h1,
html[data-theme="dark"] .ui-theme-card-title{color:#f1f5fb!important}
html[data-theme="dark"] .estimates-search-card, html[data-theme="dark"] .subscription-card{
  background:#111b2d!important;border-color:#263650!important;color:#e8eef8!important;box-shadow:0 10px 28px rgba(0,0,0,.16)!important;
}
html[data-theme="dark"] thead th{background:#17243a!important;color:#a8b7ca!important}
html[data-theme="dark"] tbody td{background:#111b2d!important;color:#e8eef8!important}
html[data-theme="dark"] tbody tr:hover td{background:#15243a!important}
html[data-theme="dark"] .ais-dialog-card{background:#111b2d!important;color:#e8eef8!important;border-color:#30435f!important}
@media(max-width:768px){
  html[data-theme="dark"] .mobile-topbar{background:#0a121f!important}
  html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs{background:#0f192a!important;border-top-color:#263650!important;border-bottom-color:#263650!important}
}

/* ===== v16.104 — unified dark theme audit ===== */
html[data-theme="dark"]{
  --bg:#09111d;
  --card:#111b2d;
  --text:#e8eef8;
  --muted:#9eacc0;
  --line:#2b3b54;
  --ais-bg:#09111d;
  --ais-surface:#111b2d;
  --ais-surface-soft:#15243a;
  --ais-line:#2b3b54;
  --ais-ink:#e8eef8;
  --ais-muted:#9eacc0;
  color-scheme:dark;
}
html[data-theme="dark"] body,html[data-theme="dark"] main,html[data-theme="dark"] .view{color:var(--text)!important}
html[data-theme="dark"] .card, html[data-theme="dark"] .estimate-hub-card, html[data-theme="dark"] .estimates-empty, html[data-theme="dark"] .admin-estimate-group, html[data-theme="dark"] .admin-estimate-group-head, html[data-theme="dark"] .admin-estimate-group-body, html[data-theme="dark"] .material-picker-modal-box, html[data-theme="dark"] .ai-wizard-card, html[data-theme="dark"] .ai-wizard-step, html[data-theme="dark"] .work-picker-group, html[data-theme="dark"] .work-picker-item, html[data-theme="dark"] .ui-theme-card{
  background:#111b2d!important;color:#e8eef8!important;border-color:#2b3b54!important;box-shadow:0 12px 34px rgba(0,0,0,.22)!important;
}
html[data-theme="dark"] .section-title, html[data-theme="dark"] .section-title h2, html[data-theme="dark"] label, html[data-theme="dark"] legend, html[data-theme="dark"] strong, html[data-theme="dark"] b{color:#eef4ff}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:#0c1626!important;color:#eef4ff!important;border-color:#344761!important;box-shadow:none!important;
}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#72839a!important;opacity:1}
html[data-theme="dark"] input:disabled,html[data-theme="dark"] select:disabled,html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] input[readonly],html[data-theme="dark"] textarea[readonly]{background:#101b2d!important;color:#9eacc0!important}
html[data-theme="dark"] .btn-light, html[data-theme="dark"] .estimate-back-btn, html[data-theme="dark"] .ais-dialog-actions .btn-light{
  background:#17263d!important;color:#dce7f7!important;border-color:#344761!important;box-shadow:none!important;
}
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .modal-box button:not(.btn):not(.btn-danger):not(.btn-ok):hover{background:#1d3150!important;color:#fff!important}
html[data-theme="dark"] .btn-danger{background:#3a1b25!important;color:#ff9aa9!important;border-color:#6c2b3b!important}
html[data-theme="dark"] .btn-ok{background:#123426!important;color:#7de2ad!important;border-color:#245b43!important}
html[data-theme="dark"] .note{background:#302918!important;color:#f0d98a!important;border-color:#5d5028!important}
html[data-theme="dark"] .small, html[data-theme="dark"] .estimate-hub-meta, html[data-theme="dark"] .admin-estimate-readonly, html[data-theme="dark"] .admin-estimate-group-count{color:#9eacc0!important}
html[data-theme="dark"] .badge{background:#1b2b43!important;color:#b9c9dc!important;border-color:#334761!important}

/* Current estimate: remove all legacy white/beige strips and keep hierarchy readable. */
html[data-theme="dark"] table{background:#111b2d!important;color:#e8eef8!important}
html[data-theme="dark"] th,html[data-theme="dark"] td{border-color:#2b3b54!important}
html[data-theme="dark"] tr.main-work-row td{background:#15243a!important;color:#f0f5fc!important}
html[data-theme="dark"] tr.main-work-row td:first-child{box-shadow:inset 4px 0 0 #397ee8!important}
html[data-theme="dark"] tr.main-work-row:hover td{background:#1a2c47!important}
html[data-theme="dark"] .estimate-subwork-row td,
html[data-theme="dark"] .linked-material-row td{background:#101c2e!important;color:#d4deeb!important}
html[data-theme="dark"] .estimate-subwork-row td:first-child,
html[data-theme="dark"] .linked-material-row td:first-child{box-shadow:inset 4px 0 0 #344b6d!important}
html[data-theme="dark"] .estimate-subwork-label{color:#8fa7c5!important}
html[data-theme="dark"] .work-subgroup-row td,
html[data-theme="dark"] .work-category-row td{background:#17263d!important;color:#dce7f7!important;border-color:#30435f!important}
html[data-theme="dark"] .work-subgroup-title{color:#c7d8ee!important}
html[data-theme="dark"] .work-subgroup-count{color:#8fa1b9!important}
html[data-theme="dark"] .work-total-row td{background:#132137!important;color:#dce7f7!important;border-color:#30435f!important}
html[data-theme="dark"] .work-total-row.final td{background:#16345d!important;color:#9bc6ff!important}
html[data-theme="dark"] .auto-row td,html[data-theme="dark"] tr.auto-row td{background:#101d30!important}
html[data-theme="dark"] .work-subgroup-toggle, html[data-theme="dark"] .material-cat-toggle, html[data-theme="dark"] .work-cat-toggle{
  background:#0e1a2c!important;color:#8dbbff!important;border-color:#3a506f!important;box-shadow:none!important;
}

/* Dialogs/popups: action bars and messages must never stay white in dark mode. */
html[data-theme="dark"] .modal-footer, html[data-theme="dark"] .modal-actions, html[data-theme="dark"] .ais-dialog-actions, html[data-theme="dark"] .document-template-editor-head, html[data-theme="dark"] .document-template-editor-tabs, html[data-theme="dark"] .document-template-editor-toolbar, html[data-theme="dark"] .document-template-editor-footer{
  background:#111b2d!important;color:#e8eef8!important;border-color:#2b3b54!important;
}
html[data-theme="dark"] .ais-dialog-message{color:#b8c5d6!important}
html[data-theme="dark"] .ais-dialog-input{background:#0c1626!important;color:#eef4ff!important;border-color:#344761!important}
html[data-theme="dark"] .template-mode-switch,
html[data-theme="dark"] .template-mode-switch button,
html[data-theme="dark"] .template-insert-field select,
html[data-theme="dark"] .template-insert-field button,
html[data-theme="dark"] .document-template-editor-tabs button{background:#17263d!important;color:#dce7f7!important;border-color:#344761!important}
html[data-theme="dark"] .template-mode-switch button.active,
html[data-theme="dark"] .document-template-editor-tabs button.active{background:#1856a5!important;color:#fff!important}
html[data-theme="dark"] .document-template-editor-workspace{background:#08101b!important}
/* The actual document page intentionally remains paper-white: it previews the printed document. */
html[data-theme="dark"] .document-template-paper{background:#fff!important;color:#181818!important}

/* Work/material picker surfaces */
html[data-theme="dark"] .material-picker-toolbar,
html[data-theme="dark"] .work-picker-toolbar,
html[data-theme="dark"] .ai-wizard-edit-source,
html[data-theme="dark"] details,
html[data-theme="dark"] summary{color:#dce7f7!important;border-color:#2b3b54!important}
html[data-theme="dark"] .material-picker-card,
html[data-theme="dark"] .material-picker-item{background:#121f32!important;color:#e8eef8!important;border-color:#2f425e!important}

/* Remove light seams caused by nested wrappers in mobile modals. */
@media(max-width:768px){
 html[data-theme="dark"] .ais-dialog-overlay{background:rgba(1,6,14,.72)!important}
 
 html[data-theme="dark"] .toolbar,html[data-theme="dark"] .form-grid{background:transparent!important}
}

/* ===== v16.104 — dark AI wizard progress ===== */
html[data-theme="dark"] .ai-wizard-box{background:#111b2d!important;color:#e8eef8!important}
html[data-theme="dark"] .ai-wizard-progress{
  background:#0d1828!important;
  border-color:#2b3b54!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025)!important;
}
html[data-theme="dark"] .ai-wizard-progress-item{color:#9eacc0!important}
html[data-theme="dark"] .ai-wizard-progress-item span{
  background:#1a2940!important;
  color:#b8c6d8!important;
  border:1px solid #334761!important;
}
html[data-theme="dark"] .ai-wizard-progress-item.active{color:#8dbbff!important}
html[data-theme="dark"] .ai-wizard-progress-item.active span{
  background:#1769e0!important;color:#fff!important;border-color:#4389ee!important;
  box-shadow:0 0 0 4px rgba(23,105,224,.16)!important;
}
html[data-theme="dark"] .ai-wizard-progress-item.done{color:#79d6a6!important}
html[data-theme="dark"] .ai-wizard-progress-item.done span{
  background:#123426!important;color:#79d6a6!important;border-color:#286248!important;
}
html[data-theme="dark"] .ai-wizard-progress-line{background:#30435f!important}
html[data-theme="dark"] .ai-wizard-step-kicker{color:#8dbbff!important}
html[data-theme="dark"] .ai-wizard-step h3{color:#f2f6fc!important}
html[data-theme="dark"] .ai-wizard-review-card,
html[data-theme="dark"] .ai-wizard-edit-source{
  background:#0f1b2d!important;color:#e8eef8!important;border-color:#2b3b54!important;
}
html[data-theme="dark"] .ai-wizard-edit-source summary{color:#dce7f7!important}
html[data-theme="dark"] .ai-wizard-skip-dictation{color:#9eacc0!important}
html[data-theme="dark"] .ai-wizard-skip-dictation:hover{color:#e8eef8!important}

/* ===== v16.105 — admin editing company-user estimates ===== */
.admin-editing-estimate-banner{margin:0 0 12px;padding:10px 14px;border-radius:12px;background:#eef5ff;border:1px solid #bcd3ff;color:#2452a4;font-weight:800}
html[data-theme="dark"] .admin-editing-estimate-banner{background:#10233f!important;border-color:#2c5a96!important;color:#b9d6ff!important}


/* ===== v16.111 — compact horizontal mobile day/night theme switch ===== */
.mobile-theme-switch{display:none}
@media(max-width:768px){
  .mobile-topbar-main{display:flex!important;align-items:center!important;gap:8px!important}
  .mobile-brand{flex:0 1 auto;min-width:0}
  .mobile-theme-switch{
    display:inline-flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;
    gap:5px!important;margin-left:auto!important;margin-right:2px!important;white-space:nowrap!important;
    flex:0 0 auto!important;width:auto!important;height:30px!important;padding:2px 3px!important;
    border:0!important;background:transparent!important;box-shadow:none!important;
  }
  .mobile-theme-icon{
    position:static!important;float:none!important;flex:0 0 24px!important;width:24px!important;height:24px!important;
    min-width:24px!important;max-width:24px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;
    margin:0!important;padding:0!important;border-radius:999px!important;box-sizing:border-box!important;
    color:#36506f!important;background:rgba(46,77,112,.08)!important;border:1px solid rgba(46,77,112,.16)!important;
    line-height:1!important;vertical-align:middle!important;transform:none;
    transition:color .18s ease,background .18s ease,border-color .18s ease,box-shadow .18s ease!important;
  }
  .mobile-theme-icon svg{width:16px!important;height:16px!important;display:block!important;overflow:visible!important}
  .mobile-theme-icon svg circle,.mobile-theme-icon svg path{
    fill:none!important;stroke:currentColor!important;stroke-width:1.9!important;stroke-linecap:round!important;stroke-linejoin:round!important;
  }
  .mobile-theme-toggle{
    appearance:none!important;-webkit-appearance:none!important;position:relative!important;display:inline-block!important;
    flex:0 0 38px!important;width:38px!important;min-width:38px!important;max-width:38px!important;height:22px!important;
    margin:0!important;padding:0!important;border:1px solid #b9c6d6!important;border-radius:999px!important;
    background:#dce3eb!important;box-shadow:none!important;cursor:pointer!important;vertical-align:middle!important;
    -webkit-tap-highlight-color:transparent!important;overflow:hidden!important;
  }
  .mobile-theme-toggle-knob{
    position:absolute!important;left:3px!important;top:3px!important;width:14px!important;height:14px!important;
    margin:0!important;border:0!important;border-radius:50%!important;background:#fff!important;
    box-shadow:0 1px 3px rgba(22,34,51,.25)!important;transform:translateX(0)!important;transition:transform .18s ease!important;
  }
  .mobile-theme-toggle.is-dark{background:#2374df!important;border-color:#2374df!important}
  .mobile-theme-toggle.is-dark .mobile-theme-toggle-knob{transform:translateX(16px)!important}
  .mobile-theme-sun{color:#9a6200!important}
  .mobile-theme-moon{color:#274f82!important}
  .mobile-theme-sun.is-active{color:#8a5700!important;background:#fff0bd!important;border-color:#e8b84f!important;box-shadow:0 1px 5px rgba(178,122,15,.14)!important}
  .mobile-theme-moon.is-active{color:#fff!important;background:#2469d8!important;border-color:#2469d8!important;box-shadow:0 1px 5px rgba(36,105,216,.18)!important}
  html[data-theme="dark"] .mobile-theme-icon{background:#16243a!important;border-color:#38506f!important;color:#a7b7cd!important}
  html[data-theme="dark"] .mobile-theme-sun{color:#c1a96f!important}
  html[data-theme="dark"] .mobile-theme-moon{color:#9fc0ff!important}
  html[data-theme="dark"] .mobile-theme-sun.is-active{color:#302000!important;background:#ffd76a!important;border-color:#ffd76a!important}
  html[data-theme="dark"] .mobile-theme-moon.is-active{color:#fff!important;background:#2f78e8!important;border-color:#5b99f2!important}
  html[data-theme="dark"] .mobile-theme-toggle{background:#33445a!important;border-color:#4a607a!important}
  html[data-theme="dark"] .mobile-theme-toggle.is-dark{background:#2f78e8!important;border-color:#5b99f2!important}
}
@media(max-width:390px){
  .mobile-topbar{padding-left:9px!important;padding-right:9px!important}
  .mobile-topbar-main{gap:6px!important}
  .mobile-brand{gap:5px!important}
  
  
  .mobile-brand small{display:inline-block!important;font-size:8px!important;white-space:nowrap!important;opacity:.78!important}
  .mobile-theme-switch{gap:3px!important;height:28px!important}
  .mobile-theme-icon{flex-basis:22px!important;width:22px!important;height:22px!important;min-width:22px!important;max-width:22px!important}
  .mobile-theme-icon svg{width:14px!important;height:14px!important}
  .mobile-theme-toggle{flex-basis:34px!important;width:34px!important;min-width:34px!important;max-width:34px!important;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}
  .mobile-menu-button{width:40px!important;height:38px!important}
}

/* ===== v16.107 — full dark-theme mobile/modal audit ===== */
html[data-theme="dark"]{
  --surface:#111b2d;
  --surface-2:#152238;
  --surface-3:#1a2a43;
  --surface-soft:#0d1728;
  --border-dark:#2d405b;
  --text-dark:#eef4ff;
  --muted-dark:#9dafc6;
}

/* Every bottom sheet / action sheet must inherit the dark palette. */
html[data-theme="dark"] .mobile-more-overlay,
html[data-theme="dark"] #mobileDocumentsOverlay,
html[data-theme="dark"] #mobileServiceOverlay{
  background:rgba(0,5,14,.78)!important;
}
html[data-theme="dark"] .mobile-more-sheet,
html[data-theme="dark"] .mobile-action-sheet,
html[data-theme="dark"] #mobileDocumentsOverlay .mobile-more-sheet,
html[data-theme="dark"] #mobileServiceOverlay .mobile-more-sheet{
  background:#111b2d!important;
  color:#eef4ff!important;
  border-color:#2d405b!important;
  box-shadow:0 -18px 52px rgba(0,0,0,.58)!important;
}
html[data-theme="dark"] .mobile-sheet-handle{background:#43536a!important}
html[data-theme="dark"] .mobile-sheet-title,
html[data-theme="dark"] .mobile-action-title{color:#eef4ff!important}
html[data-theme="dark"] .mobile-sheet-head .small,
html[data-theme="dark"] .mobile-more-sheet .small{color:#9dafc6!important}
html[data-theme="dark"] .mobile-sheet-close{
  background:#1b2b43!important;
  color:#eef4ff!important;
  border:1px solid #344a67!important;
}
html[data-theme="dark"] .mobile-action-section,
html[data-theme="dark"] #mobileDocumentsOverlay .mobile-action-section{
  border-color:#283a53!important;
  background:transparent!important;
}
html[data-theme="dark"] .mobile-export-row,
html[data-theme="dark"] .mobile-action-list,
html[data-theme="dark"] .mobile-menu-grid{background:transparent!important}
html[data-theme="dark"] .mobile-export-row button,
html[data-theme="dark"] #mobileDocumentsOverlay .mobile-export-row button,
html[data-theme="dark"] .mobile-action-list button,
html[data-theme="dark"] .mobile-menu-grid button{
  background:#182840!important;
  color:#dfe9f7!important;
  border-color:#344a67!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .mobile-export-row button:hover,
html[data-theme="dark"] #mobileDocumentsOverlay .mobile-export-row button:hover,
html[data-theme="dark"] .mobile-action-list button:hover,
html[data-theme="dark"] .mobile-menu-grid button:hover{
  background:#203553!important;
  color:#fff!important;
}
html[data-theme="dark"] .mobile-export-row button:disabled,
html[data-theme="dark"] .mobile-menu-grid button:disabled{
  background:#111d30!important;
  color:#64758c!important;
  border-color:#26384f!important;
  opacity:.72!important;
}

/* Generic modal surfaces. This catches dialogs that use custom wrappers instead of .modal-box. */
html[data-theme="dark"] .overlay, html[data-theme="dark"] .dialog-overlay, html[data-theme="dark"] .ais-dialog-overlay{color:#eef4ff!important}
html[data-theme="dark"] .dialog, html[data-theme="dark"] .modal-card, html[data-theme="dark"] .dialog-card, html[data-theme="dark"] .ais-dialog, html[data-theme="dark"] .ais-dialog-box{
  background:#111b2d!important;
  color:#eef4ff!important;
  border-color:#30445f!important;
}
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .modal-actions,
html[data-theme="dark"] .dialog-actions,
html[data-theme="dark"] .ais-dialog-actions{
  background:#111b2d!important;
  border-color:#2b3e58!important;
  color:#eef4ff!important;
}

/* Work/material editors: remove remaining light cards and white sticky action strips. */
html[data-theme="dark"] .estimate-new-work-creator,
html[data-theme="dark"] .estimate-new-work-grid,
html[data-theme="dark"] .estimate-new-work-section,
html[data-theme="dark"] .estimate-new-material-row,
html[data-theme="dark"] .estimate-work-picker,
html[data-theme="dark"] .estimate-work-picker-tools,
html[data-theme="dark"] .estimate-work-results{
  color:#eaf1fb!important;
}
html[data-theme="dark"] .estimate-new-work-section{
  background:#152238!important;
  border-color:#31455f!important;
}
html[data-theme="dark"] .estimate-new-work-section-head,
html[data-theme="dark"] .estimate-new-work-head-actions{background:transparent!important}
html[data-theme="dark"] .estimate-new-work-actions{
  background:linear-gradient(to bottom,rgba(17,27,45,0),#111b2d 20%,#111b2d)!important;
  border-color:#2d405b!important;
}
html[data-theme="dark"] .estimate-new-work-grid label,
html[data-theme="dark"] .estimate-new-work-section .small{color:#9dafc6!important}

/* Library item editor and all form cards. */
html[data-theme="dark"] #itemModal .modal-box, html[data-theme="dark"] .library-item-editor, html[data-theme="dark"] .library-editor-card, html[data-theme="dark"] .form-card, html[data-theme="dark"] .form-section, html[data-theme="dark"] .field-card{
  background:#111b2d!important;
  color:#eef4ff!important;
  border-color:#30445f!important;
}

/* White bars frequently came from sticky toolbars/footers and inline background:#fff. */
html[data-theme="dark"] .modal-box > .actions{
  background:#111b2d!important;
  border-color:#2d405b!important;
}

/* Messages / hints / status panels must be readable. */
html[data-theme="dark"] .alert,
html[data-theme="dark"] .message,
html[data-theme="dark"] .status-message,
html[data-theme="dark"] .info-box,
html[data-theme="dark"] .help-box,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .callout{
  background:#152238!important;
  color:#dce7f7!important;
  border-color:#30445f!important;
}

/* Current estimate: force all wrappers, summary and expandable metadata into the same palette. */
html[data-theme="dark"] .estimate-summary, html[data-theme="dark"] .estimate-summary-card, html[data-theme="dark"] .estimate-data-panel, html[data-theme="dark"] .estimate-data-body, html[data-theme="dark"] .estimate-extra-costs, html[data-theme="dark"] .estimate-section, html[data-theme="dark"] .current-estimate-card{
  background:#111b2d!important;
  color:#e8eef8!important;
  border-color:#2d405b!important;
}
html[data-theme="dark"] .estimate-summary-row,
html[data-theme="dark"] .estimate-data-row{border-color:#2b3e58!important;color:#dbe6f5!important}

/* Keep explicit printable-document paper white only inside the visual template editor. */
html[data-theme="dark"] .document-template-paper,
html[data-theme="dark"] .document-template-paper *{color:#181818}

/* Strong fallback for common light utility classes inside dark overlays/modals. */


/* Mobile-specific final pass. */
@media(max-width:768px){
  html[data-theme="dark"] .mobile-more-sheet,
  html[data-theme="dark"] .mobile-action-sheet,
  html[data-theme="dark"] #mobileDocumentsOverlay .mobile-more-sheet{
    background:#111b2d!important;
  }
  html[data-theme="dark"] .mobile-action-section{padding-left:0!important;padding-right:0!important}
  html[data-theme="dark"] .mobile-export-row button{min-height:46px!important}
  html[data-theme="dark"] .estimate-new-work-section{background:#152238!important}
  html[data-theme="dark"] .estimate-new-work-actions{padding-top:14px!important}
}




/* ===== v16.111 dark theme: modal/footer audit ===== */
/* Mobile sticky action bars in library editors were still hard-coded white. */
html[data-theme="dark"] #itemModal .item-modal-actions,
html[data-theme="dark"] .item-modal-actions{
  background:#111b2d!important;
  color:#eef4ff!important;
  border-color:#2d405b!important;
  box-shadow:none!important;
}

/* Cover all known sticky action areas used by modal editors. */
html[data-theme="dark"] .modal .estimate-new-work-actions, html[data-theme="dark"] .modal .item-modal-actions, html[data-theme="dark"] .modal .document-template-editor-footer, html[data-theme="dark"] .modal .modal-footer, html[data-theme="dark"] .modal .modal-actions, html[data-theme="dark"] .modal .dialog-actions{
  background:#111b2d!important;
  color:#eef4ff!important;
  border-color:#2d405b!important;
}

/* Extra modal surfaces used by work/material pickers and relation editors. */
html[data-theme="dark"] #relationModal .modal-box,
html[data-theme="dark"] #materialPickerModal .modal-box,
html[data-theme="dark"] #estimateWorkPickerModal .modal-box,
html[data-theme="dark"] #itemModal .modal-box{
  background:#111b2d!important;
  color:#eef4ff!important;
  border-color:#30445f!important;
}
html[data-theme="dark"] #relationModal .toolbar,
html[data-theme="dark"] #materialPickerModal .toolbar,
html[data-theme="dark"] #estimateWorkPickerModal .toolbar,
html[data-theme="dark"] #itemModal .form-grid{
  background:transparent!important;
  color:#eef4ff!important;
  border-color:#30445f!important;
}

/* Buttons in modal footers must not inherit a light container strip. */
html[data-theme="dark"] .modal .item-modal-actions > *,
html[data-theme="dark"] .modal .estimate-new-work-actions > *,
html[data-theme="dark"] .modal .modal-footer > *,
html[data-theme="dark"] .modal .modal-actions > *{
  position:relative;
  z-index:1;
}

/* Common cards/lists inside popups. */
html[data-theme="dark"] .modal .card:not(.document-template-paper),
html[data-theme="dark"] .modal .picker-card,
html[data-theme="dark"] .modal .picker-row,
html[data-theme="dark"] .modal .list-card,
html[data-theme="dark"] .modal .selection-card,
html[data-theme="dark"] .modal .work-card,
html[data-theme="dark"] .modal .material-card{
  background:#152238!important;
  color:#eef4ff!important;
  border-color:#30445f!important;
}

/* Form controls and labels inside every modal remain readable. */
html[data-theme="dark"] .modal label,
html[data-theme="dark"] .modal h1,
html[data-theme="dark"] .modal h2,
html[data-theme="dark"] .modal h3,
html[data-theme="dark"] .modal b,
html[data-theme="dark"] .modal strong{color:#eef4ff!important}
html[data-theme="dark"] .modal input,
html[data-theme="dark"] .modal select,
html[data-theme="dark"] .modal textarea{
  background:#0d1727!important;
  color:#f4f7fc!important;
  border-color:#38506f!important;
}
html[data-theme="dark"] .modal input::placeholder,
html[data-theme="dark"] .modal textarea::placeholder{color:#74859d!important;opacity:1}

/* Printed A4 preview remains intentionally white. */
html[data-theme="dark"] .document-template-paper{
  background:#fff!important;
  color:#181818!important;
}
html[data-theme="dark"] .document-template-paper input,
html[data-theme="dark"] .document-template-paper textarea,
html[data-theme="dark"] .document-template-paper select{
  background:#fff!important;
  color:#181818!important;
  border-color:#cfd4da!important;
}

@media(max-width:768px){
  html[data-theme="dark"] #itemModal .item-modal-actions{
    background:#111b2d!important;
    padding-top:12px!important;
    border-top:1px solid #2d405b!important;
  }
  html[data-theme="dark"] .estimate-new-work-actions{
    background:linear-gradient(to bottom,rgba(17,27,45,0),#111b2d 18%,#111b2d)!important;
    border-top:1px solid #2d405b!important;
  }
}


/* ===== v16.112 — dark estimate action buttons + always-visible version ===== */
html[data-theme="dark"] .estimate-move-btn{
  background:#17263d!important;
  color:#eaf2ff!important;
  border-color:#3b5271!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .estimate-move-btn:hover,
html[data-theme="dark"] .estimate-move-btn:focus{
  background:#223a5d!important;
  color:#fff!important;
  border-color:#5b7ca7!important;
}
html[data-theme="dark"] .estimate-row-actions button:not(.btn-danger){
  background:#17263d!important;
  color:#eaf2ff!important;
  border-color:#3b5271!important;
}
.brand small,.mobile-brand small{display:inline-block!important}
html[data-theme="dark"] .brand small,
html[data-theme="dark"] .mobile-brand small{color:#aebdd1!important}
@media(max-width:390px){
  .mobile-brand small{display:inline-block!important;font-size:8px!important;max-width:43px!important;overflow:hidden!important;text-overflow:ellipsis!important}
}


/* ===== v16.113 — dark confirmation dialog icon / close controls ===== */
html[data-theme="dark"] .ais-dialog-card .ais-dialog-icon{
  background:#17263d!important;
  color:#9bc6ff!important;
  border:1px solid #344761!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .ais-dialog-card .ais-dialog-close{
  background:#17263d!important;
  color:#dce7f7!important;
  border:1px solid #344761!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .ais-dialog-card .ais-dialog-close:hover{
  background:#1d3150!important;
  color:#ffffff!important;
}
html[data-theme="dark"] .ais-dialog-card .ais-dialog-close:focus-visible,
html[data-theme="dark"] .ais-dialog-card .ais-dialog-icon:focus-visible{
  outline:2px solid #3b82f6!important;
  outline-offset:2px!important;
}


/* ===== v16.114 — complete dark subscription/account audit ===== */
html[data-theme="dark"] #account,
html[data-theme="dark"] #account .account-pane,
html[data-theme="dark"] #accountSubscriptionPane,
html[data-theme="dark"] #accountAccountPane{
  color:#e8eef8!important;
}
html[data-theme="dark"] .account-tabs{
  background:#15243a!important;
  border:1px solid #2b3b54!important;
}
html[data-theme="dark"] .account-tab{
  background:transparent!important;
  color:#9eacc0!important;
}
html[data-theme="dark"] .account-tab.active{
  background:#1b2c46!important;
  color:#7fb2ff!important;
  box-shadow:0 1px 5px rgba(0,0,0,.28)!important;
}
html[data-theme="dark"] .account-subscription-title,
html[data-theme="dark"] .subscription-tariffs-heading,
html[data-theme="dark"] .billing-toggle-wrap{
  color:#e8eef8!important;
}
html[data-theme="dark"] #subscriptionSummary.card,
html[data-theme="dark"] .payment-coupon-card,
html[data-theme="dark"] .payment-consent-card,
html[data-theme="dark"] #paymentProviderAdminBox,
html[data-theme="dark"] #paymentManagementCard,
html[data-theme="dark"] #subscriptionAdminPanel,
html[data-theme="dark"] #accountSubscriptionPane > .card{
  background:#111b2d!important;
  color:#e8eef8!important;
  border-color:#2b3b54!important;
}
html[data-theme="dark"] .subscription-usage-item{
  background:#17243a!important;
  border-color:#30435f!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] .subscription-usage-item .small, html[data-theme="dark"] .subscription-period, html[data-theme="dark"] .subscription-desc, html[data-theme="dark"] .billing-saving-hint, html[data-theme="dark"] .payment-consent-card .small, html[data-theme="dark"] #paymentSubscriptionInfo, html[data-theme="dark"] .payment-history-list .small, html[data-theme="dark"] .tariff-feature-note{
  color:#9eacc0!important;
}
html[data-theme="dark"] .subscription-usage-value,
html[data-theme="dark"] .subscription-plan,
html[data-theme="dark"] .subscription-features,
html[data-theme="dark"] .payment-coupon-title{
  color:#f2f6fc!important;
}
html[data-theme="dark"] .subscription-progress{
  background:#263650!important;
}
html[data-theme="dark"] .subscription-progress>span{
  background:linear-gradient(90deg,#1769e0,#18a6ff)!important;
}
html[data-theme="dark"] .subscription-card{
  background:#111b2d!important;
  border-color:#30435f!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] .subscription-card-featured{
  border-color:#2b86ff!important;
  box-shadow:0 10px 28px rgba(0,88,218,.20)!important;
}
html[data-theme="dark"] .subscription-card-current{
  box-shadow:0 0 0 3px rgba(43,134,255,.30)!important;
}
html[data-theme="dark"] .subscription-price{
  color:#76b3ff!important;
}
html[data-theme="dark"] .subscription-badge{
  background:#1769e0!important;
  color:#fff!important;
}
html[data-theme="dark"] .billing-toggle{
  background:#15243a!important;
  border:1px solid #2b3b54!important;
}
html[data-theme="dark"] .billing-toggle button{
  background:transparent!important;
  color:#a8b7ca!important;
}
html[data-theme="dark"] .billing-toggle button.active{
  background:#1b2c46!important;
  color:#7fb2ff!important;
  box-shadow:0 1px 5px rgba(0,0,0,.30)!important;
}
html[data-theme="dark"] .billing-toggle button span{
  color:#62d28f!important;
}
html[data-theme="dark"] #accountSubscriptionPane input,
html[data-theme="dark"] #accountSubscriptionPane select,
html[data-theme="dark"] #accountSubscriptionPane textarea{
  background:#0d1727!important;
  color:#e8eef8!important;
  border-color:#30435f!important;
}
html[data-theme="dark"] #accountSubscriptionPane input::placeholder,
html[data-theme="dark"] #accountSubscriptionPane textarea::placeholder{
  color:#6f8097!important;
}
html[data-theme="dark"] .payment-history-row{
  border-color:#2b3b54!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] .tariff-table-wrap{
  background:#111b2d!important;
  border-color:#2b3b54!important;
}
html[data-theme="dark"] .tariff-table{
  background:#111b2d!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] .tariff-table th,
html[data-theme="dark"] .tariff-table td{
  background:#111b2d!important;
  color:#e8eef8!important;
  border-bottom-color:#2b3b54!important;
}
html[data-theme="dark"] .tariff-table thead th{
  background:#17243a!important;
  color:#b8c6d8!important;
}
html[data-theme="dark"] .tariff-table tbody tr:hover td{
  background:#15243a!important;
}
html[data-theme="dark"] .tariff-no{color:#72839a!important}
html[data-theme="dark"] .tariff-yes{color:#62d28f!important}
html[data-theme="dark"] .tariff-limit{color:#e8eef8!important}

html[data-theme="dark"] #accountSubscriptionPane .btn-light,
html[data-theme="dark"] #accountSubscriptionPane button.btn-light,
html[data-theme="dark"] #accountSubscriptionPane .subscription-plan-btn.btn-light{
  background:#1a2a43!important;
  color:#dce7f7!important;
  border-color:#30435f!important;
}
html[data-theme="dark"] #accountSubscriptionPane .btn-light:hover,
html[data-theme="dark"] #accountSubscriptionPane button.btn-light:hover{
  background:#203451!important;
  color:#fff!important;
}
html[data-theme="dark"] #accountSubscriptionPane button:disabled{
  opacity:.62!important;
}
@media(max-width:768px){
  html[data-theme="dark"] #account .account-tabs,
  html[data-theme="dark"] #accountSubscriptionPane .billing-toggle{
    background:#15243a!important;
  }
html[data-theme="dark"] #accountSubscriptionPane .subscription-usage-item{
    min-height:0!important;
  }
}

/* ===== v16.115 — unified Apple-inspired product interface ===== */
:root{
  --ais-bg:#f5f5f7;
  --ais-surface:rgba(255,255,255,.88);
  --ais-surface-solid:#fff;
  --ais-surface-muted:#f9f9fb;
  --ais-text:#1d1d1f;
  --ais-secondary:#6e6e73;
  --ais-border:rgba(60,60,67,.14);
  --ais-blue:#0071e3;
  --ais-blue-hover:#0077ed;
  --ais-blue-soft:#eaf4ff;
  --ais-green:#248a3d;
  --ais-red:#d70015;
  --ais-radius:18px;
  --ais-shadow:0 1px 2px rgba(0,0,0,.03),0 12px 35px rgba(0,0,0,.055);
  --bg:var(--ais-bg);--card:var(--ais-surface-solid);--text:var(--ais-text);
  --muted:var(--ais-secondary);--line:var(--ais-border);--accent:var(--ais-blue);
  --accent2:var(--ais-blue-hover);--shadow:var(--ais-shadow)
}
html{background:var(--ais-bg);scroll-behavior:smooth}
body{
  background:var(--ais-bg)!important;color:var(--ais-text)!important;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Helvetica Neue",Arial,sans-serif!important;
  font-size:15px;letter-spacing:-.012em;-webkit-font-smoothing:antialiased
}
header{
  min-height:68px!important;height:68px!important;padding:0 24px!important;
  background:rgba(250,250,252,.82)!important;color:var(--ais-text)!important;
  border-bottom:1px solid var(--ais-border)!important;
  box-shadow:0 1px 0 rgba(255,255,255,.75)!important;
  backdrop-filter:saturate(180%) blur(24px)!important;
  -webkit-backdrop-filter:saturate(180%) blur(24px)!important
}
.brand{display:flex!important;align-items:center;gap:10px;color:var(--ais-text)!important;min-width:max-content}
.brand-mark{
  width:36px;height:36px;display:grid;place-items:center;border-radius:11px;
  color:#fff!important;font-size:14px!important;font-weight:800!important;letter-spacing:-.04em;
  background:linear-gradient(145deg,#38a9ff 0%,#0071e3 52%,#0057c8 100%);
  box-shadow:0 5px 15px rgba(0,113,227,.24),inset 0 1px 0 rgba(255,255,255,.35)
}


#saveStatus{color:var(--ais-secondary)!important;font-size:12px!important;margin-left:auto!important}
.header-actions{gap:7px!important}.header-actions .btn-light,#currentUserButton,#currentCompanyButton{
  min-height:38px;border:1px solid var(--ais-border)!important;border-radius:11px!important;
  background:rgba(255,255,255,.74)!important;color:#343438!important;box-shadow:0 1px 2px rgba(0,0,0,.025)!important
}
.header-actions .btn-light:hover,#currentUserButton:hover,#currentCompanyButton:hover{background:#fff!important;border-color:rgba(60,60,67,.22)!important}
.layout{grid-template-columns:220px minmax(0,1fr)!important;min-height:calc(100vh - 68px)!important}
aside{
  background:rgba(250,250,252,.76)!important;border-right:1px solid var(--ais-border)!important;
  padding:20px 12px!important;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)
}
#nav{display:grid;gap:4px}
#nav button{
  position:relative;min-height:43px;margin:0!important;padding:0 13px!important;border-radius:11px!important;
  color:#4a4a4f!important;font-size:14px;font-weight:590!important;transition:background .16s ease,color .16s ease,transform .16s ease
}
#nav button:hover{background:rgba(118,118,128,.08)!important;color:#1d1d1f!important}
#nav button.active{background:#fff!important;color:var(--ais-blue)!important;box-shadow:0 3px 12px rgba(0,0,0,.055)!important}
#nav button.active::before{content:"";position:absolute;left:4px;top:12px;bottom:12px;width:3px;border-radius:3px;background:var(--ais-blue)}
main{padding:30px clamp(20px,3.2vw,48px) 56px!important;max-width:1680px;width:100%;margin:0 auto}
.view h1,.estimates-hub-head h1,#projectTitle{font-size:clamp(28px,2.7vw,40px)!important;line-height:1.08!important;font-weight:730!important;letter-spacing:-.045em!important;color:var(--ais-text)!important}
.view h2{font-weight:680!important;letter-spacing:-.025em!important}.small{color:var(--ais-secondary)!important;line-height:1.45}
.card, .subscription-card, .estimates-search-card{
  background:var(--ais-surface)!important;border:1px solid rgba(60,60,67,.11)!important;
  border-radius:var(--ais-radius)!important;box-shadow:var(--ais-shadow)!important;
  backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)
}
.card{padding:20px!important}.grid{gap:12px!important}.kpi .label{font-weight:560}.kpi .value{font-size:29px!important;letter-spacing:-.04em}
button{transition:background .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease}
button:active{transform:scale(.985)}
.btn{
  background:var(--ais-blue)!important;color:#fff!important;border:0!important;border-radius:980px!important;
  min-height:42px;padding:10px 18px!important;font-weight:630!important;box-shadow:none!important
}
.btn:hover{background:var(--ais-blue-hover)!important;transform:translateY(-1px)}
.btn-light{
  background:#fff!important;color:#2c2c2e!important;border:1px solid var(--ais-border)!important;
  border-radius:980px!important;min-height:40px;font-weight:590!important;box-shadow:0 1px 2px rgba(0,0,0,.025)
}
.btn-light:hover{background:#f7f7f9!important;border-color:rgba(60,60,67,.22)!important}
.btn-danger{background:#fff0f1!important;color:var(--ais-red)!important;border-radius:980px!important}
.btn-ok{background:#edf8ef!important;color:var(--ais-green)!important;border-radius:980px!important}
.ai-main-create-btn{
  width:auto!important;min-height:48px!important;padding-inline:24px!important;font-size:16px!important;
  background:linear-gradient(180deg,#0a84ff 0%,#0071e3 100%)!important;
  box-shadow:0 8px 20px rgba(0,113,227,.19)!important
}
input,select,textarea{
  min-height:42px;background:rgba(255,255,255,.92)!important;color:var(--ais-text)!important;
  border:1px solid rgba(60,60,67,.18)!important;border-radius:11px!important;padding:10px 12px!important;
  outline:none;transition:border-color .16s ease,box-shadow .16s ease,background .16s ease
}
input:focus,select:focus,textarea:focus{border-color:rgba(0,113,227,.7)!important;box-shadow:0 0 0 4px rgba(0,113,227,.12)!important;background:#fff!important}
input::placeholder,textarea::placeholder{color:#98989d!important}
.form-grid label{font-size:12px!important;font-weight:590!important;color:var(--ais-secondary)!important;gap:7px!important}
.estimates-hub-head{margin-bottom:22px!important}.estimates-hub-head .small{font-size:14px!important;margin-top:7px}
.estimates-hub-actions{margin-bottom:18px!important}
.estimates-search-card{display:flex!important;align-items:center;gap:12px;padding:8px 10px!important;box-shadow:none!important;background:rgba(255,255,255,.66)!important}
.estimates-search-card::before{content:"⌕";font-size:27px;color:#8e8e93;line-height:1;transform:rotate(-18deg);margin-left:5px}
.estimates-search-card input{border:0!important;background:transparent!important;box-shadow:none!important;font-size:15px!important}
.estimates-hub-list{gap:12px!important}.estimate-hub-card{
  border:1px solid rgba(60,60,67,.11)!important;border-radius:18px!important;background:#fff!important;
  box-shadow:0 2px 12px rgba(0,0,0,.035)!important;padding:19px 20px!important
}
.estimate-hub-card:hover{border-color:rgba(0,113,227,.28)!important;box-shadow:0 12px 28px rgba(0,0,0,.07)!important;transform:translateY(-2px)}
.estimate-hub-card.current{border-color:rgba(0,113,227,.38)!important;box-shadow:0 0 0 3px rgba(0,113,227,.08)!important}
.estimate-current-badge,.badge{background:var(--ais-blue-soft)!important;color:var(--ais-blue)!important;border:0!important}
.estimate-hub-title-row h2{font-size:18px!important;letter-spacing:-.025em!important}.estimate-hub-stats b{color:var(--ais-text)!important}
.estimate-details-card{box-shadow:none!important;background:rgba(255,255,255,.68)!important}
.estimate-details-plus{border-radius:50%!important;background:var(--ais-blue-soft)!important;color:var(--ais-blue)!important}
.estimate-back-btn{border:0!important;background:transparent!important;color:var(--ais-blue)!important;padding-left:2px!important;box-shadow:none!important}
.estimate-back-btn:hover{background:transparent!important;color:var(--ais-blue-hover)!important}
.table-wrap{border:1px solid var(--ais-border)!important;border-radius:16px!important;overflow:auto;background:#fff!important;box-shadow:0 2px 14px rgba(0,0,0,.035)}
table{background:#fff!important}th{
  background:#f7f7f9!important;color:#6e6e73!important;font-size:11px!important;font-weight:650!important;
  letter-spacing:.025em!important;border-bottom:1px solid var(--ais-border)!important;padding:12px 10px!important
}
td{border-bottom:1px solid rgba(60,60,67,.1)!important;padding:11px 10px!important}
tbody tr{transition:background .14s ease}tbody tr:hover td{background:rgba(0,113,227,.025)!important}
tr.main-work-row td{background:#f5f9ff!important}tr.main-work-row td:first-child{box-shadow:inset 3px 0 0 var(--ais-blue)!important}
.estimate-subwork-row td,.linked-material-row td{background:#fff!important;color:#4b4b50!important}
.work-subgroup-row td{background:#fafafa!important;border-color:var(--ais-border)!important}
.work-total-row td{background:#f7f7f9!important}.work-total-row.final td{background:#edf6ff!important;color:#005eb8!important}
.work-subgroup-toggle, .work-cat-toggle, .material-cat-toggle, .estimate-move-btn{
  background:#fff!important;color:var(--ais-blue)!important;border:1px solid var(--ais-border)!important;border-radius:9px!important;box-shadow:none!important
}
.work-subgroup-toggle:hover, .work-cat-toggle:hover, .material-cat-toggle:hover, .estimate-move-btn:hover{background:var(--ais-blue-soft)!important;border-color:rgba(0,113,227,.25)!important}
.file-menu-dropdown{
  padding:7px!important;border-radius:14px!important;border:1px solid var(--ais-border)!important;
  background:rgba(255,255,255,.92)!important;box-shadow:0 18px 50px rgba(0,0,0,.14)!important;
  backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px)
}
.file-menu-dropdown button{border-radius:9px!important;color:#29292d!important;font-weight:520!important}.file-menu-dropdown button:hover{background:rgba(0,113,227,.09)!important;color:var(--ais-blue)!important}

.ais-dialog-card{
  background:rgba(255,255,255,.96)!important;border:1px solid rgba(255,255,255,.75)!important;
  border-radius:22px!important;box-shadow:0 28px 80px rgba(0,0,0,.2)!important
}

.note{background:#fff9e8!important;border-color:#f1dda0!important;border-radius:13px!important}
.account-tabs,.billing-toggle{padding:4px!important;background:#ebebef!important;border:0!important;border-radius:12px!important}
.account-tab,.billing-toggle button{border-radius:9px!important}.account-tab.active,.billing-toggle button.active{background:#fff!important;color:var(--ais-blue)!important;box-shadow:0 1px 4px rgba(0,0,0,.12)!important}
.subscription-card-featured{border-color:rgba(0,113,227,.42)!important;box-shadow:0 12px 34px rgba(0,113,227,.11)!important}

/* Dark mode uses neutral graphite, avoiding blue-tinted panels and white seams. */
html[data-theme="dark"]{
  --ais-bg:#000;--ais-surface:rgba(28,28,30,.9);--ais-surface-solid:#1c1c1e;--ais-surface-muted:#242426;
  --ais-text:#f5f5f7;--ais-secondary:#a1a1a6;--ais-border:rgba(255,255,255,.12);
  --ais-blue:#0a84ff;--ais-blue-hover:#409cff;--ais-blue-soft:rgba(10,132,255,.16);
  --bg:var(--ais-bg);--card:var(--ais-surface-solid);--text:var(--ais-text);--muted:var(--ais-secondary);--line:var(--ais-border)
}
html[data-theme="dark"],html[data-theme="dark"] body{background:#000!important;color:var(--ais-text)!important}
html[data-theme="dark"] header{background:rgba(20,20,22,.84)!important;border-color:var(--ais-border)!important;color:var(--ais-text)!important}
html[data-theme="dark"] .brand{color:var(--ais-text)!important}
html[data-theme="dark"] aside{background:rgba(20,20,22,.88)!important;border-color:var(--ais-border)!important}
html[data-theme="dark"] #nav button{color:#b8b8bd!important}
html[data-theme="dark"] #nav button:hover{background:rgba(255,255,255,.07)!important;color:#fff!important}
html[data-theme="dark"] #nav button.active{background:#2c2c2e!important;color:#0a84ff!important;box-shadow:none!important}
html[data-theme="dark"] .card, html[data-theme="dark"] .subscription-card, html[data-theme="dark"] .estimate-hub-card, html[data-theme="dark"] .ais-dialog-card{background:#1c1c1e!important;color:var(--ais-text)!important;border-color:var(--ais-border)!important;box-shadow:none!important}
html[data-theme="dark"] .estimates-search-card,html[data-theme="dark"] .estimate-details-card{background:#1c1c1e!important;border-color:var(--ais-border)!important}

/* v23.58: remove the decorative magnifier from the object search card. */
.estimates-search-card::before{display:none!important;content:none!important}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#2c2c2e!important;color:#fff!important;border-color:rgba(255,255,255,.15)!important}
html[data-theme="dark"] input:focus,html[data-theme="dark"] select:focus,html[data-theme="dark"] textarea:focus{background:#323234!important;border-color:#0a84ff!important}
html[data-theme="dark"] .btn-light,html[data-theme="dark"] .header-actions .btn-light,html[data-theme="dark"] #currentUserButton,html[data-theme="dark"] #currentCompanyButton{background:#2c2c2e!important;color:#f5f5f7!important;border-color:var(--ais-border)!important}
html[data-theme="dark"] .file-menu-dropdown{background:rgba(38,38,40,.96)!important;border-color:var(--ais-border)!important}
html[data-theme="dark"] .file-menu-dropdown button{color:#f2f2f7!important}
html[data-theme="dark"] .file-menu-section-title{border-color:var(--ais-border)!important;color:#aeb8c7!important}
html[data-theme="dark"] table, html[data-theme="dark"] .table-wrap{background:#1c1c1e!important;border-color:var(--ais-border)!important;box-shadow:none!important}
html[data-theme="dark"] th{background:#252527!important;color:#a1a1a6!important;border-color:var(--ais-border)!important}
html[data-theme="dark"] td{background:#1c1c1e!important;color:#e9e9ed!important;border-color:rgba(255,255,255,.09)!important}
html[data-theme="dark"] tbody tr:hover td{background:#242426!important}
html[data-theme="dark"] tr.main-work-row td{background:#182536!important}html[data-theme="dark"] .work-total-row td{background:#242426!important}
html[data-theme="dark"] .work-total-row.final td{background:#152b41!important;color:#7dc0ff!important}
html[data-theme="dark"] .work-subgroup-toggle, html[data-theme="dark"] .work-cat-toggle, html[data-theme="dark"] .material-cat-toggle, html[data-theme="dark"] .estimate-move-btn{background:#2c2c2e!important;color:#79baff!important;border-color:var(--ais-border)!important}
html[data-theme="dark"] .account-tabs,html[data-theme="dark"] .billing-toggle{background:#2c2c2e!important;border-color:transparent!important}
html[data-theme="dark"] .account-tab.active,html[data-theme="dark"] .billing-toggle button.active{background:#48484a!important;color:#7dc0ff!important;box-shadow:none!important}


@media(max-width:900px){
  main{padding:20px 16px 44px!important}.layout{grid-template-columns:1fr!important}
}
@media(max-width:768px){
  header{height:auto!important;min-height:0!important;padding:0!important;background:rgba(250,250,252,.9)!important}
  html[data-theme="dark"] header{background:rgba(20,20,22,.92)!important}
  .mobile-topbar{background:transparent!important;color:var(--ais-text)!important;padding:10px 14px 8px!important}
  .mobile-topbar-main{min-height:42px!important}.mobile-brand{color:var(--ais-text)!important;gap:6px!important}
  
  .mobile-brand small{color:var(--ais-secondary)!important;font-weight:650!important}
  .mobile-menu-button{background:transparent!important;color:var(--ais-blue)!important;font-size:22px!important}
  .mobile-company-tariff{margin-top:7px!important;border-radius:11px!important;background:rgba(118,118,128,.09)!important;color:var(--ais-text)!important;border:0!important}
  .mobile-persistent-tabs{
    top:96px!important;padding:7px 10px!important;gap:4px!important;background:rgba(245,245,247,.9)!important;
    border-bottom:1px solid var(--ais-border)!important;backdrop-filter:blur(22px)!important;-webkit-backdrop-filter:blur(22px)!important
  }
  html[data-theme="dark"] .mobile-persistent-tabs{background:rgba(20,20,22,.92)!important}
  #mobilePersistentTabs.mobile-persistent-tabs>button{min-height:54px!important;border-radius:12px!important;background:transparent!important;color:var(--ais-secondary)!important;border:0!important;box-shadow:none!important}
  #mobilePersistentTabs.mobile-persistent-tabs>button.active{background:#fff!important;color:var(--ais-blue)!important;box-shadow:0 3px 12px rgba(0,0,0,.07)!important}
  html[data-theme="dark"] #mobilePersistentTabs.mobile-persistent-tabs>button.active{background:#2c2c2e!important;color:#0a84ff!important;box-shadow:none!important}
  
  
  .view h1,.estimates-hub-head h1,#projectTitle{font-size:30px!important}.ai-main-create-btn{width:100%!important;min-height:52px!important}
  .card{padding:16px!important;border-radius:16px!important}.estimate-hub-card{padding:16px!important;border-radius:16px!important}
  .ais-dialog-card{width:100%!important;max-height:91vh!important;border-radius:22px 22px 16px 16px!important}
  .item-modal-actions,.estimate-new-work-actions{background:#fff!important;border-top:1px solid var(--ais-border)!important}
  html[data-theme="dark"] .item-modal-actions,html[data-theme="dark"] .estimate-new-work-actions{background:#1c1c1e!important;border-color:var(--ais-border)!important}
}
@media(max-width:430px){
  main{padding:17px 12px 40px!important}.estimates-search-card{padding:6px 8px!important}.estimate-hub-actions{display:grid!important;grid-template-columns:1fr 1fr!important}
  .estimate-hub-actions .estimate-documents-btn{grid-column:1/-1}.section-title{align-items:flex-start!important}.view h1,#projectTitle{font-size:27px!important}
}

/* v16.116 final cascade lock: keep the approved five-tab field layout above legacy layers. */
@media(max-width:768px){
  body{padding-bottom:76px!important}
  .mobile-company-tariff,.mobile-save-status{display:none!important}
  main{padding:14px 12px 32px!important}
  #mobilePersistentTabs.foreman-five-tabs{
    position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;z-index:120!important;
    display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:0!important;margin:0!important;
    padding:6px 5px calc(6px + env(safe-area-inset-bottom))!important;min-height:70px!important;border-radius:0!important;
    background:rgba(250,250,252,.94)!important;border:0!important;border-top:1px solid rgba(60,60,67,.15)!important;
    box-shadow:0 -5px 24px rgba(0,0,0,.06)!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button,#mobilePersistentTabs.foreman-five-tabs>button:not(.context-hidden){
    display:flex!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;gap:2px!important
  }
  #mobilePersistentTabs.foreman-five-tabs>button.active{background:transparent!important;color:#0071e3!important;box-shadow:none!important}
  
  #mobilePersistentTabs.foreman-five-tabs .ais-tab-icon,#mobilePersistentTabs.foreman-five-tabs .foreman-more-icon svg{width:23px!important;height:23px!important}
  #estimates>.estimates-hub-head,#estimates>.estimates-hub-actions{display:none!important}
  #works .works-tree-card,#materials>.card{padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs{background:rgba(20,20,22,.96)!important;border-top-color:rgba(255,255,255,.12)!important}
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs>button.active{background:transparent!important;color:#0a84ff!important}
}

/* ===== v16.117 — approved AI-first home screen ===== */
@media(max-width:768px){
  #estimates>.estimates-search-card{display:none!important}
  .ai-home-greeting{margin:15px 3px 18px}.ai-home-greeting h1{font-size:28px!important;line-height:1.08!important;margin:0 0 6px!important;letter-spacing:-.04em!important}.ai-home-greeting p{margin:0;color:#77777d;font-size:16px}
  .ai-home-dictate{width:100%;min-height:78px;padding:14px 20px!important;display:flex;align-items:center;justify-content:center;gap:17px;background:#0071e3!important;color:#fff!important;border:0!important;border-radius:17px!important;box-shadow:0 8px 22px rgba(0,113,227,.2)!important;font-size:18px!important;font-weight:690!important}
  .ai-home-dictate span{width:46px;height:46px;display:grid;place-items:center;border-radius:50%;background:rgba(255,255,255,.13);font-size:26px;color:#fff}
  .ai-home-secondary{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:11px 0 16px}.ai-home-secondary button{min-height:62px;padding:10px!important;display:flex;align-items:center;justify-content:center;gap:9px;background:#fff!important;color:#28282c!important;border:1px solid rgba(60,60,67,.11)!important;border-radius:15px!important;box-shadow:0 4px 15px rgba(0,0,0,.055)!important;font-size:13px!important;font-weight:650!important}.ai-home-secondary button span{font-size:23px;color:#0071e3}
  .ai-home-current-card{padding:17px;background:#fff;border:1px solid rgba(60,60,67,.1);border-radius:20px;box-shadow:0 7px 24px rgba(0,0,0,.065)}
  .ai-home-current-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.ai-home-current-head h2{margin:0!important;font-size:18px!important;line-height:1.2;letter-spacing:-.025em}.ai-home-current-head>span{flex:0 0 auto;padding:5px 9px;border-radius:99px;background:#eaf8ef;color:#248a3d;font-size:10px;font-weight:680}
  .ai-home-current-body{display:grid;grid-template-columns:112px minmax(0,1fr);align-items:center;gap:16px;margin-top:14px}.ai-home-current-value{display:flex;flex-direction:column;min-width:0}.ai-home-current-value>small{font-size:12px;color:#7b7b80}.ai-home-current-value>strong{font-size:27px;letter-spacing:-.04em;margin:4px 0 12px;white-space:nowrap}.ai-home-current-value button{width:100%;min-height:43px;padding:8px 12px!important;background:#0071e3!important;color:#fff!important;border-radius:11px!important;font-size:15px!important}
  .ai-home-label{font-size:19px!important;margin:22px 2px 10px!important}.ai-home-stats{display:grid;grid-template-columns:repeat(3,1fr);padding:12px 6px;background:#fff;border:1px solid rgba(60,60,67,.1);border-radius:17px;box-shadow:0 5px 18px rgba(0,0,0,.055)}
  .ai-home-stats>div{display:grid;grid-template-columns:auto auto;grid-template-rows:auto auto;align-items:center;justify-content:center;gap:0 7px;min-width:0;padding:3px 6px;border-right:1px solid rgba(60,60,67,.1)}.ai-home-stats>div:last-child{border-right:0}.ai-home-stats span{grid-row:1/-1;width:30px;height:30px;display:grid;place-items:center;border-radius:9px;font-size:16px}.ai-home-stats b{font-size:22px;line-height:1}.ai-home-stats small{font-size:9px;color:#77777d}.stat-blue{background:#eaf4ff;color:#0071e3}.stat-green{background:#eaf8ef;color:#248a3d}.stat-orange{background:#fff4e5;color:#e37a00}
  /* v22.04: на мобильном показываем ВСЕ сметы объекта; ограничение первых трёх удалено. */
  #estimatesHubList .estimate-hub-card{display:grid!important}
  html[data-theme="dark"] .ai-home-greeting p{color:#a1a1a6}
  html[data-theme="dark"] .ai-home-secondary button,html[data-theme="dark"] .ai-home-current-card,html[data-theme="dark"] .ai-home-stats{background:#1c1c1e!important;color:#f5f5f7!important;border-color:rgba(255,255,255,.12)!important;box-shadow:none!important}
  html[data-theme="dark"] .ai-home-current-head>span{background:rgba(48,209,88,.14)!important;color:#63d77b!important}
  html[data-theme="dark"] .ai-home-stats>div{border-color:rgba(255,255,255,.1)!important}
}
@media(max-width:370px){
  .ai-home-greeting h1{font-size:25px!important}.ai-home-current-body{grid-template-columns:92px 1fr;gap:11px}.ai-home-current-value>strong{font-size:23px}.ai-home-secondary button{font-size:11px!important}.ai-home-stats>div{padding:3px}.ai-home-stats span{width:26px;height:26px}
}

/* ===== v16.118 — readable work/material category cards in mobile dark mode ===== */
@media(max-width:768px){
  html[data-theme="dark"] #works .work-category-row td,
  html[data-theme="dark"] #materials .material-category-row td{
    background:#1c1c1e!important;
    color:#f5f5f7!important;
    border:1px solid rgba(255,255,255,.12)!important;
  }
  html[data-theme="dark"] #works .work-category-row td strong,
  html[data-theme="dark"] #materials .material-category-row td strong{
    color:#f5f5f7!important;
  }
  html[data-theme="dark"] #works .work-category-row td .small,
  html[data-theme="dark"] #materials .material-category-row td .small{
    color:#a1a1a6!important;
  }
}

/* ===== v16.119 — tasks ===== */
.tasks-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:16px}.tasks-head h1{margin:0 0 5px}.tasks-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px!important;margin-bottom:12px}.tasks-toolbar input{max-width:360px}.tasks-filters{display:flex;gap:4px;padding:4px;background:#ececf0;border-radius:12px}.tasks-filters button{min-height:34px;padding:7px 13px;border:0;border-radius:9px;background:transparent;color:#626268;font-weight:650}.tasks-filters button.active{background:#fff;color:#0071e3;box-shadow:0 1px 5px rgba(0,0,0,.1)}.tasks-summary{display:flex;gap:10px;margin:0 2px 12px;color:#77777d;font-size:13px}.tasks-summary span{padding:5px 9px;border-radius:99px;background:rgba(118,118,128,.09)}.tasks-summary .has-overdue{background:#fff0f1;color:#d70015}.task-editor-grid{grid-template-columns:1fr 1fr}.task-title-field,.task-description-field{grid-column:1/-1}.task-description-field textarea{resize:vertical}
html[data-theme="dark"] .tasks-filters{background:#2c2c2e}html[data-theme="dark"] .tasks-filters button{color:#a1a1a6}html[data-theme="dark"] .tasks-filters button.active{background:#48484a;color:#7dc0ff;box-shadow:none}html[data-theme="dark"] .tasks-summary{color:#a1a1a6}html[data-theme="dark"] .tasks-summary span{background:#242426}html[data-theme="dark"] .tasks-summary .has-overdue{background:rgba(255,69,58,.14);color:#ff6961}
@media(max-width:768px){.tasks-head{align-items:flex-start}.tasks-head .btn{width:auto!important;white-space:nowrap;padding-inline:14px!important}.tasks-toolbar{display:block}.tasks-filters{display:grid;grid-template-columns:repeat(3,1fr);margin-bottom:9px}.tasks-filters button{padding-inline:5px;font-size:12px}.tasks-toolbar input{max-width:none;width:100%}.task-editor-grid{grid-template-columns:1fr}.task-title-field,.task-description-field{grid-column:auto}}

/* ===== v16.120 — today's tasks on AI home ===== */
.ai-home-tasks-head{display:flex;align-items:center;justify-content:space-between;margin:15px 2px 8px}.ai-home-tasks-head h3{margin:0;font-size:16px;letter-spacing:-.02em}.ai-home-tasks-head button,.ai-home-tasks-more{border:0;background:transparent;color:#0071e3;padding:5px;font-weight:620}.ai-home-tasks{display:grid;gap:7px}.ai-home-task,.ai-home-tasks-empty{display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:10px;padding:11px 12px;background:#fff;border:1px solid rgba(60,60,67,.1);border-radius:14px;box-shadow:0 3px 12px rgba(0,0,0,.04)}.ai-home-task-check{width:26px;height:26px;padding:0;border:2px solid #b9bbc1;border-radius:50%;background:transparent}.ai-home-task-check:hover{border-color:#34c759;background:#eaf8ef}.ai-home-task-main{display:flex;min-width:0;flex-direction:column;align-items:flex-start;gap:3px;padding:0;border:0;background:transparent;text-align:left}.ai-home-task-main b{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#1d1d1f;font-size:14px}.ai-home-task-main small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#77777d;font-size:10px}.ai-home-task.overdue{border-color:rgba(215,0,21,.24)}.ai-home-task.overdue .ai-home-task-main small{color:#d70015}.ai-home-task-priority{width:23px;height:23px;display:grid;place-items:center;border-radius:50%;background:#fff0f1;color:#d70015;font-weight:800}.ai-home-tasks-empty{grid-template-columns:34px minmax(0,1fr) 34px;color:#248a3d}.ai-home-tasks-empty>span{width:32px;height:32px;display:grid;place-items:center;border-radius:50%;background:#eaf8ef;font-size:18px}.ai-home-tasks-empty div{display:flex;min-width:0;flex-direction:column}.ai-home-tasks-empty b{color:#333337;font-size:13px}.ai-home-tasks-empty small{margin-top:2px;color:#8e8e93;font-size:10px}.ai-home-tasks-empty button{width:32px;height:32px;padding:0;border:0;border-radius:50%;background:#eaf4ff;color:#0071e3;font-size:20px}.ai-home-tasks-more{width:100%;padding:8px}
html[data-theme="dark"] .ai-home-task,html[data-theme="dark"] .ai-home-tasks-empty{background:#1c1c1e;color:#f5f5f7;border-color:rgba(255,255,255,.12);box-shadow:none}html[data-theme="dark"] .ai-home-task-main b,html[data-theme="dark"] .ai-home-tasks-empty b{color:#f5f5f7}html[data-theme="dark"] .ai-home-task-main small,html[data-theme="dark"] .ai-home-tasks-empty small{color:#a1a1a6}html[data-theme="dark"] .ai-home-task.overdue{border-color:rgba(255,69,58,.32)}html[data-theme="dark"] .ai-home-task.overdue .ai-home-task-main small{color:#ff6961}html[data-theme="dark"] .ai-home-task-priority{background:rgba(255,69,58,.14);color:#ff6961}html[data-theme="dark"] .ai-home-tasks-empty>span{background:rgba(48,209,88,.14);color:#63d77b}html[data-theme="dark"] .ai-home-tasks-empty button{background:rgba(10,132,255,.16);color:#79baff}

/* ===== v16.121 — ChatGPT form dictation ===== */
.form-ai-dictation{display:flex;align-items:center;gap:11px;margin:0 0 15px;padding:10px;background:#f4f8ff;border:1px solid rgba(0,113,227,.14);border-radius:13px}.form-ai-dictation button{flex:0 0 auto;color:#0071e3!important;border-color:rgba(0,113,227,.22)!important}.form-ai-dictation span{color:#64748b;font-size:12px;line-height:1.35}.form-ai-dictation button:disabled{opacity:.6}
html[data-theme="dark"] .form-ai-dictation{background:rgba(10,132,255,.1);border-color:rgba(10,132,255,.22)}html[data-theme="dark"] .form-ai-dictation button{background:#2c2c2e!important;color:#79baff!important}html[data-theme="dark"] .form-ai-dictation span{color:#aebdd0}
@media(max-width:560px){.form-ai-dictation{align-items:stretch;flex-direction:column}.form-ai-dictation button{width:100%}.form-ai-dictation span{text-align:center}}

/* ===== v16.122 — material from product photo or URL ===== */
.material-ai-source{margin:0 0 15px;padding:13px;background:#fbfbfd;border:1px solid rgba(60,60,67,.12);border-radius:14px}.material-ai-source-title{display:flex;flex-direction:column;gap:3px;margin-bottom:10px}.material-ai-source-title b{font-size:14px}.material-ai-source-title span,.material-ai-source-status{color:#77777d;font-size:11px}.material-ai-source-actions{display:grid;grid-template-columns:auto minmax(0,1fr);gap:9px}.material-link-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px}.material-link-row input{min-width:0}.material-ai-source-status:not(:empty){margin-top:9px;padding-top:9px;border-top:1px solid rgba(60,60,67,.1)}
html[data-theme="dark"] .material-ai-source{background:#242426;border-color:rgba(255,255,255,.12)}html[data-theme="dark"] .material-ai-source-title span,html[data-theme="dark"] .material-ai-source-status{color:#a1a1a6}html[data-theme="dark"] .material-ai-source-status:not(:empty){border-color:rgba(255,255,255,.1)}
@media(max-width:680px){.material-ai-source-actions,.material-link-row{grid-template-columns:1fr}.material-ai-source-actions>button,.material-link-row button{width:100%}}

/* ===== v16.123 — tool handover register ===== */
.tools-list{display:grid;gap:10px}.tool-card{display:grid;grid-template-columns:100px minmax(0,1fr) auto;gap:14px;align-items:start;padding:14px!important}.tool-card-photo{width:100px;height:86px;object-fit:cover;border-radius:11px;background:#eef1f5}.tool-card-photo.placeholder{display:grid;place-items:center;font-size:34px}.tool-card-title{font-size:17px;font-weight:740}.tool-card-recipient{margin-top:5px;color:#626268;font-size:13px}.tool-card-notes{margin-top:8px;color:#77777d;font-size:12px;white-space:pre-wrap}.tool-card.returned{opacity:.72}.tool-card-actions{display:flex;flex-direction:column;gap:6px}.tool-card-actions button{min-height:34px;padding:7px 10px!important}.tool-notes-field{grid-column:1/-1}.tool-photo-editor{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:14px 0}.tool-photo-editor img{width:150px;height:110px;object-fit:cover;border-radius:12px;border:1px solid rgba(60,60,67,.12)}.tool-photo-editor .small{flex-basis:100%}
html[data-theme="dark"] .tool-card-recipient,html[data-theme="dark"] .tool-card-notes{color:#b8b8bd}html[data-theme="dark"] .tool-card-photo{background:#2c2c2e;border-color:rgba(255,255,255,.12)}
@media(max-width:680px){.tool-card{grid-template-columns:76px minmax(0,1fr)}.tool-card-photo{width:76px;height:70px}.tool-card-actions{grid-column:1/-1;flex-direction:row;flex-wrap:wrap}.tool-card-actions button{flex:1}.tool-photo-editor{align-items:stretch;flex-direction:column}.tool-photo-editor>button{width:100%}.tool-photo-editor img{width:100%;height:190px}}

/* ===== v16.124 — workers and protected passport OCR ===== */
.workers-list{display:grid;gap:10px}.worker-card{display:grid;grid-template-columns:52px minmax(0,1fr) auto;align-items:center;gap:13px;padding:14px!important}.worker-avatar{width:48px;height:48px;display:grid;place-items:center;border-radius:50%;background:#eaf4ff;color:#0071e3;font-size:21px;font-weight:760}.worker-name{font-size:16px;font-weight:740}.worker-role{margin-top:3px;color:#77777d;font-size:12px}.worker-actions{display:flex;gap:6px;flex-wrap:wrap}.worker-actions button{min-height:34px;padding:7px 10px!important}.worker-passport-box{margin:15px 0;padding:14px;background:#fff8e8;border:1px solid #efd89b;border-radius:14px}.worker-passport-actions{display:flex;gap:8px;flex-wrap:wrap;margin:11px 0}.worker-passport-box>img{display:block;width:min(100%,420px);max-height:260px;object-fit:contain;margin:10px auto;border-radius:12px;background:#111}.worker-consent{display:flex!important;align-items:flex-start!important;gap:9px!important;margin-top:10px;color:#66561f!important;font-size:11px!important;line-height:1.4}.worker-consent input{flex:0 0 auto;width:18px!important;height:18px!important;min-height:18px!important;margin-top:1px}.worker-passport-box .small{margin-top:7px}
html[data-theme="dark"] .worker-avatar{background:rgba(10,132,255,.16);color:#79baff}html[data-theme="dark"] .worker-role{color:#a1a1a6}html[data-theme="dark"] .worker-passport-box{background:#302918;border-color:#5d5028}html[data-theme="dark"] .worker-consent{color:#f0d98a!important}
@media(max-width:680px){.worker-card{grid-template-columns:44px minmax(0,1fr)}.worker-avatar{width:42px;height:42px}.worker-actions{grid-column:1/-1}.worker-actions button{flex:1}.worker-passport-actions{display:grid;grid-template-columns:1fr}.worker-passport-actions button{width:100%}}

/* ===== v17.0 — object-first workspace ===== */
.objects-list{display:grid;gap:12px}

@media(max-width:680px){.objects-list{gap:9px}}

/* ===== v17.1 — object card sections ===== */



/* ===== v17.2 — current object first ===== */




/* ===== v17.4 — current estimate card ===== */
.ai-home-current-buttons{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:10px}.ai-home-current-value .ai-home-current-buttons button{margin-top:0}.ai-home-current-value .ai-home-current-buttons .documents{background:#fff;color:#0071e3;border:1px solid rgba(0,113,227,.28)}html[data-theme="dark"] .ai-home-current-value .ai-home-current-buttons .documents{background:#2c2c2e;color:#79baff;border-color:rgba(121,186,255,.3)}
@media(max-width:440px){.ai-home-current-buttons{grid-template-columns:1fr}}


/* ===== v17.5 — workers and tools accordions on object home ===== */








.ai-home-mini-avatar{width:34px;height:34px;display:grid;place-items:center;border-radius:50%;background:#eaf4ff;color:#0071e3;font-size:14px;font-weight:760}.ai-home-mini-avatar.tool{border-radius:10px;background:#fff4e5;font-size:16px}


html[data-theme="dark"] .ai-home-mini-avatar{background:rgba(10,132,255,.16);color:#79baff}html[data-theme="dark"] .ai-home-mini-avatar.tool{background:rgba(255,159,10,.15)}



/* ===== v17.6 — one-tap calls to workers and customers ===== */
.phone-field-row{display:flex;align-items:stretch;gap:7px;width:100%;margin-top:6px}.phone-field-row input{min-width:0;flex:1;margin-top:0!important}.phone-call-btn{flex:0 0 auto;min-height:42px;padding:0 13px;border:1px solid rgba(0,113,227,.25);border-radius:11px;background:#eaf4ff;color:#0071e3;font-size:12px;font-weight:720;white-space:nowrap;cursor:pointer}.phone-call-btn:hover{background:#dcedff}.inline-phone-link{padding:4px 8px;border:0;border-radius:99px;background:#eaf4ff;color:#0071e3;font-size:11px;font-weight:700;cursor:pointer}.worker-actions .phone-worker-action{background:#34c759!important;color:#fff!important}
html[data-theme="dark"] .phone-call-btn{background:rgba(10,132,255,.16);color:#79baff;border-color:rgba(121,186,255,.26)}html[data-theme="dark"] .phone-call-btn:hover{background:rgba(10,132,255,.24)}html[data-theme="dark"] .inline-phone-link{background:rgba(10,132,255,.16);color:#79baff}
@media(max-width:440px){.phone-call-btn span{display:none}.phone-call-btn{width:44px;padding:0;font-size:17px}.worker-actions .phone-worker-action{flex:1 1 100%}}


/* Строй OS v18.2 — AI‑Прораб */
.ai-foreman-fab{position:fixed;right:22px;bottom:86px;z-index:1200;width:124px;height:124px;border-radius:50%;border:0;display:grid;place-items:center;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;background:#0a84ff;color:#fff;box-shadow:0 14px 34px rgba(10,132,255,.34);font-weight:800}
.ai-foreman-fab:hover{transform:translateY(-1px)}
.ai-foreman-fab.dragging{cursor:grabbing;transform:none;box-shadow:0 18px 42px rgba(10,132,255,.42)}
.ai-foreman-fab-icon{display:grid;place-items:center;width:84px;height:84px;border-radius:50%;background:rgba(255,255,255,.16);font-size:28px;letter-spacing:.02em}
.ai-foreman-box{max-width:760px;width:min(760px,calc(100vw - 24px));height:min(760px,88vh);display:flex;flex-direction:column;overflow:hidden}
.ai-foreman-head{flex:0 0 auto}
.ai-foreman-title{display:flex;align-items:center;gap:11px}
.ai-foreman-avatar,.ai-foreman-message-avatar{display:grid;place-items:center;border-radius:50%;background:#0a84ff;color:white;font-weight:800}
.ai-foreman-avatar{width:42px;height:42px}
.ai-foreman-context{display:flex;gap:8px;flex-wrap:wrap;padding:0 0 12px}
.ai-foreman-context span{font-size:12px;padding:7px 10px;border-radius:999px;background:var(--soft,#eef3f8);color:var(--text,#172033)}
.ai-foreman-conversation{flex:1;overflow:auto;padding:10px 2px 14px;display:flex;flex-direction:column;gap:12px}
.ai-foreman-welcome{padding:18px;border:1px dashed var(--border,#dfe5ec);border-radius:16px;line-height:1.45}
.ai-foreman-welcome .small{margin-top:6px}
.ai-foreman-message{display:flex;gap:8px;align-items:flex-start;max-width:88%}
.ai-foreman-message.user{align-self:flex-end;justify-content:flex-end}
.ai-foreman-message.assistant{align-self:flex-start}
.ai-foreman-message-avatar{width:28px;height:28px;flex:0 0 28px;font-size:11px;margin-top:3px}
.ai-foreman-bubble{padding:11px 13px;border-radius:16px;line-height:1.48;background:var(--soft,#eef3f8);white-space:normal}
.ai-foreman-message.user .ai-foreman-bubble{background:#0a84ff;color:white;border-bottom-right-radius:5px}
.ai-foreman-message.assistant .ai-foreman-bubble{border-bottom-left-radius:5px}
.ai-foreman-message.pending .ai-foreman-bubble{opacity:.62}
.ai-foreman-voice-status{min-height:20px;padding:2px 2px 7px}
.ai-foreman-compose{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:end;border-top:1px solid var(--border,#dfe5ec);padding-top:12px}
.ai-foreman-compose textarea{resize:none;min-height:72px;max-height:150px}
.ai-foreman-compose-actions{display:flex;flex-direction:column;gap:8px}
.ai-foreman-compose-actions button{min-width:126px}
.ai-foreman-disclaimer{padding-top:9px;line-height:1.35;opacity:.8}
body.dark .ai-foreman-context span,body[data-theme="dark"] .ai-foreman-context span,
body.dark .ai-foreman-bubble,body[data-theme="dark"] .ai-foreman-bubble{background:var(--soft,#1f2937)}
body.dark .ai-foreman-message.user .ai-foreman-bubble,body[data-theme="dark"] .ai-foreman-message.user .ai-foreman-bubble{background:#0a84ff}
@media(max-width:720px){
 .ai-foreman-fab{right:16px;bottom:82px;width:112px;height:112px}
 .ai-foreman-box{width:100vw;max-width:none;height:100dvh;max-height:100dvh;border-radius:0;padding:16px}
 .ai-foreman-compose{grid-template-columns:1fr}
 .ai-foreman-compose-actions{flex-direction:row}
 .ai-foreman-compose-actions button{flex:1;min-width:0}
 .ai-foreman-message{max-width:94%}
}


/* Строй OS v18.4 — AI‑Прораб: исправление читаемости ответов в тёмной теме */
.ai-foreman-message.assistant .ai-foreman-bubble{
  background:#f2f4f7;
  color:#172033;
}
body.dark .ai-foreman-message.assistant .ai-foreman-bubble,
body[data-theme="dark"] .ai-foreman-message.assistant .ai-foreman-bubble{
  background:#20242b !important;
  color:#f4f7fb !important;
  border:1px solid rgba(255,255,255,.08);
}
body.dark .ai-foreman-message.assistant .ai-foreman-bubble *,
body[data-theme="dark"] .ai-foreman-message.assistant .ai-foreman-bubble *{
  color:inherit !important;
  background:transparent !important;
}
body.dark .ai-foreman-welcome,
body[data-theme="dark"] .ai-foreman-welcome{
  background:#1c1e22;
  color:#f4f7fb;
  border-color:rgba(255,255,255,.55);
}
body.dark .ai-foreman-welcome .small,
body[data-theme="dark"] .ai-foreman-welcome .small{
  color:#aeb7c5;
}
body.dark .ai-foreman-context span,
body[data-theme="dark"] .ai-foreman-context span{
  background:#20242b !important;
  color:#dce3ed !important;
  border:1px solid rgba(255,255,255,.08);
}

/* Строй OS v18.5 — AI‑Прораб: диктовка в фокусе по умолчанию */
.ai-foreman-mic-btn:focus,
.ai-foreman-mic-btn:focus-visible{
  outline:3px solid rgba(10,132,255,.38);
  outline-offset:2px;
  border-color:#0a84ff;
  box-shadow:0 0 0 5px rgba(10,132,255,.12);
}

/* Строй OS v18.6 — монохромные иконки ресурсов объекта */




/* Строй OS v18.7 — действия AI‑Прораба внутри программы */
.ai-foreman-actions{display:grid;gap:9px;margin-top:12px;padding-top:11px;border-top:1px solid rgba(127,127,127,.22)}
.ai-foreman-action-card{display:grid;grid-template-columns:34px 1fr auto;gap:10px;align-items:center;padding:11px;border:1px solid var(--border,#dfe5ec);border-radius:13px;background:var(--panel,#fff)}
.ai-foreman-action-icon{display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:rgba(10,132,255,.12);color:#0a84ff;font-size:16px}
.ai-foreman-action-main{display:grid;gap:3px;min-width:0}
.ai-foreman-action-main b{font-size:13px}
.ai-foreman-action-main small{font-size:12px;color:var(--muted,#738096);overflow-wrap:anywhere}
.ai-foreman-action-run{white-space:nowrap;padding:8px 11px;font-size:12px}
.ai-foreman-action-card.done{border-color:rgba(35,160,85,.35)}
.ai-foreman-action-card.done .ai-foreman-action-icon{background:rgba(35,160,85,.12);color:#239f55}
.ai-foreman-action-error{grid-column:2/-1;font-size:12px;color:#c43b3b}
body.dark .ai-foreman-action-card,body[data-theme="dark"] .ai-foreman-action-card{background:#171b21;border-color:rgba(255,255,255,.10)}
body.dark .ai-foreman-action-main small,body[data-theme="dark"] .ai-foreman-action-main small{color:#aeb7c5 !important}
@media(max-width:720px){
 .ai-foreman-action-card{grid-template-columns:32px 1fr}
 .ai-foreman-action-run{grid-column:1/-1;width:100%}
}

/* Строй OS v18.8 — выбор ранее заведённого работника компании */
.worker-company-picker{display:grid;gap:6px;padding:14px;margin-bottom:14px;border:1px solid var(--border,#dfe5ec);border-radius:14px;background:var(--soft-panel,#f8fafc)}
.worker-company-picker label{display:grid;gap:7px;font-weight:700}
.worker-company-picker select{width:100%}
body.dark .worker-company-picker,body[data-theme="dark"] .worker-company-picker{background:#171b21;border-color:rgba(255,255,255,.10)}


/* ===== Строй OS v18.9 — desktop = новая объектная логика мобильного интерфейса ===== */
@media(min-width:769px){
  /* Убираем старое левое меню: основные разделы те же, что на телефоне */
  .layout{
    display:block!important;
    min-height:calc(100vh - 64px)!important;
  }
  .layout>aside{display:none!important}

  /* Единая постоянная навигация: Объекты / Карточка / Работы / Материалы / Ещё */
  #mobilePersistentTabs.foreman-five-tabs{
    position:sticky!important;
    top:64px!important;
    z-index:110!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(128px,190px))!important;
    justify-content:center!important;
    gap:8px!important;
    width:100%!important;
    margin:0!important;
    padding:10px clamp(24px,4vw,56px)!important;
    box-sizing:border-box!important;
    background:rgba(247,247,249,.94)!important;
    border-bottom:1px solid rgba(60,60,67,.12)!important;
    box-shadow:0 5px 18px rgba(0,0,0,.035)!important;
    backdrop-filter:blur(22px)!important;
    -webkit-backdrop-filter:blur(22px)!important;
  }
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs{
    background:rgba(13,20,31,.95)!important;
    border-color:rgba(255,255,255,.10)!important;
  }
  #mobilePersistentTabs.foreman-five-tabs>button,
  #mobilePersistentTabs.foreman-five-tabs>button:not(.context-hidden){
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:center!important;
    gap:9px!important;
    min-width:0!important;
    min-height:48px!important;
    padding:8px 14px!important;
    border:0!important;
    border-radius:14px!important;
    background:transparent!important;
    color:#6e6e73!important;
    box-shadow:none!important;
    font-size:14px!important;
    font-weight:650!important;
  }
  #mobilePersistentTabs.foreman-five-tabs>button:hover{
    background:rgba(118,118,128,.08)!important;
    color:#1d1d1f!important;
  }
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs>button:hover{
    color:#f5f5f7!important;
    background:rgba(255,255,255,.07)!important;
  }
  #mobilePersistentTabs.foreman-five-tabs>button.active{
    background:#fff!important;
    color:#0071e3!important;
    box-shadow:0 3px 12px rgba(0,0,0,.075)!important;
  }
  html[data-theme="dark"] #mobilePersistentTabs.foreman-five-tabs>button.active{
    background:#1c2738!important;
    color:#79baff!important;
    box-shadow:none!important;
  }
  
  #mobilePersistentTabs.foreman-five-tabs .ais-tab-icon,
  #mobilePersistentTabs.foreman-five-tabs .foreman-more-icon svg{
    width:24px!important;height:24px!important;fill:none;stroke:currentColor;stroke-width:1.75
  }
  #mobilePersistentTabs.foreman-five-tabs .foreman-more-icon svg circle{fill:currentColor;stroke:none}

  main{
    width:min(1480px,100%)!important;
    max-width:1480px!important;
    margin:0 auto!important;
    padding:30px clamp(28px,4vw,58px) 70px!important;
    box-sizing:border-box!important;
  }

  /* Карточка объекта на десктопе использует тот же дашборд прораба */
  #estimates>.estimates-hub-head,
  #estimates>.estimates-hub-actions{display:none!important}
  #foremanDashboard.foreman-dashboard{
    display:grid!important;
    grid-template-columns:minmax(0,1.05fr) minmax(430px,.95fr)!important;
    column-gap:24px!important;
    align-items:start!important;
  }
  #foremanDashboard .ai-home-greeting,
  #foremanDashboard .ai-home-dictate,
  #foremanDashboard .ai-home-secondary,
  #foremanDashboard .ai-home-current-card{
    grid-column:1!important;
  }
  #foremanDashboard .ai-home-label, #foremanDashboard .ai-home-stats, #foremanDashboard .ai-home-tasks-head, #foremanDashboard .ai-home-tasks{
    grid-column:2!important;
  }
  #foremanDashboard .ai-home-label{
    grid-row:1!important;
    margin:14px 2px 10px!important;
  }
  #foremanDashboard .ai-home-stats{grid-row:2!important}
  #foremanDashboard .ai-home-tasks-head{grid-row:3!important}
  #foremanDashboard .ai-home-tasks{grid-row:4!important}
  #foremanDashboard #aiHomeWorkersPanel{grid-row:5!important}
  #foremanDashboard #aiHomeToolsPanel{grid-row:6!important}

  .ai-home-greeting{margin:12px 2px 20px!important}
  .ai-home-greeting h1{font-size:38px!important}
  .ai-home-greeting p{font-size:17px!important}
  .ai-home-dictate{
    min-height:88px!important;border-radius:20px!important;font-size:19px!important;
  }
  .ai-home-secondary{gap:12px!important;margin:12px 0 18px!important}
  .ai-home-secondary button{min-height:68px!important;border-radius:17px!important;font-size:14px!important}
  .ai-home-current-card{padding:22px!important;border-radius:22px!important}
  .ai-home-current-head h2{font-size:21px!important}
  .ai-home-current-body{grid-template-columns:128px minmax(0,1fr)!important;gap:22px!important}
  .ai-home-current-value>strong{font-size:34px!important}
  .ai-home-current-buttons{display:grid!important;grid-template-columns:1fr 1fr!important;gap:9px!important}
  .ai-home-current-value button{min-height:46px!important}
  .ai-home-stats{padding:15px 8px!important;border-radius:19px!important}
  .ai-home-stats b{font-size:25px!important}
  .ai-home-tasks{min-height:88px}
  
  
  

  /* Список смет остаётся частью карточки объекта, но без старого отдельного заголовка */
  #estimates>.estimates-search-card{
    margin-top:24px!important;
    padding:8px 10px!important;
    border-radius:15px!important;
  }
  #estimates>.estimates-search-card input{
    min-height:48px!important;
    border-radius:12px!important;
  }
  #estimatesHubList{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:14px!important;
    margin-top:14px!important;
  }
  #estimatesHubList .estimate-hub-card{margin:0!important;height:100%;box-sizing:border-box}

  /* Объекты: текущий объект сверху, остальные удобной сеткой */
  
  
  

  /* Работы и материалы сохраняют desktop-плотность, но визуально соответствуют новому интерфейсу */
  #works .section-title h1,#materials .section-title h1{margin-bottom:3px!important}
  #works>.toolbar input,#materials>.toolbar input{
    min-height:46px!important;border-radius:13px!important;
  }
}

/* Средний desktop / планшет landscape */
@media(min-width:769px) and (max-width:1100px){
  #mobilePersistentTabs.foreman-five-tabs{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    padding-inline:18px!important;
  }
  #mobilePersistentTabs.foreman-five-tabs>button{font-size:12px!important;padding-inline:8px!important}
  #foremanDashboard.foreman-dashboard{
    grid-template-columns:1fr!important;
  }
  #foremanDashboard .ai-home-greeting, #foremanDashboard .ai-home-dictate, #foremanDashboard .ai-home-secondary, #foremanDashboard .ai-home-current-card, #foremanDashboard .ai-home-label, #foremanDashboard .ai-home-stats, #foremanDashboard .ai-home-tasks-head, #foremanDashboard .ai-home-tasks{
    grid-column:1!important;
    grid-row:auto!important;
  }
  #estimatesHubList{grid-template-columns:1fr!important}
}

/* Строй OS v19.0 — командный центр «Сегодня» */
.today-command-center{margin:0 0 14px;padding:16px;border:1px solid rgba(60,60,67,.12);border-radius:20px;background:linear-gradient(145deg,#fff,#f7faff);box-shadow:0 5px 22px rgba(0,70,150,.06)}
.today-command-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.today-command-head>div{display:flex;min-width:0;flex-direction:column}.today-command-head b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px}.today-command-head small{margin-top:2px;color:#77777d;font-size:11px}.today-command-head>button{border:0;border-radius:10px;padding:8px 10px;background:#eaf4ff;color:#0071e3;font-weight:700;cursor:pointer}
.today-command-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.today-command-grid>button{display:flex;min-width:0;min-height:88px;flex-direction:column;align-items:flex-start;justify-content:center;padding:12px;border:1px solid rgba(60,60,67,.09);border-radius:15px;background:#fff;text-align:left;cursor:pointer}.today-command-grid strong{font-size:23px;line-height:1}.today-command-grid span{margin-top:5px;font-size:12px;font-weight:700}.today-command-grid small{margin-top:3px;color:#8e8e93;font-size:10px}.today-quick-actions{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-top:10px}.today-quick-actions button{min-height:38px;border:0;border-radius:11px;background:#f0f1f4;color:#333337;font-weight:700;cursor:pointer}.today-quick-actions button.primary{background:#0071e3;color:#fff}
html[data-theme="dark"] .today-command-center{background:linear-gradient(145deg,#1c1c1e,#20252b);border-color:rgba(255,255,255,.11);box-shadow:none}html[data-theme="dark"] .today-command-grid>button{background:#29292c;color:#f5f5f7;border-color:rgba(255,255,255,.09)}html[data-theme="dark"] .today-command-head small,html[data-theme="dark"] .today-command-grid small{color:#a1a1a6}html[data-theme="dark"] .today-command-head>button{background:rgba(10,132,255,.16);color:#79baff}html[data-theme="dark"] .today-quick-actions button{background:#2c2c2e;color:#e5e5ea}html[data-theme="dark"] .today-quick-actions button.primary{background:#0a84ff;color:#fff}
@media(max-width:680px){.today-command-grid{grid-template-columns:1fr 1fr}.today-quick-actions{grid-template-columns:1fr 1fr}.today-command-center{padding:13px;border-radius:18px}.today-command-grid>button{min-height:78px}}
/* Строй OS v19.1 — быстрые голосовые команды AI‑Прораба */
.ai-foreman-command-hints{display:flex;gap:8px;overflow:auto;padding:4px 0 8px}.ai-foreman-command-hints button{white-space:nowrap;border:1px solid var(--border,#d9dde5);background:var(--surface,#fff);color:inherit;border-radius:999px;padding:7px 11px;font:inherit;font-size:12px}.ai-foreman-command-hints button:active{transform:scale(.98)}

/* ===== v19.3 — readable "Состав работ" in dark theme ===== */
html[data-theme="dark"] .work-tree-section-subworks td,
html[data-theme="dark"] .work-tree-section-materials td,
html[data-theme="dark"] .work-tree-section-head td{
  background:#20283a!important;
  color:#f3f6fb!important;
  border-color:#34445e!important;
}
html[data-theme="dark"] .work-tree-section-toggle,
html[data-theme="dark"] .work-tree-section-title{
  color:#f5f7fb!important;
}
html[data-theme="dark"] .work-tree-section-plus{
  background:#2b3850!important;
  border-color:#536783!important;
  color:#ffffff!important;
}
html[data-theme="dark"] .work-tree-section-count{
  background:#34445e!important;
  color:#eef4ff!important;
}
html[data-theme="dark"] .work-tree-subwork-item td{
  background:#111b2d!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] .work-tree-subwork-item td:nth-child(2),
html[data-theme="dark"] .work-tree-section-add td:nth-child(2){
  border-left-color:#3d5577!important;
}
html[data-theme="dark"] .work-tree-section-add td{
  background:#111b2d!important;
  color:#e8eef8!important;
}
html[data-theme="dark"] .work-tree-section-add button{
  color:#8fbdff!important;
}


/* ===== v19.5 — material supply + receipts ===== */



.form-grid{display:grid;grid-template-columns:2fr 1fr 1fr;gap:10px}.form-grid label{display:grid;gap:6px}.form-grid input{width:100%}
@media(max-width:700px){.form-grid{grid-template-columns:1fr}}


/* v20.0 — полноэкранный режим AI‑Прораба, камера и пакетные действия */
.ai-foreman-head-actions{display:flex;gap:8px;align-items:center}.ai-foreman-modal.foreman-fullscreen .ai-foreman-box{width:100vw;max-width:none;height:100dvh;max-height:100dvh;border-radius:0;margin:0}.ai-foreman-modal.foreman-fullscreen{padding:0}.ai-foreman-batch-bar{padding:10px 12px;border-radius:14px;background:var(--panel,#f5f5f7);margin-bottom:8px;display:flex;gap:8px;align-items:center;justify-content:space-between}.ai-foreman-batch-bar[hidden]{display:none}.ai-foreman-camera-btn{min-width:110px}.ai-foreman-photo-message{max-width:220px;border-radius:14px;display:block;margin-top:8px}.ai-foreman-action-card.selected{outline:2px solid var(--accent,#0a84ff)}


.ai-foreman-voice-modal{z-index:2200}
.ai-foreman-voice-box{max-width:520px}
.ai-cloud-voice-list{display:grid;gap:8px;margin:12px 0}
.ai-cloud-voice-card{display:flex;align-items:stretch;border:1px solid var(--border,#d9dde5);border-radius:14px;overflow:hidden;background:var(--card,#fff)}
.ai-cloud-voice-card.selected{outline:2px solid var(--accent,#2563eb);outline-offset:-2px}
.ai-cloud-voice-main{border:0;background:transparent;color:inherit;display:flex;align-items:center;gap:10px;text-align:left;flex:1;padding:12px;min-width:0}
.ai-cloud-voice-main small{display:block;margin-top:3px;opacity:.7}
.ai-cloud-voice-check{width:24px;height:24px;display:grid;place-items:center;border-radius:50%;background:rgba(127,127,127,.12);font-weight:700}
.ai-cloud-voice-preview{margin:8px;min-width:46px}
.ai-cloud-voice-note{margin-top:12px;line-height:1.45}

.task-workers-panel{margin-bottom:14px}
.task-workers-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.task-workers-head>span{min-width:30px;height:30px;border-radius:999px;display:grid;place-items:center;background:rgba(127,127,127,.12);font-weight:700}
.task-workers-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px}
.task-worker-chip{border:1px solid var(--border,#d9dde5);background:var(--card,#fff);color:inherit;border-radius:12px;padding:8px 10px;display:grid;grid-template-columns:30px auto;grid-template-rows:auto auto;text-align:left;gap:1px 8px;min-width:max-content}
.task-worker-chip>span{grid-row:1/3;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:rgba(127,127,127,.14);font-weight:700}
.task-worker-chip small{opacity:.7}
.task-responsible{font-weight:600}
.task-responsible.unassigned{opacity:.55;font-weight:400}

.task-editor-grid .task-responsible-field{grid-column:1/-1;padding:12px;border:1px solid var(--line,#d9dde5);border-radius:12px;background:rgba(127,127,127,.055)}
.task-editor-grid .task-responsible-field>span{font-size:13px;font-weight:700;color:var(--text,#111827)}
.task-editor-grid .task-responsible-field select{width:100%;min-height:44px;font-size:15px}
.task-editor-grid .task-responsible-field small{font-size:11px;opacity:.72}
html[data-theme="dark"] .task-editor-grid .task-responsible-field{background:#242426;border-color:#3a3a3c}
html[data-theme="dark"] .task-editor-grid .task-responsible-field>span{color:#f5f5f7}

.worker-notification-box{margin:14px 0;padding:12px;border:1px solid var(--line,#d9dde5);border-radius:12px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.worker-notification-box>div{margin-right:auto}
.worker-notification-toggle{display:flex;align-items:center;gap:7px;font-size:14px;font-weight:600}
.worker-notification-toggle input{width:18px;height:18px}

html[data-theme="dark"] .worker-notification-box{border-color:#3a3a3c;background:#242426}

@media(max-width:640px){.worker-notification-box{align-items:flex-start}.worker-notification-box>div{width:100%}}





.worker-telegram-connect{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.worker-telegram-connect .small{min-width:145px}
@media(max-width:640px){.worker-telegram-connect{width:100%}.worker-telegram-connect button{flex:1}}

.company-status-badge{display:inline-flex;align-items:center;gap:4px;padding:3px 7px;border-radius:999px;font-size:11px;font-weight:800;line-height:1.2;vertical-align:middle;white-space:nowrap}
.company-status-verified{background:rgba(52,199,89,.14);color:#1d7f38;border:1px solid rgba(52,199,89,.28)}
.company-status-review{background:rgba(255,159,10,.14);color:#9a5d00;border:1px solid rgba(255,159,10,.3)}
.company-status-new{background:rgba(120,120,128,.12);color:#666;border:1px solid rgba(120,120,128,.22)}
html[data-theme="dark"] .company-status-verified{color:#70e58a;background:rgba(48,209,88,.15)}
html[data-theme="dark"] .company-status-review{color:#ffd27a;background:rgba(255,159,10,.16)}
html[data-theme="dark"] .company-status-new{color:#c7c7cc;background:rgba(142,142,147,.15)}
#currentCompanyButton .company-status-badge{margin-left:4px}
@media(max-width:768px){.company-admin-row{grid-template-columns:1fr!important}.company-admin-row>div,.company-admin-row>label{width:100%}}

.account-user-form{grid-template-columns:repeat(auto-fit,minmax(145px,1fr))!important}

/* Строй OS v21.7 — живая визуализация диктовки AI‑прораба */
.ai-foreman-recording-viz{
  margin:10px 0 12px;padding:12px 14px;border-radius:18px;
  background:rgba(10,132,255,.07);border:1px solid rgba(10,132,255,.14);
}
.ai-foreman-recording-top{display:flex;align-items:center;gap:8px;font-size:13px}
.ai-foreman-recording-top b{font-size:13px}
#aiForemanRecordingTimer{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--muted,#738096)}
.ai-foreman-recording-dot{width:9px;height:9px;border-radius:50%;background:#ff453a;box-shadow:0 0 0 0 rgba(255,69,58,.35);animation:aiForemanRecPulse 1.25s infinite}
.ai-foreman-waveform{height:54px;margin-top:8px;display:flex;align-items:center;justify-content:center;gap:3px;overflow:hidden}
.ai-foreman-wave-bar{display:block;width:4px;min-height:6px;max-height:48px;border-radius:999px;background:currentColor;color:#0a84ff;transition:height .08s linear,opacity .08s linear;transform-origin:center}
.ai-foreman-recording-viz[data-mode="processing"] .ai-foreman-recording-dot{background:#0a84ff;animation:aiForemanRecPulse .8s infinite}
.ai-foreman-recording-viz[data-mode="processing"] .ai-foreman-wave-bar{animation:aiForemanProcessingWave .9s ease-in-out infinite alternate}
.ai-foreman-recording-viz[data-mode="processing"] .ai-foreman-wave-bar:nth-child(3n){animation-delay:.12s}
.ai-foreman-recording-viz[data-mode="processing"] .ai-foreman-wave-bar:nth-child(4n){animation-delay:.24s}
@keyframes aiForemanRecPulse{0%{box-shadow:0 0 0 0 rgba(255,69,58,.35)}70%{box-shadow:0 0 0 7px rgba(255,69,58,0)}100%{box-shadow:0 0 0 0 rgba(255,69,58,0)}}
@keyframes aiForemanProcessingWave{from{transform:scaleY(.55);opacity:.4}to{transform:scaleY(1.3);opacity:1}}
html[data-theme="dark"] .ai-foreman-recording-viz,body.dark .ai-foreman-recording-viz{background:rgba(10,132,255,.11);border-color:rgba(100,180,255,.18)}
@media(max-width:640px){
 .ai-foreman-recording-viz{margin:8px 0 10px;padding:11px 12px;border-radius:16px}
 .ai-foreman-waveform{height:48px;gap:2.5px}
 .ai-foreman-wave-bar{width:3.5px}
}

/* Строй OS v21.8 — редактирование учётной записи пользователя */
.account-user-edit-overlay{position:fixed;inset:0;z-index:140000;background:rgba(18,24,33,.48);display:grid;place-items:center;padding:18px;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.account-user-edit-card{width:min(620px,100%);max-height:92vh;overflow:auto;background:var(--panel,#fff);color:var(--text,#172033);border-radius:22px;padding:22px;box-shadow:0 30px 90px rgba(0,0,0,.24)}
.account-user-edit-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}
.account-user-edit-head h3{margin:0 0 4px;font-size:22px}
.account-user-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}
.account-user-edit-grid label{display:grid;gap:6px;font-size:13px;font-weight:700}
.account-user-edit-grid input,.account-user-edit-grid select{width:100%;box-sizing:border-box;min-height:44px;padding:10px 12px;border:1px solid var(--border,#d8e0e9);border-radius:11px;background:var(--panel,#fff);color:inherit}
.account-user-edit-password{grid-column:1/-1}
.account-user-edit-password small{font-weight:500;color:var(--muted,#738096)}
.account-user-edit-error{min-height:20px;margin-top:10px;color:#b42318;font-size:13px}
.account-user-edit-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:12px}
html[data-theme="dark"] .account-user-edit-card,body.dark .account-user-edit-card{background:#171b21;color:#f4f7fb}
html[data-theme="dark"] .account-user-edit-grid input,html[data-theme="dark"] .account-user-edit-grid select,body.dark .account-user-edit-grid input,body.dark .account-user-edit-grid select{background:#20242b;border-color:rgba(255,255,255,.12);color:#f4f7fb}
@media(max-width:640px){.account-user-edit-overlay{padding:0;align-items:end}.account-user-edit-card{width:100%;max-height:94vh;border-radius:22px 22px 0 0;padding:18px}.account-user-edit-grid{grid-template-columns:1fr}.account-user-edit-password{grid-column:auto}.account-user-edit-actions button{flex:1}}

/* Строй ОС v21.11 — быстрый первый кадр и тема без светлой вспышки */
html{background:#f5f6f8;color-scheme:light}
html[data-theme="dark"]{background:#0d141f;color-scheme:dark}
html[data-theme="dark"] body{background:#0d141f}
html[data-theme="light"] body{background:#f5f6f8}
@media (prefers-reduced-motion:no-preference){
  html:not(.ais-app-ready) *,html:not(.ais-app-ready) *::before,html:not(.ais-app-ready) *::after{
    transition-duration:0s!important;
    animation-delay:0s!important;
  }
}


/* ===== Строй ОС v21.12 — мобильное дерево работ без горизонтального скролла ===== */
@media(max-width:768px){
  #works,
  #works .works-tree-card,
  #works .works-tree-card > *,
  #works .works-tree-table,
  #works .works-tree-table tbody{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  #works{overflow-x:hidden!important}
  #works .works-tree-card{
    overflow:visible!important;
    padding:0!important;
  }
  #works .works-tree-table{
    display:block!important;
    table-layout:fixed!important;
    border-collapse:separate!important;
    border-spacing:0!important;
  }
  #works .works-tree-table thead{display:none!important}
  #works .works-tree-table tbody{display:block!important}

  /* Категория */
  #works .work-category-row{
    display:block!important;
    width:100%!important;
    margin:15px 0 7px!important;
    border:0!important;
    box-shadow:none!important;
    background:transparent!important;
  }
  #works .work-category-row td{
    display:flex!important;
    width:100%!important;
    align-items:center!important;
    min-width:0!important;
    box-sizing:border-box!important;
    padding:8px 6px!important;
    border:0!important;
    background:transparent!important;
    font-size:15px!important;
  }
  #works .work-cat-toggle{
    flex:0 0 30px!important;
    margin-right:7px!important;
  }

  /* Основная работа: карточка */
  #works .work-tree-parent{
    display:grid!important;
    grid-template-columns:38px minmax(0,1fr)!important;
    gap:0!important;
    width:100%!important;
    margin:0 0 8px!important;
    padding:9px!important;
    border:1px solid rgba(60,60,67,.11)!important;
    border-radius:16px!important;
    background:#fff!important;
    box-shadow:0 3px 14px rgba(0,0,0,.045)!important;
    overflow:hidden!important;
  }
  #works .work-tree-parent td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    padding:5px 6px!important;
    border:0!important;
    background:transparent!important;
  }
  #works .work-tree-parent td:nth-child(1){
    grid-column:1!important;
    grid-row:1 / span 2!important;
    padding-left:0!important;
  }
  #works .work-tree-parent td:nth-child(2){
    grid-column:2!important;
    grid-row:1!important;
    padding-right:0!important;
  }
  #works .work-tree-parent td:nth-child(3){
    display:block!important;
    grid-column:2!important;
    grid-row:2!important;
    padding:1px 0 4px 6px!important;
    color:#7a7f87!important;
    font-size:11px!important;
  }
  #works .work-tree-parent td:nth-child(3)::before{
    content:"Ед.: ";
    font-weight:650;
  }
  #works .work-tree-work-prices{
    display:flex!important;
    grid-column:1/-1!important;
    grid-row:auto!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    margin-top:5px!important;
    padding:9px 8px!important;
    border-radius:11px!important;
    background:#f7f8fa!important;
  }
  #works .work-tree-work-prices>div:first-child{
    display:flex!important;
    align-items:baseline!important;
    gap:7px!important;
  }
  #works .work-tree-work-prices>div:first-child .small{
    margin:0!important;
  }
  #works .work-cost-edit{
    margin:0!important;
    max-width:55%!important;
  }
  #works .work-cost-edit input{
    width:88px!important;
    min-width:0!important;
  }
  #works .work-tree-actions{
    display:grid!important;
    grid-column:1/-1!important;
    grid-template-columns:1fr 1fr 1fr!important;
    gap:6px!important;
    width:100%!important;
    padding:7px 0 0!important;
  }
  #works .work-tree-actions button{
    width:100%!important;
    min-width:0!important;
    min-height:36px!important;
    padding:6px 3px!important;
    font-size:10.5px!important;
    white-space:normal!important;
  }
  #works .work-tree-parent-name,
  #works .work-tree-parent-name b,
  #works .work-tree-summary{
    min-width:0!important;
    max-width:100%!important;
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
    white-space:normal!important;
  }
  #works .work-tree-parent-name{font-size:14px!important;line-height:1.25!important}
  #works .work-tree-summary{font-size:10.5px!important;line-height:1.35!important;margin-top:4px!important}

  /* Заголовки "Состав работ" / "Материалы" */
  #works .work-tree-section-head{
    display:block!important;
    width:calc(100% - 10px)!important;
    margin:0 0 5px 10px!important;
    border:0!important;
    border-radius:12px!important;
    overflow:hidden!important;
    background:#fbf3dc!important;
    box-shadow:none!important;
  }
  #works .work-tree-section-head td:first-child{display:none!important}
  #works .work-tree-section-head td:nth-child(2){
    display:block!important;
    width:100%!important;
    min-width:0!important;
    padding:3px 7px!important;
    border:0!important;
    background:transparent!important;
  }
  #works .work-tree-section-toggle{
    min-height:40px!important;
    padding:5px 3px!important;
  }

  /* Состав работ: каждая строка становится вертикальной карточкой */
  #works .work-tree-child{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 82px!important;
    width:calc(100% - 10px)!important;
    margin:0 0 6px 10px!important;
    padding:9px!important;
    gap:7px 8px!important;
    border:1px solid rgba(60,60,67,.09)!important;
    border-left:3px solid #d8c388!important;
    border-radius:12px!important;
    background:#fffdf7!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  #works .work-tree-child td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }
  #works .work-tree-child .work-tree-branch{display:none!important}
  #works .work-tree-child td:nth-child(2){
    grid-column:1/-1!important;
    border:0!important;
  }
  #works .work-tree-child td:nth-child(3){
    grid-column:1!important;
    grid-row:auto!important;
  }
  #works .work-tree-child td:nth-child(3)::before{
    content:"Единица";
    display:block;
    margin:0 0 3px 2px;
    font-size:9px;
    color:#83878d;
    font-weight:700;
  }
  #works .work-tree-child .work-tree-child-calc{
    grid-column:1/-1!important;
    min-width:0!important;
    width:100%!important;
    padding:7px!important;
    border-radius:10px!important;
    background:#f7f7f5!important;
  }
  #works .work-tree-calc-line{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)!important;
    gap:5px!important;
    width:100%!important;
  }
  #works .work-tree-child input,
  #works .work-tree-child select{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    font-size:16px!important; /* без auto-zoom на iPhone */
  }
  #works .work-tree-child-actions{
    display:grid!important;
    grid-column:1/-1!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
    width:100%!important;
    justify-content:stretch!important;
  }
  #works .work-tree-child-actions button{
    width:100%!important;
    min-width:0!important;
    min-height:36px!important;
    padding:6px!important;
    font-size:11px!important;
  }

  /* Материал внутри работы */
  #works .work-tree-material{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 70px!important;
    width:calc(100% - 10px)!important;
    margin:0 0 6px 10px!important;
    padding:9px!important;
    gap:7px 8px!important;
    border:1px solid rgba(60,60,67,.09)!important;
    border-left:3px solid #afd0b4!important;
    border-radius:12px!important;
    background:#f8fcf8!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  #works .work-tree-material td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }
  #works .work-tree-material .work-tree-branch{display:none!important}
  #works .work-tree-material td:nth-child(2){
    grid-column:1!important;
    min-width:0!important;
  }
  #works .work-tree-material td:nth-child(3){
    grid-column:2!important;
    text-align:right!important;
    color:#747b83!important;
    font-size:11px!important;
    padding-top:2px!important;
  }
  #works .work-tree-material .work-tree-material-calc{
    grid-column:1/-1!important;
    min-width:0!important;
    width:100%!important;
    padding:7px!important;
    border-radius:10px!important;
    background:rgba(255,255,255,.75)!important;
  }
  #works .work-tree-rate-line{
    display:grid!important;
    grid-template-columns:auto minmax(70px,1fr) auto!important;
    gap:5px!important;
    width:100%!important;
  }
  #works .work-tree-rate-line input,
  #works .work-tree-material-select{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    font-size:16px!important;
  }
  #works .work-tree-material-name,
  #works .work-tree-material-name b,
  #works .work-tree-material-prices{
    min-width:0!important;
    max-width:100%!important;
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
    white-space:normal!important;
  }

  /* Строки добавления */
  #works .work-tree-section-add{
    display:block!important;
    width:calc(100% - 10px)!important;
    margin:0 0 8px 10px!important;
    border:0!important;
    box-shadow:none!important;
    background:transparent!important;
  }
  #works .work-tree-section-add td:first-child{display:none!important}
  #works .work-tree-section-add td:nth-child(2){
    display:block!important;
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    padding:3px 7px 8px!important;
    border:0!important;
    background:#fffaf0!important;
    border-radius:0 0 11px 11px!important;
  }
  #works .work-tree-material-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
    width:100%!important;
  }
  #works .work-tree-material-actions button{
    width:100%!important;
    min-width:0!important;
    white-space:normal!important;
    line-height:1.2!important;
    font-size:10.5px!important;
  }

  /* Темная тема */
  html[data-theme="dark"] #works .work-tree-parent{
    background:#1c1c1e!important;
    border-color:rgba(255,255,255,.11)!important;
  }
  html[data-theme="dark"] #works .work-tree-work-prices,
  html[data-theme="dark"] #works .work-tree-child .work-tree-child-calc{
    background:#252528!important;
  }
  html[data-theme="dark"] #works .work-tree-section-head{
    background:#2b271e!important;
  }
  html[data-theme="dark"] #works .work-tree-section-head td,
  html[data-theme="dark"] #works .work-tree-section-toggle{
    color:#f2e6c1!important;
  }
  html[data-theme="dark"] #works .work-tree-child{
    background:#1d1c19!important;
    border-color:rgba(255,255,255,.10)!important;
    border-left-color:#8e7b48!important;
  }
  html[data-theme="dark"] #works .work-tree-material{
    background:#182019!important;
    border-color:rgba(255,255,255,.10)!important;
    border-left-color:#5f9567!important;
  }
  html[data-theme="dark"] #works .work-tree-material .work-tree-material-calc{
    background:#222923!important;
  }
  html[data-theme="dark"] #works .work-tree-section-add td:nth-child(2){
    background:#242116!important;
  }
}

/* Очень узкие телефоны */
@media(max-width:390px){
  #works .work-tree-actions{
    grid-template-columns:1fr 1fr!important;
  }
  #works .work-tree-actions .btn-danger{
    grid-column:1/-1!important;
  }
  #works .work-tree-material-actions{
    grid-template-columns:1fr!important;
  }
  #works .work-tree-rate-line{
    grid-template-columns:auto minmax(60px,1fr)!important;
  }
  #works .work-tree-rate-line>span:last-child{
    grid-column:1/-1!important;
  }
}


/* ===== Строй ОС v21.13 — компактные действия основной работы ===== */
.work-tree-action-icon{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
}
.work-tree-action-icon svg{
  width:17px;
  height:17px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
  pointer-events:none;
}

@media(max-width:768px){
  #works .work-tree-actions{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important;
    width:100%!important;
    padding-top:7px!important;
  }
  #works .work-tree-actions .work-tree-action-icon{
    width:100%!important;
    min-width:0!important;
    height:40px!important;
    min-height:40px!important;
    padding:0!important;
    border-radius:10px!important;
    white-space:nowrap!important;
  }
  #works .work-tree-actions .work-tree-action-icon svg{
    width:18px!important;
    height:18px!important;
  }
}

@media(max-width:390px){
  #works .work-tree-actions{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  #works .work-tree-actions .btn-danger{
    grid-column:auto!important;
  }
}


/* ===== Строй ОС v21.14 — единая монохромная система иконок ===== */
/* Иконки наследуют цвет текста/кнопки и не используют цветные emoji. */
button svg, .icon-btn svg, .ais-tab-icon, .foreman-more-icon svg, .work-tree-action-icon svg{
  fill:none;
  stroke:currentColor;
  color:inherit;
}
button svg [fill]:not([fill="none"]){
  fill:currentColor;
}
button svg [stroke]{
  stroke:currentColor;
}

/* Символьные пиктограммы тоже всегда одноцветные. */
.icon-btn, .mobile-menu-button, .ui-theme-choice-icon, .object-wizard-choice-card>span{
  color:inherit;
  text-shadow:none!important;
  font-family:Arial,"Noto Sans Symbols 2","Noto Sans Symbols",sans-serif;
  font-variant-emoji:text;
}

/* На мобильном все навигационные и служебные иконки имеют единый визуальный вес. */
@media(max-width:768px){
  .ui-theme-choice-icon, .object-wizard-choice-card>span{
    filter:grayscale(1);
  }
}


/* ===== Строй ОС v21.15 — действия работ строго в один ряд ===== */
@media(max-width:768px){
  #works .work-tree-parent .work-tree-actions{
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    width:100%!important;
    grid-column:1/-1!important;
    flex-wrap:nowrap!important;
    overflow:visible!important;
  }

  #works .work-tree-parent .work-tree-actions > button{
    flex:1 1 0!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    height:40px!important;
    min-height:40px!important;
    margin:0!important;
    padding:0!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    white-space:nowrap!important;
  }

  #works .work-tree-parent .work-tree-actions .btn-danger{
    grid-column:auto!important;
  }
}

@media(max-width:390px){
  #works .work-tree-parent .work-tree-actions{
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
  }

  #works .work-tree-parent .work-tree-actions > button{
    flex:1 1 0!important;
    width:auto!important;
    min-width:0!important;
    height:38px!important;
    min-height:38px!important;
  }
}


/* ===== Строй ОС v21.16 — расходы по объекту ===== */

















/* ===== Строй ОС v21.21 — подробная карточка расхода в AI‑прорабе ===== */
.ai-foreman-action-fields{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px 10px;
  margin-top:8px;
}
.ai-foreman-action-field{
  min-width:0;
  padding:8px 10px;
  border:1px solid rgba(127,127,127,.18);
  border-radius:10px;
  background:rgba(127,127,127,.055);
}
.ai-foreman-action-field span{
  display:block;
  margin-bottom:2px;
  font-size:11px;
  line-height:1.25;
  color:var(--muted,#7b8189);
}
.ai-foreman-action-field b{
  display:block;
  font-size:13px;
  line-height:1.35;
  font-weight:750;
  overflow-wrap:anywhere;
}
@media(max-width:520px){
  .ai-foreman-action-fields{grid-template-columns:1fr;gap:6px}
  .ai-foreman-action-field{padding:7px 9px}
}


/* ===== Строй ОС v21.22 — явный переключатель голоса AI‑прораба ===== */
.ai-foreman-speech-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:36px;
  padding:0 10px;
  white-space:nowrap;
  font-size:12px;
  font-weight:700;
}
.ai-foreman-speech-toggle .ai-foreman-speech-icon{
  display:inline-flex;
  width:16px;
  align-items:center;
  justify-content:center;
  font-size:16px;
  line-height:1;
}
.ai-foreman-speech-toggle.is-off{
  opacity:.72;
}
@media(max-width:520px){
  .ai-foreman-head-actions{gap:5px}
  .ai-foreman-speech-toggle{
    min-height:34px;
    padding:0 8px;
    font-size:11px;
  }
}


/* ===== Строй ОС v21.23 — новая шапка AI‑прораба ===== */
.ai-foreman-head{
  position:relative;
  align-items:flex-start;
  padding-right:152px;
  min-height:92px;
}
.ai-foreman-title{
  min-width:0;
  padding-right:4px;
}
.ai-foreman-close{
  position:absolute;
  top:8px;
  right:8px;
  z-index:3;
}
.ai-foreman-head-actions{
  position:absolute;
  top:48px;
  right:8px;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:6px;
  width:136px;
  z-index:2;
}
.ai-foreman-voice-picker-btn,
.ai-foreman-speech-toggle{
  width:100%;
  min-height:34px;
  padding:0 9px;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:7px;
  white-space:nowrap;
  font-size:11px;
  font-weight:700;
}
.ai-foreman-avatar{
  flex:0 0 auto;
}
@media(max-width:600px){
  .ai-foreman-head{
    padding-right:124px;
    min-height:100px;
  }
  .ai-foreman-head-actions{
    width:112px;
    top:46px;
  }
  .ai-foreman-voice-picker-btn,
  .ai-foreman-speech-toggle{
    min-height:32px;
    padding:0 7px;
    font-size:10px;
    gap:5px;
  }
  .ai-foreman-title .small{
    max-width:190px;
  }
}
@media(max-width:390px){
  .ai-foreman-head{
    padding-right:108px;
  }
  .ai-foreman-head-actions{
    width:98px;
  }
  .ai-foreman-voice-picker-btn,
  .ai-foreman-speech-toggle{
    font-size:9px;
    padding:0 6px;
  }
  .ai-foreman-title .small{
    max-width:165px;
  }
}


/* ===== Строй ОС v21.24 — кнопки голоса под логотипом ===== */
.ai-foreman-head{
  position:relative;
  display:block;
  min-height:0;
  padding-right:52px;
}
.ai-foreman-title-block{
  width:100%;
  min-width:0;
}
.ai-foreman-title{
  display:flex;
  align-items:center;
  gap:16px;
  min-width:0;
  padding-right:0;
}
.ai-foreman-close{
  position:absolute;
  top:8px;
  right:8px;
  z-index:3;
}
.ai-foreman-head-actions{
  position:static;
  width:auto;
  display:flex;
  flex-direction:row;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-top:12px;
  padding-left:0;
}
.ai-foreman-voice-picker-btn,
.ai-foreman-speech-toggle{
  width:auto;
  min-height:36px;
  padding:0 12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  white-space:nowrap;
  font-size:12px;
  font-weight:700;
}
@media(max-width:600px){
  .ai-foreman-head{
    padding-right:48px;
  }
  .ai-foreman-title{
    align-items:flex-start;
    gap:12px;
  }
  .ai-foreman-title .small{
    max-width:none;
  }
  .ai-foreman-head-actions{
    gap:7px;
    margin-top:10px;
  }
  .ai-foreman-voice-picker-btn,
  .ai-foreman-speech-toggle{
    min-height:34px;
    padding:0 10px;
    font-size:11px;
  }
}
@media(max-width:390px){
  .ai-foreman-head{
    padding-right:44px;
  }
  .ai-foreman-head-actions{
    gap:6px;
  }
  .ai-foreman-voice-picker-btn,
  .ai-foreman-speech-toggle{
    min-height:32px;
    padding:0 9px;
    font-size:10.5px;
  }
}

/* ===== Строй ОС v21.26 — фирменный логотип в шапке ===== */
.stroy-os-header-brand{position:relative;display:flex;align-items:center;flex:0 0 auto;min-width:0}
.stroy-os-logo{display:block;width:210px;height:auto;max-height:62px;object-fit:contain;object-position:left center}
.stroy-os-logo-dark{display:none}
html[data-theme="dark"] .stroy-os-logo-light{display:none}
html[data-theme="dark"] .stroy-os-logo-dark{display:block}
.stroy-os-logo-version{position:absolute;right:2px;bottom:-1px;font-size:9px;line-height:1;color:var(--muted,#7b8794);opacity:.8}
@media(max-width:768px){
 .stroy-os-logo{width:154px;max-height:50px}
 .stroy-os-logo-version{font-size:8px;right:0}
}
@media(max-width:390px){
 .stroy-os-logo{width:138px;max-height:46px}
}


/* ===== Строй ОС v21.27 — мобильная шапка с полноценным логотипом ===== */
@media(max-width:768px){
  body>header{
    min-height:72px;
    padding:10px 12px;
    gap:8px;
    align-items:center;
  }
  .stroy-os-header-brand{
    flex:1 1 auto;
    min-width:0;
    max-width:245px;
    align-self:center;
  }
  .stroy-os-logo{
    width:min(100%,230px);
    max-width:230px;
    max-height:58px;
    object-fit:contain;
    object-position:left center;
  }
  .stroy-os-logo-version{
    position:static;
    flex:0 0 auto;
    margin-left:6px;
    font-size:9px;
    white-space:nowrap;
  }
  body>header #saveStatus,
  body>header #currentUserButton,
  body>header #currentCompanyButton,
  body>header .file-menu{
    display:none!important;
  }
  body>header .header-actions{
    margin-left:auto;
    flex:0 0 auto;
    gap:6px;
  }
}
@media(max-width:430px){
  body>header{
    min-height:68px;
    padding:9px 10px;
  }
  .stroy-os-header-brand{
    max-width:225px;
  }
  .stroy-os-logo{
    width:188px;
    max-width:188px;
    max-height:52px;
  }
  .stroy-os-logo-version{
    margin-left:4px;
    font-size:8px;
  }
}
@media(max-width:370px){
  .stroy-os-logo{
    width:164px;
    max-width:164px;
  }
  .stroy-os-logo-version{
    display:none;
  }
}

/* ===== Строй ОС v21.28 — реальная mobile-topbar использует новый логотип ===== */
@media(max-width:768px){
 .mobile-topbar-main{gap:8px}
 .stroy-os-mobile-brand{
   display:flex;
   align-items:center;
   min-width:0;
   flex:1 1 auto;
   gap:5px;
   font-size:0;
 }
 .stroy-os-mobile-logo{
   display:block;
   width:190px;
   max-width:100%;
   height:auto;
   max-height:52px;
   object-fit:contain;
   object-position:left center;
 }
 .stroy-os-mobile-logo-dark{display:none}
 html[data-theme="dark"] .stroy-os-mobile-logo-light{display:none}
 html[data-theme="dark"] .stroy-os-mobile-logo-dark{display:block}
 .stroy-os-mobile-brand small{
   flex:0 0 auto;
   font-size:9px;
   line-height:1;
   font-weight:500;
   color:#7b8794;
   white-space:nowrap;
 }
}
@media(max-width:430px){
 .stroy-os-mobile-logo{width:174px;max-height:48px}
 .stroy-os-mobile-brand small{font-size:8px}
}
@media(max-width:380px){
 .stroy-os-mobile-logo{width:152px}
 .stroy-os-mobile-brand small{display:none}
}


/* ===== Строй ОС v21.29 — мобильный AI‑прораб: максимум места основной области ===== */
@media(max-width:720px){
  .ai-foreman-modal{
    padding:0!important;
  }
  .ai-foreman-box{
    width:100vw!important;
    max-width:none!important;
    height:100dvh!important;
    max-height:100dvh!important;
    border-radius:0!important;
    padding:8px 10px!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  /* Максимально компактная шапка */
  .ai-foreman-head{
    padding-right:38px!important;
    margin:0!important;
  }
  .ai-foreman-title{
    gap:7px!important;
    align-items:center!important;
  }
  .ai-foreman-avatar{
    width:30px!important;
    height:30px!important;
    font-size:12px!important;
  }
  .ai-foreman-title h2{
    margin:0!important;
    font-size:17px!important;
    line-height:1.05!important;
  }
  .ai-foreman-title .small{
    display:none!important;
  }
  .ai-foreman-close{
    top:1px!important;
    right:1px!important;
    width:32px!important;
    height:32px!important;
    min-width:32px!important;
    padding:0!important;
  }
  .ai-foreman-head-actions{
    margin-top:5px!important;
    gap:5px!important;
  }
  .ai-foreman-voice-picker-btn,
  .ai-foreman-speech-toggle{
    min-height:27px!important;
    height:27px!important;
    padding:0 7px!important;
    font-size:9.5px!important;
    border-radius:9px!important;
  }

  /* Контекст объекта — одна компактная строка */
  .ai-foreman-context{
    flex:0 0 auto!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    gap:4px!important;
    padding:4px 0!important;
    scrollbar-width:none;
  }
  .ai-foreman-context::-webkit-scrollbar{display:none}
  .ai-foreman-context span{
    flex:0 0 auto!important;
    padding:4px 7px!important;
    font-size:9.5px!important;
    line-height:1.1!important;
  }

  /* Главная область становится максимально большой */
  .ai-foreman-conversation{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    padding:5px 0 7px!important;
    gap:7px!important;
  }
  .ai-foreman-welcome{
    padding:10px 11px!important;
    border-radius:12px!important;
    font-size:13px!important;
    line-height:1.3!important;
  }
  .ai-foreman-welcome .small{
    margin-top:3px!important;
    font-size:10.5px!important;
    line-height:1.3!important;
  }
  .ai-foreman-message{
    max-width:97%!important;
  }
  .ai-foreman-bubble{
    padding:9px 10px!important;
    font-size:13px!important;
    line-height:1.38!important;
  }

  /* Быстрые подсказки больше не съедают высоту */
  .ai-foreman-command-hints{
    flex:0 0 auto!important;
    gap:4px!important;
    padding:2px 0 3px!important;
    max-height:28px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scrollbar-width:none;
  }
  .ai-foreman-command-hints::-webkit-scrollbar{display:none}
  .ai-foreman-command-hints button{
    padding:4px 7px!important;
    font-size:9px!important;
    min-height:24px!important;
  }
  .ai-foreman-voice-status{
    display:none!important;
  }
  .ai-foreman-recording-viz{
    flex:0 0 auto!important;
    margin:3px 0!important;
    padding:6px 8px!important;
  }

  /* Нижняя зона компактная; поле ввода почти однострочное */
  .ai-foreman-compose{
    flex:0 0 auto!important;
    display:block!important;
    border-top:1px solid var(--border,#dfe5ec)!important;
    padding-top:6px!important;
  }
  .ai-foreman-compose textarea{
    width:100%!important;
    min-height:42px!important;
    height:42px!important;
    max-height:72px!important;
    padding:8px 10px!important;
    font-size:12px!important;
    line-height:1.25!important;
    border-radius:10px!important;
  }
  .ai-foreman-batch-bar{
    padding:5px 7px!important;
    margin:3px 0!important;
    font-size:10px!important;
  }
  .ai-foreman-compose-actions{
    display:grid!important;
    grid-template-columns:.72fr 1.55fr .9fr!important;
    gap:6px!important;
    margin-top:6px!important;
    align-items:stretch!important;
  }
  .ai-foreman-compose-actions button{
    min-width:0!important;
    min-height:38px!important;
    height:38px!important;
    padding:0 7px!important;
    font-size:10px!important;
    border-radius:11px!important;
  }

  /* Диктовка — главный акцент */
  .ai-foreman-compose-actions .ai-foreman-mic-btn{
    min-height:50px!important;
    height:50px!important;
    margin-top:-6px!important;
    font-size:14px!important;
    font-weight:800!important;
    border:2px solid rgba(10,132,255,.75)!important;
    box-shadow:0 0 0 4px rgba(10,132,255,.12)!important;
    background:rgba(10,132,255,.12)!important;
  }
  .ai-foreman-compose-actions .ai-foreman-mic-btn span{
    font-size:14px!important;
  }

  /* Камера и отправка второстепенны */
  .ai-foreman-camera-btn{
    opacity:.82;
  }

  .ai-foreman-disclaimer{
    display:none!important;
  }
}


/* ===== Строй ОС v21.30 — монохромная иконка AI‑прораба + прозрачные фоны иконок ===== */
.ai-foreman-theme-icon{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  background:transparent!important;
}
.ai-foreman-theme-icon-dark{display:none}
html[data-theme="dark"] .ai-foreman-theme-icon-light{display:none}
html[data-theme="dark"] .ai-foreman-theme-icon-dark{display:block}

/* Иконка AI‑прораба использует фон самой кнопки/шапки, без собственной подложки. */
.ai-foreman-fab-icon{
  width:78px!important;
  height:78px!important;
  padding:10px!important;
  border-radius:0!important;
  background:transparent!important;
}
.ai-foreman-avatar{
  width:42px;
  height:42px;
  padding:5px;
  border-radius:0!important;
  background:transparent!important;
  color:inherit!important;
}

/* Общий принцип: сами графические иконки всегда прозрачны. */
svg,
img[class*="icon"],
[class*="-icon"] svg,
[class*="-icon"] img{
  background:transparent!important;
}

/* Убираем отдельные цветные/белые плашки именно у иконок.
   Фон остаётся только у самой кнопки/карточки, на которой лежит иконка. */
.mobile-theme-icon, .ai-foreman-action-icon, .ais-dialog-icon, .estimates-empty-icon{
  background:transparent!important;
  box-shadow:none!important;
}

/* Пиктограммы наследуют цвет контейнера и не рисуют собственный фон. */
.ai-foreman-action-icon svg, .mobile-theme-icon svg{
  background:transparent!important;
}

/* Не трогаем настоящие аватары людей: это не пиктограммы интерфейса. */
.worker-avatar,
.ai-home-mini-avatar{
  box-shadow:none;
}

@media(max-width:720px){
  .ai-foreman-avatar{
    width:30px!important;
    height:30px!important;
    padding:3px!important;
  }
  .ai-foreman-fab-icon{
    width:76px!important;
    height:76px!important;
    padding:9px!important;
  }
}


/* ===== Строй ОС v21.31 — горизонтальный AI‑прораб: максимум основной области ===== */
@media(min-width:721px){
  .ai-foreman-modal{
    padding:12px!important;
  }
  .ai-foreman-box{
    width:min(1180px,calc(100vw - 24px))!important;
    max-width:1180px!important;
    height:min(900px,calc(100vh - 24px))!important;
    max-height:calc(100vh - 24px)!important;
    border-radius:18px!important;
    padding:12px 14px!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  /* Компактная шапка */
  .ai-foreman-head{
    flex:0 0 auto!important;
    min-height:0!important;
    padding-right:46px!important;
    margin:0!important;
  }
  .ai-foreman-title{
    gap:8px!important;
    align-items:center!important;
  }
  .ai-foreman-avatar{
    width:34px!important;
    height:34px!important;
    padding:4px!important;
  }
  .ai-foreman-title h2{
    margin:0!important;
    font-size:19px!important;
    line-height:1.1!important;
  }
  .ai-foreman-title .small{
    font-size:10px!important;
    line-height:1.2!important;
    margin-top:1px!important;
  }
  .ai-foreman-close{
    top:2px!important;
    right:2px!important;
    width:34px!important;
    height:34px!important;
    min-width:34px!important;
    padding:0!important;
  }
  .ai-foreman-head-actions{
    margin-top:5px!important;
    gap:5px!important;
    flex-wrap:nowrap!important;
  }
  .ai-foreman-voice-picker-btn,
  .ai-foreman-speech-toggle{
    min-height:28px!important;
    height:28px!important;
    padding:0 8px!important;
    font-size:10px!important;
    border-radius:9px!important;
  }

  /* Контекст в одну компактную строку */
  .ai-foreman-context{
    flex:0 0 auto!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    gap:5px!important;
    padding:5px 0!important;
    scrollbar-width:none;
  }
  .ai-foreman-context::-webkit-scrollbar{display:none}
  .ai-foreman-context span{
    flex:0 0 auto!important;
    padding:4px 8px!important;
    font-size:10px!important;
    line-height:1.1!important;
  }

  /* Основное окно — главный элемент */
  .ai-foreman-conversation{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    padding:6px 2px 8px!important;
    gap:8px!important;
  }
  .ai-foreman-welcome{
    padding:10px 12px!important;
    border-radius:12px!important;
    font-size:13px!important;
    line-height:1.35!important;
  }
  .ai-foreman-welcome .small{
    margin-top:3px!important;
    font-size:10.5px!important;
    line-height:1.3!important;
  }
  .ai-foreman-message{
    max-width:95%!important;
  }
  .ai-foreman-bubble{
    padding:9px 11px!important;
    font-size:13px!important;
    line-height:1.4!important;
  }

  /* Быстрые команды становятся одной тонкой строкой */
  .ai-foreman-command-hints{
    flex:0 0 auto!important;
    gap:5px!important;
    padding:2px 0 4px!important;
    max-height:30px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scrollbar-width:none;
  }
  .ai-foreman-command-hints::-webkit-scrollbar{display:none}
  .ai-foreman-command-hints button{
    padding:4px 8px!important;
    min-height:24px!important;
    font-size:9.5px!important;
  }
  .ai-foreman-voice-status{
    display:none!important;
  }

  .ai-foreman-recording-viz{
    flex:0 0 auto!important;
    margin:3px 0!important;
    padding:6px 8px!important;
  }

  /* Нижняя зона компактнее и горизонтальная */
  .ai-foreman-compose{
    flex:0 0 auto!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 360px!important;
    gap:8px!important;
    align-items:end!important;
    padding-top:7px!important;
    border-top:1px solid var(--border,#dfe5ec)!important;
  }
  .ai-foreman-compose textarea{
    min-height:46px!important;
    height:46px!important;
    max-height:82px!important;
    padding:8px 10px!important;
    font-size:12px!important;
    line-height:1.25!important;
    border-radius:10px!important;
  }
  .ai-foreman-batch-bar{
    grid-column:1/-1!important;
    padding:5px 8px!important;
    margin:0 0 3px!important;
    font-size:10px!important;
  }
  .ai-foreman-compose-actions{
    display:grid!important;
    grid-template-columns:.8fr 1.45fr .85fr!important;
    gap:6px!important;
    align-items:stretch!important;
  }
  .ai-foreman-compose-actions button{
    min-width:0!important;
    min-height:40px!important;
    height:40px!important;
    padding:0 8px!important;
    font-size:10px!important;
    border-radius:10px!important;
  }

  /* Диктовка остаётся главным действием */
  .ai-foreman-compose-actions .ai-foreman-mic-btn{
    min-height:52px!important;
    height:52px!important;
    margin-top:-6px!important;
    font-size:14px!important;
    font-weight:800!important;
    border:2px solid rgba(10,132,255,.75)!important;
    box-shadow:0 0 0 4px rgba(10,132,255,.12)!important;
    background:rgba(10,132,255,.12)!important;
  }
  .ai-foreman-compose-actions .ai-foreman-mic-btn span{
    font-size:14px!important;
  }
  .ai-foreman-camera-btn{
    opacity:.84;
  }

  .ai-foreman-disclaimer{
    display:none!important;
  }
}

/* На очень широких экранах ещё больше пространства под диалог */
@media(min-width:1200px) and (min-height:700px){
  .ai-foreman-box{
    width:min(1280px,calc(100vw - 32px))!important;
    max-width:1280px!important;
    height:calc(100vh - 32px)!important;
  }
}


/* v21.40 — AI‑прораб speech engine status */
.ai-foreman-speech-engine-status{
 display:inline-flex;align-items:center;gap:7px;
 min-height:34px;padding:6px 10px;border-radius:999px;
 font-size:12px;font-weight:700;line-height:1.1;
 background:rgba(127,127,127,.10);
 border:1px solid rgba(127,127,127,.18);
 white-space:nowrap;
}
.ai-foreman-engine-dot{
 width:8px;height:8px;border-radius:50%;
 background:currentColor;opacity:.55;flex:0 0 auto;
}
.ai-foreman-speech-engine-status[data-state="ok"]{color:#1f8f4e}
.ai-foreman-speech-engine-status[data-state="fallback"]{color:#b77900}
.ai-foreman-speech-engine-status[data-state="error"]{color:#b54444}
.ai-foreman-speech-engine-status[data-state="loading"]{opacity:.7}
@media (max-width:720px){
 .ai-foreman-speech-engine-status{
   order:10;width:100%;justify-content:center;box-sizing:border-box;
 }
}


/* v21.41 — Yandex/OpenAI voice provider selector */
.ai-voice-provider-section{margin:12px 0 18px}
.ai-voice-provider-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 10px;padding:0 2px}
.ai-voice-provider-title span{font-size:12px;opacity:.65}
.ai-voice-provider-grid{display:grid;gap:8px}
.ai-voice-provider-section.is-disabled{opacity:.58}
.ai-voice-provider-section.is-disabled .ai-cloud-voice-preview{opacity:.55}
@media(min-width:760px){
 .ai-voice-provider-grid{grid-template-columns:1fr 1fr}
}

/* v21.45 — AI-first tutorial */
.ais-training-ai-start{margin-bottom:10px}
.ais-training-ai-start .ais-training-full-icon{font-size:15px;font-weight:900;letter-spacing:-.5px}

/* v21.46 — AI‑прораб остаётся круглым во время tutorial */
#aiForemanFab.ais-tour-target,
.ai-foreman-fab.ais-tour-target{
  border-radius:50%!important;
  overflow:visible!important;
}

/* ===== Строй ОС v21.48 — нижние вкладки: иконки без подложки ===== */
@media(max-width:768px){
  #mobilePersistentTabs.foreman-five-tabs > button,
  #mobilePersistentTabs.foreman-five-tabs > button:hover,
  #mobilePersistentTabs.foreman-five-tabs > button:focus,
  #mobilePersistentTabs.foreman-five-tabs > button:active,
  #mobilePersistentTabs.foreman-five-tabs > button.active{
    background:transparent!important;
    box-shadow:none!important;
  }
  
  #mobilePersistentTabs.foreman-five-tabs .foreman-more-icon svg{
    background:transparent!important;
  }
}

/* ===== Строй ОС v21.70 — theme: tasks ===== */
html[data-theme="dark"] .task-card-title{color:#f5f5f7}
html[data-theme="dark"] .task-card-description{color:#b8b8bd}
html[data-theme="dark"] .task-card-meta span{background:#2c2c2e;color:#c6c6cb}
html[data-theme="dark"] .task-card-meta .task-binding{background:rgba(10,132,255,.16);color:#79baff}
html[data-theme="dark"] .task-card.overdue{border-color:rgba(255,69,58,.35)}
html[data-theme="dark"] .task-card.overdue .task-due,
html[data-theme="dark"] .task-card-meta .priority-high{background:rgba(255,69,58,.14);color:#ff6961}
html[data-theme="dark"] .task-card.today .task-due{background:rgba(255,159,10,.15);color:#ffb340}
html[data-theme="dark"] .task-card-meta .priority-low{background:rgba(48,209,88,.14);color:#63d77b}
html[data-theme="dark"] .task-card-meta .task-notify-status{background:rgba(48,209,88,.14);color:#70e58a}


/* ===== Строй ОС v21.73 — theme: object expenses ===== */
html[data-theme="dark"] .expense-date,
html[data-theme="dark"] .expense-payee>span,
html[data-theme="dark"] .expense-purpose>span{
  color:#a8adb5;
}


/* ===== Строй ОС v21.72 — theme: object receipts ===== */
html[data-theme="dark"] .receipt-items-preview span{
  background:#171b23;
  color:#f3f4f6;
  border-color:#374151;
}


/* ===== Строй ОС v21.71 — theme: object materials ===== */
html[data-theme="dark"] .material-status-actions select{
  background:#171b23;
  color:#f3f4f6;
  border-color:#374151;
}


/* ===== Строй ОС v21.69 — theme: object resources ===== */
html[data-theme="dark"] .ai-home-resource-panel{
  background:#1c1c1e;
  border-color:rgba(255,255,255,.11);
  box-shadow:none;
}
html[data-theme="dark"] .ai-home-resource-toggle{color:#f5f5f7}
html[data-theme="dark"] .ai-home-resource-title small,
html[data-theme="dark"] .ai-home-resource-info small{color:#a1a1a6}
html[data-theme="dark"] .ai-home-resource-actions{border-color:rgba(255,255,255,.09)}
html[data-theme="dark"] .ai-home-resource-actions button.secondary{background:#2c2c2e;color:#e5e5ea}
html[data-theme="dark"] .ai-home-resource-item{background:#242426}
html[data-theme="dark"] .ai-home-resource-item-actions button{background:#333336;color:#79baff}
html[data-theme="dark"] .ai-home-resource-item-actions button.call{background:rgba(48,209,88,.14);color:#63d77b}
html[data-theme="dark"] .ai-home-resource-item-actions button.danger{color:#ff6961}


/* ===== Строй ОС v21.68 — theme: objects list/cards ===== */
html[data-theme="dark"] .objects-section-label span{background:#2c2c2e}
html[data-theme="dark"] .object-card.current{
  background:linear-gradient(135deg,rgba(10,132,255,.14),rgba(28,28,30,.72));
}
html[data-theme="dark"] .object-card-icon{
  background:transparent;
  color:#79baff;
}
html[data-theme="dark"] .object-card-stats span{
  background:#2c2c2e;
  color:#c6c6cb;
}
html[data-theme="dark"] .current-object-card{
  background:linear-gradient(135deg,rgba(10,132,255,.24),rgba(28,28,30,.90));
  border-color:rgba(90,178,255,.55);
}
html[data-theme="dark"] .object-card-tabs{background:#242426}
html[data-theme="dark"] .object-card-tabs button{color:#b8b8bd}
html[data-theme="dark"] .object-card-tabs button.active{
  background:#3a3a3c;
  color:#79baff;
  box-shadow:none;
}


/* ===== Строй ОС v21.67 — theme: settings ===== */
html[data-theme="dark"] #settings .card,
html[data-theme="dark"] .settings-pane{
  background:#1c1c1e;
  color:#f5f5f7;
  border-color:rgba(255,255,255,.12);
}
html[data-theme="dark"] .settings-tabs{
  background:#111b2d;
  border-color:#30435f;
}
html[data-theme="dark"] .settings-tab{
  background:transparent;
  color:#dce7f7;
}
html[data-theme="dark"] .settings-tab.active{
  background:#245fd1;
  color:#fff;
  box-shadow:none;
}
html[data-theme="dark"] #settings .form-grid label,
html[data-theme="dark"] #settingsPaneApi p,
html[data-theme="dark"] #settingsPaneApi .small{color:#a9a9b0}
html[data-theme="dark"] #settings input,
html[data-theme="dark"] #settings select,
html[data-theme="dark"] #settings textarea{
  background:#2c2c2e;
  color:#f5f5f7;
  -webkit-text-fill-color:#f5f5f7;
  border-color:rgba(255,255,255,.14);
}
html[data-theme="dark"] #settings input::placeholder,
html[data-theme="dark"] #settings textarea::placeholder{
  color:#7f8796;
  -webkit-text-fill-color:#7f8796;
  opacity:1;
}
html[data-theme="dark"] .settings-danger-zone{
  border-color:rgba(255,120,110,.28);
  background:rgba(180,35,24,.08);
}

html[data-theme="dark"] .api-endpoint-box{
  background:#252527;
  border-color:rgba(255,255,255,.12);
  color:#f5f5f7;
}
html[data-theme="dark"] .api-keys-list{border-color:rgba(255,255,255,.16)}
html[data-theme="dark"] .api-key-row{border-color:rgba(255,255,255,.08)}
html[data-theme="dark"] .api-methods code{
  background:#252527;
  border-color:rgba(255,255,255,.12);
  color:#e9e9ed;
}
html[data-theme="dark"] .api-key-created-box{
  background:rgba(24,121,78,.16);
  border-color:rgba(76,217,100,.32);
  color:#f5f5f7;
}
html[data-theme="dark"] .api-key-secret code{
  background:#111214;
  color:#f5f5f7;
}


/* ===== Строй ОС v21.66 — theme: modal system ===== */
html[data-theme="dark"] .modal{
  background:rgba(1,6,14,.72);
  color:#eef4ff;
}
html[data-theme="dark"] .modal-box{
  background:#1c1c1e;
  color:var(--ais-text,#eef4ff);
  border-color:var(--ais-border,rgba(255,255,255,.12));
  box-shadow:none;
}
html[data-theme="dark"] .modal-head,
html[data-theme="dark"] .modal-head h2{
  color:#eef4ff;
  border-color:var(--ais-border,rgba(255,255,255,.12));
}

html[data-theme="dark"] .stroy-app-overlay-dialog{background:rgba(0,0,0,.68)}
html[data-theme="dark"] .stroy-app-dialog-card{
  background:#1c1c1e;
  color:#f5f5f7;
  border-color:rgba(255,255,255,.12);
}
html[data-theme="dark"] .stroy-app-dialog-head h2,
html[data-theme="dark"] .stroy-app-dialog-card label{color:#f5f5f7}
html[data-theme="dark"] .stroy-app-dialog-head [data-close]{
  background:#2c2c2e;
  color:#f5f5f7;
  border-color:rgba(255,255,255,.12);
}
html[data-theme="dark"] .stroy-app-dialog-card input,
html[data-theme="dark"] .stroy-app-dialog-card select,
html[data-theme="dark"] .stroy-app-dialog-card textarea{
  background:#2c2c2e;
  color:#f5f5f7;
  -webkit-text-fill-color:#f5f5f7;
  border-color:rgba(255,255,255,.14);
}
html[data-theme="dark"] .stroy-app-dialog-card input::placeholder,
html[data-theme="dark"] .stroy-app-dialog-card textarea::placeholder{
  color:#8e8e93;
  -webkit-text-fill-color:#8e8e93;
}


/* ===== Строй ОС v21.65 — theme: object wizard ===== */
html[data-theme="dark"] .object-wizard-box,
html[data-theme="dark"] .object-wizard-head,
html[data-theme="dark"] .object-wizard-actions,
html[data-theme="dark"] .object-wizard-choice-card{
  background:#1c1c1e;
  color:#f5f5f7;
}
html[data-theme="dark"] .object-wizard-actions{border-color:rgba(255,255,255,.12)}
html[data-theme="dark"] .object-wizard-progress-item.active{color:#f5f5f7}
html[data-theme="dark"] .object-wizard-progress-item span{background:#2c2c2e}
html[data-theme="dark"] .object-wizard-progress-item.active span{background:#0a84ff;color:#fff}
html[data-theme="dark"] .object-wizard-progress-item.done span{background:rgba(48,209,88,.16);color:#63d77b}
html[data-theme="dark"] .object-wizard-progress-line{background:rgba(255,255,255,.12)}
html[data-theme="dark"] .object-wizard-choice-card{border-color:rgba(255,255,255,.12)}
html[data-theme="dark"] .object-wizard-added-item{
  background:#242426;
  border-color:rgba(255,255,255,.10);
}
html[data-theme="dark"] .object-wizard-added-item>span{background:#2c2c2e}
html[data-theme="dark"] .object-wizard-date-hint{color:#a1a1a6}
/* ===== Строй ОС v21.78 — coherent desktop workspace ===== */
@media(min-width:1101px){
.layout{display:block!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important}.layout>aside{display:none!important}
main{width:min(1320px,calc(100vw - 64px))!important;max-width:1320px!important;margin:0 auto!important;padding:28px 0 72px!important;box-sizing:border-box!important;overflow:visible!important}
#mobilePersistentTabs.foreman-five-tabs{grid-template-columns:repeat(5,minmax(0,180px))!important;width:min(1040px,calc(100vw - 64px))!important;margin:0 auto 8px!important;padding:10px 16px!important;border:1px solid rgba(60,60,67,.12)!important;border-radius:0 0 18px 18px!important}
#estimates{width:100%!important;max-width:none!important}#estimates>.object-card-tabs{grid-template-columns:repeat(8,minmax(0,1fr))!important;width:100%!important;margin-bottom:20px!important}
#foremanDashboard.foreman-dashboard{display:grid!important;grid-template-columns:minmax(0,1.08fr) minmax(420px,.92fr)!important;gap:24px!important;width:100%!important;align-items:start!important}
#foremanDashboard .foreman-desktop-column{display:flex!important;min-width:0!important;flex-direction:column!important}
#foremanDashboard .foreman-desktop-primary>*,#foremanDashboard .foreman-desktop-secondary>*{grid-column:auto!important;grid-row:auto!important}
#foremanDashboard .ai-home-greeting{margin:4px 2px 18px!important}#foremanDashboard .ai-home-greeting h1{font-size:34px!important}
#foremanDashboard .ai-home-dictate{min-height:72px!important}#foremanDashboard .ai-home-secondary button{min-height:52px!important}
#foremanDashboard .ai-home-current-card{padding:18px!important}#foremanDashboard .ai-home-label{margin:7px 2px 12px!important}
#foremanDashboard .today-command-center{margin-bottom:16px!important}#foremanDashboard .ai-home-stats{margin-bottom:4px!important}#foremanDashboard .ai-home-resource-panel{width:100%!important}
}
@media(min-width:769px) and (max-width:1100px){#foremanDashboard .foreman-desktop-column{display:block!important}}


/* ===== Строй ОС v21.79 — desktop scale & proportions ===== */
@media(min-width:1280px){
  main{
    width:min(1600px,calc(100vw - 72px))!important;
    max-width:1600px!important;
    padding-top:30px!important;
  }

  #mobilePersistentTabs.foreman-five-tabs{
    width:min(1280px,calc(100vw - 72px))!important;
    grid-template-columns:repeat(5,minmax(0,220px))!important;
    gap:8px!important;
    padding:10px 14px!important;
    border-radius:0 0 16px 16px!important;
  }
  #mobilePersistentTabs.foreman-five-tabs button{
    min-height:72px!important;
    padding:10px 14px!important;
    font-size:15px!important;
  }
  #mobilePersistentTabs.foreman-five-tabs .mobile-nav-svg{
    width:24px!important;
    height:24px!important;
  }

  #estimates>.object-card-tabs{
    min-height:58px!important;
    margin-bottom:24px!important;
  }
  #estimates>.object-card-tabs button{
    min-height:48px!important;
    padding:10px 12px!important;
    font-size:14px!important;
  }

  #foremanDashboard.foreman-dashboard{
    grid-template-columns:minmax(0,1.12fr) minmax(500px,.88fr)!important;
    gap:32px!important;
  }

  #foremanDashboard .ai-home-greeting h1{
    font-size:clamp(34px,2vw,42px)!important;
    line-height:1.08!important;
  }
  #foremanDashboard .ai-home-greeting p,
  #foremanDashboard .ai-home-label{
    font-size:15px!important;
  }

  #foremanDashboard .ai-home-dictate{
    min-height:84px!important;
    font-size:18px!important;
    border-radius:16px!important;
  }
  #foremanDashboard .ai-home-secondary{
    gap:10px!important;
  }
  #foremanDashboard .ai-home-secondary button{
    min-height:54px!important;
    padding:10px 16px!important;
    font-size:14px!important;
  }

  #foremanDashboard .ai-home-current-card,
  #foremanDashboard .today-command-center,
  #foremanDashboard .ai-home-resource-panel{
    border-radius:16px!important;
  }
  #foremanDashboard .ai-home-current-card{
    padding:22px!important;
  }
  #foremanDashboard .ai-home-current-card h2{
    font-size:22px!important;
  }
  #foremanDashboard .ai-home-current-card .estimate-total,
  #foremanDashboard .ai-home-current-card strong{
    font-size:inherit;
  }

  #foremanDashboard .ai-home-stats{
    gap:10px!important;
  }
  #foremanDashboard .ai-home-stats>*{
    min-height:82px!important;
    padding:12px!important;
  }

  #foremanDashboard .tasks-list,
  #foremanDashboard .ai-home-resource-list{
    gap:10px!important;
  }
  #foremanDashboard .task-card,
  #foremanDashboard .ai-home-resource-toggle{
    min-height:58px!important;
  }

  #estimates .search-wrap,
  #estimates .search-box{
    min-height:58px!important;
  }
}

/* Ultra-wide monitors: use more of the screen without making lines excessively long. */
@media(min-width:1900px){
  main{
    width:min(1680px,calc(100vw - 96px))!important;
    max-width:1680px!important;
  }
  #mobilePersistentTabs.foreman-five-tabs{
    width:min(1360px,calc(100vw - 96px))!important;
  }
}


/* ===== Строй ОС v21.80 — desktop More menu ===== */
@media(min-width:769px){
  .mobile-more-overlay{
    position:fixed;
    inset:0;
    z-index:5000;
    display:none;
    align-items:flex-start;
    justify-content:center;
    padding:112px 24px 32px;
    box-sizing:border-box;
    background:rgba(8,15,28,.58);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
  }
  .mobile-more-overlay.open{
    display:flex!important;
  }
  .mobile-more-sheet{
    width:min(760px,calc(100vw - 48px));
    max-height:calc(100dvh - 144px);
    overflow:auto;
    box-sizing:border-box;
    padding:18px 20px 22px;
    border:1px solid var(--line,#dfe4ec);
    border-radius:22px;
    background:var(--card,#fff);
    color:var(--text,#111);
    box-shadow:0 28px 90px rgba(0,0,0,.28);
  }
  .mobile-sheet-handle{
    display:none;
  }
  .mobile-sheet-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:18px;
    margin-bottom:18px;
  }
  .mobile-sheet-title{
    font-size:26px;
    line-height:1.15;
    font-weight:800;
  }
  .mobile-sheet-close{
    width:42px;
    height:42px;
    flex:0 0 42px;
    border:1px solid var(--line,#dfe4ec);
    border-radius:12px;
    background:var(--soft,#f4f6f9);
    color:var(--text,#111);
    font-size:27px;
    line-height:1;
    cursor:pointer;
  }
  .mobile-menu-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
  }
  .mobile-menu-grid button{
    min-height:64px;
    padding:14px 16px;
    border:1px solid var(--line,#dfe4ec);
    border-radius:14px;
    background:var(--soft,#f7f9fc);
    color:var(--text,#111);
    font-size:15px;
    font-weight:700;
    text-align:left;
    cursor:pointer;
  }
  .mobile-menu-grid button:hover{
    transform:translateY(-1px);
    border-color:#5a8fe6;
  }
  .mobile-action-sheet{
    width:min(840px,calc(100vw - 48px));
  }
  body.mobile-more-open{
    overflow:hidden;
  }
}


/* ===== Строй ОС v21.81 — desktop dashboard composition ===== */
@media(min-width:1101px){
  #foremanDashboard.foreman-dashboard{
    display:grid!important;
    grid-template-columns:repeat(12,minmax(0,1fr))!important;
    gap:18px 24px!important;
    align-items:start!important;
  }
  /* Existing wrappers remain for mobile, but do not constrain desktop placement. */
  #foremanDashboard>.foreman-desktop-column{display:contents!important}

  #foremanDashboard .ai-home-greeting{grid-column:1/13!important;margin:0 0 2px!important}
  #foremanDashboard .ai-home-dictate{grid-column:1/9!important;margin:0!important;min-height:78px!important}
  #foremanDashboard .ai-home-secondary{
    grid-column:9/13!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:10px!important;
    margin:0!important;
  }
  #foremanDashboard .ai-home-secondary button{height:100%!important;min-height:78px!important}

  #foremanDashboard .ai-home-current-card{
    grid-column:1/7!important;
    margin:0!important;
    min-height:230px!important;
  }
  #foremanDashboard>.foreman-desktop-secondary>.ai-home-label{
    grid-column:7/13!important;
    margin:0 0 -8px!important;
  }
  #foremanDashboard .today-command-center{
    grid-column:7/13!important;
    margin:0!important;
    min-height:180px!important;
  }
  #foremanDashboard .ai-home-stats{
    grid-column:7/13!important;
    display:grid!important;
    grid-template-columns:repeat(3,1fr)!important;
    gap:10px!important;
    margin:0!important;
  }

  #foremanDashboard .ai-home-tasks-head{
    grid-column:1/9!important;
    margin:10px 0 -8px!important;
  }
  #foremanDashboard #aiHomeTasks{
    grid-column:1/9!important;
    margin:0!important;
  }
  #foremanDashboard #aiHomeWorkersPanel{
    grid-column:9/13!important;
    margin:10px 0 0!important;
  }
  #foremanDashboard #aiHomeToolsPanel{
    grid-column:9/13!important;
    margin:0!important;
  }

  #foremanDashboard .ai-home-current-body{min-height:150px!important}
  #foremanDashboard .today-command-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}
}

@media(min-width:1101px) and (max-width:1350px){
  #foremanDashboard .ai-home-dictate{grid-column:1/8!important}
  #foremanDashboard .ai-home-secondary{grid-column:8/13!important}
  #foremanDashboard .ai-home-current-card{grid-column:1/7!important}
  #foremanDashboard>.foreman-desktop-secondary>.ai-home-label,
  #foremanDashboard .today-command-center,
  #foremanDashboard .ai-home-stats{grid-column:7/13!important}
}


/* ===== Строй ОС v21.82 — desktop dashboard row fix ===== */
@media(min-width:1101px){
 #foremanDashboard.foreman-dashboard{
  grid-template-columns:repeat(12,minmax(0,1fr))!important;
  grid-template-rows:auto auto auto auto auto auto auto!important;
  grid-auto-flow:row!important;
  gap:16px 24px!important;
 }
 #foremanDashboard .ai-home-greeting{grid-column:1/13!important;grid-row:1!important}
 #foremanDashboard .ai-home-dictate{grid-column:1/9!important;grid-row:2!important}
 #foremanDashboard .ai-home-secondary{grid-column:9/13!important;grid-row:2!important}
 #foremanDashboard .ai-home-current-card{
  grid-column:1/7!important;grid-row:3/6!important;
  min-height:0!important;align-self:stretch!important
 }
 #foremanDashboard>.foreman-desktop-secondary>.ai-home-label{
  grid-column:7/13!important;grid-row:3!important;
  align-self:end!important;margin:0!important
 }
 #foremanDashboard .today-command-center{
  grid-column:7/13!important;grid-row:4!important;
  min-height:0!important;margin:0!important
 }
 #foremanDashboard .ai-home-stats{
  grid-column:7/13!important;grid-row:5!important;margin:0!important
 }
 #foremanDashboard .ai-home-tasks-head{
  grid-column:1/9!important;grid-row:6!important;
  margin:8px 0 -6px!important;align-self:start!important
 }
 #foremanDashboard #aiHomeTasks{
  grid-column:1/9!important;grid-row:7!important;
  min-height:64px!important;margin:0!important
 }
 #foremanDashboard #aiHomeWorkersPanel{
  grid-column:9/13!important;grid-row:6!important;margin:8px 0 0!important
 }
 #foremanDashboard #aiHomeToolsPanel{
  grid-column:9/13!important;grid-row:7!important;margin:0!important;align-self:start!important
 }
}


/* ===== Строй ОС v21.83 — restored object estimate list ===== */
#estimates .estimates-list-section{
  display:block;
}
#estimates .estimates-hub-head.estimates-list-section{
  margin-top:28px;
}
#estimates .estimates-hub-list.estimates-list-section{
  margin-bottom:28px;
}
@media(min-width:1101px){
  #estimates .estimates-hub-head.estimates-list-section,
  #estimates .estimates-hub-actions.estimates-list-section,
  #estimates .estimates-search-card.estimates-list-section,
  #estimates .estimates-hub-list.estimates-list-section{
    width:100%;
  }
}


/* ===== Строй ОС v21.85 — estimate/object naming fixes ===== */
.ai-home-current-title-row{display:flex;align-items:center;gap:10px;min-width:0;flex-wrap:wrap}
.ai-home-current-title-row h2{margin:0;min-width:0}
.ai-home-rename-estimate{min-height:34px;padding:6px 10px;font-size:12px}
@media(max-width:768px){
 .ai-home-current-title-row{align-items:flex-start}
 .ai-home-rename-estimate{width:100%}
}


/* ===== Строй ОС v21.86 — final desktop dashboard polish ===== */
@media(min-width:1101px){
  #foremanDashboard.foreman-dashboard{
    grid-template-columns:repeat(12,minmax(0,1fr))!important;
    grid-template-rows:auto auto auto auto auto auto auto!important;
    grid-auto-flow:row!important;
    gap:12px 24px!important;
    align-items:start!important;
  }
  #foremanDashboard .ai-home-greeting{grid-column:1/13!important;grid-row:1!important;margin:0!important}
  #foremanDashboard .ai-home-greeting h1{margin-bottom:4px!important}
  #foremanDashboard .ai-home-greeting p{margin:0!important}
  #foremanDashboard .ai-home-dictate{grid-column:1/9!important;grid-row:2!important;min-height:64px!important}
  #foremanDashboard .ai-home-secondary{grid-column:9/13!important;grid-row:2!important}
  #foremanDashboard .ai-home-secondary button{min-height:64px!important}

  #foremanDashboard .ai-home-current-card{
    grid-column:1/7!important;grid-row:3/5!important;
    min-height:190px!important;align-self:stretch!important
  }
  #foremanDashboard>.foreman-desktop-secondary>.ai-home-label{
    grid-column:7/13!important;grid-row:3!important;
    margin:0 0 -2px!important;align-self:end!important
  }
  #foremanDashboard .today-command-center{
    grid-column:7/13!important;grid-row:4!important;
    min-height:0!important;margin:0!important
  }

  #foremanDashboard .ai-home-stats{
    grid-column:1/7!important;grid-row:5!important;
    margin:0!important;min-height:64px!important
  }
  #foremanDashboard #aiHomeWorkersPanel{
    grid-column:7/13!important;grid-row:5!important;
    margin:0!important;align-self:start!important
  }

  #foremanDashboard .ai-home-tasks-head{
    grid-column:1/9!important;grid-row:6!important;
    margin:8px 0 -4px!important
  }
  #foremanDashboard #aiHomeTasks{
    grid-column:1/9!important;grid-row:7!important;
    margin:0!important;min-height:64px!important
  }
  #foremanDashboard #aiHomeToolsPanel{
    grid-column:9/13!important;grid-row:6/8!important;
    margin:8px 0 0!important;align-self:start!important
  }
  #foremanDashboard .ai-home-current-body{min-height:118px!important}

  #estimates .estimates-hub-head.estimates-list-section{
    margin-top:30px!important;padding-top:22px!important;
    border-top:1px solid var(--line,rgba(127,127,127,.24))
  }
  #estimates .estimates-search-card.estimates-list-section{margin-top:10px!important}
  #estimates .estimates-hub-list.estimates-list-section{margin-top:12px!important}
}
@media(min-width:1101px) and (max-width:1350px){
  #foremanDashboard .ai-home-dictate{grid-column:1/8!important}
  #foremanDashboard .ai-home-secondary{grid-column:8/13!important}
  #foremanDashboard .ai-home-current-card,#foremanDashboard .ai-home-stats{grid-column:1/7!important}
  #foremanDashboard>.foreman-desktop-secondary>.ai-home-label,
  #foremanDashboard .today-command-center,
  #foremanDashboard #aiHomeWorkersPanel{grid-column:7/13!important}
}


/* ===== Строй ОС v21.87 — theme: object documents ===== */
html[data-theme="dark"] .object-document-icon{background:#202a3b;color:#dbe9ff}
html[data-theme="dark"] .object-document-description{color:#aebbd0}

/* ===== Строй ОС v22.21 — training dark theme ===== */
html[data-theme="dark"] #aisOnboardingHelp .ais-training-menu{
  background:#15171b!important;color:#f5f5f7!important;border-color:rgba(255,255,255,.12)!important
}
html[data-theme="dark"] #aisOnboardingHelp .modal-head h2{color:#f5f5f7!important}
html[data-theme="dark"] #aisOnboardingHelp .modal-head .small{color:#a1a1a6!important}
html[data-theme="dark"] #aisOnboardingHelp .ais-training-grid button{
  background:#24262b!important;color:#f5f5f7!important;border-color:rgba(255,255,255,.11)!important;box-shadow:none!important
}
html[data-theme="dark"] #aisOnboardingHelp .ais-training-grid button:hover,
html[data-theme="dark"] #aisOnboardingHelp .ais-training-grid button:focus{
  background:#2c2e34!important;border-color:rgba(10,132,255,.6)!important
}
html[data-theme="dark"] #aisOnboardingHelp .ais-training-grid b{color:#f5f5f7!important}
html[data-theme="dark"] #aisOnboardingHelp .ais-training-grid span{color:#aeb4bd!important}
html[data-theme="dark"] #aisOnboardingHelp .ais-training-divider{color:#a1a1a6!important}
html[data-theme="dark"] #aisOnboardingHelp .ais-training-divider:before,
html[data-theme="dark"] #aisOnboardingHelp .ais-training-divider:after{background:rgba(255,255,255,.12)!important}
html[data-theme="dark"] #aisOnboardingHelp .icon-btn{
  background:#2c2e34!important;color:#f5f5f7!important;border-color:rgba(255,255,255,.12)!important
}

/* v22.80: worker access in estimate cards and editor */
.ai-home-resource-item-actions .worker-access-action{width:auto;min-width:0;height:auto;min-height:34px;padding:7px 10px;font-size:12px;white-space:normal}
.worker-access-box{margin:16px 0;padding:14px;border:1px solid var(--border,#d8dce2);border-radius:14px}.worker-access-box .small{margin:8px 0;line-height:1.45}
@media(max-width:680px){.ai-home-resource-item:has(.worker-access-action){flex-wrap:wrap}.ai-home-resource-item:has(.worker-access-action) .ai-home-resource-item-actions{width:100%;justify-content:flex-end;flex-wrap:wrap}.worker-access-box .btn{width:100%}}

/* v22.97: build number under the logo in normal layout flow. */
.stroy-os-header-brand{display:flex!important;flex-direction:column!important;align-items:flex-start!important;gap:4px!important}
.stroy-os-header-brand .stroy-os-logo-version{position:static!important;display:block!important;font-size:11px!important;line-height:1.3!important;opacity:1!important;white-space:nowrap!important;color:var(--muted,#667085)!important}
@media(max-width:768px){
 .mobile-topbar-main{align-items:center!important}
 .stroy-os-mobile-brand{flex-direction:column!important;align-items:flex-start!important;justify-content:center!important;gap:4px!important;min-width:0!important}
 .stroy-os-mobile-brand .stroy-os-mobile-logo{max-width:100%!important;flex-shrink:1!important}
 .stroy-os-mobile-brand small{position:static!important;display:block!important;visibility:visible!important;margin:0!important;max-width:100%!important;font-size:11px!important;line-height:1.3!important;color:var(--muted,#667085)!important;white-space:nowrap!important}
 .mobile-theme-switch,.mobile-menu-button{flex-shrink:0!important}
}
html[data-theme="dark"] .stroy-os-logo-version,html[data-theme="dark"] .stroy-os-mobile-brand small{color:#b8c4d5!important}

/* v23.69: retain diagnostics, hide their controls until explicitly enabled. */
:root:not([data-stroy-diagnostics="show"]) #openAiConnectionProbeBtn,
:root:not([data-stroy-diagnostics="show"]) #stroySpeechLastAttempt,
:root:not([data-stroy-diagnostics="show"]) #aiForemanSpeechEngineStatus{display:none!important}
