/* ==========================================================================
   SISTEM INVENTORY GUDANG PG2 - GREAT GIANT FOODS (GGF)
   Aesthetic Enterprise Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand Palette - GGF Green & Industrial Agricultural Tones */
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;
  --primary-gradient: linear-gradient(135deg, #059669 0%, #047857 50%, #064e3b 100%);
  --accent-gold: #f59e0b;
  --accent-gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  /* Neutrals & Surfaces */
  --bg-main: #f8fafc;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --surface-card: #ffffff;
  --surface-card-subtle: #f1f5f9;
  --border-light: #e2e8f0;
  --border-focus: #10b981;

  /* Typography */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  /* Status Colors */
  --status-safe-bg: #dcfce7;
  --status-safe-text: #15803d;
  --status-safe-border: #86efac;

  --status-warning-bg: #fee2e2;
  --status-warning-text: #b91c1c;
  --status-warning-border: #fca5a5;

  --status-pending-bg: #fef3c7;
  --status-pending-text: #b45309;
  --status-pending-border: #fcd34d;

  --status-info-bg: #e0f2fe;
  --status-info-text: #0369a1;
  --status-info-border: #7dd3fc;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
body.dark-mode {
  --bg-main: #0b1120;
  --surface-card: #131c31;
  --surface-card-subtle: #1e293b;
  --border-light: #243048;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* SIDEBAR STYLING */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.2;
  color: #ffffff;
}

.brand-text p {
  font-size: 0.72rem;
  color: #10b981;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Current User Badge in Sidebar */
.user-profile-widget {
  margin: 16px 16px 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid #10b981;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.user-role-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-weight: 600;
  border-color: rgba(16, 185, 129, 0.3);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: #10b981;
  border-radius: 0 4px 4px 0;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f59e0b;
  color: #ffffff;
  font-weight: 700;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
}

.btn-sidebar-action {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-sidebar-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* MAIN CONTENT AREA */
.main-wrapper {
  margin-left: 280px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 280px);
}

/* TOPBAR */
.topbar {
  height: 70px;
  background-color: var(--surface-card);
  border-bottom: 1px solid var(--border-light);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  gap: 14px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.page-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.estate-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: var(--radius-full);
  font-weight: 700;
  border: 1px solid var(--primary-200);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-right .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* TOPBAR USER BADGE & ROLE SWITCHER */
.topbar-user-badge,
.mobile-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px 12px 4px 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  text-decoration: none;
  max-width: 260px;
}

.topbar-user-badge:hover,
.mobile-user-badge:hover {
  background: rgba(5, 150, 105, 0.08);
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.15);
  transform: translateY(-1px);
}

.topbar-avatar-img,
.mobile-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #059669;
  flex-shrink: 0;
}

.topbar-user-meta,
.mobile-user-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
  min-width: 0;
}

.topbar-user-name,
.mobile-user-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-role,
.mobile-user-role {
  font-size: 0.68rem;
  font-weight: 700;
  color: #059669;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.topbar-user-badge:hover .topbar-user-chevron {
  color: #059669;
  transform: translateY(1px);
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--surface-card-subtle);
  color: var(--text-main);
  border-color: #cbd5e1;
}

/* CONTENT CONTAINER */
.content-body {
  padding: 28px 32px 48px;
  flex: 1;
}

/* VIEWS SWITCHING */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-section.active {
  display: block;
}

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

/* STATS KPI CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-600);
}

.stat-card.card-warning::after { background: #ef4444; }
.stat-card.card-amber::after { background: #f59e0b; }
.stat-card.card-blue::after { background: #0284c7; }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-50);
  color: var(--primary-600);
}

.card-warning .stat-icon { background: #fee2e2; color: #dc2626; }
.card-amber .stat-icon { background: #fef3c7; color: #d97706; }
.card-blue .stat-icon { background: #e0f2fe; color: #0284c7; }

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.stat-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* CARDS & PANELS */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(248, 250, 252, 0.4);
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-body {
  padding: 24px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.3);
  transform: translateY(-1px);
}

