/* ============================================================
   ERP System – Global Stylesheet
   ============================================================ */
:root {
  --primary:       #1a237e;
  --primary-light: #283593;
  --secondary:     #1976d2;
  --success:       #16a34a;
  --success-bg:    #f0fdf4;
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --text-dark:     #0f172a;
  --text-muted:    #64748b;
  --border-light:  #e2e8f0;
  --bg-page:       #f8fafc;
  --card-bg:       #ffffff;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
  --sidebar-w:     260px;
  --topbar-h:      60px;
  --radius:        12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
input, textarea, select, button { font-family: inherit; font-size: 14px; }

/* ── PAGE SHELLS ── */
.page { min-height: 100vh; }
#loginPage  { display: flex; align-items: center; justify-content: center; }
#mainApp    { display: flex; flex-direction: column; }

/* ── LOGIN ── */
@keyframes pulse {
  0%,100% { opacity:1 } 50% { opacity:.5 }
}
@keyframes orbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-30px) scale(1.05); }
}
@keyframes orbFloat2 {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(24px) scale(0.96); }
}
.login-bg {
  width: 100%; min-height: 100vh;
  background: linear-gradient(135deg, #0c2b30 0%, #123a41 40%, #17505a 70%, #1c6570 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
}
.login-orb-1 {
  width: 500px; height: 500px; top: -120px; left: -80px;
  background: radial-gradient(circle, rgba(47,168,118,0.22) 0%, transparent 70%);
  animation: orbFloat 8s ease-in-out infinite;
}
.login-orb-2 {
  width: 400px; height: 400px; bottom: -100px; right: 360px;
  background: radial-gradient(circle, rgba(28,101,112,0.25) 0%, transparent 70%);
  animation: orbFloat2 10s ease-in-out infinite;
}
.login-orb-3 {
  width: 280px; height: 280px; top: 40%; right: -60px;
  background: radial-gradient(circle, rgba(47,168,118,0.15) 0%, transparent 70%);
  animation: orbFloat 12s ease-in-out infinite 2s;
}
.login-split {
  display: flex; align-items: stretch;
  width: 100%; max-width: 1100px; min-height: 640px;
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.07);
  position: relative; z-index: 1;
  transform: perspective(1200px) rotateY(-1deg);
}
/* Accent bar across the top of the whole card */
.login-split::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #17505a 0%, #2fa876 50%, #17505a 100%);
  z-index: 3;
}

