:root {
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --primary-glow: 0 4px 14px 0 rgba(234, 88, 12, 0.32);
  --sidebar-bg: linear-gradient(180deg, #0b1120 0%, #0f172a 100%);
  --text-title: #0f172a;
  --text-main: #334155;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --card-border: 1px solid #dbe2ec;
  --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --card-shadow-hover: 0 10px 25px -3px rgba(15, 23, 42, 0.09), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
  --radius-lg: 11px;
  --radius-md: 8px;
  --radius-sm: 5px;
}

* {
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #0b1120 0%, #1e1b4b 45%, #2a1208 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background grid pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(#fff 1px, transparent 1px);
  background-size: 24px 24px;
}

.hidden { display: none !important; }

/* ==========================================================================
   LOGIN VIEW
   ========================================================================== */
.login-wrap {
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  padding: 32px 28px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.2);
  border-top: 4px solid var(--primary);
  animation: cardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card h1 {
  color: var(--primary);
  margin: 0 0 4px 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 20px 0;
  font-weight: 500;
}

.login-card input {
  width: 100%;
  padding: 10px 13px;
  margin: 6px 0;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-title);
  transition: all 0.2s ease;
}

.login-card input:focus {
  background: #ffffff;
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.login-card button {
  width: 100%;
  padding: 10px;
  background: var(--primary-gradient);
  color: #fff;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  margin-top: 10px;
  transition: all 0.2s ease;
  box-shadow: var(--primary-glow);
}

.login-card button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.42);
}

.login-card button:active {
  transform: translateY(0);
}

/* ==========================================================================
   APP LAYOUT & HORIZONTAL LANDSCAPE NAVBAR (PREMIUM ENTERPRISE - FROZEN)
   ========================================================================== */
#appView {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #070a12;
}

.app-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 66px;
  min-height: 66px;
  z-index: 9999;
  background: linear-gradient(180deg, #070a12 0%, #0d1424 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-sizing: border-box;
  flex-wrap: nowrap !important;
}

.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Brand Shape Container Mewah di Kiri */
.brand-shape-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  padding: 6px 14px 6px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  flex-shrink: 0;
}

.brand-shape-container:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-color: rgba(251, 146, 60, 0.45);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.brand-logo-badge {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45);
  flex-shrink: 0;
}

.brand-icon {
  font-size: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  color: #fb923c;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(251, 146, 60, 0.25);
}

.brand-sub-badge {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #f97316;
  background: rgba(234, 88, 12, 0.18);
  border: 1px solid rgba(234, 88, 12, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.brand-tagline {
  color: #94a3b8;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* Horizontal Nav Tabs (Berisi, Memanjang & Fit Kolom) */
.header-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  padding: 2px 4px;
  margin: 0 8px;
}
.header-nav::-webkit-scrollbar {
  height: 3px;
}
.header-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.header-nav button,
.sidebar nav button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cbd5e1;
  padding: 6px 11px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.header-nav button:hover,
.sidebar nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.header-nav button.active,
.sidebar nav button.active {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #ffffff;
  font-weight: 800;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 18px rgba(234, 88, 12, 0.5);
}

/* Header Right - User Profile & Fixed Permanent Logout (Selalu Sejajar di Kanan) */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 14px;
  border-radius: 999px;
  color: #f1f5f9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  min-height: 40px;
  box-sizing: border-box;
}

.user-avatar-icon {
  font-size: 14px;
}

.user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #ea580c;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.user-name-tag,
.sidebar #userInfo {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn,
.logout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12.5px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  min-height: 40px;
  box-sizing: border-box;
}

.logout-btn:hover,
.logout:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}

.header-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  flex-shrink: 0;
}

.header-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.header-refresh-btn:active {
  transform: translateY(0);
}

@keyframes spinIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning span, .spinning svg, button.spinning span {
  animation: spinIcon 0.75s linear infinite;
  display: inline-block;
}

html.has-active-session #loginView {
  display: none !important;
}

html.has-active-session #appView {
  display: flex !important;
}