.btn-success {
  background: #10b981;
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--surface-card-subtle);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* FORM ELEMENTS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-label .required {
  color: #ef4444;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface-card);
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-control[readonly], .form-control:disabled {
  background-color: var(--surface-card-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}

#orderBagian:disabled {
  background-color: rgba(5, 150, 105, 0.08) !important;
  color: #065f46 !important;
  -webkit-text-fill-color: #065f46 !important;
  font-weight: 800 !important;
  border-color: #10b981 !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

body.dark-mode #orderBagian:disabled {
  background-color: rgba(5, 150, 105, 0.18) !important;
  color: #34d399 !important;
  -webkit-text-fill-color: #34d399 !important;
  border-color: #059669 !important;
}

body.dark-mode #orderWilayahNotice {
  background: rgba(5, 150, 105, 0.15) !important;
  color: #a7f3d0 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* TABLES (Mirip Sheet LR & Riwayat Excel tapi Lebih Modern) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.84rem;
}

.custom-table th {
  background: var(--surface-card-subtle);
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: var(--transition);
}

.custom-table tbody tr:hover {
  background-color: rgba(16, 185, 129, 0.04);
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-safe {
  background: var(--status-safe-bg);
  color: var(--status-safe-text);
  border: 1px solid var(--status-safe-border);
}

.badge-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
  border: 1px solid var(--status-pending-border);
}

.badge-info {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border: 1px solid var(--status-info-border);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ITEM CODE TAG (Monospace style) */
.item-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--primary-700);
}

/* ACTION BARS & SEARCH */
.toolbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-input-group {
  position: relative;
  min-width: 280px;
  flex: 1;
  max-width: 420px;
}

.search-input-group .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.search-input-group input {
  padding-left: 38px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* APPROVAL CARD DESIGN */
.approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.approval-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: var(--transition);
}

.approval-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.approval-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.approval-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.info-row .label {
  color: var(--text-muted);
}

.info-row .val {
  font-weight: 600;
  color: var(--text-main);
}

.order-items-box {
  background: var(--surface-card-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border-light);
}

.order-items-box .item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.order-items-box .item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.order-note-callout {
  font-size: 0.78rem;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 0 4px 4px 0;
  color: #92400e;
  font-style: italic;
}

.approval-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.approval-actions .btn {
  flex: 1;
}

/* MODAL SYSTEM */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--surface-card-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-card-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 300px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border-left: 4px solid var(--primary-600);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 0.3s ease;
}

.toast.toast-error { border-left-color: #ef4444; }
.toast.toast-warning { border-left-color: #f59e0b; }
.toast.toast-success { border-left-color: #10b981; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}




/* EDITABLE TABLE NUMBERS (CLICK TO EDIT) */
.editable-cell {
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  border-radius: 4px;
  padding: 4px 6px;
  display: inline-block;
}

.editable-cell:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981 !important;
  outline: 1px dashed #10b981;
}

.editable-cell::after {
  content: ' ✎';
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
}

.editable-cell:hover::after {
  opacity: 1;
  color: #10b981;
}

/* APPROVAL SUB-TABS (BARANG KELUAR VS BARANG MASUK) */
.approval-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.approval-tab-btn {
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-card-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.approval-tab-btn:hover {
  color: var(--text-main);
  background: rgba(16, 185, 129, 0.08);
}

.approval-tab-btn.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.approval-tab-btn .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
}

.approval-tab-btn:not(.active) .tab-badge {
  background: #f59e0b;
  color: #ffffff;
}

/* DIGITAL STAMP BADGE (STEMPEL RESMI BON / SLIP GGF PG2) */
.stamp-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 24px 0 12px;
}

.digital-stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 10px;
  font-family: 'Plus Jakarta Sans', Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1.25;
  user-select: none;
  position: relative;
  box-shadow: inset 0 0 0 2px currentColor;
}

