/* ============================================================
   Pismoreklam ERP — redizajn ljuske i mobilnog prikaza (2026-11-22)
   Učitava se ZADNJI. Boje: Pismoreklam narančasta + crna + neutralne sive.
   NE dira izgled artikala ni kartice artikala (.art, .detail, .hero,
   stranice "articles" i "supplierCatalog").
   ============================================================ */
:root{
  color-scheme:light;
  --pr-orange:#E86810;
  --pr-orange-dark:#C94F00;
  --pr-orange-soft:#FFF1E7;
  --pr-black:#0B0B0C;
  --pr-ink:#171719;
  --pr-muted:#6B6B70;
  --pr-canvas:#F4F4F2;
  --pr-surface:#FFFFFF;
  --pr-line:#E8E8E5;
  --pr-radius:16px;
  --pr-head:"Archivo","Amsi Pro","Avenir Next",Inter,Helvetica,Arial,sans-serif;
}
/* Sustav je samo svijetli: tamni način mobitela više ne miješa boje. */
html,body{color-scheme:light}
html body,html body #app#app.app{background:var(--pr-canvas);color:var(--pr-ink)}

/* ---------- Tipografija ---------- */
html body #app#app.app .top h1,
html body #app#app.app .main h2,
html body #app#app.app .main h3{
  font-family:var(--pr-head);font-stretch:92%;letter-spacing:-.015em;
}
html body #app#app.app .top h1{font-weight:800;color:var(--pr-ink)}

/* ---------- Zaglavlje stranice ---------- */
html body #app#app.app .top{
  background:var(--pr-surface);border-bottom:1px solid var(--pr-line);
  align-items:center;
}
html body #app#app.app .top .pill{
  background:var(--pr-black);color:#fff;border-color:var(--pr-black);
  font-weight:800;letter-spacing:.04em;
}

/* ---------- Podizbornik (kartice odjeljka) ---------- */
html body #app#app.app .erp-section-tabs{border-bottom:0;gap:6px;scrollbar-width:none}
html body #app#app.app .erp-section-tabs::-webkit-scrollbar{display:none}
html body #app#app.app .erp-section-tabs .erp-tab{
  border-radius:999px;border:1px solid var(--pr-line);background:var(--pr-surface);
  color:var(--pr-ink);font-weight:700;
}
html body #app#app.app .erp-section-tabs .erp-tab.active{
  background:var(--pr-black);border-color:var(--pr-black);color:#fff;
  box-shadow:inset 0 -3px 0 var(--pr-orange);
}

/* ---------- Paneli i kartice (osim artikala) ---------- */
body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .panel,
body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .card:not(.art){
  border-radius:var(--pr-radius);border:1px solid var(--pr-line);background:var(--pr-surface);
  box-shadow:none;
}
body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content table th{
  background:#F7F7F5;color:var(--pr-muted);font-size:11px;letter-spacing:.03em;
}

/* Fokus tipkovnicom svugdje vidljiv */
html body #app#app.app :is(button,a,input,select,textarea,summary):focus-visible{
  outline:3px solid var(--pr-orange);outline-offset:2px;
}

