/* Phone and tablet only. html.lumen-handheld is set by the device script.
   A desktop window, even a narrow one, never gets this class. */
html.lumen-handheld{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
html.lumen-handheld,html.lumen-handheld body{
  overflow:auto;
  height:auto;
  min-height:100%;
}
html.lumen-handheld body{
  font-size:16px;
  -webkit-tap-highlight-color:rgba(37,99,235,.16);
}
html.lumen-handheld button,
html.lumen-handheld a,
html.lumen-handheld .btn,
html.lumen-handheld input,
html.lumen-handheld select,
html.lumen-handheld textarea,
html.lumen-handheld summary{
  touch-action:manipulation;
}
html.lumen-handheld input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):not([type=range]),
html.lumen-handheld select,
html.lumen-handheld textarea{
  font-size:16px !important;
}
html.lumen-handheld .btn,
html.lumen-handheld .btn-sm{
  min-height:44px;
  padding-top:10px;
  padding-bottom:10px;
}
html.lumen-handheld .form-check-input{
  width:20px;
  height:20px;
  margin-top:.2em;
}

/* ---- Header and menu ---- */
html.lumen-handheld .lumen-desktop-head{
  position:sticky;
  top:0;
  z-index:80;
  height:56px;
  padding:0 10px 0 8px;
  gap:8px;
  overflow:visible;
}
html.lumen-handheld .lumen-mnav-btn{
  display:inline-flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:5px;
  width:44px;
  height:44px;
  margin:0;
  padding:0;
  border:0;
  border-radius:10px;
  background:transparent;
  flex:0 0 auto;
}
html.lumen-handheld .lumen-mnav-btn span{
  display:block;
  width:18px;
  height:2px;
  border-radius:2px;
  background:#0f172a;
}
html.lumen-handheld .lumen-brand{flex:1 1 auto;min-width:0}
html.lumen-handheld .lumen-brand-name{display:inline;font-size:17px}
html.lumen-handheld .lumen-role-badge{
  display:none;
}
html.lumen-handheld .lumen-logout{
  display:inline-flex;
  align-items:center;
  min-height:44px;
  padding:0 10px;
  font-size:14px;
  font-weight:700;
}
html.lumen-handheld .lumen-mnav-mask{
  display:none;
  position:fixed;
  inset:0;
  z-index:90;
  background:rgba(15,23,42,.42);
}
html.lumen-handheld.lumen-mnav-open .lumen-mnav-mask{display:block}
html.lumen-handheld .lumen-nav{
  position:fixed;
  top:0;
  left:0;
  bottom:0;
  z-index:100;
  width:min(300px,86vw);
  flex:none;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:4px;
  padding:72px 14px 24px;
  background:#fff;
  border-right:1px solid var(--lm-border);
  box-shadow:12px 0 32px rgba(15,23,42,.12);
  transform:translateX(-105%);
  transition:transform .18s ease;
  overflow-y:auto;
}
html.lumen-handheld.lumen-mnav-open .lumen-nav{transform:none}
html.lumen-handheld .lumen-nav a{
  display:block;
  padding:14px 12px;
  border-radius:10px;
  border-bottom:0;
  font-size:16px;
  font-weight:600;
  color:#0f172a;
}
html.lumen-handheld .lumen-nav a.active{
  background:#eff6ff;
  color:#1d4ed8;
}
html.lumen-handheld .lumen-nav a.has-draft{
  background:#fff7ed;
  color:#9a3412;
  box-shadow:none;
}
html.lumen-handheld .lumen-content{padding:10px}
html.lumen-handheld .lumen-footer{padding:10px 12px calc(16px + env(safe-area-inset-bottom,0px))}
html.lumen-handheld .lumen-topbar{
  min-height:0;
  height:auto;
  padding:8px 10px;
}
html.lumen-handheld .lumen-topbar-right{
  flex-wrap:wrap;
  width:100%;
  gap:8px;
}
html.lumen-handheld .lumen-topbar-right .btn,
html.lumen-handheld .lumen-topbar-right .form-select{
  flex:1 1 auto;
  min-width:calc(50% - 8px);
}
html.lumen-handheld .lumen-toast{
  left:12px;
  right:12px;
  bottom:calc(12px + env(safe-area-inset-bottom,0px));
  max-width:none;
}
html.lumen-handheld .lumen-net{
  top:calc(8px + env(safe-area-inset-top,0px));
  left:12px;
  right:12px;
  transform:none;
  max-width:none;
}