.digital-stamp::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1.5px dashed currentColor;
  border-radius: 6px;
  pointer-events: none;
}

.stamp-approved {
  color: #059669;
  border: 4px double #059669;
  transform: rotate(-6deg);
  background: rgba(16, 185, 129, 0.05);
}

.stamp-approved .stamp-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: #047857;
  letter-spacing: 2px;
}

.stamp-rejected {
  color: #dc2626;
  border: 4px double #dc2626;
  transform: rotate(5deg);
  background: rgba(239, 68, 68, 0.05);
}

.stamp-rejected .stamp-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: #b91c1c;
  letter-spacing: 2px;
}

.stamp-company {
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.stamp-meta {
  font-size: 0.68rem;
  font-weight: 700;
  margin-top: 4px;
}

/* DASHBOARD INTERACTIVE CHARTS */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

@media screen and (max-width: 768px) {
  .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.chart-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 260px;
}

/* ========================================================================= */
/* PREMIUM UNIFIED STOCK TOOLBAR & CATEGORY PILLS                            */
/* ========================================================================= */
.stock-top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stock-search-group {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
  max-width: 280px;
}

.stock-search-group .search-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
}

.stock-search-group .form-control {
  padding-left: 32px !important;
  padding-right: 28px !important;
  height: 38px;
  font-size: 0.82rem;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  width: 100%;
}

.stock-search-group .form-control:focus {
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

.search-clear-btn:hover { color: #dc2626; }

.stock-filter-sorter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-pills-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.category-pill-btn {
  padding: 6px 14px;
  font-size: 0.80rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.category-pill-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.category-pill-btn.active {
  background: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.3);
}

.stock-sorter-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 3px 8px;
  height: 38px;
}

.stock-sorter-box label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
  margin: 0;
}

.stock-sorter-box select {
  border: none !important;
  background: transparent !important;
  font-size: 0.80rem !important;
  font-weight: 700 !important;
  color: #047857 !important;
  outline: none !important;
  cursor: pointer;
  padding: 2px 4px !important;
}

.stock-action-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.apd-wilayah-alert-banner {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, rgba(2, 132, 199, 0.06) 100%);
  border: 1.5px solid rgba(5, 150, 105, 0.3);
  border-left: 5px solid #059669;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

#containerAdminWilayahSelect {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sortable table headers */
th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

th.sortable-th:hover {
  background: rgba(5, 150, 105, 0.08) !important;
  color: #047857 !important;
}

th.sortable-th.sorted-active {
  color: #047857 !important;
  background: rgba(5, 150, 105, 0.1) !important;
}

.sort-icon {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 4px;
}

th.sortable-th.sorted-active .sort-icon {
  color: #047857;
  font-weight: 900;
}


.approval-tab-btn.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.approval-tab-btn .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
}

.approval-tab-btn:not(.active) .tab-badge {
  background: #f59e0b;
  color: #ffffff;
}

/* DIGITAL STAMP (CAP STEMPEL DIGITAL RESMI GGF PG2) */
.stamp-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
  margin: 12px 0;
}

.digital-stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 8px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', 'Plus Jakarta Sans', monospace, sans-serif;
  transform: rotate(-6deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  user-select: none;
  animation: stampPop 0.3s ease-out;
}

@keyframes stampPop {
  0% { transform: scale(1.6) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(-6deg); opacity: 1; }
}

.digital-stamp .stamp-company {
  font-size: 0.65rem;
  letter-spacing: 2px;
  font-weight: 700;
  opacity: 0.85;
}

.digital-stamp .stamp-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1.1;
  margin: 3px 0;
}

.digital-stamp .stamp-meta {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0.9;
}

.stamp-approved {
  border: 3.5px double #059669;
  color: #059669;
  background: rgba(16, 185, 129, 0.06);
}

.stamp-approved .stamp-title {
  color: #047857;
  text-shadow: 0 0 1px rgba(4, 120, 87, 0.3);
}

.stamp-rejected {
  border: 3.5px double #dc2626;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.06);
}

