/* MBus WMS mobile terminal UI v36
   Mobile/PWA only. Desktop layout remains unchanged. */

body.mbus-terminal-mode {
  --mbus-terminal-bg: #07111f;
  --mbus-terminal-panel: #0f172a;
  --mbus-terminal-panel-2: #111c2f;
  --mbus-terminal-border: rgba(148, 163, 184, .32);
  --mbus-terminal-green: #22c55e;
  --mbus-terminal-green-2: #86efac;
  --mbus-terminal-blue: #38bdf8;
  --mbus-terminal-amber: #f59e0b;
  --mbus-terminal-red: #ef4444;
  --mbus-terminal-text: #e5edf7;
  --mbus-terminal-muted: #9fb0c7;
  background: var(--mbus-terminal-bg) !important;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overflow-x: hidden;
  touch-action: manipulation;
}

body.mbus-terminal-mode #root,
body.mbus-terminal-mode #root > div,
body.mbus-terminal-mode .min-h-screen {
  min-height: 100dvh !important;
  background: linear-gradient(180deg, #07111f 0%, #0d1726 46%, #101827 100%) !important;
}

body.mbus-terminal-mode * {
  -webkit-tap-highlight-color: transparent;
}

body.mbus-terminal-mode header {
  min-height: 54px !important;
  background: linear-gradient(90deg, #020617 0%, #0f172a 100%) !important;
  color: #f8fafc !important;
  border-bottom: 1px solid rgba(34, 197, 94, .35) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .32) !important;
}

body.mbus-terminal-mode header span,
body.mbus-terminal-mode header div {
  color: inherit;
}

body.mbus-terminal-mode header button,
body.mbus-terminal-mode header svg {
  color: #f8fafc !important;
}

body.mbus-terminal-mode header [class*="bg-primary"] {
  background: var(--mbus-terminal-green) !important;
  color: #03120a !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .22), 0 0 18px rgba(34, 197, 94, .40) !important;
}

body.mbus-terminal-mode header [class*="bg-primary"] svg {
  color: #03120a !important;
}

body.mbus-terminal-mode main {
  padding-top: 48px !important;
  padding-bottom: calc(112px + env(safe-area-inset-bottom)) !important;
}

body.mbus-terminal-mode main > div {
  width: 100% !important;
  max-width: none !important;
  padding: 10px !important;
}

body.mbus-terminal-mode h1 {
  font-size: 24px !important;
  line-height: 1.05 !important;
  letter-spacing: -.04em !important;
  color: #f8fafc !important;
  margin-bottom: 10px !important;
}

body.mbus-terminal-mode h2,
body.mbus-terminal-mode h3 {
  letter-spacing: -.02em;
}

body.mbus-terminal-mode .mbus-terminal-status {
  position: fixed;
  left: 0;
  right: 0;
  top: 54px;
  z-index: 39;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 8px max(18px, env(safe-area-inset-right)) 8px 10px;
  background: rgba(2, 6, 23, .94);
  color: var(--mbus-terminal-text);
  border-bottom: 1px solid rgba(56, 189, 248, .24);
  box-shadow: 0 12px 28px rgba(0,0,0,.26);
  backdrop-filter: blur(14px);
}

body.mbus-terminal-mode .mbus-terminal-status-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mbus-terminal-mode .mbus-terminal-status-title::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--mbus-terminal-green);
  box-shadow: 0 0 16px rgba(34, 197, 94, .95);
  flex: 0 0 auto;
}

body.mbus-terminal-mode .mbus-terminal-status-sub {
  min-width: 0;
  color: var(--mbus-terminal-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mbus-terminal-mode .mbus-terminal-status-text {
  min-width: 0;
}

body.mbus-terminal-mode .mbus-terminal-status-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  transform: translateX(-8px);
}

body.mbus-terminal-mode .mbus-terminal-logout {
  appearance: none;
  -webkit-appearance: none;
  min-height: 32px !important;
  height: 32px !important;
  width: auto !important;
  padding: 0 10px !important;
  border: 1px solid rgba(248, 113, 113, .55) !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, rgba(127, 29, 29, .98), rgba(220, 38, 38, .92)) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 22px rgba(127, 29, 29, .30) !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 1000 !important;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}