/* =================== MOBITEL =================== */
@media (max-width:850px){
  html body #app#app.app{display:block;min-height:100dvh}

  /* Gornja traka s logom */
  html body #app#app.app>aside.side{
    position:sticky!important;top:0;z-index:60;height:auto!important;
    padding:0 14px!important;background:#fff!important;
    /* bez backdrop-filtera: on zatvara fiksni izbornik u visinu trake */
    border-bottom:1px solid var(--pr-line)!important;box-shadow:none!important;
  }
  html body #app#app.app .mobile-head{
    height:56px!important;min-height:56px!important;padding:0!important;margin:0!important;
    background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important;
    display:flex!important;align-items:center;justify-content:space-between;
  }
  html body #app#app.app .mobile-head .brand-logo-side{max-height:24px;width:auto}
  html body #app#app.app .mobile-menu-btn{
    width:42px;height:42px;border-radius:12px;border:1px solid var(--pr-line);background:#fff;
  }
  html body.mobile-nav-open #app#app.app .mobile-menu-btn{background:var(--pr-black);border-color:var(--pr-black)}
  html body.mobile-nav-open #app#app.app .mobile-menu-btn span{background:#fff}
  html body #app#app.app .side .nav.erp-grouped-nav{inset:57px 0 0!important;padding-bottom:120px!important}

  /* Glavni sadržaj: mjesto za plutajući dock */
  html body #app#app.app .main{padding:0 12px calc(104px + env(safe-area-inset-bottom))!important;min-width:0}

  /* Naslov stranice: jedan kompaktan blok umjesto 250 px gumba */
  html body #app#app.app .top{
    display:flex!important;flex-wrap:wrap;align-items:center;gap:8px 8px;
    height:auto!important;min-height:0!important;
    margin:0 -12px 10px!important;padding:12px 12px 10px!important;
  }
  html body #app#app.app .top>div:first-child{flex:1 1 100%;min-width:0}
  html body #app#app.app .top h1{
    font-size:24px!important;line-height:1.2!important;margin:0!important;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
  html body #app#app.app .top .sub{display:none}
  html body #app#app.app .top>div:nth-child(2){
    flex:0 1 auto;max-width:100%;display:flex!important;flex-wrap:nowrap!important;justify-content:flex-start!important;
    gap:6px!important;overflow-x:auto;scrollbar-width:none;
  }
  html body #app#app.app .top>div:nth-child(2)::-webkit-scrollbar{display:none}
  html body #app#app.app .top .pill,
  html body #app#app.app .top .btn{
    flex:0 0 auto;min-height:32px!important;height:32px;padding:0 12px!important;margin:0!important;
    border-radius:999px!important;font-size:12px!important;line-height:32px!important;
    white-space:nowrap;max-width:none!important;width:auto!important;display:inline-flex!important;align-items:center;
  }
  html body #app#app.app .top .btn[style*="display: none"],
  html body #app#app.app .top .btn[style*="display:none"]{display:none!important}
  html body #app#app.app .top>#crmNotifications{order:3;flex:0 0 auto}

  /* Podizbornik */
  html body #app#app.app .erp-section-tabs{margin:0 0 12px!important;padding:2px 0 4px!important;
    -webkit-mask-image:linear-gradient(90deg,#000 88%,transparent);mask-image:linear-gradient(90deg,#000 88%,transparent)}
  html body #app#app.app .erp-section-tabs .erp-tab{min-height:38px!important;padding:0 14px!important;font-size:13px!important}

  /* Plutajući dock — crna kapsula, aktivna stavka narančasta */
  html body #app#app.app .mobile-dock{
    display:grid!important;grid-template-columns:repeat(5,1fr);gap:4px;
    position:fixed!important;left:12px!important;right:12px!important;width:auto!important;max-width:560px;margin:0 auto!important;box-sizing:border-box;
    bottom:calc(12px + env(safe-area-inset-bottom))!important;top:auto!important;
    height:64px!important;padding:6px!important;z-index:70;
    background:var(--pr-black)!important;border:0!important;border-radius:22px!important;
    box-shadow:0 14px 34px rgba(11,11,12,.28)!important;
  }
  html body #app#app.app .mobile-dock button{
    display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:3px;
    min-width:0;height:52px!important;padding:0!important;border:0!important;border-radius:16px!important;
    background:transparent!important;color:#A9A9AE!important;font-size:11px!important;font-weight:700;
  }
  html body #app#app.app .mobile-dock button.hide{display:none!important}
  html body #app#app.app .mobile-dock button b{font-size:19px!important;line-height:1;color:inherit!important}
  html body #app#app.app .mobile-dock button.on{background:var(--pr-orange)!important;color:#fff!important}
  html body #app#app.app .mobile-dock .dock-camera-icon svg{stroke:currentColor;fill:none;width:20px;height:20px;stroke-width:1.8}
  html body #app#app.app .mobile-dock:has(button.hide){grid-template-columns:repeat(4,1fr)}

  /* Čitljivost: nijedan tekst ispod 12 px, polja 16 px (iOS ne zumira) */
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content{font-size:14px}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content :is(small,.help,.sub,.muted){font-size:12px!important}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app :is(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px!important;min-height:44px}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app .field label{font-size:11px!important}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .btn{min-height:42px}

  /* Paneli: puna širina, zaglavlja složena okomito */
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .panel{margin-left:0;margin-right:0}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .ph{display:block;padding:14px}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .ph h2{font-size:18px}
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .pb{padding:12px 14px}

  /* Tablice: vodoravno pomicanje umjesto zgnječenih stupaca */
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content table{
    display:block;width:100%;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;
    border-collapse:collapse;
    background:
      linear-gradient(90deg,#fff 30%,rgba(255,255,255,0)) left/24px 100% no-repeat local,
      linear-gradient(270deg,#fff 30%,rgba(255,255,255,0)) right/24px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.12),transparent) left/10px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.12),transparent) right/10px 100% no-repeat scroll;
  }
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content :is(th,td){
    min-width:92px;max-width:260px;padding:10px 12px!important;vertical-align:top;
    white-space:normal;overflow-wrap:anywhere;font-size:13px;line-height:1.4;height:auto!important;
  }
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content th{white-space:nowrap}

  /* Mreže kartica pokazatelja: dvije u redu */
  body:not([data-page="articles"]):not([data-page="supplierCatalog"]) #app#app.app #content .cards{grid-template-columns:1fr 1fr;gap:8px}

  /* Modal kao donji list preko cijele širine (ne dira sadržaj kartice artikla) */
  html body #modal.modalbg{padding:0!important;align-items:flex-end!important}
  html body #modal .modal{
    width:100%!important;max-width:100%!important;max-height:92dvh;overflow:auto;
    border-radius:20px 20px 0 0!important;padding-bottom:env(safe-area-inset-bottom);
  }
}