/* ---- Login ---- */
html.lumen-handheld .lumen-start{
  align-items:stretch;
  padding:12px 12px calc(16px + env(safe-area-inset-bottom,0px));
}
html.lumen-handheld .lumen-start-card{
  display:flex;
  flex-direction:column-reverse;
  grid-template-columns:1fr;
  border-radius:14px;
}
html.lumen-handheld .lumen-start-brand{
  padding:22px 18px 16px;
  border-right:none;
  border-bottom:1px solid var(--lm-border);
}
html.lumen-handheld .lumen-start-brand h1{font-size:32px}
html.lumen-handheld .lumen-start-lead{font-size:16px;margin-top:8px}
html.lumen-handheld .lumen-press{margin-top:14px}
html.lumen-handheld .lumen-start-author{margin-top:12px;font-size:11px}
html.lumen-handheld .lumen-start-panel{padding:20px 16px 22px}
html.lumen-handheld .lumen-start-tabs a{
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
}
html.lumen-handheld .lumen-start-fields input{
  height:48px;
  font-size:16px;
}
html.lumen-handheld .lumen-start-fields button[type=submit]{
  height:48px;
  font-size:16px;
}
html.lumen-handheld .lumen-pass-toggle{
  width:44px;
  height:44px;
  right:2px;
}
html.lumen-handheld .lumen-save-card{padding:22px 16px}
html.lumen-handheld .lumen-save-form button{height:48px}