/* Left brand */
.login-brand {
  flex: 1; min-width: 0;
  background: linear-gradient(155deg, rgba(12,43,48,0.96) 0%, rgba(18,58,65,0.93) 50%, rgba(23,80,90,0.9) 100%);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column;
  padding: 52px 48px 36px; position: relative; overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
}
/* Faint industrial line-art (pipes / gauge / factory silhouette) */
.login-brand::after {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='M20 480 h120 v-90 h80 v60 h100 v-140 h70 v90 h90 v-200 h100'/%3E%3Ccircle cx='470' cy='140' r='46'/%3E%3Ccircle cx='470' cy='140' r='6'/%3E%3Cpath d='M470 100 v40 l28 20'/%3E%3Cpath d='M0 560 h600'/%3E%3Cpath d='M60 560 v-60 h40 v60'/%3E%3Cpath d='M140 560 v-100 h30 v100'/%3E%3Cpath d='M300 560 v-160 l40 -40 h60 v200'/%3E%3Ccircle cx='230' cy='260' r='18'/%3E%3Ccircle cx='230' cy='260' r='3'/%3E%3Cpath d='M230 246 v14 l10 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right -40px bottom -20px;
  background-size: 480px 480px;
}
.login-brand-inner {
  position: relative; z-index: 1;
  opacity: 0; transform: translateY(14px);
  animation: brandFadeIn .7s ease-out .1s forwards;
}
.login-brand-logo-wrap {
  margin-bottom: 28px;
  display: inline-block;
  background: rgba(255,255,255,0.88);
  border-radius: 10px; padding: 7px 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.login-brand-img { height: 44px; width: auto; object-fit: contain; display: block; }
.login-brand-title {
  font-size: 28px; font-weight: 800; color: #fff;
  line-height: 1.28; margin-bottom: 10px; letter-spacing: -0.3px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.login-brand-sub { font-size: 13px; color: rgba(255,255,255,0.6); font-weight: 500; margin-bottom: 36px; }
.login-brand-divider {
  width: 40px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, #2fa876, transparent);
  margin-bottom: 28px;
}
.login-brand-features { display: flex; flex-direction: column; gap: 13px; }
.login-brand-feat {
  display: flex; align-items: center; gap: 13px;
  font-size: 13px; color: rgba(255,255,255,0.78); font-weight: 500;
}
.login-brand-feat i {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: rgba(47,168,118,0.16);
  border: 1px solid rgba(47,168,118,0.32);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: #2fa876;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.login-brand-dept {
  font-size: 11px; color: rgba(255,255,255,0.4);
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 6px;
  margin-top: auto; padding-top: 24px;
}

/* Right form */
.login-form-wrap {
  width: 420px; flex-shrink: 0;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.login-card {
  width: 100%; padding: 44px 44px 32px;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(14px);
  animation: brandFadeIn .7s ease-out .22s forwards;
}
@keyframes brandFadeIn {
  to { opacity: 1; transform: translateY(0); }
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-form-logo { height: 46px; width: auto; object-fit: contain; margin: 0 auto 14px; display: block; }
.login-logo h2 { font-size: 21px; font-weight: 800; color: #123a41; margin-bottom: 3px; }
.factory-tag  { font-size: 12.5px; color: #94a3b8; font-weight: 500; }
.system-tag   { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: #64748b; margin-bottom: 7px;
}
.login-input-wrap {
  position: relative; display: flex; align-items: center;
}
.login-plain-input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; color: #1e293b; background: #f8fafc;
  outline: none; transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.login-plain-input:focus {
  border-color: #1c6570; background: #fff;
  box-shadow: 0 0 0 3px rgba(28,101,112,0.12);
}
.login-pwd-wrap {
  position: relative; display: flex; align-items: center;
}
.login-pwd-wrap .login-plain-input { padding-right: 40px; }
.login-pwd-wrap .eye-btn { position: absolute; right: 12px; }

.login-remember-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; font-size: 12.5px; flex-wrap: wrap; gap: 8px;
}
.login-remember-check {
  display: flex; align-items: center; gap: 7px;
  color: #64748b; font-weight: 500; cursor: pointer;
}
.login-remember-check input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; accent-color: #17505a;
}

.login-btn {
  width: 100%; min-height: 46px; padding: 13px;
  background: linear-gradient(135deg, #17505a 0%, #1c6570 100%);
  color: #fff; border: none; border-radius: 11px;
  font-size: 14.5px; font-weight: 700; cursor: pointer; margin-top: 8px;
  box-shadow: 0 6px 20px rgba(23,80,90,0.35);
  transition: transform .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(23,80,90,0.45);
}
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: .75; cursor: not-allowed; transform: none; }
.login-btn-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Focus visibility for accessibility */
.login-plain-input:focus-visible,
.login-btn:focus-visible,
.eye-btn:focus-visible,
.text-link:focus-visible {
  outline: 2px solid #2fa876; outline-offset: 2px;
}

/* ============================================================
   APP SHELL — sidebar + topbar (post-login)
   ============================================================ */
.um-app { background: #eef2f2; height: 100vh; overflow: hidden; }

.app-shell { display: flex; height: 100%; padding: 16px; gap: 16px; align-items: stretch; }

/* Sidebar — floating glass card, fixed in place (does not scroll with the page) */
.app-sidebar {
  width: 272px; flex-shrink: 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 22px;
  color: #123a41; display: flex; flex-direction: column;
  height: 100%;
  z-index: 60; box-shadow: 0 12px 40px rgba(18,58,65,0.12), 0 0 0 1px rgba(18,58,65,0.03);
  overflow: hidden;
}
.app-sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px;
  position: relative; z-index: 1;
}
.app-sidebar-logo {
  width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #2fa876 0%, #17505a 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  box-shadow: 0 6px 16px rgba(47,168,118,0.32), inset 0 1px 0 rgba(255,255,255,0.25);
}
.app-sidebar-brand-text { line-height: 1.25; min-width: 0; }
.asb-title { font-size: 13px; font-weight: 800; color: #123a41; letter-spacing: .2px; }
.asb-sub   { font-size: 11px; color: #6b8a8f; font-weight: 500; }
.app-sidebar-close { display: none; margin-left: auto; background: none; border: none; color: #123a41; font-size: 18px; cursor: pointer; }

.app-nav-divider {
  margin: 4px 20px 12px; padding-top: 12px; border-top: 1px solid rgba(18,58,65,0.08);
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: #9fb4b7;
}

.app-nav { flex: 1; overflow-y: auto; padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.app-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  color: #4d6a6e; font-size: 13.5px; font-weight: 600;
  transition: background .18s, color .18s, box-shadow .18s;
  position: relative;
}
.app-nav-item:hover { background: rgba(23,80,90,0.06); color: #123a41; }
.app-nav-item.active {
  background: linear-gradient(135deg, #17505a 0%, #1c6570 100%);
  color: #fff; font-weight: 700;
  box-shadow: 0 8px 20px rgba(23,80,90,0.32);
}
.app-nav-item.active::after {
  content: ''; margin-left: auto; width: 6px; height: 6px; border-radius: 50%;
  background: #6fe3ae; box-shadow: 0 0 0 3px rgba(111,227,174,0.25);
}
.app-nav-icon {
  width: 30px; height: 30px; flex-shrink: 0; text-align: center; font-size: 13.5px;
  color: #17505a; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: rgba(23,80,90,0.08); transition: background .18s, color .18s;
}
.app-nav-item:hover .app-nav-icon { background: rgba(23,80,90,0.12); }
.app-nav-item.active .app-nav-icon { background: rgba(255,255,255,0.18); color: #fff; }

/* Collapsible nav group (Power Record + sub-sources) */
.app-nav-caret {
  margin-left: auto; font-size: 10px; color: #9fb4b7; transition: transform .18s;
}
.app-nav-group.open > .app-nav-group-toggle .app-nav-caret { transform: rotate(180deg); }
.app-nav-subgroup {
  max-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px;
  padding-left: 20px; transition: max-height .2s ease;
}
.app-nav-group.open .app-nav-subgroup { max-height: 800px; margin-top: 8px; }
.app-nav-subitem {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 10px;
  color: #6b8a8f; font-size: 12.5px; font-weight: 600;
  transition: background .15s, color .15s;
}
.app-nav-subitem i { width: 16px; text-align: center; font-size: 11px; }
.app-nav-subitem:hover { background: rgba(23,80,90,0.06); color: #123a41; }
.app-nav-subitem.active { background: rgba(23,80,90,0.1); color: #17505a; font-weight: 700; }

/* Distinct colorful identity per power source, in the sidebar sub-menu */
.app-nav-subitem[data-source-code="REB"] i     { color: #0ea5e9; }
.app-nav-subitem[data-source-code="GEN1501"] i { color: #f59e0b; }
.app-nav-subitem[data-source-code="GEN1064"] i { color: #8b5cf6; }
.app-nav-subitem[data-source-code="DGEN"] i    { color: #f97316; }
.app-nav-subitem[data-source-code="REB"].active     { background: rgba(14,165,233,0.14); color: #0369a1; box-shadow: inset 2px 0 0 #0ea5e9; }
.app-nav-subitem[data-source-code="GEN1501"].active { background: rgba(245,158,11,0.14); color: #c2410c; box-shadow: inset 2px 0 0 #f59e0b; }
.app-nav-subitem[data-source-code="GEN1064"].active { background: rgba(139,92,246,0.14); color: #6d28d9; box-shadow: inset 2px 0 0 #8b5cf6; }
.app-nav-subitem[data-source-code="DGEN"].active    { background: rgba(249,115,22,0.14); color: #b45309; box-shadow: inset 2px 0 0 #f97316; }

.app-nav-subitem[data-cng-code="operation"] i   { color: #0ea5e9; }
.app-nav-subitem[data-cng-code="purchase"] i    { color: #f59e0b; }
.app-nav-subitem[data-cng-code="log"] i         { color: #8b5cf6; }
.app-nav-subitem[data-cng-code="consumption"] i { color: #10b981; }
.app-nav-subitem[data-cng-code="settings"] i    { color: #64748b; }
.app-nav-subitem[data-cng-code="operation"].active   { background: rgba(14,165,233,0.14); color: #0369a1; box-shadow: inset 2px 0 0 #0ea5e9; }
.app-nav-subitem[data-cng-code="purchase"].active    { background: rgba(245,158,11,0.14); color: #c2410c; box-shadow: inset 2px 0 0 #f59e0b; }
.app-nav-subitem[data-cng-code="log"].active         { background: rgba(139,92,246,0.14); color: #6d28d9; box-shadow: inset 2px 0 0 #8b5cf6; }
.app-nav-subitem[data-cng-code="consumption"].active { background: rgba(16,185,129,0.14); color: #047857; box-shadow: inset 2px 0 0 #10b981; }
.app-nav-subitem[data-cng-code="settings"].active    { background: rgba(100,116,139,0.14); color: #334155; box-shadow: inset 2px 0 0 #64748b; }

.app-nav-subitem[data-boiler-code="dashboard"] i { color: #0ea5e9; }
.app-nav-subitem[data-boiler-code="entry"] i     { color: #f59e0b; }
.app-nav-subitem[data-boiler-code="log"] i       { color: #8b5cf6; }
.app-nav-subitem[data-boiler-code="reports"] i   { color: #10b981; }
.app-nav-subitem[data-boiler-code="master"] i    { color: #64748b; }
.app-nav-subitem[data-boiler-code="dashboard"].active { background: rgba(14,165,233,0.14); color: #0369a1; box-shadow: inset 2px 0 0 #0ea5e9; }
.app-nav-subitem[data-boiler-code="entry"].active     { background: rgba(245,158,11,0.14); color: #c2410c; box-shadow: inset 2px 0 0 #f59e0b; }
.app-nav-subitem[data-boiler-code="log"].active       { background: rgba(139,92,246,0.14); color: #6d28d9; box-shadow: inset 2px 0 0 #8b5cf6; }
.app-nav-subitem[data-boiler-code="reports"].active   { background: rgba(16,185,129,0.14); color: #047857; box-shadow: inset 2px 0 0 #10b981; }
.app-nav-subitem[data-boiler-code="master"].active    { background: rgba(100,116,139,0.14); color: #334155; box-shadow: inset 2px 0 0 #64748b; }

.app-nav-subitem[data-water-code="dashboard"] i         { color: #0ea5e9; }
.app-nav-subitem[data-water-code="withdrawn"] i         { color: #3b82f6; }
.app-nav-subitem[data-water-code="consumption-entry"] i { color: #f59e0b; }
.app-nav-subitem[data-water-code="wastewater"] i        { color: #8b5cf6; }
.app-nav-subitem[data-water-code="meterdata"] i         { color: #ec4899; }
.app-nav-subitem[data-water-code="consumption"] i       { color: #f97316; }
.app-nav-subitem[data-water-code="reports"] i           { color: #10b981; }
.app-nav-subitem[data-water-code="setting"] i           { color: #64748b; }
.app-nav-subitem[data-water-code="dashboard"].active         { background: rgba(14,165,233,0.14); color: #0369a1; box-shadow: inset 2px 0 0 #0ea5e9; }
.app-nav-subitem[data-water-code="withdrawn"].active         { background: rgba(59,130,246,0.14); color: #1d4ed8; box-shadow: inset 2px 0 0 #3b82f6; }
.app-nav-subitem[data-water-code="consumption-entry"].active { background: rgba(245,158,11,0.14); color: #c2410c; box-shadow: inset 2px 0 0 #f59e0b; }
.app-nav-subitem[data-water-code="wastewater"].active        { background: rgba(139,92,246,0.14); color: #6d28d9; box-shadow: inset 2px 0 0 #8b5cf6; }
.app-nav-subitem[data-water-code="meterdata"].active         { background: rgba(236,72,153,0.14); color: #be185d; box-shadow: inset 2px 0 0 #ec4899; }
.app-nav-subitem[data-water-code="consumption"].active       { background: rgba(249,115,22,0.14); color: #b45309; box-shadow: inset 2px 0 0 #f97316; }
.app-nav-subitem[data-water-code="reports"].active           { background: rgba(16,185,129,0.14); color: #047857; box-shadow: inset 2px 0 0 #10b981; }
.app-nav-subitem[data-water-code="setting"].active           { background: rgba(100,116,139,0.14); color: #334155; box-shadow: inset 2px 0 0 #64748b; }

.app-sidebar-footer { padding: 14px; position: relative; z-index: 1; }
.app-sidebar-user {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  padding: 10px; border-radius: 14px; background: rgba(23,80,90,0.05);
}
.app-sidebar-ava {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2fa876 0%, #17505a 100%);
  color: #fff; font-weight: 700; font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(47,168,118,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
}
.app-sidebar-user-info { min-width: 0; }
.asu-name { font-size: 12.5px; font-weight: 700; color: #123a41; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asu-role { font-size: 10.5px; color: #6b8a8f; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.app-signout-btn { width: 100%; color: #17505a; border-color: rgba(23,80,90,0.18); justify-content: center; background: #fff; }
.app-signout-btn:hover { border-color: #17505a; color: #fff; background: linear-gradient(135deg, #17505a, #1c6570); }

.app-sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(12,43,48,0.45); z-index: 55;
  backdrop-filter: blur(3px);
}
.app-sidebar-overlay.active { display: block; }

/* Main column — topbar stays put, only .app-content scrolls */
.app-main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }

.app-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; background: rgba(255,255,255,0.8);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(18,58,65,0.08);
  flex-shrink: 0; z-index: 40;
}
.app-menu-btn { display: none; background: none; border: none; font-size: 18px; color: #123a41; cursor: pointer; }
.app-topbar-title {
  font-size: 16.5px; font-weight: 800; letter-spacing: -.1px;
  background: linear-gradient(90deg, #123a41, #17505a);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.um-topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.um-topbar-name { font-size: 13px; color: #64748b; font-weight: 600; }

.app-content {
  flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable;
  padding: 0 4px 20px; max-width: 1100px; margin: 0 auto; width: 100%;
}

.app-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 72px 20px; color: #94a3b8; text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #fafcfc 100%);
  border: 1.5px dashed #d7e4e3; border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(23,80,90,0.05);
}
.app-empty-state .app-empty-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(47,168,118,0.14), rgba(23,80,90,0.14));
  display: flex; align-items: center; justify-content: center;
}
.app-empty-state .app-empty-icon i {
  font-size: 26px; background: linear-gradient(135deg, #2fa876, #17505a);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.app-empty-state p { font-size: 13.5px; max-width: 360px; }

@media (max-width: 900px) {
  .app-shell { padding: 0; gap: 0; }
  .app-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
    border-radius: 0; border: none;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-sidebar-close { display: block; }
  .app-menu-btn { display: block; }
  .app-topbar { border-radius: 0; top: 0; }
  .app-main { gap: 0; }
  .app-content { padding: 16px; }
}

/* Modal has no fixed sidebar offset in this layout */
.um-modal.modal { left: 0; }

/* Users table */
.um-users-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.um-users-table th {
  text-align: left; padding: 14px 18px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: #64748b;
  background: #f1f5f9; border-bottom: 2px solid #e2e8f0;
}
.um-users-table th:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.um-users-table th:last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.um-users-table td { padding: 14px 18px; border-bottom: 1px dashed #e2e8f0; vertical-align: middle; transition: background .2s, transform .2s; }
.um-users-table tr:last-child td { border-bottom: none; }

/* Smaller, denser rows for the Power Record log table */
.pr-log-table { font-size: 11.5px; }
.pr-log-table th { padding: 8px 12px; font-size: 10px; }
.pr-log-table td { padding: 7px 12px; }
.um-users-table tr:hover td { background: rgba(13, 148, 136, 0.03); }

/* Compact toggle switch (e.g. "Bulk Only" filters) */
.pr-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; font-weight: 600; color: #334155; }
.pr-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pr-switch-track { position: relative; width: 38px; height: 21px; background: #cbd5e1; border-radius: 999px; flex-shrink: 0; transition: background .2s ease; }
.pr-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s ease; }
.pr-switch input:checked + .pr-switch-track { background: var(--secondary, #0d9488); }
.pr-switch input:checked + .pr-switch-track::after { transform: translateX(17px); }
.pr-switch input:focus-visible + .pr-switch-track { outline: 2px solid var(--secondary, #0d9488); outline-offset: 2px; }

.um-role-select {
  padding: 5px 8px; border: 1.5px solid var(--border-light); border-radius: 7px;
  font-size: 12.5px; background: #fff; color: #1e293b; cursor: pointer;
}

/* User cell (avatar + name + code) used in Users table */
.um-user-cell { display: flex; align-items: center; gap: 10px; }
.um-user-ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2fa876 0%, #17505a 100%);
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(47,168,118,0.28);
}
.um-user-cell-info { min-width: 0; }
.um-user-cell-name { font-size: 13px; font-weight: 700; color: #123a41; }
.um-user-cell-code { font-size: 11px; color: #94a3b8; }

.um-role-badge-list { display: flex; flex-wrap: wrap; gap: 5px; max-width: 280px; }

.um-status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 20px; font-size: 11.5px; font-weight: 800; cursor: pointer;
  border: 1px solid transparent; transition: all .2s ease;
}
.um-status-pill:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.um-status-active   { background: #ecfdf5; color: #059669; border-color: #a7f3d0; box-shadow: 0 2px 6px rgba(16,185,129,0.15); }
.um-status-inactive { background: #fef2f2; color: #dc2626; border-color: #fecdd3; box-shadow: 0 2px 6px rgba(220,38,38,0.15); }
.tp-stock-pill { cursor: default; }
.tp-stock-reserve   { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.tp-stock-partial   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.um-toggle-btn {
  background: none; border: none; cursor: pointer; color: #94a3b8;
  font-size: 15px; padding: 4px; border-radius: 6px; transition: color .15s;
}
.um-toggle-btn:hover { color: var(--secondary); }
.um-toggle-btn.on { color: #d97706; }

/* Tabs */
.um-tabs {
  display: flex; gap: 4px; margin-bottom: 22px;
  background: rgba(241, 245, 249, 0.7); backdrop-filter: blur(8px);
  border-radius: 14px; padding: 6px; width: fit-content;
  border: 1px solid rgba(226, 232, 240, 0.6);
}
.um-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; background: transparent; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: #64748b; cursor: pointer;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}
.um-tab:hover { color: #0d9488; background: rgba(255,255,255,0.4); }
.um-tab.active { background: #fff; color: #0d9488; box-shadow: 0 4px 12px rgba(13,148,136,0.12); }
.um-tab-panel { display: none; animation: fadeIn .3s ease; }
.um-tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Role badge (read-only display) */
.um-role-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  background: #eef2f2; color: #17505a; border: 1px solid #d7e4e3;
}
.um-role-badge.um-role-unassigned { background: #fff7ed; color: #c2410c; border-color: #ffd8a8; }

.um-role-hint {
  font-size: 11.5px; color: #6b8a8f; background: #f4f9f8; border: 1px solid #e0ece9;
  border-radius: 8px; padding: 8px 12px; margin-top: 6px; display: flex; align-items: flex-start; gap: 7px;
}

/* Roles tab */
.um-roles-note {
  font-size: 12.5px; color: #6b8a8f; background: #f4f9f8; border: 1px solid #e0ece9;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.um-roles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px;
}
.um-role-card {
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 16px;
  padding: 22px 16px; text-align: center;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.04);
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.um-role-card:hover { 
  transform: translateY(-4px); 
  box-shadow: 0 12px 28px rgba(13, 148, 136, 0.15); 
  border-color: rgba(13, 148, 136, 0.2);
}
.um-role-card-icon {
  width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(47,168,118,0.14), rgba(23,80,90,0.14));
  display: flex; align-items: center; justify-content: center;
}
.um-role-card-icon i {
  font-size: 18px; background: linear-gradient(135deg, #2fa876, #17505a);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.um-role-card-name { font-size: 12.5px; font-weight: 700; color: #123a41; margin-bottom: 3px; }
.um-role-card-count { font-size: 11px; color: #94a3b8; font-weight: 600; }

/* Access Control tab */
.um-ac-search {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--border-light); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 18px; max-width: 380px;
}
.um-ac-search i { color: #94a3b8; font-size: 13px; }
.um-ac-search input { border: none; outline: none; font-size: 13px; width: 100%; background: transparent; }

.um-ac-list { display: flex; flex-direction: column; gap: 12px; }
.um-ac-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: 16px;
  padding: 16px 18px; box-shadow: 0 2px 10px rgba(23,80,90,0.05);
}
.um-ac-card-user { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.um-user-card-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.um-role-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.um-role-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #f4f7f7; border: 1.5px solid var(--border-light); color: #64748b;
  cursor: pointer; transition: all .15s;
}
.um-role-chip:hover { border-color: #17505a; color: #17505a; }
.um-role-chip.assigned {
  background: linear-gradient(135deg, #17505a 0%, #1c6570 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 12px rgba(23,80,90,0.3);
}
.um-role-chip.assigned:hover { color: #fff; }

@media (max-width: 700px) {
  .app-topbar { padding: 12px 16px; }
  .app-content { padding: 16px; }
  .um-users-table { display: block; overflow-x: auto; white-space: nowrap; }
  .um-tabs { width: 100%; overflow-x: auto; }
  .um-ac-search { max-width: 100%; }
}

/* ============================================================
   ACCESS CONTROL — role permission matrix editor
   ============================================================ */
.ac-card {
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 18px;
  padding: 22px 24px; box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06); margin-bottom: 22px;
}
.ac-card-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ac-card-hdr-title {
  font-size: 11.5px; font-weight: 800; letter-spacing: .6px; color: #6b8a8f;
  display: flex; align-items: center; gap: 8px;
}
.ac-card-hdr-title i { color: #17505a; }

.ac-role-pills { display: flex; flex-direction: column; gap: 14px; }
.ac-role-group-label {
  font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  color: #b3c4c2; margin-bottom: 8px;
}
.ac-role-group-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-role-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 7px; border-radius: 22px; border: 1.5px solid var(--border-light);
  background: #fff; color: #374151; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.ac-role-pill:hover { transform: translateY(-1px); }
.ac-role-pill.active { color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.ac-role-pill-ava {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 9.5px; font-weight: 800;
}

.ac-role-summary { display: flex; align-items: center; gap: 14px; }
.ac-role-summary-ava {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
}
.ac-role-summary-info { flex: 1; min-width: 0; }
.ac-role-summary-name { font-size: 15px; font-weight: 800; color: #123a41; }
.ac-role-summary-count { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }
.ac-full-access-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fef9c3; color: #92400e; border: 1px solid #fde68a;
  border-radius: 10px; padding: 6px 14px; font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}

.ac-full-access-banner {
  display: flex; align-items: center; gap: 8px;
  background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0;
  border-radius: 12px; padding: 12px 16px; font-size: 12.5px; margin-bottom: 18px;
}

.ac-category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.ac-category {
  background: #fff; border: 1px solid var(--border-light); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 2px 10px rgba(23,80,90,0.04);
}
.ac-category-hdr {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .6px; color: #6b8a8f;
}
.ac-category-hdr i { color: #17505a; font-size: 11px; }
.ac-category-hdr span:nth-child(2) { flex: 1; }
.ac-category-count { color: #b3c4c2; font-weight: 700; }

.ac-perm-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 12px; margin-bottom: 6px; border: 1px solid rgba(226, 232, 240, 0.6); 
  background: rgba(248, 250, 252, 0.5); backdrop-filter: blur(4px);
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ac-perm-row:hover { background: #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04); }
.ac-perm-row:last-child { margin-bottom: 0; }
.ac-perm-row i { font-size: 13.5px; color: #cbd5e1; flex-shrink: 0; transition: color .2s; }
.ac-perm-row-label { flex: 1; font-size: 12.5px; color: #64748b; font-weight: 600; transition: color .2s; }
.ac-perm-row.granted { border-color: #a7f3d0; background: #ecfdf5; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.05); }
.ac-perm-row.granted i { color: #059669; }
.ac-perm-row.granted .ac-perm-row-label { color: #065f46; font-weight: 700; }

@media (max-width: 700px) {
  .ac-role-summary { flex-wrap: wrap; }
}

/* ============================================================
   POWER RECORD — entry form
   ============================================================ */
.pr-remarks-input {
  height: 44px; min-height: 44px; resize: none; overflow-y: auto;
  padding-top: 11px; padding-bottom: 11px;
}

.pr-entry-source-hdr {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; margin-bottom: 18px; border-radius: 14px;
  background: linear-gradient(135deg, var(--pr-src-1, #17505a)14, var(--pr-src-2, #1c6570)14);
  background: linear-gradient(135deg, color-mix(in srgb, var(--pr-src-1, #17505a) 12%, white), color-mix(in srgb, var(--pr-src-2, #1c6570) 12%, white));
  border: 1px solid color-mix(in srgb, var(--pr-src-1, #17505a) 25%, white);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--pr-src-1, #17505a) 12%, transparent);
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.pr-entry-source-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--pr-src-1, #17505a) 0%, var(--pr-src-2, #1c6570) 100%);
  color: #fff; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--pr-src-1, #17505a) 45%, transparent);
  transition: background .25s;
}
.pr-entry-source-name {
  font-size: 15.5px; font-weight: 800;
  background: linear-gradient(90deg, var(--pr-src-1, #123a41), var(--pr-src-2, #17505a));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.pr-entry-source-hint { font-size: 11.5px; color: #6b8a8f; margin-top: 1px; }

.pr-duration-display {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 10px;
  background: #f4f9f8; border: 1.5px solid #e0ece9;
  color: #17505a; font-size: 14px; font-weight: 700;
}
.pr-duration-display i { color: #2fa876; }
.pr-duration-display.ongoing { color: #d97706; background: #fffbeb; border-color: #fde68a; }
.pr-duration-display.ongoing i { color: #d97706; }
.pr-duration-display.invalid { color: #dc2626; background: #fef2f2; border-color: #fecdd3; }
.pr-duration-display.invalid i { color: #dc2626; }

.pr-duration-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  background: linear-gradient(135deg, #f4f9f8, #eaf6f3);
  border: 1.5px solid #d7ece7;
}
.pr-duration-banner-icon {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #17505a; color: #fff; font-size: 15px;
}
.pr-duration-banner-val { font-size: 17px; font-weight: 800; color: #123a41; line-height: 1.2; }
.pr-duration-banner-lbl { font-size: 10.5px; font-weight: 700; color: #6b8a8f; text-transform: uppercase; letter-spacing: .4px; margin-top: 1px; }
.pr-duration-banner.ongoing { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: #fde68a; }
.pr-duration-banner.ongoing .pr-duration-banner-icon { background: #d97706; }
.pr-duration-banner.ongoing .pr-duration-banner-val { color: #92400e; }
.pr-duration-banner.invalid { background: linear-gradient(135deg, #fef2f2, #fee2e2); border-color: #fecdd3; }
.pr-duration-banner.invalid .pr-duration-banner-icon { background: #dc2626; }
.pr-duration-banner.invalid .pr-duration-banner-val { color: #991b1b; }

.pr-date-fmt {
  font-size: 10.5px; color: #6b8a8f; margin-top: 3px; font-weight: 600;
  letter-spacing: .2px;
}

.tl-psi-edit-btn {
  border: none; background: #f1f5f9; color: #64748b; width: 20px; height: 20px;
  border-radius: 5px; font-size: 10px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.tl-psi-edit-btn:hover { background: #8b5cf6; color: #fff; }

.tl-psi-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; font-weight: 700; color: #1e293b; }
.tl-psi-meta-when { font-size: 11.5px; color: #94a3b8; font-weight: 600; }
.tl-psi-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0;
  font-size: 12.5px; color: #475569; margin-bottom: 8px;
}
.tl-psi-row strong { color: #1e293b; }

.pr-entry-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 18px;
  margin-bottom: 16px;
}
.pr-entry-grid:last-child { margin-bottom: 4px; }
.pr-entry-grid-4 { grid-template-columns: repeat(4, 1fr); }
.pr-entry-grid-3 { grid-template-columns: repeat(3, 1fr); }
.pr-span-2 { grid-column: span 2; }
@media (max-width: 900px) {
  .pr-entry-grid { grid-template-columns: repeat(2, 1fr); }
  .pr-span-2 { grid-column: span 2; }
}
@media (max-width: 600px) {
  .pr-entry-grid { grid-template-columns: 1fr; }
  .pr-span-2 { grid-column: span 1; }
}

.pr-filter-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px;
}
@media (max-width: 900px) { .pr-filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .pr-filter-grid { grid-template-columns: 1fr; } }

/* Compact single-row Log filter toolbar */
.pr-filter-card { padding: 10px 14px; }
.pr-filter-bar {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 2px;
}

.pr-filter-divider {
  width: 1px; align-self: stretch; min-height: 24px;
  background: var(--border-light); flex-shrink: 0;
}

.pr-quick-filters { display: flex; flex-wrap: nowrap; gap: 5px; flex-shrink: 0; }
.pr-quick-btn {
  padding: 6px 11px; border-radius: 20px; border: 1.5px solid var(--border-light);
  background: #fff; color: #64748b; font-size: 11px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; transition: all .15s;
}
.pr-quick-btn:hover { border-color: #17505a; color: #17505a; }
.pr-quick-btn.active {
  background: linear-gradient(135deg, #17505a 0%, #1c6570 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px rgba(23,80,90,0.3);
}

.pr-inline-field { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.pr-inline-field label { font-size: 10.5px; font-weight: 700; color: #64748b; white-space: nowrap; }
.pr-input-sm {
  height: 30px; padding: 0 8px; font-size: 11.5px; border-radius: 7px;
  border: 1.5px solid var(--border-light); background: #f8fafc; color: #1e293b;
  outline: none; transition: border-color .2s; flex-shrink: 0;
}
.pr-input-sm:focus { border-color: #17505a; background: #fff; }
input.pr-input-sm[type="date"] { width: 118px; }
select.pr-input-sm { width: 98px; cursor: pointer; }

.pr-filter-bar .btn { flex-shrink: 0; }

.pr-pagination {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px; border-top: 1px solid var(--border-light);
}
.pr-pagination span { font-size: 12.5px; color: #64748b; font-weight: 600; }

/* Dashboard toolbar */
.pr-dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; margin-bottom: 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(23,80,90,0.06), rgba(47,168,118,0.06));
  border: 1px solid rgba(23,80,90,0.1);
}
.pr-dash-toolbar-title {
  font-size: 13px; font-weight: 800; color: #123a41; display: flex; align-items: center; gap: 8px;
}
.pr-dash-toolbar-title i { color: #17505a; }
.pr-month-input { width: 150px; }
.pr-dash-toolbar { flex-wrap: wrap; gap: 10px; }

.pr-dash-period-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: #17505a;
  background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px;
  padding: 8px 14px; margin-bottom: 16px;
}
.pr-dash-period-label i { color: #0891b2; }

.pr-kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px;
  margin: 0 0 16px;
}
.pr-kpi-accent { position: relative; overflow: hidden; }
.pr-kpi-accent::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--kpi-c1), var(--kpi-c2));
}
.pr-kpi-accent::after {
  content: ''; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: radial-gradient(circle, var(--kpi-c1) 0%, transparent 72%);
  opacity: .07; pointer-events: none;
}

.pr-chart-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
@media (max-width: 900px) { .pr-chart-grid { grid-template-columns: 1fr; } }

.pr-chart-card { transition: box-shadow .2s, transform .2s; }
.pr-chart-card:hover { box-shadow: 0 10px 28px rgba(23,80,90,0.1); }
.pr-chart-box-sm { position: relative; height: 175px; }
.pr-chart-box-sm canvas { max-height: 175px; }
.pr-chart-hdr {
  font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px;
}
.pr-chart-hdr-red  i  { color: #dc2626; }
.pr-chart-hdr-teal i  { color: #17505a; }
.pr-chart-hdr-blue i  { color: #0891b2; }
.pr-chart-hdr { color: #64748b; }
.pr-chart-hdr .pr-legend-lbl { font-size: 10px; font-weight: 600; text-transform: none; letter-spacing: 0; color: #94a3b8; margin-left: auto; }

.pr-trend-card { margin-bottom: 16px; }
.pr-trend-box { position: relative; height: 280px; }
.pr-trend-box canvas { max-height: 280px; }

.pr-shift-card { display: flex; flex-direction: column; margin-bottom: 16px; }
.pr-shift-row { display: flex; align-items: center; gap: 28px; }
.pr-shift-donut-wrap { position: relative; height: 150px; width: 150px; flex-shrink: 0; margin: 0; }
.pr-shift-donut-wrap canvas { max-height: 150px; }
.pr-shift-legend { display: flex; flex-direction: column; gap: 12px; flex: 1; margin: 0; }
@media (max-width: 600px) {
  .pr-shift-row { flex-direction: column; }
  .pr-shift-donut-wrap { margin: 0 auto 10px; }
  .pr-shift-legend { width: 100%; }
}

.pr-alert-card { display: flex; flex-direction: column; margin-bottom: 16px; }
.pr-alert-box { position: relative; height: 180px; }
.pr-alert-box canvas { max-height: 180px; }

.pr-shift-legend-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; padding: 2px 0;
}
.pr-shift-legend-label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #475569; }
.pr-shift-legend-val { font-weight: 800; color: #1e293b; }
.pr-shift-legend-pct { font-weight: 600; color: #94a3b8; font-size: 11px; }
.pr-shift-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pr-legend-dot { width: 9px; height: 9px; border-radius: 50%; margin-left: auto; }
.pr-legend-repeated { background: #fecaca; border: 1px solid #dc2626; }

/* KPI change indicator (vs. previous month) */
.pr-kpi-change { font-size: 9.5px; font-weight: 700; margin-top: 1px; display: flex; align-items: center; gap: 4px; }
.pr-kpi-change.up   { color: #dc2626; }
.pr-kpi-change.down { color: #16a34a; }
.pr-kpi-change.flat { color: #94a3b8; }

/* Daily breakdown table */
.pr-daily-table tr.pr-row-repeated td { background: #fef2f2; }
.pr-daily-table tr.pr-row-repeated td:first-child { box-shadow: inset 3px 0 0 #dc2626; }

/* JSpreadsheet Ultra-Premium Customizations */
#dyQuickGrid .jexcel_container {
  border-radius: 8px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
  border: 1px solid #d1d5db !important;
  background: #ffffff !important;
}
/* Frozen Header with Premium Color */
#dyQuickGrid .jexcel > thead > tr > td {
  background-color: #e0f2fe !important; /* Light Sky Blue */
  color: #075985 !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  border-bottom: 2px solid #bae6fd !important;
  border-right: 1px solid #bae6fd !important;
  padding: 12px 10px !important;
  text-align: left !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important; /* Higher z-index to stay above cells */
}
/* Make the corner block match the header */
#dyQuickGrid .jexcel_corner {
  background-color: #e0f2fe !important;
  border-bottom: 2px solid #bae6fd !important;
  border-right: 1px solid #bae6fd !important;
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 25 !important;
}
/* Smaller, smarter text for rows */
#dyQuickGrid .jexcel > tbody > tr > td {
  font-size: 12px !important;
  color: #1e293b !important;
  padding: 8px 10px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #e2e8f0 !important;
  transition: background-color 0.1s ease !important;
}
#dyQuickGrid .jexcel > tbody > tr:hover > td {
  background-color: #f1f5f9 !important;
}
#dyQuickGrid .jexcel > tbody > tr > td.highlight {
  background-color: #eef2ff !important;
  border: 1px solid #6366f1 !important;
  box-shadow: inset 0 0 0 1px #6366f1 !important;
  color: #312e81 !important;
}
/* Frozen Footer */
#dyQuickGrid .jexcel > tfoot > tr > td {
  background-color: #f8fafc !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  font-size: 12.5px !important;
  border-top: 2px solid #cbd5e1 !important;
  border-right: 1px solid #e2e8f0 !important;
  padding: 10px 10px !important;
  position: sticky !important;
  bottom: 0 !important;
  z-index: 20 !important;
}
/* Row number column styling */
#dyQuickGrid .jexcel > tbody > tr > td:first-child,
#dyQuickGrid .jexcel > tfoot > tr > td:first-child {
  background-color: #f8fafc !important;
  color: #64748b !important;
  font-weight: 600 !important;
  border-right: 2px solid #cbd5e1 !important;
  text-align: center !important;
  z-index: 5 !important;
}
#dyQuickGrid .jexcel > tbody > tr > td.editor {
  box-shadow: 0 0 0 2px #17434c !important;
  border-radius: 2px !important;
  background: #ffffff !important;
  z-index: 30 !important;
}
#dyQuickGrid .jexcel_content {
  max-height: 450px !important;
  overflow-y: auto !important;
}
#dyQuickGrid .jexcel_content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#dyQuickGrid .jexcel_content::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 8px;
  border: 2px solid #ffffff;
}
#dyQuickGrid .jexcel_content::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ── Printing Quick Entry grid: same styling as Dyeing's, plus two-line headers ── */
#ptQuickGrid .jexcel_container {
  border-radius: 8px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
  border: 1px solid #d1d5db !important;
  background: #ffffff !important;
}
#ptQuickGrid .jexcel > thead > tr > td {
  background-color: #e0f2fe !important;
  color: #075985 !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  border-bottom: 2px solid #bae6fd !important;
  border-right: 1px solid #bae6fd !important;
  padding: 8px 10px !important;
  text-align: left !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  white-space: pre-line !important;
  line-height: 1.35 !important;
  vertical-align: middle !important;
}
#ptQuickGrid .jexcel_corner {
  background-color: #e0f2fe !important;
  border-bottom: 2px solid #bae6fd !important;
  border-right: 1px solid #bae6fd !important;
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 25 !important;
}
#ptQuickGrid .jexcel > tbody > tr > td {
  font-size: 12px !important;
  color: #1e293b !important;
  padding: 8px 10px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #e2e8f0 !important;
  transition: background-color 0.1s ease !important;
}
#ptQuickGrid .jexcel > tbody > tr:hover > td {
  background-color: #f1f5f9 !important;
}
#ptQuickGrid .jexcel > tbody > tr > td.highlight {
  background-color: #eef2ff !important;
  border: 1px solid #6366f1 !important;
  box-shadow: inset 0 0 0 1px #6366f1 !important;
  color: #312e81 !important;
}
#ptQuickGrid .jexcel > tfoot > tr > td {
  background-color: #f8fafc !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  font-size: 12.5px !important;
  border-top: 2px solid #cbd5e1 !important;
  border-right: 1px solid #e2e8f0 !important;
  padding: 10px 10px !important;
  position: sticky !important;
  bottom: 0 !important;
  z-index: 20 !important;
}
#ptQuickGrid .jexcel > tbody > tr > td:first-child,
#ptQuickGrid .jexcel > tfoot > tr > td:first-child {
  background-color: #f8fafc !important;
  color: #64748b !important;
  font-weight: 600 !important;
  border-right: 2px solid #cbd5e1 !important;
  text-align: center !important;
  z-index: 5 !important;
}
#ptQuickGrid .jexcel > tbody > tr > td.editor {
  box-shadow: 0 0 0 2px #17434c !important;
  border-radius: 2px !important;
  background: #ffffff !important;
  z-index: 30 !important;
}
#ptQuickGrid .jexcel_content {
  max-height: 450px !important;
  overflow-y: auto !important;
}
#ptQuickGrid .jexcel_content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#ptQuickGrid .jexcel_content::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 8px;
  border: 2px solid #ffffff;
}
#ptQuickGrid .jexcel_content::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Dyeing Quick Entry Glass Modal - Premium Light */
.dy-quick-glass-modal {
  background: rgba(241, 245, 249, 0.7) !important;
  backdrop-filter: blur(16px) !important;
}
.dy-quick-glass-modal .modal-box {
  background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
  border: 2px solid #10b981 !important; /* Premium Emerald Green Border */
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.12), 0 0 20px rgba(16, 185, 129, 0.15) !important; /* Subtle green glow */
  border-radius: 16px !important;
}
.dy-quick-glass-modal .modal-hdr {
  background: transparent !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  padding: 20px 24px !important;
}
.dy-quick-glass-modal .modal-hdr h3 {
  color: #0f172a !important;
  font-size: 17px !important;
}
.dy-quick-glass-modal .modal-close {
  color: #64748b !important;
  background: transparent !important;
}
.dy-quick-glass-modal .modal-close:hover {
  color: #0f172a !important;
  background: rgba(0, 0, 0, 0.05) !important;
}
.dy-quick-glass-modal .dy-toolbar-card {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,0.8) !important;
  padding: 16px !important;
  border-radius: 10px !important;
}
.dy-quick-glass-modal .login-label {
  color: #475569 !important;
  font-weight: 600 !important;
}
.dy-quick-glass-modal .login-plain-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: 6px !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02) !important;
}
.dy-quick-glass-modal .login-plain-input::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.7;
}
.dy-quick-glass-modal .btn-outline {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}
.dy-quick-glass-modal .btn-outline:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}
.dy-quick-glass-modal .dy-save-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}
.dy-quick-glass-modal .dy-save-btn:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4) !important;
}

/* Import modal */
.pr-import-instructions {
  background: #f4f9f8; border: 1px solid #e0ece9; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px;
}
.pr-import-instructions-title {
  font-size: 12px; font-weight: 800; color: #17505a; margin-bottom: 8px;
  display: flex; align-items: center; gap: 7px;
}
.pr-import-instructions ul { margin: 0; padding-left: 18px; }
.pr-import-instructions li { font-size: 12px; color: #4d6a6e; line-height: 1.6; }
.pr-import-instructions strong { color: #123a41; }

.pr-import-summary { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.pr-import-summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--border-light);
  font-size: 12.5px;
}
.pr-import-summary-row.skipped-sheet { opacity: .6; }
.pr-import-summary-name { font-weight: 700; color: #123a41; }
.pr-import-summary-counts { display: flex; gap: 10px; font-weight: 700; }
.pr-import-summary-counts .ok { color: #16a34a; }
.pr-import-summary-counts .warn { color: #d97706; }

/* ── Print report (dedicated design, built fresh by JS at export time) ── */
.prr-report { display: none; }

.prr-header { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 3px solid #123a41; }
.prr-logo { height: 38px; width: auto; }
.prr-header-text { flex: 1; }
.prr-company { font-size: 16px; font-weight: 800; color: #123a41; }
.prr-report-title { font-size: 11px; font-weight: 700; color: #17505a; text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }
.prr-header-meta { display: flex; flex-direction: column; gap: 2px; text-align: right; font-size: 10px; color: #475569; }
.prr-header-meta span { font-weight: 700; color: #94a3b8; text-transform: uppercase; font-size: 8px; letter-spacing: .4px; margin-right: 4px; }

.prr-stat-strip {
  display: flex; border: 1px solid #d7e0e6; border-radius: 10px; margin-bottom: 14px; overflow: hidden;
}
.prr-stat { flex: 1; text-align: center; padding: 10px 6px; border-right: 1px solid #e2e8f0; }
.prr-stat:last-child { border-right: none; }
.prr-stat-val { font-size: 18px; font-weight: 800; color: #123a41; white-space: nowrap; }
.prr-stat-lbl { font-size: 8px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }

.prr-sec-title {
  font-size: 9.5px; font-weight: 800; color: #17505a; text-transform: uppercase; letter-spacing: .4px;
  padding-bottom: 5px; margin-bottom: 6px; border-bottom: 1.5px solid #e2e8f0;
  display: flex; align-items: center; gap: 6px;
}
.prr-legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; display: inline-block; margin-left: auto; }
.prr-legend-lbl { font-size: 8px; font-weight: 600; color: #94a3b8; text-transform: none; letter-spacing: 0; }

.prr-chart-row { display: flex; gap: 12px; margin-bottom: 10px; }
.prr-chart-box, .prr-mini-box {
  flex: 1; border: 1px solid #d7e0e6; border-radius: 10px; padding: 8px 12px; background: #fff;
}
.prr-chart-box-wide { flex: 1; }
.prr-chart-img { width: 100%; height: 95px; object-fit: contain; display: block; }
.prr-chart-box-wide .prr-chart-img { height: 110px; }

.prr-mini-body { display: flex; align-items: center; gap: 14px; }
.prr-mini-img { width: 90px; height: 90px; object-fit: contain; flex-shrink: 0; }
.prr-mini-list { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.prr-mini-row { display: flex; align-items: center; gap: 6px; font-size: 9px; }
.prr-mini-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prr-mini-lbl { font-weight: 600; color: #475569; flex: 1; }
.prr-mini-val { font-weight: 800; color: #1e293b; white-space: nowrap; }
.prr-mini-pct { font-weight: 600; color: #94a3b8; }

.prr-table-box { border: 1px solid #d7e0e6; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.prr-table { width: 100%; border-collapse: collapse; font-size: 8.5px; }
.prr-table th {
  text-align: left; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px;
  color: #64748b; padding: 5px 7px; border-bottom: 1.5px solid #e2e8f0;
}
.prr-table td { padding: 3.5px 7px; border-bottom: 1px solid #f1f5f9; }
.prr-table tr:nth-child(even) td { background: #f8fafc; }
.prr-row-repeated td { background: #fff7ed !important; }

.prr-footer { text-align: center; font-size: 8px; color: #94a3b8; margin-top: 6px; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }

  * { print-color-adjust: exact !important; -webkit-print-color-adjust: exact !important; }

  .app-sidebar, .app-topbar, .um-tabs, .pr-no-print, .app-sidebar-overlay,
  .pr-entry-source-hdr, .pr-dash-period-label, .sec-hdr, #prd-printable { display: none !important; }

  body, .um-app, .app-content, .app-main, .app-shell {
    height: auto !important; min-height: 0 !important; overflow: visible !important;
    background: #fff !important; padding: 0 !important; margin: 0 !important; display: block !important;
  }
  .app-content { max-width: 100% !important; }
  #section-powerRecord { padding: 0 !important; }

  .prr-report { display: block !important; }
  .prr-header { page-break-after: avoid; break-after: avoid; }
  .prr-stat-strip, .prr-chart-row { break-inside: avoid; }
  .prr-chart-box, .prr-mini-box, .prr-table-box { break-inside: avoid; }
}

.inv-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; flex-wrap: wrap; gap: 8px;
}
.inv-pg-info { font-size: 12px; color: #64748b; }
.inv-pg-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.inv-pg-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  background: #fff; color: #374151; font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.inv-pg-btn:hover:not(:disabled) { border-color: var(--secondary); color: var(--secondary); background: #eff6ff; }
.inv-pg-btn.active { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.inv-pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.inv-pg-dots { font-size: 13px; color: #94a3b8; padding: 0 2px; }
.email-ac-drop {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 999;
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); overflow: hidden;
}
.email-ac-item {
  padding: 10px 14px; font-size: 13.5px; color: #1e293b; cursor: pointer;
  display: flex; align-items: center; transition: background .1s;
}
.email-ac-item:hover { background: #eff6ff; color: var(--secondary); }
.login-copyright {
  margin-top: 28px; padding-top: 18px;
  border-top: 1px solid #f1f5f9;
  text-align: center; font-size: 11px; color: #94a3b8;
}
.login-copyright strong { color: #64748b; }
.logo-icon {
  width: 60px; height: 60px; border-radius: 16px;
  background: linear-gradient(135deg, #1a237e, #1976d2);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 24px; color: #fff;
  box-shadow: 0 8px 24px rgba(26,35,126,0.3);
}
@media (max-width: 900px) {
  .login-brand { display: none; }
  .login-form-wrap { width: 100%; background: #ffffff; }
  .login-bg { padding: 20px; }
  .login-split { max-width: 440px; transform: none; border-radius: 6px; }
  .login-card { background: #ffffff; border-radius: 6px; }
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label {
  display: block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-bottom: 6px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], textarea, select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border-light);
  border-radius: 8px; background: #f8fafc; transition: border .2s, box-shadow .2s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--secondary); background: #fff;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.12);
}
textarea { resize: vertical; min-height: 80px; }

.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 42px; }
.eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--text-muted); font-size: 15px;
}
.eye-btn:hover { color: var(--secondary); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: none;
  font-weight: 700; cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn-full   { width: 100%; }
.btn-sm     { padding: 6px 12px; font-size: 12px; }
.btn-primary   { background: linear-gradient(135deg, #17505a 0%, #1c6570 100%); color: #fff; box-shadow: 0 3px 10px rgba(23,80,90,0.28); }
.btn-primary:hover { background: linear-gradient(135deg, #123a41 0%, #17505a 100%); box-shadow: 0 6px 18px rgba(23,80,90,0.4); transform: translateY(-1px); }
.btn-secondary { background: #e8eaf6; color: var(--primary); }
.btn-secondary:hover { background: #c5cae9; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-outline   { background: transparent; border: 1.5px solid var(--border-light); color: var(--text-dark); }
.btn-outline:hover { border-color: var(--secondary); color: var(--secondary); }
.btn-outline.active { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-danger-out  { background: transparent; border: 1.5px solid rgba(220,38,38,.3); color: var(--danger); }
.btn-danger-out:hover  { background: var(--danger); color: #fff; }
.btn-warning-out { background: transparent; border: 1.5px solid rgba(217,119,6,.4); color: #b45309; }
.btn-warning-out:hover { background: var(--warning); color: #fff; }
.btn-success-out { background: transparent; border: 1.5px solid rgba(22,163,74,.4); color: #15803d; }
.btn-success-out:hover { background: var(--success); color: #fff; }
.grn-pending-row { background: #fffbeb; }
.grn-pending-row:hover { background: #fef9c3 !important; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── ALERTS ── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-danger  { background: var(--danger-bg); color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-bg); color: #14532d; border: 1px solid #86efac; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); height: 100vh; overflow: hidden; position: fixed; top: 0; left: 0; z-index: 100;
  background: linear-gradient(180deg, #080d1f 0%, #0e1530 55%, #131c42 100%);
  display: flex; flex-direction: column; transition: width .3s cubic-bezier(0.4,0,0.2,1), transform .3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 4px 0 32px rgba(0,0,0,0.18);
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sb-brand-text,
.sidebar.collapsed .sb-user-details,
.sidebar.collapsed .sb-search-wrap,
.sidebar.collapsed .ng-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .caret,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sb-footer-clock { display: none !important; }
.sidebar.collapsed .sidebar-header { padding: 18px 10px; justify-content: center; }
.sidebar.collapsed .sidebar-logo { margin: 0 auto; }
.sidebar.collapsed .sb-collapse-btn { margin: 0 auto; }
.sidebar.collapsed .user-info-box { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-group-header { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; margin: 3px 8px; }
.sidebar.collapsed .nav-item::after { content: attr(data-label); position: absolute; left: 72px; top: 50%; transform: translateY(-50%); background: #1e40af; color: #fff; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 200; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }
.sidebar.collapsed .nav-group-header:hover::after { content: attr(data-group-label); position: absolute; left: 72px; top: 50%; transform: translateY(-50%); background: #1e40af; color: #fff; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px; white-space: nowrap; opacity: 1; pointer-events: none; z-index: 200; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
.sidebar.collapsed .nav-group-items { display: none; }
.sidebar.collapsed .sb-logout-btn { justify-content: center; }
.sidebar.collapsed .sb-footer { align-items: center; }

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.sb-brand-text { flex: 1; min-width: 0; overflow: hidden; }
.sb-factory { font-size: 13px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-system  { font-size: 10px; color: #64748b; font-weight: 500; margin-top: 2px; white-space: nowrap; }
.sb-collapse-btn { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); font-size: 12px; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s; flex-shrink: 0; }
.sb-collapse-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.sidebar.collapsed .sb-collapse-btn { margin-left: 0; }
.sidebar-close { display: none; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); font-size: 14px; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; flex-shrink: 0; display: none; align-items: center; justify-content: center; transition: background .2s; }
.sidebar-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* User box */
.user-info-box {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15); flex-shrink: 0; overflow: hidden;
}
.user-ava-wrap { position: relative; flex-shrink: 0; }
.user-ava {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.user-online-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; border: 2px solid #0e1530;
}
.sb-user-details { min-width: 0; flex: 1; overflow: hidden; }
.user-nm { font-size: 13px; font-weight: 700; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-rl { font-size: 10px; color: #64748b; margin-top: 2px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }

/* Search */
.sb-search-wrap {
  margin: 10px 12px 4px; position: relative; flex-shrink: 0;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 9px; display: flex; align-items: center; gap: 0;
  transition: border-color .2s, background .2s;
}
.sb-search-wrap:focus-within { border-color: rgba(59,130,246,0.5); background: rgba(59,130,246,0.07); }
.sb-search-icon { color: rgba(255,255,255,0.3); font-size: 12px; padding: 0 10px; flex-shrink: 0; }
.sb-search-input { background: none; border: none; outline: none; color: #e2e8f0; font-size: 12px; flex: 1; padding: 8px 0; }
.sb-search-input::placeholder { color: rgba(255,255,255,0.25); }
.sb-search-clear { background: none; border: none; color: rgba(255,255,255,0.3); font-size: 11px; padding: 0 10px; cursor: pointer; flex-shrink: 0; }
.sb-search-clear:hover { color: #fff; }

/* Nav */
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 0 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; margin: 2px 10px;
  color: rgba(255,255,255,0.5);
  font-size: 13px; font-weight: 600; border-radius: 9px; text-decoration: none;
  transition: background .2s, color .2s, transform .2s; cursor: pointer;
  position: relative; overflow: hidden; white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; transform: translateX(3px); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.18), rgba(37,99,235,0.12));
  color: #93c5fd; border: 1px solid rgba(59,130,246,0.2);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 16px; width: 3px; background: #3b82f6; border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; text-align: center; font-size: 14px; opacity: 0.75; transition: transform .2s, opacity .2s; flex-shrink: 0; }
.nav-item:hover .nav-icon { opacity: 1; transform: scale(1.1); }
.nav-item.active .nav-icon { color: #3b82f6; opacity: 1; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 800;
  padding: 1px 6px; border-radius: 20px; line-height: 16px; flex-shrink: 0;
}
.nav-badge-warn { background: #f59e0b; }

/* Nav search highlight */
.nav-item.sb-hidden { display: none !important; }
.nav-item mark { background: rgba(59,130,246,0.35); color: #fff; border-radius: 2px; padding: 0 1px; }

/* Footer */
.sb-footer {
  padding: 12px 10px; border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sb-footer-clock {
  font-size: 11px; color: rgba(255,255,255,0.25); text-align: center;
  font-variant-numeric: tabular-nums; letter-spacing: .3px; padding: 2px 0 4px;
}
.sb-logout-btn {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px; margin: 0; border-radius: 9px; text-decoration: none;
  color: rgba(255,255,255,0.4); font-size: 13px; font-weight: 600;
  transition: background .2s, color .2s; cursor: pointer;
}
.sb-logout-btn:hover { background: rgba(239,68,68,0.12); color: #f87171; }
.sb-logout-btn i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh; flex: 1;
  display: flex; flex-direction: column;
  overflow-x: hidden;
  min-width: 0;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; position: sticky; top: 0; z-index: 90;
  box-shadow: var(--shadow-sm);
}
.tb-menu { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-dark); }
.tb-title { font-size: 18px; font-weight: 800; color: var(--primary); flex: 1; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.tb-ava {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, #42a5f5, #1976d2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff;
}
.tb-name { font-size: 13px; font-weight: 700; }

/* ── SECTIONS ── */
.section { display: none; padding: 24px; animation: fadeIn .25s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

.sec-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.sec-hdr h2 { font-size: 22px; font-weight: 800; color: var(--primary); }
.app-content .sec-hdr h2 {
  background: linear-gradient(90deg, #123a41, #17505a 70%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.app-content .sec-hdr h2 i { -webkit-text-fill-color: initial; color: var(--secondary); }

/* ── CARDS ── */
.card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border-light); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-hdr { padding: 14px 20px; font-size: 14px; font-weight: 700; background: #f8fafc; border-bottom: 1px solid var(--border-light); }
.card-body { padding: 20px; }

/* ── STAT GRID ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
}
.sc-info { flex: 1; }
.stat-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.stat-val { font-size: 28px; font-weight: 900; color: var(--text-dark); }
.sc-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }

/* ── STAGE BREAKDOWN ── */
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 10px; }
.stage-card { background: #fff; border: 1px solid var(--border-light); border-radius: 10px; padding: 12px 16px; }
.sc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.sc-value { font-size: 22px; font-weight: 900; color: var(--primary); }
.chips-label { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; }

/* ── TABLES ── */
.tbl-wrap { overflow-x: auto; }
table.epr-table { width: 100%; border-collapse: collapse; }
table.epr-table th {
  background: var(--primary); color: #fff; padding: 7px 10px;
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  white-space: nowrap;
}
table.epr-table td { padding: 7px 10px; font-size: 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
table.epr-table tr:last-child td { border-bottom: none; }
table.epr-table tr:hover td { background: #f8fafc; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-purchased{ background: #e0f2fe; color: #0369a1; }
.badge-local    { background: #f3e8ff; color: #6b21a8; }
.badge-regular  { background: var(--success-bg); color: var(--success); }
.badge-urgent   { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.badge-cat-1    { background: #ccfbf1; color: #0f766e; }
.badge-cat-2    { background: #fce7f3; color: #be185d; }
.badge-cat-3    { background: #ffedd5; color: #c2410c; }
.badge-cat-4    { background: #e0e7ff; color: #4338ca; }

/* ── MODAL ── */
.modal-overlay,
.modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: var(--sidebar-w);
  background: rgba(15,23,42,0.6); z-index: 1200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 100px 20px 20px;
  overflow-y: auto;
  animation: fadeIn .2s; backdrop-filter: blur(2px);
}

.modal-box {
  background: #fff; border-radius: 18px; width: 100%; max-width: 820px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 32px 80px rgba(15,23,42,0.28), 0 0 0 1px rgba(255,255,255,0.15);
  animation: modalSlideIn .22s cubic-bezier(0.34,1.56,0.64,1);
  align-self: flex-start;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.92) translateY(-16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
#inv-modal-portal { position: relative; z-index: 0; }
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-hdr h3 { font-size: 16px; font-weight: 800; color: var(--primary); }
.modal-close {
  background: none; border: none; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; color: var(--text-muted);
  border-radius: 8px; transition: background .15s, color .15s; flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 20px 24px; }

/* ── LOADER ── */
.loader-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  animation: loaderFadeIn .18s ease;
}
@keyframes loaderFadeIn { from { opacity:0; } to { opacity:1; } }

.loader-card {
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  padding: 36px 48px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.6) inset;
}

.spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 5px solid #e2e8f0;
  border-top-color: var(--primary);
  animation: spin .75s linear infinite;
}
.loader-text {
  font-size: 15px; font-weight: 700; color: #1e293b; letter-spacing: .3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SEARCH ── */
.search-wrap input {
  width: 260px; padding: 8px 14px;
  border: 1.5px solid var(--border-light); border-radius: 8px;
  background: #f8fafc;
}

/* ── ITEMS TABLE (new requisition form) ── */
.items-table th, .items-table td { padding: 8px; border-bottom: 1px solid var(--border-light); }
/* Ensure epr-table dark header is never overridden */
table.epr-table thead th { background: var(--primary) !important; color: #fff !important; }
.items-table input, .items-table select { width: 100%; padding: 6px 8px; border: 1px solid var(--border-light); border-radius: 6px; }
.items-table input:focus { border-color: var(--secondary); outline: none; }

/* ── DIVIDER ── */
.divider-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); border-bottom: 2px solid var(--border-light);
  padding-bottom: 6px; margin-bottom: 14px;
}

/* ── APPROVAL TIMELINE (legacy, kept for compatibility) ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 14px; padding-bottom: 16px; position: relative; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute; left: 15px; top: 32px;
  width: 2px; bottom: 0; background: var(--border-light);
}
.tl-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.tl-dot.approved { background: var(--success-bg); color: var(--success); }
.tl-dot.rejected { background: var(--danger-bg); color: var(--danger); }
.tl-dot.pending  { background: #f1f5f9; color: var(--text-muted); }
.tl-content { flex: 1; }
.tl-label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.tl-status { font-size: 13px; font-weight: 700; }
.tl-meta   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── MR DETAIL MODAL — REDESIGN ── */
.mr-modal-top {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 16px; border-bottom: 1px solid var(--border-light);
}
.mr-modal-id { font-size: 15px; font-weight: 700; color: var(--primary); }
.mr-modal-id span { font-weight: 400; color: #64748b; }

/* Horizontal Stepper */
.approval-stepper-wrap { padding: 20px 0 20px; border-bottom: 1px solid var(--border-light); }

/* Stepper Card */
.wf-stepper-card {
  border-radius: 14px; overflow: hidden;
  border: 1px solid #bfdbfe;
  background: #fff;
  box-shadow: 0 2px 12px rgba(99,102,241,.07);
}
.wf-stepper-card.wf-local  { border-color: #bbf7d0; box-shadow: 0 2px 12px rgba(22,163,74,.08); }

.wf-stepper-header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #eff6ff 0%, #f8faff 100%);
  border-bottom: 1px solid #dbeafe;
}
.wf-stepper-card.wf-local .wf-stepper-header {
  background: linear-gradient(90deg, #f0fdf4 0%, #f8fffb 100%);
  border-bottom-color: #bbf7d0;
}

.wf-type-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: #1e40af; color: #fff; white-space: nowrap; flex-shrink: 0;
  letter-spacing: .3px;
}
.wf-stepper-card.wf-local .wf-type-pill { background: #16a34a; }

.wf-progress-wrap {
  flex: 1; height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden;
}
.wf-progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width .5s ease;
}
.wf-stepper-card.wf-local .wf-progress-bar { background: linear-gradient(90deg, #22c55e, #16a34a); }

.wf-progress-label { font-size: 11.5px; font-weight: 700; color: #64748b; white-space: nowrap; }

/* Track */
.stepper-track {
  display: flex; align-items: flex-start;
  padding: 20px 18px 18px;
  overflow-x: auto; gap: 0;
  -webkit-overflow-scrolling: touch;
}

.step-item { display: flex; flex-direction: column; align-items: center; gap: 0; flex-shrink: 0; width: 80px; }
.step-circle {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; border: 2px solid #e2e8f0;
  background: #f1f5f9; color: #94a3b8; border: 2px solid #e2e8f0;
  font-size: 15px; transition: all .25s;
}
.step-num { font-size: 12px; font-weight: 700; color: #94a3b8; }
.step-item.step-approved .step-circle {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #16a34a; color: #fff;
  box-shadow: 0 3px 10px rgba(22,163,74,.3);
}
.step-item.step-rejected .step-circle {
  background: linear-gradient(135deg, #f87171, #dc2626);
  border-color: #dc2626; color: #fff;
  box-shadow: 0 3px 10px rgba(220,38,38,.3);
}
.step-item.step-current .step-circle {
  background: #fff; border-color: #6366f1; color: #6366f1; border-width: 2.5px;
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
  animation: stepPulse 1.8s ease-in-out infinite;
}
@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(99,102,241,.15); }
  50%       { box-shadow: 0 0 0 7px rgba(99,102,241,.08); }
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.6); opacity: 0.5; }
}

/* Step body (label + chips + meta) */
.step-body { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 8px; width: 100%; }
.step-label { font-size: 11px; font-weight: 700; color: #94a3b8; text-align: center; white-space: nowrap; line-height: 1.2; }
.step-item.step-approved .step-label { color: #16a34a; }
.step-item.step-rejected .step-label { color: #dc2626; }
.step-item.step-current  .step-label { color: #4f46e5; }

/* Status chips */
.step-chip {
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.chip-done     { background: #dcfce7; color: #166534; }
.chip-rejected { background: #fee2e2; color: #991b1b; }
.chip-current  { background: #ede9fe; color: #4338ca; }
.chip-partial  { background: #fef3c7; color: #92400e; }

/* Meta (approved by / date) */
.step-meta { font-size: 9px; color: #94a3b8; text-align: center; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-meta-date { color: #a5b4c8; font-size: 8.5px; }

/* Connector */
.step-connector {
  flex: 1; min-width: 12px; height: 3px;
  background: #e2e8f0; margin-top: 20px; border-radius: 99px;
  position: relative; overflow: hidden;
}
.step-connector--sm { min-width: 8px; flex: 0 0 10px; }
.step-connector-inner {
  position: absolute; inset: 0; border-radius: 99px;
  background: transparent; transition: background .4s;
}
.step-connector.step-done .step-connector-inner { background: linear-gradient(90deg, #22c55e, #16a34a); }
.step-connector.step-fail .step-connector-inner { background: #dc2626; }

/* Procurement sub-steps — identical size to regular steps */
.step-item.step-pur-sub { width: 80px; }
.step-item.step-pur-sub .step-circle { width: 44px; height: 44px; font-size: 14px; }
.step-item.step-pur-sub .step-label  { font-size: 11px; }
.step-item.step-pur-sub .step-chip   { font-size: 10px; padding: 2px 6px; }
/* HO Finance sub-step: blue only when active or done */
.step-item.step-pur-hof.step-current .step-circle  { background: linear-gradient(135deg,#1d4ed8,#2563eb); border-color: #1d4ed8; color: #fff; }
.step-item.step-pur-hof.step-approved .step-circle { background: linear-gradient(135deg,#1d4ed8,#2563eb); border-color: #1d4ed8; color: #fff; }

/* MR Info Grid */
.mr-info-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border-light);
}
@media (max-width: 600px) { .mr-info-grid { grid-template-columns: 1fr 1fr; } }
.mr-info-label {
  font-size: 10px; font-weight: 700; color: #94a3b8;
  letter-spacing: 0.6px; text-transform: uppercase; margin-bottom: 5px;
}
.mr-info-val { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.mr-overall-remarks { padding: 14px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }

.hm-edit-section { margin-top: 18px; border: 1.5px solid var(--secondary); border-radius: 8px; padding: 14px 16px; background: #f8faff; }
.hm-edit-title { font-size: 13px; font-weight: 700; color: var(--secondary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.loading-txt { padding: 30px; text-align: center; color: var(--text-muted); }
.text-link { color: var(--secondary); font-size: 13px; font-weight: 600; }
.text-link:hover { text-decoration: underline; }

/* ── PROFILE ── */
.profile-card { max-width: 560px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main-content { margin-left: 0; }
  .tb-menu { display: block; }
  .tb-name { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .search-wrap input { width: 100%; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .section { padding: 16px; }
}

/* ── TOPBAR QUICK-ACTION BUTTONS ── */
.tb-quick-group {
  display: inline-flex; align-items: center; gap: 6px;
}
.tb-quick-divider {
  width: 1px; height: 28px;
  background: linear-gradient(to bottom, transparent, #cbd5e1, transparent);
  margin: 0 4px; flex-shrink: 0;
}
.tb-quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 8px; border: 1.5px solid #c7d2fe;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: #3730a3; font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: background .18s, box-shadow .18s, transform .1s, border-color .18s;
  white-space: nowrap; line-height: 1; box-shadow: 0 1px 3px rgba(99,102,241,0.1);
}
.tb-quick-btn i { font-size: 13px; }
.tb-quick-btn:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: #4f46e5; color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.38);
  transform: translateY(-1px);
}
.tb-quick-btn--green {
  border-color: #6ee7b7; background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #065f46;
  box-shadow: 0 1px 3px rgba(16,185,129,0.12);
}
.tb-quick-btn--green:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #059669; color: #fff;
  box-shadow: 0 4px 14px rgba(16,185,129,0.38);
}
@media (max-width: 768px) {
  .tb-quick-label { display: none; }
  .tb-quick-btn { padding: 7px 9px; }
  .tb-copyright-full { display: none !important; }
  .tb-copyright-short { display: inline !important; }

  /* Report tabs — scrollable on mobile */
  .report-tabs-wrapper {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }
  .rtab-btn {
    flex-shrink: 0;
    min-width: unset;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Chart grid — single column on mobile */
  .rpt-chart-grid {
    grid-template-columns: 1fr !important;
  }

  /* Card header with date filters — stack vertically */
  .card-hdr-with-filter {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* KPI cards — full width on small screens */
  .rpt-kpi-card {
    flex: 1 1 calc(50% - 6px) !important;
    min-width: 0 !important;
    padding: 12px 10px !important;
    gap: 10px !important;
  }
  .rpt-kpi-card > div:first-child {
    width: 36px !important; height: 36px !important;
  }
  .rpt-kpi-card > div:last-child > div:nth-child(2) {
    font-size: 16px !important;
  }

  /* Report mini-stat grids (e.g. category breakdown Total/Approved/Pending/Rejected) — 2 cols */
  .rpt-mini-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Report tables — tighter & scrollable for mobile */
  #section-reports .epr-table { font-size: 11.5px !important; }
  #section-reports .epr-table th,
  #section-reports .epr-table td { padding: 7px 8px !important; white-space: nowrap; }
  #section-reports .card-body,
  #section-reports > div > .epr-table,
  #section-reports [style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

  /* Report tab heading + filter selects stack cleanly */
  #section-reports .sec-hdr { flex-direction: column; align-items: flex-start; }

  /* Item Master — stats board 2 columns */
  .inv-stats-board {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Item Master — header buttons compact */
  .inv-sec-hdr h2 { font-size: 17px; }
  .inv-hdr-btn-label span { display: none; }

  /* Item Master — tab bar stacks: category on top, tabs below */
  .inv-items-tabbar {
    flex-direction: column;
    padding: 10px 12px 0;
    border-radius: 12px 12px 0 0;
  }
  .inv-items-cat-wrap {
    padding: 0 0 10px 0;
    border-right: none;
    border-bottom: 1.5px solid #e2e8f0;
    margin-right: 0;
    margin-bottom: 0;
    width: 100%;
  }
  .inv-items-tabs {
    padding: 8px 0;
  }

  /* Filter bar — date inputs full width */
  .inv-date-input { width: 100%; flex: 1; }
  .inv-filter-row { gap: 6px; }
  .inv-filter-row--single { flex-wrap: wrap; overflow-x: unset; }
}

@media (max-width: 540px) {
  .rpt-hide-sm { display: none !important; }
  .rpt-show-xs-only { display: block !important; }
  .rpt-kpi-card { flex: 1 1 100% !important; }

  /* Item Master — stats board 1 column on very small */
  .inv-stats-board { grid-template-columns: repeat(2, 1fr) !important; }
  .inv-sec-hdr-actions .btn { padding: 7px 10px; font-size: 12px; }
}

@media (max-width: 400px) {
  .rpt-hide-xs { display: none !important; }
}

@media (min-width: 541px) {
  .rpt-show-xs-only { display: none !important; }
}

/* ── INVENTORY MOBILE CARDS (GRN / MIV / Items) ── */
.inv-mob-table-wrap { display: block; }
.inv-mob-cards-wrap { display: none; padding: 0 0 8px; }

/* ── Premium Mobile Cards ─────────────────────────────────────── */
.inv-mob-card {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 16px;
  padding: 0;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.07), 0 0 0 1px rgba(99,102,241,0.04);
  overflow: hidden;
  transition: box-shadow .18s;
}
.inv-mob-card:active { box-shadow: 0 1px 4px rgba(15,23,42,0.10); }

/* card top strip (number + date + badge) */
.inv-mob-card-hdr {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 13px 14px 10px;
  background: linear-gradient(135deg, #f8faff 0%, #f1f5ff 100%);
  border-bottom: 1px solid #e8edf5;
}
.inv-mob-card-hdr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.inv-mob-card-hdr-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.inv-mob-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* card body */
.inv-mob-card-body { padding: 11px 14px 13px; }

.inv-mob-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 8px;
}
.inv-mob-card-meta span { white-space: nowrap; }
.inv-mob-card-items {
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
  margin-top: 6px;
}
.inv-mob-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed #f1f5f9;
  gap: 8px;
}
.inv-mob-item-row:last-child { border-bottom: none; }
.inv-mob-item-name { font-size: 12px; color: #334155; flex: 1; min-width: 0; font-weight: 500; }
.inv-mob-item-qty  { font-size: 11px; color: #64748b; white-space: nowrap; flex-shrink: 0; }
.inv-mob-card-total {
  display: flex;
  justify-content: flex-end;
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
}
.inv-mob-card-no   { font-weight: 800; font-size: 14px; color: #1e3a8a; letter-spacing: -.2px; }
.inv-mob-card-date { font-size: 11px; color: #94a3b8; }
.inv-mob-card-supplier { font-size: 11px; color: #475569; margin-bottom: 6px; }

.inv-mob-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.inv-mob-kv {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  min-width: 80px;
}
.inv-mob-kv-label { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 2px; }

/* mobile pagination */
.mob-page-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 4px;
}
.mob-page-bar button {
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #3730a3;
  cursor: pointer;
}
.mob-page-bar button:disabled { opacity: .35; cursor: default; }
.mob-page-info { font-size: 12px; font-weight: 700; color: #64748b; }

/* requisition mobile cards */
.req-mob-cards-wrap { display: none; }
.req-mob-table-wrap { display: block; }

/* status pill for req cards */
.req-mob-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

@media (max-width: 768px) {
  .inv-mob-table-wrap { display: none !important; }
  .inv-mob-cards-wrap { display: block !important; }
  .req-mob-table-wrap { display: none !important; }
  .req-mob-cards-wrap { display: block !important; }
  .backup-btn { display: none !important; }
}

/* ── DB BACKUP BUTTON ── */
.backup-btn {
  background: none; border: none; cursor: pointer;
  padding: 7px 9px; border-radius: 8px; color: var(--text-muted);
  font-size: 17px; transition: background .2s, color .2s; line-height: 1;
}
.backup-btn:hover { background: rgba(26,35,126,0.08); color: var(--primary); }

/* ── NOTIFICATION BELL ── */
.notif-wrap { position: relative; display: flex; align-items: center; }
.notif-btn {
  position: relative; background: none; border: none; cursor: pointer;
  padding: 7px 9px; border-radius: 8px; color: var(--text-muted);
  font-size: 17px; transition: background .2s, color .2s; line-height: 1;
}
.notif-btn:hover { background: rgba(26,35,126,0.08); color: var(--primary); }
.notif-badge {
  position: absolute; top: 1px; right: 1px;
  background: var(--danger); color: #fff;
  border-radius: 999px; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; pointer-events: none;
}
.notif-panel {
  display: none; position: absolute; top: calc(100% + 12px); right: -8px;
  width: 340px; background: #fff; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15); border: 1px solid var(--border-light);
  z-index: 2000; overflow: hidden;
}
.notif-panel.open { display: block; animation: slideInRight .2s ease; }
.notif-panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border-light);
}
.notif-panel-hdr strong { font-size: 14px; color: var(--text-dark); }
.notif-mark-all {
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: var(--secondary); font-weight: 600; padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; padding: 11px 16px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background .15s;
  align-items: flex-start;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; margin-top: 1px;
}
.notif-icon.info    { background: #dbeafe; color: #1d4ed8; }
.notif-icon.success { background: #dcfce7; color: #16a34a; }
.notif-icon.warning { background: #fef9c3; color: #b45309; }
.notif-icon.danger  { background: #fee2e2; color: #dc2626; }
.notif-body   { flex: 1; min-width: 0; }
.notif-title  { font-size: 12px; font-weight: 600; color: var(--text-dark); margin-bottom: 2px; }
.notif-msg    { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time   { font-size: 10px; color: #94a3b8; margin-top: 3px; }
.notif-dot    { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); flex-shrink: 0; align-self: center; }
.notif-empty  { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 2; }
.notif-footer { padding: 8px 16px; text-align: center; border-top: 1px solid var(--border-light); font-size: 11px; color: var(--text-muted); }

/* ── MIV notification styling ── */
.notif-item.notif-miv { background: #f0f9ff; border-left: 3px solid #0891b2; padding-left: 13px; position: relative; }
.notif-item.notif-miv:hover { background: #e0f2fe; }
.notif-item.notif-miv.unread { background: #e0f7ff; }
.notif-item.notif-miv.unread:hover { background: #bae6fd; }
.notif-miv-bar { display: none; }
.notif-miv-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: #0891b2; background: #cffafe; border: 1px solid #a5f3fc;
  border-radius: 4px; padding: 1px 6px; margin-bottom: 3px;
}

/* ── REQUISITION ITEMS TABLE ── */
.items-table tbody tr.req-item-row { transition: background .15s; }
.items-table tbody tr.req-item-row:hover { background: #f8fafc; }
.items-table tbody tr.req-item-row td { padding: 7px 6px; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }
.sl-cell { text-align: center; width: 40px; }
.sl-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.name-cell { min-width: 220px; }
.items-table input[type="text"],
.items-table input[type="number"],
.items-table select {
  width: 100%; padding: 7px 10px;
  border: 1.5px solid #e2e8f0; border-radius: 7px;
  font-size: 13px; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.items-table input[type="text"]:focus,
.items-table input[type="number"]:focus,
.items-table select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(25,118,210,0.12);
  outline: none;
}
/* Autocomplete */
.ac-wrap { position: relative; }
.ac-dropdown {
  position: fixed; z-index: 9999;
  background: #fff; border: 1.5px solid var(--border-light); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.13); max-height: 220px; overflow-y: auto;
}
.ac-item {
  padding: 9px 14px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid #f1f5f9; transition: background .1s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.ac-active { background: #eff6ff; color: var(--primary); font-weight: 600; }

/* ── REPORT TABS ── */
.report-tabs-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  background: #f1f5f9;
  padding: 8px;
  border-radius: 12px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.rpt-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.rtab-btn {
  flex: 1 1 auto;
  min-width: 140px;
  text-align: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.rtab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.5);
}
.rtab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

/* ── ADMIN TABS ── */
.admin-tab {
  padding: 10px 22px; border: none; background: transparent;
  font-size: 13.5px; font-weight: 600; color: #64748b;
  cursor: pointer; border-bottom: 3px solid transparent;
  transition: all .2s; display: inline-flex; align-items: center; gap: 7px;
  margin-bottom: -2px;
}
.admin-tab:hover  { color: var(--primary); background: #f8fafc; }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── PERMISSION MATRIX ── */
.perm-matrix-scroll { overflow-x: auto; max-height: 600px; }
.perm-matrix { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 11.5px; }
.perm-matrix th {
  background: var(--primary); color: #fff; padding: 7px 5px;
  text-align: center; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.perm-matrix th.perm-label-col {
  text-align: left; padding-left: 12px; min-width: 160px; max-width: 200px;
  position: sticky; top: 0; left: 0; z-index: 4; background: var(--primary);
}
.perm-matrix td { padding: 6px 4px; border-bottom: 1px solid #f1f5f9; text-align: center; min-width: 40px; }
.perm-matrix td.perm-name {
  text-align: left; padding-left: 12px; font-weight: 600; color: #374151; white-space: nowrap;
  position: sticky; left: 0; z-index: 1; background: #fff;
}
.perm-matrix tr:hover td { background: #f8fafc; }
.perm-matrix tr:hover td.perm-name { background: #f8fafc; }
.perm-matrix tr.perm-group-hdr td { background: #f1f5f9; font-size: 10px; font-weight: 800; color: #475569; text-transform: uppercase; letter-spacing: .5px; padding: 5px 12px; }
.perm-matrix tr.perm-group-hdr td:first-child { position: sticky; left: 0; z-index: 1; background: #f1f5f9; }
.perm-matrix tr.perm-reset-row td { background: #fafafa; padding: 4px; }
.perm-matrix tr.perm-reset-row td:first-child { position: sticky; left: 0; z-index: 1; background: #fafafa; }
.perm-role-col { min-width: 42px; max-width: 52px; font-size: 10px !important; }

/* Permission toggle — compact */
.perm-toggle { display: flex; align-items: center; justify-content: center; }
.perm-toggle input[type="checkbox"] { display: none; }
.perm-toggle label {
  width: 28px; height: 16px; background: #cbd5e1; border-radius: 10px;
  cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0;
}
.perm-toggle label::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s;
}
.perm-toggle input:checked + label { background: #22c55e; }
.perm-toggle input:checked + label::after { left: 14px; }
.perm-toggle.disabled label { opacity: .4; cursor: not-allowed; }

/* Role column header color coding */
.role-col-management { background: #581c87 !important; }
.role-col-submitter  { background: #1e40af !important; }
.role-col-approval   { background: #065f46 !important; }
.role-col-purchase   { background: #92400e !important; }

/* ── NAV ACCESS MATRIX ── */
.nav-matrix td { padding: 5px 3px; }
.nav-cell {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; margin: 0 auto;
}
.nav-cell-yes { background: #dcfce7; color: #16a34a; }
.nav-cell-no  { background: #f1f5f9; color: #94a3b8; }

/* ── ROLE PERMISSION PANEL (new card-based design) ── */
#acRoleSidebar { scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent; }
#acPermPanel   { scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent; }
#acRoleSidebar > div[onclick]:hover { background: #f1f5f9 !important; }
@media (max-width: 640px) {
  #acMainLayout { flex-direction: column; }
  #acRoleSidebar { width: 100% !important; min-width: 0 !important; max-height: 160px !important; border-right: none !important; border-bottom: 1px solid #f1f5f9; }
  #acPermPanel { max-height: none !important; }
}

/* ── WORKFLOW CHAIN ADMIN ── */
.wf-chain-card .card-header { padding: 14px 18px; }
.wf-chain-list { display: flex; flex-direction: column; gap: 0; }
.wf-connector { text-align: center; color: #94a3b8; font-size: 13px; padding: 2px 0; }
.wf-step-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px;
  background: #fff; margin-bottom: 0; transition: box-shadow .15s;
}
.wf-step-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.wf-step-order {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wf-step-name { flex: 1; display: flex; align-items: center; gap: 8px; }
.wf-role-badge {
  background: #eff6ff; color: #1e40af; padding: 2px 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.wf-stage-label { color: #64748b; font-size: 12px; }
.wf-step-active { display: flex; align-items: center; }
.wf-step-actions { display: flex; gap: 4px; }
.wf-arrow-btn {
  width: 28px; height: 28px; border: 1px solid #e2e8f0; border-radius: 7px;
  background: #f8fafc; color: #64748b; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  transition: all .15s;
}
.wf-arrow-btn:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.wf-arrow-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Active toggle (workflow step) */
.wf-active-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.wf-active-toggle input { display: none; }
.wf-slider {
  width: 34px; height: 20px; background: #cbd5e1; border-radius: 12px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.wf-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s;
}
.wf-active-toggle input:checked + .wf-slider { background: #22c55e; }
.wf-active-toggle input:checked + .wf-slider::after { left: 17px; }

/* ── STEP NOTE (local/pay-close hint) ── */

/* Stepper step note sub-label */
.step-note {
  font-size: 9.5px; color: #6366f1; font-weight: 700; margin-top: 2px;
  text-transform: uppercase; letter-spacing: .4px;
}

/* =====================================================
   MOBILE OVERLAY
   ===================================================== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 299;
}
.sidebar-overlay.active { display: block; }

/* =====================================================
   RESPONSIVE — TABLET (<=900px)
   ===================================================== */
@media (max-width: 900px) {
  .main-content { margin-left: 0 !important; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 300;
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w) !important; }
  .sidebar.collapsed .sb-brand-text,
  .sidebar.collapsed .sb-user-details,
  .sidebar.collapsed .sb-search-wrap,
  .sidebar.collapsed .ng-label,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .caret,
  .sidebar.collapsed .sb-footer-clock { display: revert !important; }
  .sidebar.collapsed .nav-item { padding-left: 40px !important; justify-content: flex-start !important; }
  .sidebar.collapsed .nav-group-items { display: grid !important; }
  .sidebar.collapsed .sidebar-header { padding: 20px 16px 16px !important; justify-content: flex-start !important; }
  .sidebar.collapsed .user-info-box { padding: 14px 16px !important; justify-content: flex-start !important; }
  .sb-collapse-btn { display: none !important; }

  .sidebar-close { display: flex !important; }
  .tb-menu       { display: flex !important; }

  .topbar { padding: 0 12px; gap: 8px; }
  .tb-title { font-size: 14px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Modal must ignore sidebar width on tablet/mobile */
  .modal-overlay, .modal { left: 0; padding-top: 60px; }
  .modal-box { width: 96vw; max-width: 96vw; }
}

/* ══════════════════════════════════════════════════════════════
   STORE INVENTORY MODULE — CSS
══════════════════════════════════════════════════════════════ */

/* ── Data Table (used across all inventory sections) ── */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.data-table thead tr {
  background: linear-gradient(135deg, var(--primary) 0%, #283593 100%);
}
.data-table th {
  color: #fff; padding: 8px 10px; text-align: left;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; white-space: nowrap;
}
.data-table th:first-child { border-radius: 10px 0 0 0; }
.data-table th:last-child  { border-radius: 0 10px 0 0; }
.data-table td {
  padding: 7px 10px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle; color: var(--text-dark);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8fafc; }
/* MRN item rows — rowspan cells get subtle left border as visual separator */
#inv-grn-tbody td[rowspan] { border-left: 2px solid #e2e8f0; vertical-align: top; padding-top: 10px; }

/* ── Card with title bar ── */
.card-title {
  font-size: 13px; font-weight: 700; color: var(--text-dark);
  padding: 14px 18px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: 13px;
}

/* ── Filter bar ── */
.inv-filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
  align-items: center;
}
.inv-filter-bar input,
.inv-filter-bar select {
  flex: 1; min-width: 150px; max-width: 260px;
  padding: 8px 12px; font-size: 13px;
  border: 1.5px solid var(--border-light);
  border-radius: 8px; background: #f8fafc;
}
.inv-filter-bar input:focus,
.inv-filter-bar select:focus {
  border-color: var(--secondary); background: #fff;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1); outline: none;
}

/* ── Inventory Dashboard — two-column grid ── */
.inv-dash-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px;
}
.inv-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.inv-card-full { grid-column: 1 / -1; }

/* ── Procurement Dashboard ── */
.prd-kpi-card {
  background: linear-gradient(180deg, #fff 0%, #fbfdfe 100%);
  border: 1px solid #e7edf1; border-radius: 16px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 7px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.03);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
}
.prd-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px -8px rgba(15,23,42,.14), 0 4px 10px rgba(15,23,42,.06);
  border-color: #d7e0e6;
}
.prd-kpi-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.09);
  margin-bottom: 2px;
}
.prd-kpi-val { font-size: 24px; font-weight: 800; color: #0f172a; line-height: 1.05; letter-spacing: -.3px; }
.prd-kpi-lbl { font-size: 11px; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }

/* ── Premium KPI card variant (CNG Truck Purchase dashboard only) ── */
.kpi-premium {
  position: relative;
  background: #ffffff;
  border: 1px solid #e8edf1;
  border-radius: 14px;
  border-top: 3px solid var(--kpi-c1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.kpi-premium:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -8px rgba(15, 23, 42, .16);
  border-color: #d7e0e6;
}
.kpi-premium .prd-kpi-icon {
  width: 38px; height: 38px; border-radius: 10px; font-size: 15px;
  background: linear-gradient(150deg, var(--kpi-c1), var(--kpi-c2)) !important;
  color: #fff !important;
  box-shadow: 0 4px 10px -3px var(--kpi-c1);
}
.kpi-premium .prd-kpi-val { font-size: 18px; }
.kpi-premium .prd-kpi-lbl { color: #64748b; }

/* ── Executive Dashboard — module quick-link cards ── */
.md-module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.md-module-card {
  position: relative; display: block; text-decoration: none; cursor: pointer;
  background: linear-gradient(180deg, #fff 0%, #fbfdfe 100%);
  border: 1px solid #e7edf1; border-radius: 16px; padding: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.03);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
}
.md-module-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--md-c1), var(--md-c2));
}
.md-module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px -8px rgba(15,23,42,.14), 0 4px 10px rgba(15,23,42,.06);
  border-color: #d7e0e6;
}
.md-module-icon {
  width: 42px; height: 42px; border-radius: 11px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: linear-gradient(150deg, var(--md-c1), var(--md-c2)); color: #fff;
  box-shadow: 0 4px 10px -3px var(--md-c1);
}
.md-module-name { font-size: 12.5px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.md-module-val { font-size: 21px; font-weight: 800; color: #0f172a; line-height: 1.15; letter-spacing: -.3px; }
.md-module-unit { font-size: 12px; color: #94a3b8; font-weight: 600; margin-left: 4px; }
.md-module-arrow { position: absolute; top: 16px; right: 16px; color: #cbd5e1; font-size: 13px; transition: transform .18s ease, color .18s ease; }
.md-module-card:hover .md-module-arrow { transform: translateX(3px); color: var(--md-c1); }

@media (prefers-color-scheme: dark) {
  .md-module-card { background: linear-gradient(180deg, #1e293b 0%, #1a2332 100%); border-color: #334155; }
  .md-module-val { color: #f1f5f9; }
  .md-module-name { color: #94a3b8; }
}
:root[data-theme="dark"] .md-module-card { background: linear-gradient(180deg, #1e293b 0%, #1a2332 100%); border-color: #334155; }
:root[data-theme="dark"] .md-module-val { color: #f1f5f9; }
:root[data-theme="dark"] .md-module-name { color: #94a3b8; }

/* ── Dyeing Daily Report KPI row: fixed 4-col grid = a clean two-line layout for 7 cards ── */
.dy-daily-kpi-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
@media (max-width: 900px) { .dy-daily-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.dy-kpi-grand {
  grid-column: span 2;
  background: linear-gradient(150deg, #ecfeff 0%, #ffffff 60%);
  border: 1px solid #a5f3fc;
  box-shadow: 0 4px 16px -6px rgba(8, 145, 178, .25);
  padding: 20px 24px;
}
.dy-kpi-grand .prd-kpi-icon { width: 46px; height: 46px; font-size: 18px; }
.dy-kpi-grand .prd-kpi-val { font-size: 30px; color: #0e7490; }
.dy-kpi-grand .prd-kpi-lbl { color: #0891b2; font-size: 12px; }

/* ── Dyeing Monthly matrix: sticky machine-name column while scrolling horizontally ── */
.dy-mm-matrix { font-size: 11.5px; }
.dy-mm-matrix th, .dy-mm-matrix td { text-align: center; padding: 5px 8px; white-space: nowrap; }
.dy-mm-sticky { position: sticky; left: 0; z-index: 2; text-align: left !important; background: #fff; box-shadow: 2px 0 4px -2px rgba(15,23,42,.12); }
.dy-mm-matrix thead .dy-mm-sticky { background: #f1f5f9; z-index: 3; }
.dy-mm-matrix tfoot .dy-mm-sticky { background: #f1f5f9; }

.prd-pipeline {
  display:flex; align-items:stretch; gap:0; overflow-x:auto; padding-bottom:4px;
}
.prd-pipe-step {
  display:flex; align-items:center; gap:12px; flex:1; min-width:140px;
  background:var(--pipe-bg); border:1px solid var(--pipe-border);
  border-radius:12px; padding:14px 16px;
  transition:transform .15s, box-shadow .15s;
}
.prd-pipe-step:hover { transform:translateY(-2px); box-shadow:0 6px 16px rgba(0,0,0,.08); }
.prd-pipe-icon {
  width:38px; height:38px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:16px;
}
.prd-pipe-info { flex:1; min-width:0; }
.prd-pipe-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--pipe-color); }
.prd-pipe-count { font-size:28px; font-weight:800; color:var(--pipe-color); line-height:1.1; }
.prd-pipe-sub   { font-size:10px; color:#94a3b8; }
.prd-pipe-arrow {
  display:flex; align-items:center; justify-content:center;
  color:#cbd5e1; font-size:14px; padding:0 8px; flex-shrink:0;
}
@media (max-width:768px) {
  .prd-pipeline { flex-direction:column; }
  .prd-pipe-arrow { transform:rotate(90deg); padding:4px 0; }
}

/* ── Inventory Dashboard Redesign ── */
.inv-kpi-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .15s, box-shadow .15s;
}
.inv-kpi-card[onclick] { cursor: pointer; }
.inv-kpi-card[onclick]:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.inv-kpi-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.inv-kpi-val { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1; }
.inv-kpi-lbl { font-size: 12px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

.inv-dash-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden;
}
.inv-dash-card-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; font-size: 13px; font-weight: 700;
  border-bottom: 2px solid #f1f5f9;
}
.inv-dash-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}
.inv-dash-body { max-height: 300px; overflow-y: auto; }

/* Low stock progress bar row */
.ls-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 18px; border-bottom: 1px solid #f8fafc; font-size: 13px;
  gap: 10px;
}
.ls-row:last-child { border-bottom: none; }
.ls-name  { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.ls-code  { font-size: 11px; color: #94a3b8; }
.ls-stock { font-weight: 800; color: #ea580c; white-space: nowrap; }
.ls-bar-wrap { flex: 1; min-width: 50px; }
.ls-bar { height: 5px; border-radius: 3px; background: #fee2e2; overflow: hidden; }
.ls-bar-fill { height: 100%; border-radius: 3px; background: #ea580c; transition: width .4s; }

/* Pending MIV row */
.miv-dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; border-bottom: 1px solid #f8fafc; font-size: 13px; cursor: pointer;
}
.miv-dash-row:last-child { border-bottom: none; }
.miv-dash-row:hover { background: #f8fafc; }
.miv-dash-no { font-weight: 700; color: #0891b2; flex-shrink: 0; }
.miv-dash-dept { flex: 1; color: #475569; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miv-dash-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }

@media (max-width: 700px) {
  .inv-dash-main-grid { grid-template-columns: 1fr !important; }
}

/* Recent movement row */
.mv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px; border-bottom: 1px solid #f8fafc;
  font-size: 12px;
}
.mv-row:last-child { border-bottom: none; }
.mv-type-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.mv-type-IN     { background: #dcfce7; color: #16a34a; }
.mv-type-OUT    { background: #fee2e2; color: #dc2626; }
.mv-type-ADJ    { background: #ede9fe; color: #7c3aed; }
.mv-type-RETURN { background: #e0f2fe; color: #0369a1; }
.mv-info { flex: 1; min-width: 0; }
.mv-item { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-meta { color: var(--text-muted); font-size: 11px; }
.mv-qty  { font-weight: 800; font-size: 14px; }

/* Low stock item row */
.ls-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 18px; border-bottom: 1px solid #f8fafc; font-size: 13px;
}
.ls-row:last-child { border-bottom: none; }
.ls-name  { font-weight: 600; }
.ls-code  { font-size: 11px; color: #94a3b8; }
.ls-stock { font-weight: 800; color: var(--danger); }

/* Expiry row */
.exp-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 18px; border-bottom: 1px solid #f8fafc; font-size: 13px;
}
.exp-row:last-child { border-bottom: none; }
.exp-name { font-weight: 600; }
.exp-date { font-weight: 700; color: var(--warning); font-size: 12px; }

/* ── Item Master — stock level indicator ── */
.stock-bar-wrap {
  display: flex; align-items: center; gap: 8px;
}
.stock-bar {
  flex: 1; height: 6px; border-radius: 3px;
  background: #e2e8f0; overflow: hidden; min-width: 60px;
}
.stock-bar-fill {
  height: 100%; border-radius: 3px; transition: width .4s;
}
.stock-ok   { background: var(--success); }
.stock-low  { background: var(--danger); }
.stock-warn { background: var(--warning); }

/* ── GRN Status Steps ── */
.grn-steps {
  display: flex; gap: 0; margin: 16px 0;
}
.grn-step {
  flex: 1; text-align: center; padding: 8px 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  border-bottom: 3px solid var(--border-light);
  color: var(--text-muted);
}
.grn-step.done   { border-color: var(--success); color: var(--success); }
.grn-step.active { border-color: var(--secondary); color: var(--secondary); }

/* ── MIV flow indicator ── */
.miv-flow {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 16px; font-size: 11px; font-weight: 700;
}
.miv-flow-step {
  padding: 4px 12px; border-radius: 20px;
  background: #f1f5f9; color: var(--text-muted);
}
.miv-flow-step.done   { background: #dcfce7; color: var(--success); }
.miv-flow-step.active { background: #dbeafe; color: var(--secondary); }
.miv-flow-arrow { color: var(--border-light); font-size: 10px; }

/* ── Reorder Alert Table ── */
.reorder-critical { background: #fff5f5 !important; }
.reorder-critical td:first-child { border-left: 3px solid var(--danger); }

/* ── Modal footer ── */
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  background: #f8fafc; border-radius: 0 0 16px 16px;
}

/* Inventory modals: accent stripe on header */
#invItemModal .modal-hdr,
#invGrnModal .modal-hdr,
#invGrnDetailModal .modal-hdr,
#invMivModal .modal-hdr,
#invMivDetailModal .modal-hdr,
#invReturnModal .modal-hdr,
#invInspectModal .modal-hdr,
#invAdjModal .modal-hdr,
#invAdjDetailModal .modal-hdr,
#invLedgerModal .modal-hdr {
  background: linear-gradient(135deg, #f0f4ff 0%, #fff 60%);
  border-bottom: 2px solid var(--primary);
}

/* Section table cards */
#section-invItems .card,
#section-invGrn .card,
#section-invMiv .card,
#section-invReturn .card,
#section-invAdjust .card,
#section-invReorder .card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Reorder info alert */
.inv-alert-info {
  display: flex; align-items: center; gap: 10px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 10px; padding: 10px 16px;
  font-size: 13px; color: #1e40af; margin-bottom: 16px;
}

/* ── Inline table inputs (GRN / MIV form rows) ── */
.data-table input[type="number"],
.data-table input[type="text"],
.data-table input[type="date"],
.data-table select {
  width: 100%; padding: 6px 8px; font-size: 12px;
  border: 1.5px solid var(--border-light); border-radius: 6px;
  background: #f8fafc; transition: border .15s;
}
.data-table input:focus,
.data-table select:focus {
  border-color: var(--secondary); background: #fff;
  box-shadow: 0 0 0 2px rgba(25,118,210,0.1); outline: none;
}

/* ── Inventory info grid (detail modals) ── */
.inv-info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px;
  background: #f8fafc; border-radius: 10px;
  padding: 14px 18px; margin-bottom: 16px;
  border: 1px solid var(--border-light); font-size: 13px;
}
.inv-info-grid .inv-info-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-muted); margin-bottom: 2px;
}
.inv-info-grid .inv-info-val { font-weight: 600; color: var(--text-dark); }

/* ── Adjustment variance colors ── */
.var-pos { color: var(--success); font-weight: 800; }
.var-neg { color: var(--danger);  font-weight: 800; }
.var-zero { color: var(--text-muted); }

/* ── Item Picker (autocomplete) ── */
.inv-picker { position: relative; }
.inv-picker-input {
  width: 100%; padding: 7px 10px; font-size: 12px;
  border: 1.5px solid var(--border-light); border-radius: 8px;
  background: #fff; transition: border .15s;
}
.inv-picker-input:focus {
  border-color: var(--secondary); outline: none;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}
.inv-picker-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1.5px solid var(--border-light);
  border-radius: 10px; z-index: 3000;
  box-shadow: 0 8px 24px rgba(15,23,42,0.14);
  max-height: 240px; overflow-y: auto;
}
.inv-picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 12px;
  border-bottom: 1px solid #f8fafc; transition: background .1s;
}
.inv-picker-item:last-child { border-bottom: none; }
.inv-picker-item:hover { background: #eff6ff; }
.inv-picker-code {
  font-family: monospace; font-size: 11px; font-weight: 700;
  color: var(--primary); background: #eff6ff;
  padding: 2px 5px; border-radius: 4px; flex-shrink: 0;
}
.inv-picker-name { flex: 1; font-weight: 500; color: var(--text-dark); }
.inv-picker-stock {
  font-size: 11px; font-weight: 700; color: var(--success);
  flex-shrink: 0;
}
.inv-picker-low { color: var(--danger); }
.inv-picker-empty {
  padding: 10px 14px; font-size: 12px; color: var(--text-muted);
  text-align: center;
}

/* ── Section header with gradient accent ── */
.inv-sec-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.inv-sec-hdr h2 {
  font-size: 22px; font-weight: 800; color: var(--primary);
  display: flex; align-items: center; gap: 10px;
}
.inv-sec-hdr-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.inv-sec-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 12px rgba(26,35,126,0.3);
}

/* ── Item Master Stats Board ── */
.inv-stats-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Item Master Tab Bar ── */
.inv-items-tabbar {
  display: flex; align-items: stretch;
  background: #fff; border-radius: 14px 14px 0 0;
  border: 1px solid #e2e8f0; border-bottom: none; padding: 0 16px;
  overflow: hidden;
}
.inv-items-cat-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px 0 0; border-right: 1.5px solid #e2e8f0;
  margin-right: 14px; flex-shrink: 0;
}
.inv-items-tabs {
  display: flex; align-items: center; gap: 2px;
  flex: 1; overflow-x: auto; -webkit-overflow-scrolling: touch;
}

/* ── Item Master Filter Bar ── */
.inv-items-filterbar {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0; border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 14px 16px 12px;
  margin-bottom: 14px;
}
.inv-search-wrap {
  display: flex; align-items: center; gap: 0;
  background: #fff; border: 2px solid #e2e8f0;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: border-color .2s, box-shadow .2s;
}
.inv-search-wrap.focused {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.inv-filter-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; flex-wrap: wrap;
}
.inv-filter-row--single {
  flex-wrap: nowrap; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.inv-filter-row--single .inv-filter-group {
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.inv-filter-row--single .inv-filter-label {
  flex-shrink: 0;
}
.inv-filter-label {
  font-size: 11px; font-weight: 600; color: #64748b;
  white-space: nowrap; display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.inv-filter-group {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.inv-filter-group--scroll {
  flex-wrap: nowrap; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.inv-date-input {
  font-size: 12px !important; padding: 4px 8px !important;
  border: 1.5px solid #e2e8f0 !important; border-radius: 8px !important;
  color: #374151; outline: none; cursor: pointer;
  width: 130px !important; background: #fff !important;
  box-shadow: none !important;
}
.inv-sort-btn {
  font-size: 11px; font-weight: 600; padding: 5px 10px;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  background: #fff; color: #64748b; cursor: pointer;
  white-space: nowrap; transition: all .15s; flex-shrink: 0;
}
.inv-sort-btn:hover, .inv-sort-btn.active {
  border-color: var(--primary); color: var(--primary);
  background: #eff6ff;
}
.inv-sort-btn--clear {
  border-color: #fecaca !important; background: #fef2f2 !important;
  color: #dc2626 !important;
}

/* ── Badge for chemical ── */
.badge-chem {
  background: #fce7f3; color: #be185d;
  padding: 2px 7px; border-radius: 10px;
  font-size: 9px; font-weight: 800; text-transform: uppercase;
}
.badge-active   { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

/* ── Mobile responsive for inventory ── */
@media (max-width: 768px) {
  .inv-dash-grid { grid-template-columns: 1fr; }
  .inv-info-grid { grid-template-columns: 1fr; }
  .grn-hdr-grid  { grid-template-columns: 1fr; }
  .item-form-grid { grid-template-columns: 1fr; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .admin-tabs .tab-btn { white-space: nowrap; flex-shrink: 0; }
  .wf-chains { flex-direction: column; }
}

/* ── Inventory Table Card (below tabs) ── */
.inv-table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  border: 1px solid var(--border-light);
  overflow-x: auto;
  overflow-y: hidden;
}

/* ── Inventory Tab Bar ── */
.inv-tab-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-bottom: 20px; padding-bottom: 0; overflow: visible;
  border-bottom: 2px solid var(--border-light);
}
.inv-tab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 16px; font-size: 13px; font-weight: 700; flex-shrink: 0;
  border: none; background: none; cursor: pointer; color: #64748b;
  position: relative; transition: color .15s, background .15s;
  border-radius: 8px 8px 0 0;
}
.inv-tab::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: transparent; transition: background .15s;
}
.inv-tab:hover { color: var(--secondary); background: #eff6ff; }
.inv-tab.active { color: var(--secondary); background: #eff6ff; }
.inv-tab.active::after { background: var(--secondary); }
.inv-tab-badge {
  font-size: 10px; font-weight: 800; padding: 1px 7px;
  border-radius: 10px; min-width: 18px; text-align: center;
  background: var(--danger); color: #fff;
}
.inv-tab-badge-blue  { background: var(--secondary); color: #fff; }
.inv-tab-badge-gray  { background: #94a3b8; color: #fff; }
.inv-tab-badge-green  { background: var(--success); color: #fff; }
.inv-tab-badge-orange { background: #f59e0b; color: #fff; }
.inv-tab-badge-yellow { background: #d97706; color: #fff; }
.inv-tab-badge-red    { background: var(--danger); color: #fff; }
.inv-tab-badge-dark  { background: #1e293b; color: #fff; }
.grn-tab-pending-btn { color: #d97706 !important; }
.grn-tab-pending-btn.active { background: #fffbeb !important; }
.grn-tab-pending-btn.active::after { background: #d97706 !important; }
.grn-tab-pending-btn .inv-tab-badge { background: #d97706; }
.grn-status-filter {
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border-light); background: #f8fafc; color: #374151;
  cursor: pointer; height: 32px; outline: none;
}

/* ── GRN Modal ── */
.grn-modal-box { max-width: 960px; width: 96vw; display: flex; flex-direction: column; max-height: 86vh; overflow: hidden; }
.grn-modal-hdr { background: linear-gradient(135deg, var(--primary) 0%, #283593 100%) !important; border-radius: 12px 12px 0 0; border-bottom: none !important; }
.grn-modal-hdr h3 { color: #fff !important; }
.grn-modal-hdr .modal-close { color: rgba(255,255,255,.85) !important; background: rgba(255,255,255,0.1); border-radius: 8px; }
.grn-modal-hdr .modal-close:hover { color: #fff !important; background: rgba(255,255,255,.22) !important; }
.grn-modal-body { overflow-y: auto; flex: 1; min-height: 0; padding-top: 12px; background: #f1f5f9; gap: 12px; display: flex; flex-direction: column; }
.grn-hdr-section { padding: 20px 24px; border-bottom: none; background: #fff; border-radius: 10px; margin: 0 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.grn-items-section { background: #fff; border-radius: 10px; margin: 0 12px 12px; padding: 18px 20px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.grn-hdr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grn-items-section { padding: 16px 24px 20px; }
.grn-add-row-btn {
  background: linear-gradient(135deg, var(--secondary), #1565c0);
  color: #fff; border: none; font-size: 12px; font-weight: 700;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: opacity .15s;
}
.grn-add-row-btn:hover { opacity: .88; }
.grn-table-wrap { overflow-x: auto; border-radius: 10px; border: 1.5px solid var(--border-light); }
.grn-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.grn-table thead tr { background: linear-gradient(135deg, var(--primary) 0%, #283593 100%); }
.grn-table thead th {
  color: #fff; font-weight: 700; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; padding: 10px; white-space: nowrap; border: none;
}
.grn-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .12s; }
.grn-table tbody tr:hover { background: #f8faff; }
.grn-table tbody td { padding: 7px 6px; vertical-align: middle; }
.grn-table input[type=number], .grn-table input[type=text], .grn-table input[type=date], .grn-table select {
  width: 100%; padding: 6px 8px; font-size: 12px; border: 1.5px solid #e2e8f0;
  border-radius: 6px; background: #f8fafc; font-family: inherit; transition: border .15s;
}
.grn-table input:focus, .grn-table select:focus { border-color: var(--secondary); outline: none; background: #fff; }
.grn-modal-footer { background: #f8fafc; border-top: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.grn-del-btn {
  background: none; border: none; color: #cbd5e1; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px; font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: color .15s, background .15s; flex-shrink: 0;
}
.grn-del-btn:hover { color: var(--danger); background: #fee2e2; }

/* GRN item cards */
.grn-cards { display: flex; flex-direction: column; gap: 10px; }
.grn-item-card {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.grn-item-card:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(25,118,210,0.08); }
.grn-card-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #f8faff;
  border-bottom: 1px solid #e8edf5; border-radius: 10px 10px 0 0;
}
.grn-row-num {
  font-size: 11px; font-weight: 800; color: #fff;
  background: var(--secondary); border-radius: 6px;
  padding: 3px 7px; flex-shrink: 0; letter-spacing: .3px;
}
.grn-picker-wrap { flex: 1; }
.grn-picker-wrap .inv-picker { min-width: unset; }
.grn-card-fields {
  display: flex; flex-wrap: wrap; gap: 0;
  padding: 12px 14px; gap: 10px 14px; align-items: flex-start;
}
.grn-field { display: flex; flex-direction: column; gap: 4px; }
.grn-field label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: #94a3b8; white-space: nowrap;
}
.grn-field-wide { flex: 1; min-width: 150px; }
.grn-num-input {
  width: 72px; height: 34px; padding: 0 8px; font-size: 13px; font-weight: 600;
  text-align: center; border: 1.5px solid #e2e8f0; border-radius: 7px;
  background: #f8fafc; font-family: inherit; transition: border .15s; box-sizing: border-box;
}
.grn-num-input:focus { border-color: var(--secondary); outline: none; background: #fff; }
.grn-rejected-field { background: #fef2f2 !important; color: #b91c1c; border-color: #fecaca !important; }
.grn-text-input {
  padding: 7px 10px; font-size: 12px;
  border: 1.5px solid #e2e8f0; border-radius: 7px;
  background: #f8fafc; font-family: inherit; transition: border .15s; width: 100%;
}
.grn-text-input:focus { border-color: var(--secondary); outline: none; background: #fff; }
.grn-empty-hint {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 32px; color: #94a3b8; font-size: 13px;
  border: 2px dashed #e2e8f0; border-radius: 10px; background: #f8fafc;
}
.grn-empty-hint i { font-size: 20px; color: #cbd5e1; }

/* ── Item Picker: Add new ── */
.inv-picker-add {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  cursor: pointer; font-size: 12px; color: #059669; font-weight: 600;
  border-top: 1px dashed #d1fae5; background: #f0fdf4; transition: background .12s;
}
.inv-picker-add:hover { background: #dcfce7; }

/* ══════════════════════════════════════════════
   MOBILE OPTIMIZATIONS — v20260704t
   ══════════════════════════════════════════════ */

/* ── Skeleton loading ── */
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
.mob-skeleton-card {
  background:#fff;border:1px solid #e8edf5;border-radius:16px;padding:14px;margin-bottom:12px;
}
.mob-skeleton-line {
  height:12px;border-radius:6px;margin-bottom:8px;
  background:linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 50%,#f1f5f9 75%);
  background-size:200% 100%;animation:shimmer 1.5s infinite;
}

/* ── Empty state ── */
.mob-empty-state {
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:40px 20px;text-align:center;color:#94a3b8;
}
.mob-empty-state i { font-size:40px;margin-bottom:12px;opacity:.4; }
.mob-empty-state p { font-size:14px;font-weight:600;margin:0 0 4px; }
.mob-empty-state span { font-size:12px;color:#cbd5e1; }

/* ── Section title & count badge ── */
.mob-section-title {
  font-size:12px;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.5px;
  padding:8px 0 10px;display:flex;align-items:center;gap:6px;
}
.mob-section-count {
  font-size:11px;font-weight:700;background:#e0e7ff;color:#4338ca;
  padding:2px 8px;border-radius:20px;
}

/* ── Dashboard mobile cards ── */
.mob-dash-cards-wrap { display: none; }
.mob-req-card {
  background:#fff;border-radius:14px;padding:14px;margin-bottom:12px;
  box-shadow:0 2px 8px rgba(15,23,42,.07);border:1px solid #e8edf5;
}
.mob-req-card-hdr {
  display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;
}
.mob-req-card-no { font-weight:800;font-size:14px;color:#1e3a8a;letter-spacing:-.2px; }
.mob-req-card-status {
  display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:20px;
  font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.3px;
}
.mob-req-card-meta {
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:11px;color:#64748b;
}

/* ── Item master filter collapse ── */
.inv-filter-wrap { display:flex;flex-direction:column;gap:0; }
.inv-filter-toggle { display:none; }

/* ── Touch-friendly buttons ── */
@media (max-width:768px) {
  .btn { min-height:40px; }
  .btn-sm { min-height:36px; padding:6px 12px; font-size:12px; }
  .inv-mob-card-actions .btn, .inv-mob-card-actions button { min-height:36px; }

  /* Sticky section header */
  .sec-hdr, .inv-sec-hdr {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #f8fafc;
    padding: 10px 0 10px;
    margin: -4px 0 14px;
    border-bottom: 1px solid #e2e8f0;
  }

  /* Stats horizontal scroll */
  .prd-pipeline { overflow-x:auto; -webkit-overflow-scrolling:touch; flex-wrap:nowrap; padding-bottom:8px; }
  .prd-pipe-step { min-width:110px; flex-shrink:0; }
  .prd-kpi-card { min-width:130px; flex-shrink:0; }

  /* Dashboard mobile cards — hide table, show cards only */
  #dashStatusTable { display: none !important; }
  .mob-dash-cards-wrap { display: block; }

  /* Item master filter toggle */
  .inv-filter-toggle { display:inline-flex !important; margin-bottom:8px; }
  .inv-filter-collapsible { display:none !important; }
  .inv-filter-collapsible.open { display:flex !important; flex-direction:column; gap:8px; }
}
.inv-picker-add i { font-size: 14px; flex-shrink:0; }
.inv-picker-empty {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; color: #94a3b8; font-size: 12px; font-style: italic;
}

/* ── Item Form Modal ── */
.item-form-section-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .8px; color: var(--secondary);
  border-bottom: 2px solid #eff6ff; padding-bottom: 6px; margin-bottom: 12px;
}
.item-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.form-control {
  width: 100%; padding: 9px 12px; font-size: 13px;
  border: 1.5px solid var(--border-light); border-radius: 8px;
  background: #f8fafc; transition: border .15s, box-shadow .15s;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--secondary); background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}
.form-group label { display: block; font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.req { color: var(--danger); }

/* Toggle switch */
.toggle-wrap { display: inline-block; position: relative; width: 38px; height: 20px; flex-shrink: 0; }
.toggle-input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--danger);
  border-radius: 20px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-input:checked + .toggle-slider { background: var(--success); }
.toggle-input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Form error */
.inv-form-error {
  background: #fee2e2; border: 1px solid #fca5a5; border-radius: 8px;
  padding: 10px 14px; font-size: 12px; color: #b91c1c; margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* =====================================================
   RESPONSIVE — MOBILE (<=600px)
   ===================================================== */
@media (max-width: 600px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .tb-title { font-size: 13px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Inventory section header — actions wrap below title */
  .inv-sec-hdr { flex-wrap: wrap; }
  .inv-sec-hdr-actions { width: 100%; justify-content: flex-end; }

  /* Filter bar stacks vertically */
  .inv-filter-bar { flex-direction: column; }
  .inv-filter-bar input, .inv-filter-bar select { max-width: 100%; width: 100%; }

  /* Inventory tab bar scrolls horizontally */
  .inv-tab-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .inv-tab { flex-shrink: 0; }

  /* GRN modal full screen on mobile */
  .grn-modal-box { width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; }
  .grn-hdr-section, .grn-items-section { margin: 0 8px; }

  /* Modal bottom sheet on mobile */
  .modal-overlay, .modal { align-items: flex-end; padding: 0; }
  .modal-box { width: 100% !important; max-width: 100% !important; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .tb-user-name { display: none; }
  .topbar-right { gap: 4px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-val { font-size: 24px; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header .btn { width: 100%; justify-content: center; }

  .filter-row, .filters-row { flex-direction: column; gap: 8px; }
  .filter-row .form-control,
  .filters-row .form-control,
  .filter-row select,
  .filters-row select { width: 100%; }

  .card { padding: 14px 12px; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card-header .btn { width: 100%; justify-content: center; }

  .table-wrap, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }
  th, td { padding: 8px 10px; font-size: 12.5px; }

  .mr-info-grid { grid-template-columns: 1fr; }

  .workflow-banner { font-size: 11px; flex-wrap: wrap; gap: 6px; }
  .wf-step { font-size: 11px; padding: 4px 8px; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
  }
  .modal-header { padding: 14px 16px 10px; }
  .modal-body   { padding: 12px 16px; }
  .modal-footer { padding: 10px 16px 16px; flex-direction: column; gap: 8px; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  .items-table-wrap { overflow-x: auto; }
  .items-table { min-width: 480px; }

  .admin-tabs { gap: 4px; }
  .admin-tabs .tab-btn { font-size: 12px; padding: 7px 12px; }

  .ac-table-wrap { overflow-x: auto; }
  .ac-table { min-width: 500px; font-size: 12px; }

  .report-grid { grid-template-columns: 1fr; gap: 12px; }
  .report-card { padding: 14px 12px; }

  .notif-item { padding: 10px 12px; font-size: 13px; }

  .btn-sm { padding: 5px 10px; font-size: 12px; }

  .form-row { flex-direction: column; gap: 8px; }
  .form-row .form-group { width: 100% !important; }
}

/* =====================================================
   RESPONSIVE — SMALL PHONES (<=400px)
   ===================================================== */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tb-title { max-width: 90px; }
  .stat-val { font-size: 20px; }
}
/* Sidebar Accordion Styles */
.nav-group { margin-bottom: 2px; }
.nav-group-header {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 14px;
  color: rgba(255,255,255,0.35); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; transition: color .2s, background .2s; user-select: none;
  border-radius: 6px; margin: 2px 10px; position: relative;
}
.nav-group-header:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.04); }
.nav-group-header .caret { margin-left: auto; font-size: 9px; transition: transform 0.25s; opacity: 0.5; }
.nav-group-header .nav-icon { font-size: 12px; opacity: 0.6; flex-shrink: 0; width: 16px; text-align: center; }
.nav-group-header .ng-label { flex: 1; }
.nav-group.open .nav-group-header { color: rgba(255,255,255,0.6); }
.nav-group.open .caret { transform: rotate(90deg); }
.nav-group-items {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s cubic-bezier(0.4,0,0.2,1);
}
.nav-group-items-inner { overflow: hidden; }
.nav-group.open .nav-group-items { grid-template-rows: 1fr; }
.nav-group-items .nav-item { padding-left: 40px; }

/* =====================================================
   MOBILE RESPONSIVE — Materials List / Approvals / Suppliers cards
   ===================================================== */
.mat-mob-cards-wrap, .appr-mob-cards-wrap, .sup-mob-cards-wrap { display: none; }
.mat-mob-table-wrap, .appr-mob-table-wrap, .sup-mob-table-wrap { display: block; }

@media (max-width: 768px) {
  .mat-mob-table-wrap { display: none !important; }
  .mat-mob-cards-wrap { display: block !important; }
  .appr-mob-table-wrap { display: none !important; }
  .appr-mob-cards-wrap { display: block !important; }
  .sup-mob-table-wrap { display: none !important; }
  .sup-mob-cards-wrap { display: block !important; }

  /* New Requisition items table — stack as cards */
  table.req-items-mob-table thead { display: none; }
  table.req-items-mob-table, table.req-items-mob-table tbody,
  table.req-items-mob-table tr, table.req-items-mob-table td { display: block; width: 100%; }
  table.req-items-mob-table { min-width: 0 !important; }
  table.req-items-mob-table tr.req-item-row {
    background: #fff; border: 1px solid #e8edf5; border-radius: 14px;
    padding: 10px 12px 12px; margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.06);
  }
  table.req-items-mob-table td {
    padding: 7px 0; border-bottom: 1px dashed #f1f5f9;
    display: flex; flex-direction: column; gap: 4px;
  }
  table.req-items-mob-table td:last-child { border-bottom: none; padding-top: 10px; }
  table.req-items-mob-table td::before {
    content: attr(data-th); font-size: 10px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: .3px;
  }
  table.req-items-mob-table td.sl-cell { flex-direction: row; align-items: center; gap: 8px; }
  table.req-items-mob-table td.sl-cell::before { margin-bottom: 0; }
  table.req-items-mob-table td input,
  table.req-items-mob-table td select { width: 100%; }
  table.req-items-mob-table td[style*="text-align:center"] { align-items: flex-end; }

  /* Master List — category filter, full-width & touch friendly */
  .inv-items-cat-wrap select#inv-item-cat {
    width: 100%; padding: 8px 4px; font-size: 14px !important;
  }
  .inv-items-cat-wrap {
    background: #f8fafc; border-radius: 8px; padding: 8px 10px !important;
  }

  /* MRN / MIV — KPI stat boards scroll horizontally */
  #grn-stats-board, #miv-stats-board {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 6px;
  }
  #grn-stats-board > div, #miv-stats-board > div {
    flex: 0 0 150px;
  }
}

/* ============================================================
   Global Mobile Polish — applies site-wide on phones
   ============================================================ */
@media (max-width: 768px) {
  /* Prevent iOS Safari auto-zoom on focus (inputs under 16px trigger it) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Remove the ugly grey flash Android/iOS show on tap */
  a, button, .btn, [onclick] {
    -webkit-tap-highlight-color: transparent;
  }

  /* Respect the notch / home-indicator on iPhone (safe-area insets) */
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .app-sidebar {
    padding-top: env(safe-area-inset-top);
  }
  .app-topbar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  /* Comfortable minimum tap target size (Apple/Google guidance: 44px) */
  .btn, button, select, .app-topbar-icon-btn, .app-sidebar-close {
    min-height: 40px;
  }
}

@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    .app-topbar {
      padding-top: max(12px, env(safe-area-inset-top));
    }
  }
}

/* Dyeing Entry Form Customization */
.um-users-table input.dy-entry-input, .um-users-table select.dy-entry-input { padding: 4px 6px !important; font-size: 11px !important; background-color: #f1f5f9 !important; border: 1px solid #cbd5e1 !important; height: auto !important; min-height: 28px !important; }
.um-users-table input.pt-entry-input, .um-users-table select.pt-entry-input { padding: 4px 6px !important; font-size: 11px !important; background-color: #f1f5f9 !important; border: 1px solid #cbd5e1 !important; height: auto !important; min-height: 28px !important; }
#dyEntryTable td, #dyEntryTable th { padding: 4px 4px !important; }