/* ==========================================================================
   MAIN WORKSPACE (FULL WIDTH 100% - MEWAH, LAPANG & OFFSET DARI HEADER)
   ========================================================================== */
main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 24px 28px 40px 28px;
  margin: 66px 0 0 0 !important; /* Offset pas di bawah header yang di-freeze */
  overflow-y: visible;
  background: linear-gradient(155deg, #f1f5f9 0%, #e8edf5 45%, #dfe7f2 100%);
  border-radius: 0;
  min-height: calc(100vh - 66px);
}

/* ==========================================================================
   RESPONSIVE AUTO-FIT TIERS (19"-32" MONITORS & LAPTOPS)
   Mencegah Elemen Bertumpuk di Resolusi 1440x900, 1920x1080, 1366x768, 2560x1440
   ========================================================================== */

/* Tier 1: Large & Ultrawide Screens (>= 1600px, e.g. 1920x1080, 2560x1440 / Layar 21"-32") */
@media (min-width: 1600px) {
  .app-header {
    height: 70px;
    min-height: 70px;
    padding: 0 32px;
  }
  main {
    margin-top: 70px !important;
    padding: 28px 36px 48px 36px;
  }
  .header-nav {
    gap: 8px;
    margin: 0 20px;
  }
  .header-nav button,
  .sidebar nav button {
    padding: 9px 18px;
    font-size: 13.5px;
    min-height: 42px;
  }
}

/* Tier 2: Medium Screens & 19 Inch Monitors (1280px s/d 1599px, e.g. 1440x900) */
@media (max-width: 1599px) and (min-width: 1280px) {
  .app-header {
    height: 58px;
    min-height: 58px;
    padding: 0 12px;
    gap: 8px;
  }
  main {
    margin-top: 58px !important;
    padding: 18px 20px 36px 20px;
  }
  .brand-shape-container {
    padding: 4px 8px;
    gap: 7px;
  }
  .brand-logo-badge {
    width: 28px;
    height: 28px;
  }
  .brand-icon {
    font-size: 15px;
  }
  .brand-title {
    font-size: 13.5px;
  }
  .brand-tagline,
  .brand-sub-badge {
    display: none;
  }
  .header-nav {
    gap: 3px;
    margin: 0 4px;
    padding: 2px 0;
  }
  .header-nav button,
  .sidebar nav button {
    padding: 5px 8px;
    font-size: 11.5px;
    gap: 4px;
    min-height: 33px;
    border-radius: 7px;
  }
  .header-right {
    gap: 6px;
  }
  .user-badge {
    padding: 4px 8px;
    gap: 5px;
    min-height: 33px;
  }
  .user-avatar-icon {
    font-size: 11px;
  }
  .user-name-tag {
    max-width: 115px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-refresh-btn {
    width: 32px;
    height: 32px;
  }
  .logout-btn,
  .logout {
    padding: 5px 10px;
    font-size: 11px;
    min-height: 33px;
    gap: 4px;
  }
}

/* Tier 3: Compact Laptops (900px s/d 1279px, e.g. 1366x768) */
@media (max-width: 1279px) and (min-width: 900px) {
  .app-header {
    height: 54px;
    min-height: 54px;
    padding: 0 8px;
    gap: 6px;
  }
  main {
    margin-top: 54px !important;
    padding: 14px 16px;
  }
  .brand-tagline,
  .brand-sub-badge {
    display: none;
  }
  .brand-shape-container {
    padding: 3px 6px;
    gap: 5px;
  }
  .brand-logo-badge {
    width: 26px;
    height: 26px;
  }
  .brand-title {
    font-size: 12.5px;
  }
  .header-nav {
    gap: 2px;
    margin: 0 2px;
  }
  .header-nav button,
  .sidebar nav button {
    padding: 4px 5px;
    font-size: 10.5px;
    gap: 3px;
    min-height: 30px;
    border-radius: 6px;
  }
  .header-right {
    gap: 4px;
  }
  .user-badge {
    padding: 3px 6px;
    gap: 4px;
    min-height: 30px;
  }
  .user-name-tag {
    max-width: 85px;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-refresh-btn {
    width: 30px;
    height: 30px;
  }
  .logout-btn,
  .logout {
    padding: 4px 8px;
    font-size: 10px;
    min-height: 30px;
    gap: 3px;
  }
}

/* Tier 4: Tablets / Small Windows (< 900px) */
@media (max-width: 899px) {
  .app-header {
    padding: 0 10px;
    gap: 6px;
  }
  .brand-tagline,
  .brand-sub-badge {
    display: none;
  }
  .user-name-tag {
    display: none;
  }
  .header-nav button,
  .sidebar nav button {
    padding: 6px 8px;
    font-size: 11px;
  }
}

/* Page titles */
h3 {
  margin: 0 0 14px 0;
  color: var(--text-title);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid #fdba74;
  padding-bottom: 8px;
}

h4 {
  color: var(--text-title);
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

/* ==========================================================================
   STAT CARDS (Dashboard)
   ========================================================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cards > div {
  background: var(--card-bg);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  border-top: 3px solid var(--primary);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.cards > div:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.cards > div small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cards > div b {
  font-size: 21px;
  color: var(--text-title);
  display: block;
  margin-top: 4px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

/* ==========================================================================
   BUTTONS SYSTEM (Modern, Elevated, "Mahal")
   ========================================================================== */
button, .btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}

/* Primary Button (Amber / Orange Gradient) */
button, .btn-primary, .form button {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: var(--primary-glow);
}

button:hover, .btn-primary:hover, .form button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.4);
}