body.mbus-terminal-mode .mbus-terminal-logout:active {
  transform: translateY(1px) scale(.98);
}

body.mbus-terminal-mode .mbus-terminal-clock {
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, .26);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(15, 23, 42, .72);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
}

body.mbus-terminal-mode [class*="rounded"][class*="border"],
body.mbus-terminal-mode [data-slot="card"],
body.mbus-terminal-mode .rounded-xl,
body.mbus-terminal-mode .rounded-lg,
body.mbus-terminal-mode .rounded-md {
  border-color: rgba(203, 213, 225, .92) !important;
}

body.mbus-terminal-mode [data-slot="card"],
body.mbus-terminal-mode .bg-card,
body.mbus-terminal-mode [class*="bg-background"],
body.mbus-terminal-mode [class*="bg-card"] {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

body.mbus-terminal-mode header[class*="bg-background"],
body.mbus-terminal-mode header [class*="bg-background"] {
  background: transparent !important;
  color: #f8fafc !important;
}

body.mbus-terminal-mode [class*="rounded-xl"],
body.mbus-terminal-mode [data-slot="card"] {
  border-radius: 18px !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .20) !important;
}

body.mbus-terminal-mode .grid {
  gap: 10px !important;
}

body.mbus-terminal-mode label,
body.mbus-terminal-mode [data-slot="label"] {
  font-size: 13px !important;
  font-weight: 950 !important;
  letter-spacing: .02em;
  color: #0f172a !important;
}

body.mbus-terminal-mode input,
body.mbus-terminal-mode textarea,
body.mbus-terminal-mode button,
body.mbus-terminal-mode [role="combobox"] {
  font-size: 16px !important;
}

body.mbus-terminal-mode input:not([type="checkbox"]):not([type="radio"]),
body.mbus-terminal-mode textarea,
body.mbus-terminal-mode [role="combobox"] {
  min-height: 50px !important;
  border-radius: 14px !important;
}

body.mbus-terminal-mode input.mbus-terminal-scan-field,
body.mbus-terminal-mode textarea.mbus-terminal-scan-field {
  min-height: 64px !important;
  padding: 0 14px !important;
  border: 2px solid rgba(34, 197, 94, .86) !important;
  background: #f7fff9 !important;
  color: #03120a !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 20px !important;
  font-weight: 950 !important;
  letter-spacing: .02em !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 10px 22px rgba(15, 23, 42, .08) !important;
}

body.mbus-terminal-mode input.mbus-terminal-scan-field::placeholder,
body.mbus-terminal-mode textarea.mbus-terminal-scan-field::placeholder {
  color: #64748b !important;
  opacity: 1;
  font-weight: 850 !important;
}

body.mbus-terminal-mode input.mbus-terminal-scan-field:focus,
body.mbus-terminal-mode textarea.mbus-terminal-scan-field:focus {
  outline: none !important;
  border-color: #16a34a !important;
  background: #ecfdf5 !important;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .20), 0 0 24px rgba(34, 197, 94, .22) !important;
}

body.mbus-terminal-mode .mbus-terminal-scan-wrap {
  position: relative;
}

body.mbus-terminal-mode .mbus-terminal-scan-wrap::before {
  content: "SCAN";
  position: absolute;
  right: 8px;
  top: -8px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  background: #052e16;
  color: #bbf7d0;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .10em;
  pointer-events: none;
}

body.mbus-terminal-mode input.mbus-terminal-number-field {
  min-height: 58px !important;
  font-size: 22px !important;
  font-weight: 950 !important;
  text-align: center;
}

body.mbus-terminal-mode button,
body.mbus-terminal-mode a[role="button"] {
  min-height: 48px;
  border-radius: 14px !important;
  font-weight: 900 !important;
  touch-action: manipulation;
}

body.mbus-terminal-mode button:active,
body.mbus-terminal-mode a[role="button"]:active {
  transform: translateY(1px) scale(.992);
}