.stamp-rejected .stamp-title {
  color: #b91c1c;
  text-shadow: 0 0 1px rgba(185, 28, 28, 0.3);
}

/* ========================================================================= */
/* MOBILE & RESPONSIVE APP EXPERIENCE (GGF PG2 MOBILE-FIRST)                 */
/* ========================================================================= */

#btnToggleSidebar {
  display: none;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.desktop-only-inline {
  display: inline-flex;
}

.mobile-only-inline {
  display: none;
}

/* STRICT ROLE-BASED ACCESS CONTROL (RBAC) STYLING */
body:not(.is-admin) .admin-only {
  display: none !important;
}

body.is-admin .karyawan-only {
  display: none !important;
}


/* MOBILE BOTTOM NAVIGATION BAR */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface-card);
  border-top: 1px solid var(--border-light);
  z-index: 950;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 0 8px;
  justify-content: space-around;
  align-items: center;
  backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.68rem;
  font-weight: 600;
  gap: 3px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-item.active {
  color: var(--primary-700);
}

.mobile-nav-item.active svg {
  color: var(--primary-600);
  stroke-width: 2.5;
}

.mobile-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* ELEVATED CENTER FAB BUTTON FOR QUICK ACTION */
.mobile-nav-fab-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  top: -14px;
  padding: 0 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-fab-btn:active .mobile-fab-circle {
  transform: scale(0.9);
}

.mobile-fab-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45);
  border: 3.5px solid var(--surface-card);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-nav-fab-btn span {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary-700);
  margin-top: 3px;
}

/* VIEW MODE TOGGLE (KARTU HP VS TABEL LENGKAP) */
.view-mode-toggle {
  display: flex;
  gap: 6px;
  background: var(--surface-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 12px;
  width: fit-content;
}

.view-mode-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.view-mode-btn.active {
  background: var(--surface-card);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

/* MOBILE STOCK CARDS GRID */
.stock-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.mobile-stock-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.mobile-stock-card.card-warning-border {
  border-left: 5px solid #dc2626;
  background: linear-gradient(180deg, rgba(254, 226, 226, 0.15) 0%, var(--surface-card) 60%);
}

.mobile-stock-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mobile-stock-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
}

.mobile-stock-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

.mobile-stock-numbers-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 8px;
  background: var(--surface-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 14px;
  text-align: center;
}

.mobile-stock-stat-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mobile-stock-stat-box.primary {
  border-right: 1px solid var(--border-light);
  padding-right: 8px;
  text-align: left;
}

.stat-box-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.stat-box-value {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-main);
  margin-top: 2px;
}

.mobile-stock-stat-box.primary .stat-box-value {
  font-size: 1.35rem;
}

.mobile-stock-card-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px dashed var(--border-light);
  padding-top: 12px;
  margin-top: auto;
}

.mobile-table-hint {
  padding: 8px 12px;
  background: rgba(5, 150, 105, 0.08);
  border: 1px dashed rgba(5, 150, 105, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #047857;
  margin-bottom: 10px;
  text-align: center;
  font-weight: 600;
}

/* STEPPER QUANTITY CONTROLLER (FOR TOUCH / MOBILE GLOVED USE) */
.stepper-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-stepper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--surface-card);
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-stepper:hover {
  background: var(--primary-50);
  border-color: var(--primary-600);
  color: var(--primary-700);
}

.btn-stepper:active {
  transform: scale(0.92);
}

.stepper-field {
  width: 80px !important;
  height: 44px;
  text-align: center;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  color: var(--primary-700);
}

.stepper-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.chip-qty {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--surface-card-subtle);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.chip-qty:hover, .chip-qty:active {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
  transform: scale(0.95);
}

/* MOBILE PROFILE & WILAYAH SHEET (BOTTOM MODAL) */
.user-role-card-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin: 14px 0;
  padding-right: 4px;
}

.role-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--surface-card);
  cursor: pointer;
  transition: var(--transition);
}