button:active, .btn-primary:active, .form button:active {
  transform: translateY(0);
}

/* Outline / Secondary Button */
.btn-outline, .btn-secondary {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.btn-outline:hover, .btn-secondary:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: translateY(-1px);
}

/* Success / Emerald Button */
.btn-success, .btn-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28) !important;
}

.btn-success:hover, .btn-emerald:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.38) !important;
}

/* Danger / Delete Action Button (High-End Soft Rose Badge Style) */
.btn-delete, .btn-danger {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.btn-delete:hover, .btn-danger:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28) !important;
}

/* Info / Sky Button */
.btn-info, .btn-sky {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.btn-info:hover, .btn-sky:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25) !important;
}

/* Compact Table Buttons */
.btn-sm, td button {
  padding: 4px 8px !important;
  font-size: 11px !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
}

/* ==========================================================================
   FORMS & INPUTS (Elevated Cards with Crisp Borders)
   ========================================================================== */
.form {
  background: var(--card-bg);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

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

.form-group label {
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form input,
.form select,
select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="password"] {
  font-family: inherit;
  padding: 7px 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-title);
  outline: none;
  transition: all 0.2s ease;
}

.form input:focus,
.form select:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.16);
}

.form input[readonly] {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

/* ==========================================================================
   UPLOAD / EXPORT MODULES (Polished Card Treatment)
   ========================================================================== */
#boqUploadWrap,
#stokUploadWrap {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--radius-md) !important;
  padding: 12px 16px !important;
  box-shadow: var(--card-shadow) !important;
  margin-bottom: 14px !important;
}

#boqUploadWrap b,
#stokUploadWrap b {
  color: var(--text-title);
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 3px;
}

#boqUploadWrap small,
#stokUploadWrap small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
  display: block;
}

/* Modern file input button */
input[type="file"] {
  font-size: 11.5px;
  color: #475569;
  padding: 4px 8px;
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

input[type="file"]::file-selector-button {
  font-family: inherit;
  font-weight: 600;
  font-size: 11px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-right: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

input[type="file"]::file-selector-button:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   TABLES (High-End Enterprise Grid)
   ========================================================================== */
.table-container {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  overflow-x: auto;
  margin-top: 14px;
}

.table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
  color: var(--text-main);
  vertical-align: middle;
}

tr:nth-child(even) td {
  background: #fafbfc;
}

tr:hover td {
  background: #fff7ed !important;
}

/* Monospace Code Pill */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #0369a1;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #e0f2fe;
}