body.mbus-terminal-mode .mbus-terminal-primary,
body.mbus-terminal-mode button.mbus-terminal-primary {
  min-height: 58px !important;
  width: 100%;
  background: linear-gradient(135deg, #052e16 0%, #16a34a 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(134, 239, 172, .55) !important;
  box-shadow: 0 18px 32px rgba(22, 163, 74, .26) !important;
  text-transform: uppercase;
  letter-spacing: .04em;
}

body.mbus-terminal-mode .mbus-terminal-danger,
body.mbus-terminal-mode button.mbus-terminal-danger {
  background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 100%) !important;
  color: white !important;
}

body.mbus-terminal-mode nav[class*="fixed"][class*="bottom"] {
  display: none !important;
}

body.mbus-terminal-mode .mbus-terminal-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99998;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
  background: rgba(2, 6, 23, .98);
  border-top: 1px solid rgba(34, 197, 94, .33);
  box-shadow: 0 -18px 38px rgba(0, 0, 0, .38);
  backdrop-filter: blur(14px);
}

body.mbus-terminal-mode .mbus-terminal-nav a,
body.mbus-terminal-mode .mbus-terminal-nav button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  border-radius: 13px;
  color: #b7c7dc;
  text-decoration: none;
  font-size: 10px;
  border: 0;
  background: transparent;
  font-weight: 950;
  letter-spacing: .02em;
  text-transform: uppercase;
}

body.mbus-terminal-mode .mbus-terminal-nav a span:first-child,
body.mbus-terminal-mode .mbus-terminal-nav button span:first-child {
  font-size: 20px;
  line-height: 1;
}


body.mbus-terminal-mode .mbus-terminal-nav a.is-active {
  background: rgba(34, 197, 94, .14);
  color: #dcfce7;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, .35);
}

body.mbus-terminal-mode .mbus-terminal-scan-fab {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 99999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 158px;
  height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(134, 239, 172, .70);
  border-radius: 999px;
  background: linear-gradient(135deg, #052e16, #16a34a);
  color: #ffffff;
  font-weight: 1000;
  letter-spacing: .06em;
  text-transform: uppercase;
  box-shadow: 0 20px 42px rgba(22, 163, 74, .34), 0 0 0 6px rgba(2, 6, 23, .55);
}

body.mbus-terminal-mode .mbus-terminal-scan-fab:active {
  transform: translateX(-50%) translateY(1px) scale(.99);
}

body.mbus-terminal-mode .mbus-terminal-home {
  margin: 8px 0 12px;
  padding: 10px;
  border: 1px solid rgba(34, 197, 94, .22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(30, 41, 59, .96));
  box-shadow: 0 18px 38px rgba(0, 0, 0, .24);
  color: #f8fafc;
}

body.mbus-terminal-mode .mbus-terminal-home-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .10em;
  text-transform: uppercase;
}

body.mbus-terminal-mode .mbus-terminal-home-title small {
  color: #9fb0c7;
  font-size: 10px;
  letter-spacing: .02em;
  text-transform: none;
}

body.mbus-terminal-mode .mbus-terminal-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body.mbus-terminal-mode .mbus-terminal-home-card {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  color: #f8fafc;
  text-decoration: none;
}

body.mbus-terminal-mode .mbus-terminal-home-card b {
  display: block;
  font-size: 18px;
  line-height: 1;
}

body.mbus-terminal-mode .mbus-terminal-home-card span {
  color: #9fb0c7;
  font-size: 11px;
  font-weight: 800;
}

body.mbus-terminal-mode .mbus-terminal-home-card em {
  font-style: normal;
  align-self: flex-start;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .16);
  color: #bbf7d0;
  font-size: 10px;
  font-weight: 950;
}

body.mbus-terminal-mode table {
  font-size: 13px !important;
}

body.mbus-terminal-mode table th,
body.mbus-terminal-mode table td {
  padding: 9px 8px !important;
}

body.mbus-terminal-mode .overflow-x-auto,
body.mbus-terminal-mode [class*="overflow-x-auto"] {
  border-radius: 14px;
  border: 1px solid rgba(203, 213, 225, .85);
}

body.mbus-terminal-mode [role="dialog"],
body.mbus-terminal-mode [data-radix-popper-content-wrapper] {
  z-index: 100001 !important;
}