/* ---- Orders list ---- */
html.lumen-handheld .lumen-orders-toolbar{
  flex-direction:column;
  align-items:stretch;
  gap:10px;
}
html.lumen-handheld .lumen-orders-toolbar form{
  flex:none;
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:stretch !important;
  gap:8px;
}
html.lumen-handheld .lumen-orders-toolbar .form-select,
html.lumen-handheld .lumen-orders-toolbar .form-control{
  max-width:none !important;
  width:100%;
  min-height:44px;
}
html.lumen-handheld .lumen-orders-summary{
  width:100%;
  gap:6px;
}
html.lumen-handheld .lumen-stat-chip{
  flex:1 1 calc(50% - 6px);
  min-height:40px;
}
html.lumen-handheld #shop-summary-btn,
html.lumen-handheld #summary-btn,
html.lumen-handheld #report-cancel-btn{
  width:100%;
}
html.lumen-handheld .lumen-order-card{
  display:grid;
  grid-template-columns:40px minmax(0,1fr) auto;
  gap:8px 10px;
  padding:12px;
  margin:10px 0;
  cursor:pointer;
}
html.lumen-handheld .lumen-order-card:hover{background:#fff;border-color:var(--lm-border)}
html.lumen-handheld .lumen-order-card:active{background:#f8fafc}
html.lumen-handheld .lumen-oc-select{grid-column:1;grid-row:1}
html.lumen-handheld .lumen-oc-avatar{grid-column:1;grid-row:1}
html.lumen-handheld .lumen-oc-client{
  grid-column:2;
  grid-row:1;
  min-width:0;
  max-width:none;
}
html.lumen-handheld .lumen-oc-client .name{white-space:normal}
html.lumen-handheld .lumen-oc-film{
  grid-column:1 / -1;
  grid-row:2;
  min-width:0;
  max-width:none;
}
html.lumen-handheld .lumen-oc-film .fname,
html.lumen-handheld .lumen-oc-film .fmeta{white-space:normal}
html.lumen-handheld .lumen-order-card > .flex-shrink-0{
  grid-column:3;
  grid-row:1;
}
html.lumen-handheld .lumen-oc-types{
  grid-column:1 / -1;
  grid-row:3;
  min-width:0;
}
html.lumen-handheld .lumen-oc-date{
  grid-column:1 / -1;
  grid-row:4;
  text-align:left;
  min-width:0;
}
html.lumen-handheld .lumen-oc-actions{
  grid-column:1 / -1;
  grid-row:5;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
  flex-wrap:nowrap;
}
html.lumen-handheld .lumen-oc-act{
  width:100%;
  min-width:0;
  height:52px;
  border:1px solid #e2e8f0;
  background:#fff;
}
html.lumen-handheld .lumen-oc-act span{font-size:11px}

/* ---- New order ---- */
html.lumen-handheld body.lumen-new-order-page,
html.lumen-handheld body.lumen-new-order-page .lumen-shell,
html.lumen-handheld body.lumen-new-order-page .lumen-main,
html.lumen-handheld body.lumen-new-order-page .lumen-content{
  height:auto;
  min-height:0;
  overflow:visible;
}
html.lumen-handheld body.lumen-new-order-page{overflow:auto}
html.lumen-handheld body.lumen-new-order-page .lumen-shell{min-height:100vh}
html.lumen-handheld body.lumen-new-order-page .lumen-content{
  padding:8px 10px calc(88px + env(safe-area-inset-bottom,0px));
}
html.lumen-handheld body.lumen-new-order-page .lumen-topbar,
html.lumen-handheld body.lumen-new-order-page .lumen-footer{display:none}
html.lumen-handheld .lumen-new-split{grid-template-columns:1fr;gap:10px}
html.lumen-handheld .lumen-new-order-root,
html.lumen-handheld .lumen-new-order-root .lumen-new-left,
html.lumen-handheld .lumen-new-order-root .lumen-parts-card{
  height:auto;
  overflow:visible;
}
html.lumen-handheld .lumen-params-head,
html.lumen-handheld .lumen-client-row,
html.lumen-handheld .lumen-client-actions,
html.lumen-handheld .lumen-date-block,
html.lumen-handheld .lumen-fg-inline{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
}
html.lumen-handheld .lumen-new-order-root #params-card #f-client,
html.lumen-handheld .lumen-new-dense .lumen-fg-inline #f-film,
html.lumen-handheld .lumen-new-dense .lumen-fg-inline #f-supplier{
  width:100% !important;
  max-width:none !important;
  min-width:0 !important;
}
html.lumen-handheld .lumen-client-actions #sheet-btn-top,
html.lumen-handheld .lumen-client-actions #cancel-edit-btn,
html.lumen-handheld .lumen-date-actions .btn{
  width:100%;
}
html.lumen-handheld body.lumen-new-order-page #save-btn-top{
  position:fixed;
  left:10px;
  right:10px;
  bottom:calc(10px + env(safe-area-inset-bottom,0px));
  z-index:70;
  width:auto;
  min-height:50px;
  font-size:16px;
  border-radius:12px;
  box-shadow:0 0 0 6px rgba(244,247,251,.92),0 8px 20px rgba(37,99,235,.35);
}
html.lumen-handheld .lumen-new-order-root:has(input:focus,select:focus,textarea:focus) #save-btn-top{
  opacity:0;
  pointer-events:none;
  transform:translateY(88px);
}
html.lumen-handheld .lumen-master-bar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
html.lumen-handheld .lumen-master-bar > span{display:none}
html.lumen-handheld .lumen-master-bar .form-select,
html.lumen-handheld .lumen-master-bar .lumen-color-dd{
  flex:1 1 30%;
  min-width:0;
}
html.lumen-handheld #add-row,
html.lumen-handheld #clear-parts{
  flex:1 1 46%;
}
html.lumen-handheld .lumen-new-order-root #parts-scroll-wrap{
  height:auto !important;
  max-height:none !important;
  overflow:visible;
}
html.lumen-handheld .lumen-parts-excel,
html.lumen-handheld .lumen-parts-excel tbody{display:block;width:100%}
html.lumen-handheld .lumen-parts-excel thead{display:none}
html.lumen-handheld .lumen-parts-excel tbody tr{
  display:grid;
  grid-template-columns:22px minmax(0,1fr) minmax(0,1fr) 70px 44px;
  gap:8px 8px;
  padding:12px;
  margin:0 0 10px;
  background:#fff;
  border:1px solid #d4ddeb;
  border-radius:12px;
}
html.lumen-handheld .lumen-new-order-root .lumen-parts-excel tbody td{
  display:block;
  min-width:0;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(1){grid-column:1;grid-row:1;align-self:end;padding-bottom:10px !important}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(2){grid-column:2;grid-row:1}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(3){grid-column:3;grid-row:1}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(4){grid-column:4;grid-row:1}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(10){grid-column:5;grid-row:1;align-self:end}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(5){grid-column:1 / 4;grid-row:2}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(6){grid-column:4 / 6;grid-row:2}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(8){grid-column:1 / 4;grid-row:3}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(9){grid-column:4 / 6;grid-row:3}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(2)::before{content:"Длина, мм"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(3)::before{content:"Ширина, мм"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(4)::before{content:"Кол-во"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(5)::before{content:"Тип фасада"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(6)::before{content:"Толщ., мм"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(8)::before{content:"Доп. услуга 1"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(9)::before{content:"Доп. услуга 2"}
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(2)::before,
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(3)::before,
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(4)::before,
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(5)::before,
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(6)::before,
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(8)::before,
html.lumen-handheld .lumen-parts-excel tbody td:nth-child(9)::before{
  display:block;
  margin-bottom:4px;
  font-size:12px;
  font-weight:700;
  color:#64748b;
}
html.lumen-handheld .lumen-new-order-root .lumen-parts-excel input.form-control-sm,
html.lumen-handheld .lumen-new-order-root .lumen-parts .lumen-color-dd-btn{
  width:100%;
  min-height:44px;
  height:44px;
  border-radius:10px;
}
html.lumen-handheld .lumen-parts-excel .lumen-del{
  width:44px;
  height:44px;
  min-height:44px;
}
html.lumen-handheld #calc-btn,
html.lumen-handheld #layout-editor-btn{width:100%}
html.lumen-handheld .lumen-layout-host{overflow-x:auto;-webkit-overflow-scrolling:touch}

/* ---- Settings ---- */
html.lumen-handheld .lumen-settings-grid{column-count:1}
html.lumen-handheld .lumen-settings-top{flex-direction:column}
html.lumen-handheld .lumen-settings-maincol,
html.lumen-handheld .lumen-settings-top > .lumen-tg-card{
  flex:1 1 auto;
  min-width:0;
  width:100%;
}
html.lumen-handheld .lumen-mvp-body{grid-template-columns:1fr}
html.lumen-handheld .lumen-mvp-inputs{grid-template-columns:1fr}
html.lumen-handheld .lumen-mvp-visual{min-height:200px}
html.lumen-handheld .lumen-settings .form-control,
html.lumen-handheld .lumen-settings .form-select{
  min-height:44px;
  height:44px;
  padding:8px 10px;
}
html.lumen-handheld .lumen-settings input[type=file].form-control{
  height:auto;
  min-height:44px;
}
html.lumen-handheld .lumen-thick-grid,
html.lumen-handheld .lumen-preset-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
html.lumen-handheld .lumen-settings-actions{
  position:sticky;
  bottom:0;
  padding:10px 0 calc(10px + env(safe-area-inset-bottom,0px));
}
html.lumen-handheld .lumen-settings-actions .btn{width:100%}
html.lumen-handheld .lumen-qr-img,
html.lumen-handheld .lumen-qr-img.is-lg{
  width:min(240px,72vw);
  height:auto;
  aspect-ratio:1;
}
html.lumen-handheld .lumen-tg-steps{font-size:14px;line-height:1.5}

/* ---- Owner board ---- */
html.lumen-handheld .lumen-owner{margin:16px auto;padding:0 12px 28px}
html.lumen-handheld .lumen-owner-login{margin:8vh auto}
html.lumen-handheld .lumen-owner input[type=password]{
  min-height:48px;
  font-size:16px;
}
html.lumen-handheld .lumen-owner .btn{min-height:48px;width:100%}
html.lumen-handheld .lumen-owner-head{flex-direction:column;align-items:stretch}
html.lumen-handheld .lumen-owner-stats{flex-direction:column}
html.lumen-handheld .lumen-owner table,
html.lumen-handheld .lumen-owner thead,
html.lumen-handheld .lumen-owner tbody,
html.lumen-handheld .lumen-owner th,
html.lumen-handheld .lumen-owner td,
html.lumen-handheld .lumen-owner tr{display:block}
html.lumen-handheld .lumen-owner thead{display:none}
html.lumen-handheld .lumen-owner tr{
  padding:12px 0;
  border-bottom:1px solid #f1f5f9;
}
html.lumen-handheld .lumen-owner td{
  padding:4px 0;
  border:0;
}
html.lumen-handheld .lumen-owner td:first-child{font-weight:700;font-size:16px}
html.lumen-handheld .lumen-owner-delete{
  min-height:44px;
  width:100%;
}

/* ---- Reports / popups ---- */
html.lumen-handheld .lumen-popup-content{height:100%}
html.lumen-handheld #lumenPopupModal .modal-dialog{
  margin:0;
  max-width:100%;
  height:100%;
}
html.lumen-handheld #lumenPopupModal .modal-content{height:100%;border-radius:0}
html.lumen-handheld .lumen-popup-frame{min-height:70vh}
html.lumen-handheld .lumen-report-header,
html.lumen-handheld .lumen-report-actions{flex-wrap:wrap}
html.lumen-handheld .lumen-report-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch}
html.lumen-handheld .lumen-report-tab{flex:0 0 auto;min-height:40px}
html.lumen-handheld .table-responsive,
html.lumen-handheld .lumen-grid-scroll{
  -webkit-overflow-scrolling:touch;
}
html.lumen-handheld .modal-dialog{margin:10px}
html.lumen-handheld .modal-footer .btn{min-width:44px}
html.lumen-handheld .lumen-delivery-popup{
  width:calc(100vw - 16px);
  max-height:70vh;
  left:8px !important;
}
html.lumen-handheld .lumen-delivery-row{min-height:48px}
html.lumen-handheld .lumen-layout-editor-grid{grid-template-columns:1fr}
html.lumen-handheld .lumen-layout-edit-canvas{touch-action:none}
html.lumen-handheld .lumen-add-row,
html.lumen-handheld .lumen-editor-rotate{display:inline-block}