/* ==========================================================================
   BADGES & STATUS LABELS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  text-transform: uppercase;
}

.badge.green { background: #10b981; }
.badge.yellow { background: #f59e0b; }
.badge.red { background: #ef4444; }
.badge.gray { background: #64748b; }

.unit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid #bae6fd;
}

/* ==========================================================================
   FILTER GUDANG BAR
   ========================================================================== */
#filterGudangWrap {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1.5px solid #cbd5e1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

#filterGudangWrap .form-group {
  margin: 0;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

#filterGudangWrap label {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  text-transform: none;
  white-space: nowrap;
}

#filterGudangWrap select {
  min-width: 220px;
  font-weight: 600;
  font-size: 12px;
}

/* ==========================================================================
   SECURITY POLICY UI
   ========================================================================== */
.security-toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #1e293b;
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  z-index: 999999;
  border-left: 4px solid #f97316;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.security-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.security-toast .toast-icon {
  font-size: 18px;
}

/* DEVTOOLS FULLSCREEN BLOCKER OVERLAY */
.devtools-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.devtools-overlay.active {
  display: flex !important;
}

.devtools-card {
  background: #ffffff;
  max-width: 460px;
  width: 100%;
  border-radius: 16px;
  padding: 35px 30px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  border-top: 6px solid #ef4444;
  animation: cardPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.devtools-badge {
  display: inline-block;
  background: #fee2e2;
  color: #dc2626;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 15px;
}

.devtools-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.devtools-card h2 {
  color: #0f172a;
  font-size: 20px;
  margin: 0 0 10px 0;
}

.devtools-desc {
  color: #475569;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 20px 0;
}

.devtools-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #0369a1;
}

/* BLUR CONTENT WHEN BLOCKED */
body.devtools-blocked #loginView,
body.devtools-blocked #appView {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
}

/* ==========================================================================
   PRINT MEDIA RULES (SURAT JALAN PRINT-READY A4)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }
  body::before {
    display: none !important;
  }
  .no-print {
    display: none !important;
  }
  /* Sembunyikan semua komponen di luar modal Surat Jalan saat mencetak */
  .app-header, header, nav, #sidebarNav, .login-wrap, .form, .cards, #inTransitWrap, #mutasiWrap, #returMaterialWrap, #pemakaianWrap, #distribusiWrap, #stokUploadWrap, #formStokManualWrap, section.page, .modal-wrap:not(#modalCetakSuratJalanWrap) {
    display: none !important;
  }
  body.has-active-print > *:not(#appView) {
    display: none !important;
  }
  body.has-active-print #appView > header,
  body.has-active-print #appView > main > section,
  body.has-active-print #appView > main > div:not(#modalCetakSuratJalanWrap) {
    display: none !important;
  }
  #modalCetakSuratJalanWrap {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
  }
  #modalCetakSuratJalanWrap > div {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #areaSuratJalanPrint {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  table thead {
    display: table-header-group !important;
  }
  table tr {
    page-break-inside: avoid !important;
  }
}

/* Custom Status Badges */
.badge-transit {
  background: #0284c7;
  color: #ffffff;
}
.badge-delivered {
  background: #059669;
  color: #ffffff;
}
.badge-cancelled {
  background: #ef4444;
  color: #ffffff;
}
.badge-retur-pending {
  background: #f59e0b;
  color: #ffffff;
}
.badge-retur-approved {
  background: #10b981;
  color: #ffffff;
}
.badge-burn-kritis {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-weight: 700;
}
.badge-burn-waspada {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fcd34d;
  font-weight: 700;
}
.badge-burn-aman {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
  font-weight: 700;
}

/* QR Camera Scanner Styling */
#qrReaderBox {
  overflow: hidden !important;
}
#qrReaderBox video {
  border-radius: 10px !important;
  object-fit: cover !important;
  width: 100% !important;
}
#qrReaderBox img[alt="Info icon"] {
  display: none !important;
}