body.mbus-terminal-mode [data-radix-popper-content-wrapper] [role="listbox"],
body.mbus-terminal-mode [data-radix-popper-content-wrapper] {
  max-width: calc(100vw - 18px) !important;
}

body.mbus-terminal-mode .mbus-terminal-mini-toast {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(136px + env(safe-area-inset-bottom));
  z-index: 100002;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .98);
  color: #ffffff;
  border: 1px solid rgba(34, 197, 94, .35);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  transform: translateY(8px);
  opacity: 0;
  animation: mbusTerminalToast .16s ease forwards;
}

@keyframes mbusTerminalToast {
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 380px) {
  body.mbus-terminal-mode .mbus-terminal-nav a,
  body.mbus-terminal-mode .mbus-terminal-nav button {
    font-size: 9px;
  }
  body.mbus-terminal-mode .mbus-terminal-scan-fab {
    min-width: 142px;
    height: 50px;
  }
  body.mbus-terminal-mode input.mbus-terminal-scan-field,
  body.mbus-terminal-mode textarea.mbus-terminal-scan-field {
    font-size: 18px !important;
  }
  body.mbus-terminal-mode .mbus-terminal-logout {
    width: 36px !important;
    padding: 0 !important;
    font-size: 0 !important;
  }
  body.mbus-terminal-mode .mbus-terminal-logout::before {
    content: "⎋";
    font-size: 16px;
    line-height: 1;
  }
  body.mbus-terminal-mode .mbus-terminal-clock {
    font-size: 11px;
    padding: 5px 7px;
  }
  body.mbus-terminal-mode .mbus-terminal-status-actions {
    transform: translateX(-10px);
  }
}

@media (max-width: 430px) {
  body.mbus-terminal-mode .mbus-terminal-status-sub {
    display: none;
  }
  body.mbus-terminal-mode .mbus-terminal-status-title::after {
    display: none !important;
  }
}

@media (min-width: 901px) and (pointer: fine) {
  body.mbus-terminal-mode .mbus-terminal-status,
  body.mbus-terminal-mode .mbus-terminal-nav,
  body.mbus-terminal-mode .mbus-terminal-scan-fab,
  body.mbus-terminal-mode .mbus-terminal-home,
  body.mbus-terminal-mode .mbus-terminal-mini-toast {
    display: none !important;
  }
}

/* v30: role-specific mobile terminal */
body.mbus-terminal-mode.mbus-terminal-frontline header button[aria-label="Meni"],
body.mbus-terminal-mode.mbus-terminal-frontline header button[aria-label="Obvestila"] {
  display: none !important;
}

body.mbus-terminal-mode.mbus-terminal-frontline header {
  justify-content: center !important;
}

body.mbus-terminal-mode.mbus-terminal-frontline .mbus-terminal-home {
  display: none !important;
}

body.mbus-terminal-mode.mbus-terminal-nav-count-1 .mbus-terminal-nav {
  grid-template-columns: 1fr !important;
}

body.mbus-terminal-mode.mbus-terminal-nav-count-2 .mbus-terminal-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.mbus-terminal-mode.mbus-terminal-nav-count-3 .mbus-terminal-nav {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

body.mbus-terminal-mode.mbus-terminal-nav-count-4 .mbus-terminal-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

body.mbus-terminal-mode.mbus-terminal-nav-count-5 .mbus-terminal-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

body.mbus-terminal-mode.mbus-terminal-frontline .mbus-terminal-nav a,
body.mbus-terminal-mode.mbus-terminal-frontline .mbus-terminal-nav button {
  min-height: 62px;
  font-size: 11px;
}

body.mbus-terminal-mode.mbus-terminal-frontline .mbus-terminal-status-title::after {
  content: " · samo dodeljene funkcije";
  color: #9fb0c7;
  font-weight: 800;
  letter-spacing: .03em;
}

body.mbus-terminal-mode.mbus-route-komision .grid.lg\:grid-cols-3,
body.mbus-terminal-mode.mbus-route-regalist .grid.md\:grid-cols-2,
body.mbus-terminal-mode.mbus-route-regalist .grid.md\:grid-cols-3 {
  grid-template-columns: 1fr !important;
}
