/* Shared CRM surfaces. Business forms and canvas rendering keep their existing hooks. */
body.ms-ui{--primary:#377cf6;--primary-hover:#2466de;--primary-light:#edf4ff;--bg:#f3f6fb;--card:#fff;--border:#dce4ef;--text:#14213a;--text-muted:#64748b;background:var(--bg);color:var(--text);font-family:Inter,Arial,sans-serif}
body.ms-ui *,body.ms-ui *::before,body.ms-ui *::after{box-sizing:border-box}
body.ms-ui .ms-icon{display:inline-block;vertical-align:middle;width:22px;height:22px;flex:none}
body.ms-ui .ms-preview-note{border:1px dashed #9bbbf8;background:#f0f6ff;color:#3f5f91;font-size:12px;line-height:1.6;padding:10px 12px;border-radius:8px;margin-bottom:18px}
body.ms-ui a:focus-visible,body.ms-ui button:focus-visible,body.ms-ui summary:focus-visible{outline:3px solid #93b4fd;outline-offset:3px}
body.ms-ui .header{height:64px;min-height:64px;background:#fff;border-bottom:1px solid var(--border);box-shadow:none;position:fixed;top:0;left:0;right:0;z-index:100}
body.ms-ui .header>.container{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:24px;height:100%;max-width:none;padding:0 24px}
body.ms-ui .header__logo{flex:0 0 208px;min-width:0}
body.ms-ui .header__logo a{display:flex;align-items:center;gap:10px;font-size:17px;font-weight:750;line-height:1.2;color:var(--text);text-decoration:none}
body.ms-ui .header__logo .ms-icon{width:30px;height:30px;color:var(--primary)}
body.ms-ui .global-search-wrap{max-width:500px}
body.ms-ui .global-search-input{min-height:40px;border-radius:9px;font-size:14px}
body.ms-ui .logout-link{display:inline-flex;align-items:center;gap:6px;margin-left:auto;min-height:44px;white-space:nowrap;color:var(--text-muted)}
body.ms-ui .current-panel{display:inline-flex;align-items:center;min-height:40px;border-radius:8px;font-size:13px;white-space:nowrap}
body.ms-ui .layout-wrapper{padding-top:64px}
body.ms-ui .admin-sidebar{top:64px;width:232px;height:calc(100dvh - 64px);bottom:0;border-right:1px solid var(--border);box-shadow:none;display:flex;flex-direction:column;z-index:110;background:#fff}
body.ms-ui .admin-logo{padding:20px 18px;border-bottom:1px solid var(--border);font-size:14px;min-height:64px}
body.ms-ui .admin-logo-icon{color:var(--primary)}
body.ms-ui .admin-nav{padding:8px 10px;flex:1;overflow-y:auto;min-height:0}
body.ms-ui .admin-nav-item{display:flex;align-items:center;gap:12px;min-height:44px;padding:10px 12px;margin:3px 0;border-radius:8px;font-size:14px;color:#475569;text-decoration:none}
body.ms-ui .admin-nav-item.active{background:#eaf2ff;color:#2466de;font-weight:700}
body.ms-ui .admin-nav-item:hover{background:#f0f5fc;color:#2466de}
body.ms-ui .admin-nav-icon{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;font-size:18px}
body.ms-ui .ms-nav-group{margin:8px 0 14px}
body.ms-ui .ms-nav-label{font-size:10px;font-weight:750;letter-spacing:.08em;text-transform:uppercase;color:#78869b;padding:8px 12px}
body.ms-ui .ms-nav-section{border-top:1px solid var(--border);margin-top:10px;padding-top:8px}
body.ms-ui .ms-nav-section>summary{cursor:pointer;font-size:12px;font-weight:650;color:#64748b;padding:12px}
body.ms-ui .admin-sidebar-footer{padding:12px;border-top:1px solid var(--border);background:#fff;flex:none}
body.ms-ui .admin-user-name{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.ms-ui .admin-user-info{display:flex;align-items:center;gap:10px}
body.ms-ui .admin-logout-btn{display:flex;gap:8px;align-items:center;min-height:40px}
body.ms-ui .main-content{margin-top:0;margin-left:232px;width:calc(100% - 232px);min-width:0;height:calc(100dvh - 64px);overflow-y:auto;overflow-x:clip;padding:24px}
body.ms-ui .main-content>.container{max-width:1500px;width:100%;margin:0 auto;padding:24px;border-radius:14px;min-width:0;box-shadow:0 2px 8px #14213a05}
body.ms-ui .admin-wrapper,body.ms-ui .admin-main{margin:0;padding:0;width:100%;min-width:0;background:transparent}
body.ms-ui h1{font-size:30px;letter-spacing:-.035em;line-height:1.2;color:#14213a}
body.ms-ui h2{font-size:20px;letter-spacing:-.02em}
body.ms-ui .page-header,body.ms-ui .content-header,body.ms-ui .admin-topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:24px}
body.ms-ui .page-header h1,body.ms-ui .content-header h1,body.ms-ui .admin-topbar h1{margin:0}
body.ms-ui .ms-subtitle{color:var(--text-muted);font-size:13px;margin:8px 0 0}
body.ms-ui .btn-primary,body.ms-ui .btn-outline{border-radius:9px;min-height:42px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:13px;text-decoration:none;padding:10px 16px}
body.ms-ui .btn-primary{background:var(--primary);color:#fff;border:1px solid var(--primary)}
body.ms-ui .btn-outline{background:#fff;border:1px solid var(--border);color:#334155}
body.ms-ui .stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:0 0 24px}
body.ms-ui .stats-grid>.stat-card{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;padding:20px;text-align:left;border:1px solid var(--border);border-radius:12px;background:#fff;color:var(--text);box-shadow:0 2px 4px #14213a04;text-decoration:none}
body.ms-ui .stat-info{min-width:0}
body.ms-ui .stat-label{font-size:12px;color:var(--text-muted);line-height:1.4;min-height:34px}
body.ms-ui .stats-grid .stat-number{font-size:clamp(22px,2.1vw,32px);font-weight:750;white-space:nowrap;line-height:1.2;font-variant-numeric:tabular-nums}
body.ms-ui .stat-icon-wrapper{width:42px;height:42px;border-radius:10px;background:#f1f6fd;display:flex;align-items:center;justify-content:center;color:#53769f;flex:none}
body.ms-ui .ms-worklist,body.ms-ui .ms-orders-section{border:1px solid var(--border);border-radius:12px;padding:20px;margin-bottom:24px;background:#fff}
body.ms-ui .ms-worklist h2{margin:0 0 12px}
body.ms-ui .ms-worklist a{display:flex;align-items:center;gap:12px;padding:13px 0;border-top:1px solid #edf1f7;text-decoration:none;color:var(--text);font-size:14px;min-height:48px}
body.ms-ui .ms-worklist a>.ms-icon{color:#5c80ab}
body.ms-ui .ms-worklist a>span:last-child{margin-left:auto;color:var(--primary);font-size:13px}
body.ms-ui .ms-dashboard-links{display:flex;flex-wrap:wrap;gap:12px 20px;margin:16px 0;color:var(--text-muted);font-size:13px}
body.ms-ui .ms-dashboard-links a{color:inherit;min-height:36px;display:inline-flex;align-items:center}
body.ms-ui .admin-grid{gap:12px}
body.ms-ui .admin-section{min-width:0}
body.ms-ui .section-header{gap:12px;flex-wrap:wrap}
body.ms-ui .section-title{font-size:18px}
body.ms-ui .table-responsive{max-width:100%;min-width:0;overflow:auto}
body.ms-ui .admin-table{width:100%;font-size:13px;border-collapse:collapse}
body.ms-ui .admin-table th{font-weight:650;color:#64748b;background:#f7f9fc;white-space:nowrap;padding:12px}
body.ms-ui .admin-table td{padding:14px 12px;border-bottom:1px solid #eaf0f6;vertical-align:middle}
body.ms-ui .admin-table tbody tr[class*="row-"]{background:#fff;filter:none;border-left-width:2px}
body.ms-ui .admin-table tbody tr:hover{background:#f7faff;filter:none}
body.ms-ui .admin-table .ms-amount{white-space:nowrap;text-align:right;font-variant-numeric:tabular-nums}
body.ms-ui .ms-status{border-radius:20px;font-size:11px;font-weight:650;display:inline-block;white-space:nowrap;padding:5px 9px;background:#eef3fa;color:#445f86}
body.ms-ui .ms-status[data-status=new]{background:#e8f1ff;color:#2563b9}
body.ms-ui .ms-status[data-status=in_production],body.ms-ui .ms-status[data-status=agreed]{background:#fff2d8;color:#94620c}
body.ms-ui .ms-status[data-status=ready],body.ms-ui .ms-status[data-status=done]{background:#e5f6ec;color:#227447}
body.ms-ui .ms-filter-caption{font-size:12px;color:var(--text-muted);margin:0 0 8px}
body.ms-ui .stat-cards{display:flex;gap:8px;overflow-x:auto;padding:2px 2px 10px;scrollbar-width:thin;margin-bottom:16px}
body.ms-ui .stat-cards .stat-card{min-width:max-content;flex:0 0 auto;display:flex;align-items:center;gap:7px;padding:8px 12px;min-height:42px;border-radius:8px;box-shadow:none}
body.ms-ui .stat-cards .cnt{font-size:14px;font-weight:700;order:2}
body.ms-ui .stat-cards .lbl{font-size:12px;margin:0;opacity:1}
body.ms-ui .ms-orders-filters{margin-bottom:16px}
body.ms-ui .ms-orders-table .btn-icon{min-height:40px;min-width:40px}
body.ms-ui .cfg-wrap{min-width:0}
body.ms-ui .cfg-panel,body.ms-ui .cfg-right{min-width:0}
body.ms-ui .cfg-section{padding:16px}
body.ms-ui .cfg-section-title{font-size:11px;letter-spacing:.04em;margin-bottom:10px;color:#52657e}
body.ms-ui .cfg-mesh-btn,body.ms-ui .cfg-prop-btn{min-height:44px;padding:10px 12px;font-size:12px;border-radius:8px}
body.ms-ui .cfg-input{min-height:44px;font-size:16px;padding:9px 12px}
body.ms-ui .cfg-type-card{min-height:58px;padding:10px;border-radius:9px;gap:10px}
body.ms-ui .cfg-type-name{font-size:13px;line-height:1.4}
body.ms-ui .cfg-type-desc{font-size:11px;line-height:1.4}
body.ms-ui .cfg-type-icon .ms-icon{width:24px;height:24px}
body.ms-ui .cfg-color-swatch{width:44px;height:44px}
body.ms-ui .cfg-qty-btn{min-width:44px;min-height:44px}
body.ms-ui .cfg-price-total{white-space:nowrap;font-size:24px;font-variant-numeric:tabular-nums}
body.ms-ui .cfg-price-bar{border-color:var(--border);gap:12px;padding:16px}
body.ms-ui .cfg-order-btn{min-height:46px;font-size:14px;padding:12px 18px}
body.ms-ui .ms-cfg-nav{display:flex;gap:8px;padding:12px 16px;border-bottom:1px solid var(--border);background:#f8faff;position:sticky;top:0;z-index:2}
body.ms-ui .ms-cfg-nav button{flex:1;min-height:40px;border:1px solid var(--border);border-radius:8px;background:white;color:#334155;font-size:12px;cursor:pointer}
body.ms-ui .ms-cfg-nav button:hover{color:var(--primary);border-color:var(--primary)}
body.ms-ui .ms-cfg-extra>summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:650;font-size:13px;gap:8px}
body.ms-ui .ms-cfg-extra>summary::after{content:'⌄';margin-left:auto}
body.ms-ui .ms-cfg-extra[open]>summary{margin-bottom:12px}
body.ms-ui .footer{margin-top:28px}
body.ms-ui .footer__content{box-shadow:none;border:0;font-size:12px;padding:12px 0}
body.ms-ui .ms-sidebar-close,body.ms-ui .ms-sidebar-overlay{display:none}
body.ms-ui .auth-wrap{min-height:calc(100dvh - 64px)}
body.ms-ui .auth-form-side{padding:48px 24px}
body.ms-ui .auth-panel{padding:48px}
body.ms-ui .auth-submit{background:var(--primary);box-shadow:0 3px 8px #377cf61f}
body.ms-ui .auth-submit:hover:not(:disabled){background:var(--primary-hover);box-shadow:0 4px 10px #377cf62b}
@media(min-width:769px) and (max-width:1150px){
 body.ms-ui .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body.ms-ui .header__logo{flex-basis:180px}
 body.ms-ui .header>.container{gap:16px}
}
@media(max-width:860px){
 body.ms-ui .cfg-panel{max-height:none;overflow-y:visible;position:static}
 body.ms-ui .cfg-wrap:not(.cfg-wrap--embedded){padding-bottom:calc(var(--ms-pricebar-height,150px) + 16px)}
 body.ms-ui .cfg-wrap:not(.cfg-wrap--embedded)>.cfg-right>.cfg-price-bar{position:fixed;bottom:0;left:0;right:0;z-index:90;border:0;border-top:1px solid var(--border);border-radius:0;margin:0;box-shadow:0 -4px 18px #14213a0a;padding:12px 16px max(12px,env(safe-area-inset-bottom));display:flex;align-items:center}
 body.ms-ui .cfg-price-bar .cfg-price-label{font-size:10px}
 body.ms-ui .cfg-price-bar .cfg-price-total{font-size:20px}
 body.ms-ui .cfg-price-info>div:first-child{gap:12px!important}
 body.ms-ui .cfg-order-btn{white-space:normal;max-width:45%;min-width:120px;font-size:13px}
 body.ms-ui .cfg-canvas-toggle-btn{min-height:46px}
 body.ms-ui .cart-panel{position:static}
 body.ms-ui .ms-cfg-nav{position:static}
}
@media(max-width:768px){
 body.ms-ui .header>.container{padding:0 14px 0 68px;gap:8px;justify-content:space-between}
 body.ms-ui .header__logo,body.ms-ui .global-search-wrap{display:none}
 body.ms-ui .header-dropdown{min-width:0;margin:0}
 body.ms-ui .header-dropdown{flex:0 1 auto}
 body.ms-ui .current-panel{font-size:12px;max-width:230px;padding:9px 10px}
 body.ms-ui .logout-link{padding:0 4px;min-width:32px;width:auto;flex:0 0 32px;justify-content:center}
 body.ms-ui .logout-link>span{display:none}
 body.ms-ui .mobile-menu-btn{display:flex!important;align-items:center;justify-content:center;position:fixed;top:10px;left:12px;width:44px;height:44px;padding:0;margin:0;border:1px solid var(--border);border-radius:9px;background:#fff;color:#2f6ddc;font-size:23px;z-index:140}
 body.ms-ui .admin-sidebar{top:0;bottom:0;height:100dvh;width:min(300px,86vw);transform:translateX(-105%);transition:transform .2s;z-index:160}
 body.ms-ui .admin-sidebar.open{transform:translateX(0)}
 body.ms-ui .admin-logo{padding-right:54px}
 body.ms-ui .ms-sidebar-close{display:flex;position:absolute;top:10px;right:10px;align-items:center;justify-content:center;width:44px;height:44px;font-size:28px;border:0;background:transparent;color:#64748b;cursor:pointer}
 body.ms-ui.ms-menu-open .ms-sidebar-overlay{display:block;position:fixed;inset:0;background:#14213a65;z-index:150;border:0;margin:0;padding:0}
 body.ms-ui .main-content{margin-left:0;width:100%;height:calc(100dvh - 64px);padding:12px;overflow-y:auto}
 body.ms-ui .main-content>.container{padding:16px 12px;border-radius:12px}
 body.ms-ui h1{font-size:26px;line-height:1.2}
 body.ms-ui .page-header,body.ms-ui .content-header,body.ms-ui .admin-topbar{align-items:flex-start;gap:12px;margin-bottom:20px}
 body.ms-ui .page-header>span{width:100%;line-height:1.5}
 body.ms-ui .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 body.ms-ui .stats-grid>.stat-card{min-width:0;padding:14px;gap:0;box-shadow:none}
 body.ms-ui .stats-grid .stat-icon-wrapper{display:none}
 body.ms-ui .stats-grid .stat-number{font-size:clamp(19px,5.8vw,25px)}
 body.ms-ui .stats-grid .stat-label{font-size:11px;min-height:32px}
 body.ms-ui .ms-worklist,body.ms-ui .ms-orders-section{padding:14px;margin-bottom:18px}
 body.ms-ui .ms-worklist a{font-size:13px;gap:8px}
 body.ms-ui .ms-worklist a>span:last-child{font-size:12px;white-space:nowrap}
 body.ms-ui .stat-cards .stat-card{min-height:44px;max-width:none}
 body.ms-ui .ms-orders-filters{display:grid!important;grid-template-columns:minmax(0,1fr) auto auto;gap:8px!important;align-items:center}
 body.ms-ui .ms-orders-filters>[name=search]{grid-column:1/3;grid-row:1;width:100%!important;min-width:0!important;min-height:44px}
 body.ms-ui .ms-orders-filters>button{grid-column:3;grid-row:1;min-height:44px;padding:8px 12px}
 body.ms-ui .ms-orders-filters>label{grid-column:1;grid-row:2;min-height:40px;width:auto!important;margin:0!important}
 body.ms-ui .ms-orders-filters>a{min-height:40px;padding:8px 10px;width:auto!important}
 body.ms-ui .admin-grid{grid-template-columns:1fr}
 body.ms-ui .ms-orders-table,body.ms-ui .ms-orders-table tbody{display:block;width:100%}
 body.ms-ui .ms-orders-table thead{display:none}
 body.ms-ui .ms-orders-table tbody>tr:not(:has(td[colspan])){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px 12px;border:1px solid var(--border);border-radius:12px;background:#fff;padding:14px;margin-bottom:12px;box-shadow:0 1px 3px #14213a04;position:relative}
 body.ms-ui .ms-orders-table td{display:block;border:0;padding:0;min-width:0;font-size:13px;overflow-wrap:anywhere}
 body.ms-ui .ms-orders-table td[data-label]::before{content:attr(data-label);display:block;font-size:10px;color:#718096;font-weight:400;margin-bottom:3px}
 body.ms-ui .ms-orders-table td[data-label="Заказ"]{grid-column:1;grid-row:1;font-size:14px;font-weight:700;align-self:center}
 body.ms-ui .ms-orders-table td[data-label="Заказ"]::before,body.ms-ui .ms-orders-table td[data-label="Статус"]::before{display:none}
 body.ms-ui .ms-orders-table td[data-label="Статус"]{grid-column:2;grid-row:1;text-align:right;align-self:center}
 body.ms-ui .ms-orders-table td[data-label="Клиент"]{grid-column:1/-1}
 body.ms-ui .ms-orders-table td[data-label="Сумма"]{text-align:right;font-size:16px;font-weight:700;grid-column:2;grid-row:3}
 body.ms-ui .ms-orders-table td[data-label="Телефон"]{grid-column:1;grid-row:3}
 body.ms-ui .ms-orders-table td[data-label="Дата"]{grid-column:1/-1;order:10;border-top:1px solid #edf1f7;padding-top:8px}
 body.ms-ui .ms-orders-table td[data-label="Оплачено"],body.ms-ui .ms-orders-table td[data-label="Остаток"]{text-align:left}
 body.ms-ui .ms-orders-table .ms-amount{white-space:normal}
 body.ms-ui .ms-orders-table .ms-amount>span{white-space:nowrap}
 body.ms-ui .auth-wrap{min-height:auto;grid-template-columns:1fr;grid-template-rows:auto auto}
 body.ms-ui .auth-form-side{min-height:0;padding:36px 20px 44px}
 body.ms-ui .auth-panel{padding:30px 24px}
 body.ms-ui .auth-panel h1,body.ms-ui .auth-panel h2{font-size:26px}
 body.ms-ui .auth-panel p{font-size:14px}
 body.ms-ui.guest-page .header{position:static;height:auto;min-height:64px}
 body.ms-ui.guest-page .header>.container{padding:12px 16px;flex-wrap:wrap;gap:10px}
 body.ms-ui.guest-page .header__logo{display:block;flex:1 0 100%}
 body.ms-ui.guest-page .header__nav{display:flex;flex-wrap:wrap;gap:4px}
 body.ms-ui.guest-page .header__nav a{min-height:40px;font-size:12px;padding:8px}
 body.ms-ui.guest-page .auth-wrap{left:auto;transform:none;width:100%}
}
@media(prefers-reduced-motion:reduce){body.ms-ui .admin-sidebar{transition:none}}