@media (max-width:360px){
  html body #app#app.app .mobile-dock button span{font-size:10px}
  html body #app#app.app .top h1{font-size:23px!important}
}

@media (prefers-reduced-motion:reduce){
  html body *{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}
@media print{
  html body #app#app.app .mobile-dock{display:none!important}
}

/* ---------- Skriveni izbornik na dodirnim ekranima u desktop rasporedu ---------- */
.pr-drawer-btn{display:none}
body.pr-drawer #app#app.app{grid-template-columns:minmax(0,1fr)!important}
body.pr-drawer #app#app.app>aside.side{
  position:fixed!important;top:0;left:0;bottom:0;width:min(320px,86vw);height:100dvh!important;
  z-index:90;overflow-y:auto;transform:translateX(-105%);
  box-shadow:0 0 40px rgba(0,0,0,.35);
}
body.pr-drawer.pr-drawer-open #app#app.app>aside.side{transform:none}
body.pr-drawer.pr-drawer-anim #app#app.app>aside.side{transition:transform .2s ease}
body.pr-drawer #app#app.app>aside.side .nav.erp-grouped-nav{max-height:none}
body.pr-drawer .pr-drawer-shade{position:fixed;inset:0;z-index:85;background:rgba(11,11,12,.45);display:none}
body.pr-drawer.pr-drawer-open .pr-drawer-shade{display:block}
body.pr-drawer #app#app.app .top{gap:14px}
body.pr-drawer .pr-drawer-btn{
  display:inline-flex;flex-direction:column;justify-content:center;align-items:center;gap:5px;
  width:48px;height:48px;flex:0 0 48px;border:0;border-radius:14px;background:var(--pr-black);cursor:pointer;
}
body.pr-drawer .pr-drawer-btn span{width:22px;height:2.5px;border-radius:3px;background:#fff}
body.pr-drawer.pr-drawer-open .pr-drawer-btn{background:var(--pr-orange)}
@media (prefers-reduced-motion:reduce){body.pr-drawer #app#app.app>aside.side{transition:none}}