.role-picker-option:hover, .role-picker-option.active {
  border-color: var(--primary-600);
  background: rgba(5, 150, 105, 0.08);
}

.role-picker-option.active .role-check {
  display: block;
}

.role-check {
  display: none;
  color: #059669;
  font-size: 1.1rem;
}

/* ========================================================================= */
/* COMPREHENSIVE RESPONSIVE SYSTEM (MOBILE, TABLET, DESKTOP)                 */
/* ========================================================================= */

/* 1. COMPACT DESKTOPS / SMALL LAPTOPS (1025px - 1200px) */
@media screen and (max-width: 1200px) and (min-width: 1025px) {
  .topbar {
    padding: 0 18px;
    gap: 10px;
  }
  .page-title {
    max-width: 260px;
    font-size: 1.15rem;
  }
  .topbar-user-badge {
    max-width: 200px;
    padding: 3px 10px 3px 4px;
  }
  .topbar-user-name {
    max-width: 95px;
  }
  .topbar-user-role {
    max-width: 95px;
  }
  .topbar-right .btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
}

/* 2. TABLETS & RESIZED DESKTOP WINDOWS (<= 1024px) */
/* When window is resized or on tablet, prevent overcrowding & enable mobile-first navigation */
@media screen and (max-width: 1024px) {
  /* Toggle Sidebar as Drawer */
  #btnToggleSidebar {
    display: inline-flex !important;
    flex-shrink: 0;
  }
  .sidebar {
    transform: translateX(-100%);
    z-index: 1000;
    width: 290px;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: flex;
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  /* Hide bulky desktop topbar items (Select & Buttons) & show sleek mobile avatar badge */
  .desktop-only-inline {
    display: none !important;
  }
  .mobile-only-inline {
    display: inline-flex !important;
  }

  /* Show Bottom Navigation Bar so user always has direct access */
  .mobile-bottom-nav {
    display: flex !important;
    max-width: 680px;
    margin: 0 auto;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--border-light);
    border-bottom: none;
  }
  .content-body {
    padding: 16px 16px 96px !important; /* Space for bottom nav */
  }

  /* Topbar sizing & non-wrapping title */
  .topbar {
    height: 60px;
    padding: 0 16px;
    gap: 10px;
  }
  .topbar-left {
    gap: 10px;
    min-width: 0;
    flex: 1;
  }
  .page-title-badge {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .page-title {
    font-size: 1.05rem;
    max-width: clamp(140px, 32vw, 290px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
  }
  .estate-tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    flex-shrink: 0;
  }
  .topbar-right {
    gap: 8px;
    flex-shrink: 0;
  }

  /* KPI Stats on Tablet */
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
  }
  .stat-card {
    padding: 14px 16px;
  }

  /* Charts Grid on Tablet */
  .dashboard-charts-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
  }
  .chart-card {
    padding: 16px;
  }
  .chart-canvas-wrapper {
    height: 240px;
  }

  /* Approval Tabs */
  .approval-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }
  .approval-tab-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
}

