/* Glamuriki ERP — phone layer (Android + iPhone). Include it last in <head> (after the page <style>) so it wins; only changes small screens. */
:root{--ac:var(--btn,#c2185b);--acl:var(--btn-soft,#fdeef6);--mb-h:64px;--mb-safe:env(safe-area-inset-bottom,0px);--mb-top:env(safe-area-inset-top,0px)}
#mbar,#mdim,.mb-tip,.mb-net{display:none}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
@media (max-width:980px){
  html,body{overscroll-behavior-y:contain}
  body{padding-bottom:calc(var(--mb-h) + var(--mb-safe));-webkit-tap-highlight-color:transparent}
  /* top bar: sticky, brand gradient, safe area under the iPhone notch */
  .topb{position:sticky;top:0;z-index:35;margin:0;padding:calc(10px + var(--mb-top)) 14px 10px!important;background:var(--grad);color:#fff;box-shadow:0 6px 18px rgba(120,30,140,.18)}
  .topb .crumb{color:#fff;font-weight:800;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .topb .pill{display:none}
  .topb .burger{display:none!important}
  .topb .mb-me{width:36px;height:36px;border-radius:50%;overflow:hidden;border:2px solid rgba(255,255,255,.6);display:grid;place-items:center;font-weight:800;background:rgba(255,255,255,.2);flex:0 0 auto}
  .topb .mb-me img{width:100%;height:100%;object-fit:cover}
  .wrap{padding:12px 12px 18px!important}
  h1{font-size:20px!important}h2{font-size:16px}
  footer{display:none!important}
  .hero .av{width:56px!important;height:56px!important;font-size:22px!important}
  /* touch targets + no iOS zoom on focus */
  input,select,textarea,.inp{font-size:16px!important}
  .inp,select.inp{min-height:48px}
  .btn{min-height:48px;padding:12px 16px}
  .card{border-radius:16px}
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}
  .kpi{padding:12px 14px}.kpi b{font-size:21px}
  /* wide tables scroll sideways, first column stays */
  .mb-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:0 -12px;padding:0 12px;scrollbar-width:none}
  .mb-scroll::-webkit-scrollbar{display:none}
  .mb-scroll table{min-width:560px}
  .mb-scroll th:first-child,.mb-scroll td:first-child{position:sticky;left:0;background:#fff;z-index:1;box-shadow:6px 0 8px -8px rgba(60,20,80,.35)}
  td{padding:10px 8px}
  /* opt-in: <table class="mk"> becomes one card per row on phones (labels come from <th>) */
  .mb-dup{display:none!important}
  table.mk{min-width:0!important}table.mk thead{display:none}
  table.mk tr{display:block;background:#fff;border:1px solid var(--line);border-radius:14px;margin-bottom:10px;padding:6px 12px}
  table.mk td{display:flex;justify-content:space-between;gap:12px;border:0;padding:7px 0;text-align:right;position:static!important;box-shadow:none!important}
  table.mk td::before{content:attr(data-l);color:var(--muted);font-size:13px;font-weight:700;text-align:left}
  table.mk td:first-child{font-size:17px;font-weight:800;padding-top:10px;border-bottom:1px solid var(--line)}
  table.mk td:first-child::before{display:none}
  /* left menu becomes a bottom sheet opened from the tab bar */
  .side{top:auto!important;bottom:0;left:0;right:0;width:100%!important;height:auto!important;max-height:82vh;border-radius:22px 22px 0 0;border:0;
    transform:translateY(105%)!important;padding:10px 14px calc(16px + var(--mb-safe))!important;z-index:60!important}
  .side.open{transform:none!important}
  .side .mb-hide{display:none!important}
  .side.mb-one .brand,.side.mb-one .me,.side.mb-one .mb-inst{display:none!important}
  .side::before{content:"";display:block;width:44px;height:5px;border-radius:5px;background:#e2dbe8;margin:0 auto 8px}
  .side a{padding:13px 12px;font-size:15px}
  .side .brand{padding:4px 10px 8px!important}
  .side .mb-inst{display:flex;align-items:center;gap:12px;margin:8px 0 4px;padding:13px 12px;border-radius:12px;background:var(--acl);color:var(--ac);font-weight:800;border:0;width:100%;font-size:15px}
  #mdim{position:fixed;inset:0;background:rgba(29,20,38,.45);z-index:55}
  #mdim.on{display:block}
  /* bottom tab bar */
  #mbar{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;position:fixed;left:0;right:0;bottom:0;z-index:30;height:calc(var(--mb-h) + var(--mb-safe));
    padding:6px 4px var(--mb-safe);background:rgba(255,255,255,.97);border-top:1px solid var(--line);box-shadow:0 -6px 20px rgba(80,20,140,.07);
    -webkit-backdrop-filter:saturate(1.6) blur(12px);backdrop-filter:saturate(1.6) blur(12px)}
  #mbar a,#mbar button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:none;color:#8a7f96;font:700 10.5px/1.1 inherit;
    padding:2px;min-width:0;text-align:center;cursor:pointer;-webkit-user-select:none;user-select:none}
  #mbar span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #mbar svg.gi{width:28px;height:28px;stroke:none}
  #mbar svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  #mbar i{display:grid;place-items:center;width:46px;height:28px;border-radius:14px;transition:background .15s}
  #mbar .on{color:var(--ac)}#mbar .on i{background:var(--acl)}
  #mbar a:active i,#mbar button:active i{transform:scale(.92)}
  /* pages that use bottom-fixed things move above the bar */
  #toast{bottom:calc(var(--mb-h) + var(--mb-safe) + 12px)!important}
  .sticky-save,.mb-save{position:sticky;bottom:calc(var(--mb-h) + var(--mb-safe) + 8px);z-index:20;width:100%}
  /* shop-floor screen (ekran.html): the size sheet covers the bar and respects the home indicator */
  /* count pad: save in brand purple (green is for status only), chosen size row purple, not red */
  .pad .sv{background:var(--btn,#a73afd)!important;color:#fff!important}
  .s.on{border:2px solid var(--btn,#a73afd)!important;background:var(--btn-soft,#f3e8ff)!important}
  /* standard phone pad: quick chips (+5 +10 +50 +112) on top, digits 3 per row, then ⌫ 0, then save.
     Buttons come from ekran.html in this order: 1 2 3 4 5 +5 6 7 8 9 0 +10 +50 +112 ⌫ save */
  .pad{grid-template-columns:repeat(12,1fr)!important}
  .pad button{grid-column:span 4!important}
  .pad button:nth-child(6),.pad button:nth-child(12),.pad button:nth-child(13),.pad button:nth-child(14){grid-column:span 3!important;order:-1;height:42px!important;font-size:17px!important}
  .pad button:nth-child(15){order:1}.pad button:nth-child(11){order:2;grid-column:span 8!important}
  .pad button:nth-child(16){order:3;grid-column:span 12!important}
  .sheet{z-index:65!important}.sheet .pn{padding-bottom:calc(16px + var(--mb-safe))!important;max-height:calc(100dvh - var(--mb-top) - 8px)!important}
  .hero{padding:18px!important;border-radius:18px!important}
}
@media (max-width:420px){
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .tiles{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .tile{padding:14px!important}.tile p{display:none}
}
@media (hover:none){.tile:hover,.side a:hover{transform:none}tr:hover td{background:inherit}}
/* installed app (home-screen icon): no browser bar, so give a little more room at the top */
@media (display-mode:standalone){.topb{padding-top:calc(12px + var(--mb-top))!important}}
/* offline strip + install tip */
.mb-net{position:fixed;left:12px;right:12px;top:calc(8px + var(--mb-top));z-index:90;background:#2b2233;color:#fff;border-radius:12px;padding:10px 14px;font-weight:700;font-size:14px;text-align:center}
.mb-net.on{display:block}
.mb-tip{position:fixed;left:10px;right:10px;bottom:calc(var(--mb-h) + var(--mb-safe) + 10px);z-index:58;background:#fff;border-radius:18px;padding:14px 44px 14px 14px;
  box-shadow:0 12px 40px rgba(60,20,90,.25);font-size:14px;line-height:1.4;gap:12px;align-items:center}
.mb-tip.on{display:flex}.mb-tip img{width:44px;height:44px;border-radius:12px;flex:0 0 auto}
.mb-tip svg{width:18px;height:18px;vertical-align:-3px;stroke:var(--ac2);fill:none;stroke-width:2}
.mb-tip button{position:absolute;right:8px;top:8px;width:32px;height:32px;border:0;border-radius:50%;background:#f3eef7;font-size:16px}
@media print{#mbar,#mdim,.mb-tip,.mb-net{display:none!important}}
/* small phones (iPhone SE, older Android): the count pad shrinks so at least two sizes stay visible */
@media (max-width:980px) and (max-height:720px){
  .pad{gap:6px!important}.pad button{height:46px!important;font-size:19px!important}
  .ph2 img{width:56px!important;height:56px!important}.ph2 h2{font-size:20px!important}.ph2 .x{width:44px!important;height:44px!important}
  .sz{min-height:124px}.s .v{height:46px!important;font-size:24px!important}
}
/* workshop tablets: bigger fields and buttons (gloves, distance) */
@media (min-width:600px) and (max-width:1100px) and (pointer:coarse){
  input,select,.inp{min-height:56px!important;font-size:18px!important}.btn{min-height:56px}
}