/* 3. SMARTPHONES PORTRAIT (< 768px) */
@media screen and (max-width: 768px) {
  .mobile-bottom-nav {
    max-width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .topbar {
    padding: 0 12px;
  }
  .page-title {
    font-size: 0.98rem;
    max-width: clamp(120px, 36vw, 190px);
  }
  .estate-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  /* 2x2 KPI Stats on Smartphone */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  .stat-card {
    padding: 12px 14px;
  }
  .stat-value {
    font-size: 1.45rem;
  }
  .stat-header {
    margin-bottom: 6px;
  }
  .stat-icon {
    width: 30px;
    height: 30px;
  }
  .stat-title {
    font-size: 0.68rem;
  }
  .stat-caption {
    font-size: 0.68rem;
  }

  /* Single Column Charts */
  .dashboard-charts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
  }
  .chart-card {
    padding: 14px;
  }
  .chart-canvas-wrapper {
    height: 220px;
  }

  /* Form Grids on Smartphone */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .form-group[style*="grid-column"] {
    grid-column: span 1 !important;
  }

  /* Bottom Sheet Modals on Smartphone */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 85vh;
    border-bottom: none;
    animation: sheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .modal-header {
    padding: 14px 18px;
    position: sticky;
    top: 0;
    background: var(--surface-card);
    z-index: 10;
  }
  .modal-body {
    padding: 14px 18px 24px;
  }
  @keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Full Width Approval Action Buttons */
  .approval-actions {
    flex-direction: column;
    gap: 8px;
  }
  .approval-actions .btn {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
  }

  /* Filter toolbar pills on mobile */
  .toolbar-container {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filter-group {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    white-space: nowrap;
    gap: 6px;
  }
  .filter-group::-webkit-scrollbar {
    height: 3px;
  }
  .filter-group .btn {
    flex-shrink: 0;
  }

  /* Digital Stamp on Smartphone */
  .digital-stamp {
    padding: 8px 16px;
  }
  .digital-stamp .stamp-title {
    font-size: 1.25rem;
    letter-spacing: 2px;
  }
}

/* 4. SMALL SMARTPHONES (< 480px) */
@media screen and (max-width: 480px) {
  .page-title {
    max-width: 115px;
  }
  .mobile-user-name {
    display: none;
  }
  .mobile-stock-numbers-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .mobile-stock-stat-box.primary {
    grid-column: span 2;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 6px;
    margin-bottom: 4px;
  }
}

/* ========================================================================= */
/* 5. PRINT SLIP STYLES (STANDAR RESMI CETAK SURAT BON GUDANG A4)            */
/* ========================================================================= */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 12mm;
  }

  /* 1. HIDE ALL APPLICATION UI CHROME */
  body > *:not(#voucherModal),
  .app-container,
  .app-layout,
  .sidebar,
  .sidebar-backdrop,
  .topbar,
  .main-wrapper,
  .content-body,
  .mobile-bottom-nav,
  .mobile-fab,
  .modal-overlay:not(#voucherModal),
  #userProfileModal,
  #mobileProfileModal,
  #toastContainer {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* 2. BASE PRINT BODY SETUP */
  html, body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    overflow: visible !important;
    font-size: 10pt !important;
    line-height: 1.3 !important;
  }

  /* 3. PIN VOUCHER MODAL DIRECTLY AT TOP OF PRINT PAGE */
  #voucherModal {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
    z-index: 999999 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #voucherModal .modal-content {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    transform: none !important;
    animation: none !important;
    max-height: none !important;
  }

  /* HIDE MODAL DIALOG CHROME (HEADER TITLE & FOOTER BUTTONS) */
  #voucherModal .modal-header,
  #voucherModal .modal-footer,
  #voucherModal .modal-close,
  #voucherModal .btn {
    display: none !important;
  }

  #voucherModal .modal-body {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
  }

  #voucherPrintContent {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 4. COMPACT SINGLE-PAGE SLIP CONTAINER */
  #voucherPrintContent > div {
    border: 2px solid #0f172a !important;
    border-radius: 6px !important;
    padding: 14px 18px !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Header slip */
  #voucherPrintContent h2 {
    font-size: 1.15rem !important;
  }

  /* Barcode container in print */
  #voucherPrintContent svg {
    max-width: 220px !important;
    height: 38px !important;
  }

  /* Item Table in print */
  #voucherPrintContent table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
    margin-bottom: 12px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  #voucherPrintContent th,
  #voucherPrintContent td {
    padding: 5px 6px !important;
    border: 1px solid #cbd5e1 !important;
  }

  /* Stamp seal in print */
  .stamp-container {
    padding: 10px 0 !important;
    margin: 8px 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .digital-stamp {
    animation: none !important;
    box-shadow: none !important;
    padding: 6px 18px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .digital-stamp .stamp-title {
    font-size: 1.3rem !important;
    margin: 2px 0 !important;
  }

  /* Exact Color Preservation in Print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}



