﻿/* ============================================================
   ServicePro HP v5.1 â€” Design System
   Premium Dark Theme with Glassmorphism
   ============================================================ */

  /* Google Fonts */
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

  /* CSS Variables */
  :root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.88);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-focus: #6366f1;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dark: #1e293b;

    --accent-blue: #6366f1;
    --accent-blue-hover: #818cf8;
    --accent-emerald: #10b981;
    --accent-emerald-hover: #34d399;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-red-hover: #f87171;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;

    --gradient-primary: linear-gradient(135deg, #6366f1, #a855f7);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-danger: linear-gradient(135deg, #ef4444, #ec4899);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #f97316);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.05));

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    /* Branch Colors */
    --color-sib: #3b82f6;
    --color-bl: #10b981;
    --color-lj: #f59e0b;
    --color-af: #ef4444;
    --color-utama: #8b5cf6;
    
    /* Branch Backgrounds */
    --bg-sib: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(10, 14, 26, 1) 100%);
    --bg-bl: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(10, 14, 26, 1) 100%);
    --bg-lj: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(10, 14, 26, 1) 100%);
    --bg-af: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(10, 14, 26, 1) 100%);
    --bg-utama: var(--bg-primary);
  }

  /* ========== BRANCH-SPECIFIC THEMING ========== */
  /* SIB = ðŸ“± Biru */
  body[data-branch="SIB"] { background: var(--bg-sib); }
  body[data-branch="SIB"] .sidebar { border-right-color: rgba(59, 130, 246, 0.3); }
  body[data-branch="SIB"] .sidebar-header .logo { background: linear-gradient(135deg, #3b82f6, #60a5fa); -webkit-background-clip: text; }
  body[data-branch="SIB"] .nav-item.active { background: rgba(59, 130, 246, 0.15); color: #3b82f6; box-shadow: inset 4px 0 0 #3b82f6; }
  body[data-branch="SIB"] .kpi-card::before { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
  body[data-branch="SIB"]::before { background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.25) 0%, transparent 60%), radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 60%); }

  /* BL = âš¡ Ungu */
  body[data-branch="BL"] { background: var(--bg-bl); }
  body[data-branch="BL"] .sidebar { border-right-color: rgba(139, 92, 246, 0.3); }
  body[data-branch="BL"] .sidebar-header .logo { background: linear-gradient(135deg, #8b5cf6, #a78bfa); -webkit-background-clip: text; }
  body[data-branch="BL"] .nav-item.active { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; box-shadow: inset 4px 0 0 #8b5cf6; }
  body[data-branch="BL"] .kpi-card::before { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
  body[data-branch="BL"]::before { background: radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.25) 0%, transparent 60%), radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 60%); }

  /* LJ = ðŸ› ï¸ Hijau-Emas */
  body[data-branch="LJ"] { background: var(--bg-lj); }
  body[data-branch="LJ"] .sidebar { border-right-color: rgba(245, 158, 11, 0.3); }
  body[data-branch="LJ"] .sidebar-header .logo { background: linear-gradient(135deg, #f59e0b, #fbbf24); -webkit-background-clip: text; }
  body[data-branch="LJ"] .nav-item.active { background: rgba(245, 158, 11, 0.15); color: #f59e0b; box-shadow: inset 4px 0 0 #f59e0b; }
  body[data-branch="LJ"] .kpi-card::before { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
  body[data-branch="LJ"]::before { background: radial-gradient(circle at 20% 20%, rgba(245, 158, 11, 0.25) 0%, transparent 60%), radial-gradient(circle at 80% 80%, rgba(245, 158, 11, 0.15) 0%, transparent 60%); }

  /* AF = ðŸ”§ Merah */
  body[data-branch="AF"] { background: var(--bg-af); }
  body[data-branch="AF"] .sidebar { border-right-color: rgba(239, 68, 68, 0.3); }
  body[data-branch="AF"] .sidebar-header .logo { background: linear-gradient(135deg, #ef4444, #f87171); -webkit-background-clip: text; }
  body[data-branch="AF"] .nav-item.active { background: rgba(239, 68, 68, 0.15); color: #ef4444; box-shadow: inset 4px 0 0 #ef4444; }
  body[data-branch="AF"] .kpi-card::before { background: linear-gradient(135deg, #ef4444, #f87171); }
  body[data-branch="AF"]::before { background: radial-gradient(circle at 20% 20%, rgba(239, 68, 68, 0.25) 0%, transparent 60%), radial-gradient(circle at 80% 80%, rgba(239, 68, 68, 0.15) 0%, transparent 60%); }

  /* SEMUA / UTAMA = ðŸŒ Default Purple */
  body[data-branch="SEMUA"] { background: var(--bg-utama); }

  /* Sidebar Dynamic Logo */
  .dynamic-branch-logo {
    height: 40px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    transition: var(--transition);
    mix-blend-mode: screen;
  }

  body[data-branch="SIB"] .dynamic-branch-logo { filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.8)); }
  body[data-branch="BL"] .dynamic-branch-logo { filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.8)); }
  body[data-branch="LJ"] .dynamic-branch-logo { filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8)); }
  body[data-branch="AF"] .dynamic-branch-logo { filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8)); }

  /* Dynamic Watermark */
  body::after {
    content: "";
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg);
    width: 600px; height: 600px;
    background-image: var(--branch-logo-url, none);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0;
    display: none;
    z-index: -1;
    pointer-events: none;
    transition: var(--transition);
    mix-blend-mode: screen;
  }

  body[data-branch="SIB"]::after { filter: drop-shadow(0 0 40px rgba(59, 130, 246, 0.6)); }
  body[data-branch="BL"]::after { filter: drop-shadow(0 0 40px rgba(139, 92, 246, 0.6)); }
  body[data-branch="LJ"]::after { filter: drop-shadow(0 0 40px rgba(245, 158, 11, 0.6)); }
  body[data-branch="AF"]::after { filter: drop-shadow(0 0 40px rgba(239, 68, 68, 0.6)); }

  /* Custom Scrollbar */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 10px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
  }

  /* Skeleton Loading Animation */
  .skeleton {
    background: linear-gradient(90deg, var(--bg-glass) 25%, var(--bg-glass-hover) 50%, var(--bg-glass) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
  }

  /* --- BRANDING ANIMATIONS --- */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .fade-up {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes staggerFadeIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
  }

  .stagger-row {
    opacity: 0;
    animation: staggerFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }


  @keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  .skeleton-text { height: 1em; width: 100%; margin-bottom: 8px; }
  .skeleton-card { height: 100px; width: 100%; border-radius: var(--radius-md); }

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

  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden; /* Blokir scroll di body â€” scroll terjadi di .main-content */
  }

  /* Background pattern */
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
      radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
      radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
      radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
  }

  /* Layout */
  .app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
  }

  /* Sidebar */
  .sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
    text-align: center;
  }

  .sidebar-header .logo {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .sidebar-header .version {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
  }

  .branch-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    color: #fff;
  }

  .branch-badge.sib {
    background: var(--color-sib);
  }

  .branch-badge.bl {
    background: var(--color-bl);
  }

  .branch-badge.lj {
    background: var(--color-lj);
  }

  .branch-badge.af {
    background: var(--color-af);
  }

  .branch-badge.utama {
    background: var(--color-utama);
  }

  .sidebar-nav {
    flex: 1;
    padding: 12px 0;
  }

  .nav-group {
    margin-bottom: 8px;
  }

  .nav-group-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    text-decoration: none;
  }

  .nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    transform: translateX(4px);
  }

  .nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue);
    font-weight: 600;
    box-shadow: inset 4px 0 0 var(--accent-blue);
  }

  .nav-item .icon {
    width: 28px;
    min-width: 28px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
  }

  .nav-item.active .icon {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.16);
    color: var(--accent-blue);
  }

  .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass);
  }

  .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
  }

  .user-name {
    font-size: 13px;
    font-weight: 600;
  }

  .user-role {
    font-size: 11px;
    color: var(--text-muted);
  }

  /* Main Content */
  .main-content {
    flex: 1;
    min-width: 0;         /* Cegah flex item mendorong sidebar keluar */
    margin-left: 280px;
    padding: 84px 24px 24px 24px;
    height: 100vh;        /* Tinggi tetap agar scroll terjadi di sini */
    overflow-y: auto;     /* Scroll vertikal di area konten, bukan body */
    overflow-x: auto;     /* Scroll horizontal jika konten lebar */
    /* Scrollbar vertikal custom */
    scrollbar-width: thin;
    scrollbar-color: rgba(99,102,241,0.4) transparent;
  }

  .main-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  .main-content::-webkit-scrollbar-track { background: transparent; }
  .main-content::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.4);
    border-radius: 10px;
  }
  .main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(99,102,241,0.7);
  }

  .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-title {
    font-size: 18px;
    font-weight: 700;
  }

  .page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
  }

  /* Cards */
  .card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 12px;
    transition: var(--transition);
  }

  .card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  }

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

  .card-title {
    font-size: 16px;
    font-weight: 600;
  }

  /* KPI Cards */
  .kpi-grid {
    display: grid;
    /* Responsif: minimal 160px per card, maksimal 1fr â€” tidak pernah melebar keluar */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .kpi-card {
    background: rgba(17, 24, 39, 0.88);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 10px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
  }

  .kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
  }

  .kpi-card:nth-child(2)::before {
    background: var(--gradient-success);
  }

  .kpi-card:nth-child(3)::before {
    background: var(--gradient-warning);
  }

  .kpi-card:nth-child(4)::before {
    background: var(--gradient-danger);
  }

  .kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
  }

  .kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .kpi-value {
    font-size: 28px;
    font-weight: 800;
    margin-top: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .kpi-change {
    font-size: 12px;
    margin-top: 6px;
  }

  .kpi-change.up {
    color: var(--accent-emerald);
  }

  .kpi-change.down {
    color: var(--accent-red);
  }

  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
  }

  .btn-primary {
    background: var(--gradient-primary);
    color: #fff;
  }

  .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
  }

  .btn-success {
    background: var(--gradient-success);
    color: #fff;
  }

  .btn-danger {
    background: var(--gradient-danger);
    color: #fff;
  }

  .btn-warning {
    background: var(--gradient-warning);
    color: var(--text-dark);
  }

  .btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
  }

  .btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
  }

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

  .btn-lg {
    padding: 10px 20px;
    font-size: 14px;
  }

  .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
  }

  /* Forms */
  .form-group {
    margin-bottom: 4px;
  }

  .form-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1px;
  }

  .form-label.required::after {
    content: ' *';
    color: var(--accent-red);
  }

  .form-control {
    width: 100%;
    padding: 5px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
  }

  .form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  }

  .form-control::placeholder {
    color: var(--text-muted);
  }

  select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
  }

  select.form-control option {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px;
  }

  .part-table select {
    background-color: #1e293b;
    color: #e2e8f0;
  }

  .part-table select option {
    background: #1e293b;
    color: #e2e8f0;
  }

  textarea.form-control {
    resize: vertical;
    min-height: 60px;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .form-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
  }

  /* Tables */
  .table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch; /* Smooth scroll di iOS */
    /* Scrollbar selalu terlihat di bawah tabel */
    scrollbar-width: thin;
    scrollbar-color: rgba(99,102,241,0.5) rgba(255,255,255,0.05);
  }

  /* Pastikan tabel tidak mengecil */
  .data-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 800px; /* Minimum lebar tabel agar scroll horizontal muncul */
  }
  /* Izinkan wrap hanya di kolom tertentu yang panjang */
  .data-table td.wrap-cell,
  .data-table th.wrap-cell {
    white-space: normal;
    min-width: 150px;
    max-width: 300px;
  }

  /* Scrollbar styling untuk webkit (Chrome, Edge) */
  .table-container::-webkit-scrollbar {
    height: 8px;    /* Tinggi scrollbar horizontal */
    width: 6px;
  }
  .table-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
  }
  .table-container::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.5);
    border-radius: 4px;
  }
  .table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(99,102,241,0.8);
  }

  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  .data-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid var(--border-glass);
    white-space: nowrap;
  }

  .data-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
  }

  .data-table tr:hover td {
    background: rgba(99, 102, 241, 0.05);
  }

  .data-table .text-right {
    text-align: right;
  }

  .data-table td.text-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  /* Form page width (half page centered) */
  #pageContent.form-page { max-width: 750px; margin-left: auto; margin-right: auto; }
  #pageContent.form-page .table-container,
  #pageContent.form-page .part-table-wrap,
  #pageContent.form-page .kpi-grid { max-width: 100%; }

  .data-table .text-center {
    text-align: center;
  }

  .table-container table {
    table-layout: auto;
  }

  .table-container .wrap-cell,
  .table-container .long-text-cell {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
    min-width: 180px;
    max-width: 360px;
  }

  .table-container .compact-cell {
    min-width: 90px;
    white-space: nowrap;
  }

  .so-table-container {
    max-height: calc(100vh - 270px);
    min-height: 360px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
  }

  .so-print-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1500px;
    table-layout: fixed;
    font-size: 12px;
  }

  .so-print-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 9px 10px;
    background: rgba(18, 24, 38, 0.98);
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-glass);
    text-align: left;
    white-space: nowrap;
  }

  .so-print-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
    color: var(--text-primary);
  }

  .so-wrap-cell,
  .so-name-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.35;
  }

  .so-name-cell {
    font-weight: 700;
  }

  .so-group-row td {
    border-top: 2px solid rgba(99, 102, 241, 0.38);
  }

  .so-check-box {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-glass);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
  }

  .stock-detail-overlay {
    z-index: 10000;
    padding: 12px;
  }

  .stock-detail-modal {
    width: min(1440px, 98vw);
    max-width: 1440px;
    max-height: 92vh;
    background: var(--bg-primary);
    overflow: hidden;
  }

  .stock-detail-modal .modal-body {
    padding: 0;
    overflow: auto;
    max-height: calc(92vh - 74px);
  }

  .stock-detail-modal-header {
    background: rgba(12, 18, 31, 0.96);
  }

  .stock-detail-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
  }

  .stock-detail-loading {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 260px;
    color: var(--text-muted);
  }

  .stock-detail-shell {
    min-width: 1120px;
  }

  .stock-detail-topline {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.2fr) 110px 150px;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(10, 15, 26, 0.98);
    border-bottom: 1px solid var(--border-glass);
  }

  .stock-detail-name {
    color: #ff3b3b;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .stock-detail-path {
    color: var(--text-primary);
    text-align: center;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .stock-detail-stock {
    color: var(--text-primary);
    text-align: right;
    font-weight: 800;
    white-space: nowrap;
  }

  .stock-detail-value {
    color: var(--text-primary);
    text-align: right;
    font-weight: 800;
    white-space: nowrap;
  }

  .stock-detail-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: rgba(22, 32, 48, 0.92);
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 1px solid var(--border-glass);
  }

  .stock-detail-tabs {
    display: flex;
    gap: 10px;
    padding: 8px 16px 0;
    background: rgba(35, 53, 73, 0.98);
    border-bottom: 1px solid var(--border-glass);
  }

  .stock-detail-tab {
    border: 1px solid var(--border-glass);
    border-bottom: none;
    background: transparent;
    color: var(--text-primary);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
  }

  .stock-detail-tab.active {
    background: rgba(16, 185, 129, 0.18);
    color: var(--accent-emerald);
  }

  .stock-detail-panel {
    display: none;
    padding: 0;
  }

  .stock-detail-panel.active {
    display: block;
  }

  .stock-detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    padding: 16px;
  }

  .stock-detail-summary-grid > div {
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
  }

  .stock-detail-summary-grid label {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 8px;
  }

  .stock-detail-summary-grid strong {
    color: var(--text-primary);
    font-size: 18px;
  }

  .stock-detail-table-wrap {
    overflow: auto;
    max-height: 58vh;
    border-top: 1px solid var(--border-glass);
  }

  .stock-detail-table {
    min-width: 1280px;
  }

  .stock-detail-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(32, 45, 61, 0.98);
  }

  .stock-ref-cell {
    color: var(--text-primary);
    font-family: Consolas, Monaco, monospace;
    font-weight: 700;
  }

  .stock-move-kind {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 3px;
  }

  .stock-qty-in {
    color: var(--accent-emerald) !important;
    font-weight: 800;
  }

  .stock-qty-out {
    color: var(--accent-red) !important;
    font-weight: 800;
  }

  .stock-detail-empty {
    padding: 44px 16px;
    text-align: center;
    color: var(--text-muted);
  }

  .stock-detail-empty.error {
    color: var(--accent-red);
  }

  @media (max-width: 900px) {
    .stock-detail-shell {
      min-width: 760px;
    }

    .stock-detail-topline {
      grid-template-columns: minmax(190px, 1fr) minmax(220px, 1fr) 90px 135px;
    }
  }

  /* Status Badges */
  .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
  }

  .badge-antri {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
  }

  .badge-proses,
  .badge-sedang_proses {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue);
  }

  .badge-selesai_belum_diambil {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
  }

  .badge-selesai_belum_lunas {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
  }

  .badge-selesai_diambil {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
  }

  .badge-batal {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
  }

  .badge-aktif {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
  }

  .badge-nonaktif {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
  }

  .badge-lunas {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
  }

  .badge-belum_lunas {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
  }

  /* Modal */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  .modal-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  .modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
    position: relative; /* Ensure stacking context */
  }

  .modal:focus-within {
    overflow: visible !important;
  }

  .modal-overlay.show .modal {
    transform: scale(1);
  }

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

  .modal-title {
    font-size: 18px;
    font-weight: 600;
  }

  .modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 24px;
    padding: 4px;
    transition: var(--transition);
  }

  .modal-close:hover {
    color: var(--text-primary);
  }

  .modal-body {
    padding: 24px;
  }

  .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
  }

  /* Toast Notifications */
  .toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s;
    max-width: 400px;
  }

  .toast-success {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
  }

  .toast-error {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
  }

  .toast-warning {
    background: rgba(245, 158, 11, 0.9);
    color: #000;
  }

  .toast-info {
    background: rgba(99, 102, 241, 0.9);
    color: #fff;
  }

  /* Loading Spinner */
  .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
  }

  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }

  .loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .loading-text {
    color: var(--text-secondary);
    font-size: 14px;
  }

  /* Login Page */
  .login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
  }

  /* Login Background â€” 4 logo tiles */
  .login-bg-logos {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    z-index: 0;
    pointer-events: none;
  }

  .login-bg-logo-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }

  .login-bg-logo-cell:nth-child(1) { background: radial-gradient(circle at center, rgba(59,130,246,0.12) 0%, transparent 70%); }
  .login-bg-logo-cell:nth-child(2) { background: radial-gradient(circle at center, rgba(139,92,246,0.12) 0%, transparent 70%); }
  .login-bg-logo-cell:nth-child(3) { background: radial-gradient(circle at center, rgba(245,158,11,0.12) 0%, transparent 70%); }
  .login-bg-logo-cell:nth-child(4) { background: radial-gradient(circle at center, rgba(239,68,68,0.12) 0%, transparent 70%); }

  .login-bg-logo-cell img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    opacity: 0.13;
    mix-blend-mode: screen;
    filter: blur(1px);
    transition: var(--transition);
    animation: loginLogoFloat 6s ease-in-out infinite;
  }
  .login-bg-logo-cell:nth-child(2) img { animation-delay: -1.5s; }
  .login-bg-logo-cell:nth-child(3) img { animation-delay: -3s; }
  .login-bg-logo-cell:nth-child(4) img { animation-delay: -4.5s; }

  @keyframes loginLogoFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-12px) scale(1.04); }
  }

  /* Divider lines between quadrants */
  .login-bg-logos::before {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  }
  .login-bg-logos::after {
    content: '';
    position: absolute;
    left: 50%; top: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.06), transparent);
  }

  /* Center glow overlay */
  .login-center-glow {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 60% 60% at 50% 50%, rgba(10,14,26,0.75) 0%, rgba(10,14,26,0.2) 100%);
    z-index: 0;
    pointer-events: none;
  }

  .login-card {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(99,102,241,0.15);
    animation: fadeUp 0.6s ease;
    position: relative;
    z-index: 2;
  }

  /* Glowing border accent on top */
  .login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #6366f1, #a855f7, #6366f1, transparent);
    border-radius: 100%;
  }

  .login-logo {
    text-align: center;
    margin-bottom: 32px;
  }

  /* Mini 4-logo grid in login card header */
  .login-logo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 88px;
    height: 88px;
    margin: 0 auto 16px auto;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 30px rgba(99,102,241,0.3);
  }

  .login-logo-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 18px;
  }

  .login-logo-cell:nth-child(1) { background: rgba(59,130,246,0.15); }
  .login-logo-cell:nth-child(2) { background: rgba(139,92,246,0.15); }
  .login-logo-cell:nth-child(3) { background: rgba(245,158,11,0.15); }
  .login-logo-cell:nth-child(4) { background: rgba(239,68,68,0.15); }

  .login-logo-cell img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    mix-blend-mode: screen;
  }

  .login-logo h1 {
    font-size: 26px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .login-logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 6px;
  }

  /* SEMUA watermark â€” 4 quadrant logos */
  .watermark-semua {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    z-index: -1;
    pointer-events: none;
  }

  .watermark-semua-cell {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .watermark-semua-cell img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    opacity: 0.06;
    mix-blend-mode: screen;
    transform: rotate(-10deg);
  }
  .watermark-semua-cell:nth-child(1) img { filter: drop-shadow(0 0 20px rgba(59,130,246,0.4)); }
  .watermark-semua-cell:nth-child(2) img { filter: drop-shadow(0 0 20px rgba(139,92,246,0.4)); }
  .watermark-semua-cell:nth-child(3) img { filter: drop-shadow(0 0 20px rgba(245,158,11,0.4)); }
  .watermark-semua-cell:nth-child(4) img { filter: drop-shadow(0 0 20px rgba(239,68,68,0.4)); }


  /* Tabs */
  .tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    overflow-x: auto;
  }

  .tab {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
  }

  .tab.active {
    background: var(--accent-blue);
    color: #fff;
  }

  .tab:hover:not(.active) {
    color: var(--text-primary);
  }

  /* Autocomplete */
  .autocomplete-wrapper {
    position: relative;
  }

  .autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    background: #2a3441; /* Warna lebih terang agar kontras dengan card */
    border: 1px solid var(--accent-blue); /* Border biru tegas */
    border-radius: var(--radius-sm);
    max-height: 400px; 
    overflow-y: auto;
    z-index: 9999; /* Sangat tinggi agar di depan semua elemen */
    display: none;
    min-width: 520px;
    max-width: min(92vw, 840px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3); /* Bayangan kuat ke bawah */
  }

  /* Global Fix: Angkat kontainer saat dropdown aktif (via JS) */
  .card.dropdown-active, 
  .form-group.dropdown-active,
  .autocomplete-wrapper.dropdown-active,
  .table-container.dropdown-active {
    z-index: 9999 !important;
    position: relative !important;
    overflow: visible !important;
    backdrop-filter: none !important; /* Safari Bug Fix */
    transform: none !important; /* Safari Bug Fix */
  }

  /* Cadangan: tetap angkat saat ada input yang difokuskan */
  .autocomplete-wrapper:focus-within {
    z-index: 999;
    position: relative;
    overflow: visible !important;
  }

  /* Cegah grid/flex memotong dropdown */
  .form-row, .form-inline {
    overflow: visible !important;
  }

  .autocomplete-list.show {
    display: block;
  }

  .autocomplete-item {
    padding: 10px 14px; /* Area klik lebih lebar dan lega */
    cursor: pointer;
    font-size: 13px; /* Font dibesarkan agar mudah dibaca */
    line-height: 1.5;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: var(--transition);
  }

  .autocomplete-item strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.35;
  }

  .autocomplete-item .meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 4px;
    font-size: 11px;
    color: #94a3b8;
  }

  .autocomplete-item .meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(99, 102, 241, 0.28);
    color: #c7d2fe;
    white-space: nowrap;
  }

  .autocomplete-item .meta-badge.strong {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.28);
    color: #bbf7d0;
  }

  .autocomplete-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
  }

  /* Multi-Part Table */
  .part-table {
    width: 100%;
    border-collapse: collapse;
  }

  .part-table th {
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
  }

  .part-table td {
    padding: 6px 4px;
  }

  .part-table input,
  .part-table select {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
  }

  .part-table input[type="number"] {
    min-width: 70px;
    text-align: right;
  }

  .part-table input:focus,
  .part-table select:focus {
    border-color: var(--border-focus);
    outline: none;
  }

  .btn-add-row {
    margin-top: 8px;
  }

  .btn-remove-row {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: var(--accent-red);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
  }

  .btn-remove-row:hover {
    background: rgba(239, 68, 68, 0.2);
  }

  /* Calculation Panel */
  .calc-panel {
    background: var(--gradient-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-top: 8px;
  }

  .calc-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
  }

  .calc-row.total {
    border-top: 1px solid var(--border-glass);
    padding-top: 6px;
    margin-top: 4px;
    font-weight: 700;
    font-size: 14px;
  }

  .calc-label {
    color: var(--text-secondary);
  }

  .calc-value {
    font-weight: 600;
  }

  .calc-value.positive {
    color: var(--accent-emerald);
  }

  .calc-value.negative {
    color: var(--accent-red);
  }

  /* Search */
  .search-box {
    position: relative;
    max-width: 360px;
  }

  .search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
  }

  .search-box input:focus {
    border-color: var(--border-focus);
    outline: none;
  }

  .search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
  }

  /* Filter Bar */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-end;
    margin-bottom: 10px;
    padding: 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
  }

  .filter-bar .form-group {
    margin-bottom: 0;
    min-width: 150px;
  }

  /* Charts placeholder */
  .chart-container {
    position: relative;
    height: 300px;
  }

  /* Empty State */
  .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
  }

  .empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
  }

  .empty-state p {
    font-size: 14px;
  }

  /* Animations */
  @keyframes fadeUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }

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

  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateX(100px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes fadeOut {
    to {
      opacity: 0;
      transform: translateX(100px);
    }
  }

  .fade-up {
    animation: fadeUp 0.4s ease forwards;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes pulse {

    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: 0.5;
    }
  }

  /* Hamburger */
  .hamburger {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
  }

  /* Top Bar */
  .top-bar {
    transition: var(--transition);
  }

  @media (max-width: 768px) {
    html, body {
      height: auto;
      min-height: 100%;
      overflow-y: auto !important;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-y: contain;
    }

    .app-container {
      min-height: 100dvh;
      overflow: visible;
    }

    .top-bar {
      margin-left: 0 !important;
      padding: 0 12px !important;
    }
    .hamburger {
      display: block !important;
    }
    #topBranchName {
      font-size: 16px !important;
    }
    .main-content {
      padding: 12px;
      padding-top: 80px !important;
      margin-left: 0 !important;
      height: auto !important;
      min-height: 100dvh;
      overflow-y: auto !important;
      overflow-x: auto !important;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; -webkit-tap-highlight-color: transparent; }
    .sidebar-backdrop.show { display: block; }
    .sidebar {
      transform: translateX(-100%);
      height: 100dvh;
      max-height: 100dvh;
      overflow-y: auto !important;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }
    .sidebar.open { transform: translateX(0); z-index: 150 !important; }
    .sidebar-nav {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
      padding-bottom: 88px;
    }
    .hamburger, .sidebar button { min-height: 44px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
    .sidebar .nav-item { min-height: 44px; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
    .kpi-card { padding: 12px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .modal-content { max-width: 100%; width: 100%; border-radius: 12px 12px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-height: 90vh; }
    .filter-bar .form-group { width: 100%; }
    .autocomplete-list { left: -50px; right: -50px; min-width: auto; width: calc(100% + 100px); }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .filter-bar { flex-direction: column; }
    .modal { max-width: 95%; }
    .login-card { padding: 24px; }
  }

  @media (max-width: 480px) {
    .kpi-card { padding: 10px; }
    .kpi-card .value { font-size: 20px; }
    .page-title { font-size: 16px; }
    .form-control { padding: 8px 10px; }
    .btn { padding: 7px 14px; }
  }

  /* Print */
  @media print {
    @page {
      size: A4;
      margin: 10mm;
    }

    @page stock-opname-landscape {
      size: A4 landscape;
      margin: 6mm;
    }

    .sidebar,
    .hamburger,
    .top-bar,
    .btn,
    .filter-bar,
    .modal-overlay,
    .toast-container {
      display: none !important;
    }

    .main-content, .content, #pageContent {
      margin-left: 0;
      padding: 0;
      height: auto !important;
      min-height: 0 !important;
      max-height: none !important;
      overflow: visible !important;
      width: 100% !important;
      max-width: none !important;
    }

    body, html {
      background: #fff;
      color: #000;
      height: auto !important;
      min-height: 0 !important;
      max-height: none !important;
      overflow: visible !important;
    }

    .card {
      border: 1px solid #ddd;
      background: #fff;
      box-shadow: none !important;
      page-break-inside: auto;
      break-inside: auto;
      overflow: visible !important;
    }

    .table-container,
    .data-table-wrapper,
    .report-table-wrapper {
      overflow: visible !important;
      max-height: none !important;
      width: 100% !important;
    }

    .kpi-grid {
      display: grid !important;
      grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
      gap: 6px !important;
      page-break-inside: avoid;
      break-inside: avoid;
    }

    .kpi-card {
      border: 1px solid #ddd !important;
      background: #fff !important;
      color: #000 !important;
      box-shadow: none !important;
      padding: 8px !important;
    }

    .data-table,
    table {
      width: 100% !important;
      max-width: 100% !important;
      border-collapse: collapse !important;
      table-layout: auto !important;
      font-size: 8.5pt !important;
    }

    thead { display: table-header-group !important; }
    tfoot { display: table-footer-group !important; }
    tr {
      page-break-inside: avoid;
      break-inside: avoid;
    }

    .data-table th,
    .data-table td {
      border: 1px solid #ddd;
      color: #000;
    }

    body.print-nota-mode * {
      visibility: hidden !important;
    }

    body.print-nota-mode #printAreaContainer,
    body.print-nota-mode #printAreaContainer * {
      visibility: visible !important;
    }

    body.print-nota-mode #printAreaContainer {
      display: block !important;
      position: absolute;
      inset: 0 auto auto 0;
      width: 190mm;
      min-height: 277mm;
      padding: 8mm;
      background: #fff;
      color: #000;
      z-index: 99999;
    }

    .print-receipt {
      width: 100%;
      max-width: none;
      margin: 0;
      color: #000;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      line-height: 1.35;
    }

    .print-receipt h2 {
      text-align: center;
      font-size: 22px;
      margin: 0 0 6px;
    }

    .print-receipt table {
      width: 100%;
      border-collapse: collapse;
      margin: 8px 0;
    }

    .print-receipt th,
    .print-receipt td {
      display: table-cell !important;
      border-bottom: 1px solid #ddd;
      padding: 6px 4px;
      color: #000;
      vertical-align: top;
    }

    .print-divider {
      border-top: 1px solid #333;
      margin: 10px 0;
    }

    .print-footer {
      margin-top: 14px;
      text-align: center;
      font-size: 11px;
    }

    body.stock-opname-print-mode {
      page: stock-opname-landscape;
    }

    body.stock-opname-print-mode .sidebar,
    body.stock-opname-print-mode .hamburger,
    body.stock-opname-print-mode .page-header,
    body.stock-opname-print-mode .so-filters,
    body.stock-opname-print-mode #soSearchCard,
    body.stock-opname-print-mode .toast-container {
      display: none !important;
    }

    body.stock-opname-print-mode .main-content,
    body.stock-opname-print-mode .content,
    body.stock-opname-print-mode #pageContent {
      margin: 0 !important;
      padding: 0 !important;
      width: 100% !important;
      max-width: none !important;
      overflow: visible !important;
    }

    body.stock-opname-print-mode .card {
      margin: 0 !important;
      padding: 0 !important;
      border: 0 !important;
      box-shadow: none !important;
      background: #fff !important;
      page-break-inside: auto;
    }

    body.stock-opname-print-mode #printHeader {
      display: block !important;
      margin-bottom: 4mm !important;
      color: #000 !important;
      text-align: center;
    }

    body.stock-opname-print-mode #printHeader h1 {
      font-size: 12pt !important;
      margin: 0 0 2mm !important;
      color: #000 !important;
    }

    body.stock-opname-print-mode #printHeaderDesc {
      font-size: 8pt !important;
      margin: 0 !important;
      color: #000 !important;
    }

    body.stock-opname-print-mode .so-table-container,
    body.stock-opname-print-mode .table-container {
      overflow: visible !important;
      max-height: none !important;
      min-height: 0 !important;
      border: 0 !important;
      width: 100% !important;
    }

    body.stock-opname-print-mode .so-print-table {
      width: 100% !important;
      min-width: 0 !important;
      table-layout: fixed !important;
      border-collapse: collapse !important;
      font-size: 8.6pt !important;
      line-height: 1.22 !important;
    }

    body.stock-opname-print-mode .so-print-table th,
    body.stock-opname-print-mode .so-print-table td {
      position: static !important;
      padding: 2.4pt 2.2pt !important;
      border: 1px solid #777 !important;
      color: #000 !important;
      background: #fff !important;
      white-space: normal !important;
      overflow-wrap: anywhere !important;
      word-break: normal !important;
      vertical-align: top !important;
    }

    body.stock-opname-print-mode .so-print-table th {
      font-size: 8pt !important;
      font-weight: 700 !important;
      text-align: center !important;
    }

    body.stock-opname-print-mode .so-print-table th:nth-child(1),
    body.stock-opname-print-mode .so-print-table td:nth-child(1) { width: 3% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(2),
    body.stock-opname-print-mode .so-print-table td:nth-child(2) { width: 7% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(3),
    body.stock-opname-print-mode .so-print-table td:nth-child(3) { width: 8% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(4),
    body.stock-opname-print-mode .so-print-table td:nth-child(4) { width: 8% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(5),
    body.stock-opname-print-mode .so-print-table td:nth-child(5) { width: 39% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(6),
    body.stock-opname-print-mode .so-print-table td:nth-child(6) { width: 7% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(7),
    body.stock-opname-print-mode .so-print-table td:nth-child(7) { width: 7% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(8),
    body.stock-opname-print-mode .so-print-table td:nth-child(8) { width: 9% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(9),
    body.stock-opname-print-mode .so-print-table td:nth-child(9) { width: 5% !important; }
    body.stock-opname-print-mode .so-print-table th:nth-child(10),
    body.stock-opname-print-mode .so-print-table td:nth-child(10) { width: 7% !important; }

    body.stock-opname-print-mode .so-check-box {
      width: 11px !important;
      height: 11px !important;
      border: 1.5px solid #000 !important;
      border-radius: 0 !important;
      background: #fff !important;
    }
  }

  .modal.stock-detail-modal {
    width: calc(100vw - 24px) !important;
    max-width: none !important;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .modal.stock-detail-modal .modal-body {
    max-height: calc(100vh - 98px);
  }

  .stock-detail-overlay {
    align-items: stretch;
    justify-content: stretch;
  }

  .stock-detail-shell {
    min-width: 1320px;
  }

  .stock-detail-table {
    min-width: 1500px;
  }

/* =========================================================
   FIX GLOBAL: MODAL / POPUP + SIDEBAR MOBILE SCROLL
   Tujuan:
   - Popup/form tidak tertutup
   - Popup muncul dari atas dan bisa scroll
   - Menu sidebar di HP bisa discroll sampai bawah
   ========================================================= */

/* Pop-up overlay dibuat scrollable */
.modal-overlay {
  position: fixed;
  inset: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 18px 12px 28px !important;
  align-items: flex-start !important;
  justify-content: center !important;
  -webkit-overflow-scrolling: touch;
}

/* Saat modal tampil */
.modal-overlay.show {
  display: flex !important;
}

/* Kotak modal jangan terlalu tinggi dan jangan terpotong */
.modal-overlay .modal,
.modal {
  width: min(96vw, 760px);
  max-height: calc(100vh - 36px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  margin: 0 auto !important;
}

/* Header modal tetap di atas */
.modal-header {
  flex: 0 0 auto;
}

/* Isi modal bisa scroll */
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: none !important;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 18px;
}

/* Tombol bawah tetap kelihatan */
.modal-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--bg-card, #111827);
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.2));
}

/* Untuk layar laptop pendek */
@media (max-height: 720px) {
  .modal-overlay {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .modal-overlay .modal,
  .modal {
    max-height: calc(100vh - 20px) !important;
  }
}

/* Sidebar desktop juga dibuat aman scroll */
.sidebar {
  max-height: 100vh;
  overflow: hidden;
}

.sidebar-nav {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

/* Sidebar mobile setelah klik hamburger/garis 3 */
@media (max-width: 768px) {
  .hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 24px;
  }

  .sidebar.open {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-nav {
    max-height: none !important;
    overflow-y: visible !important;
    padding-bottom: 24px;
  }

  .sidebar-footer {
    position: relative !important;
    bottom: auto !important;
    flex-shrink: 0;
    margin-top: 12px;
  }

  .nav-item {
    min-height: 44px;
  }

  /* Modal di HP dibuat hampir full layar tapi tetap bisa scroll */
  .modal-overlay {
    padding: 8px !important;
  }

  .modal-overlay .modal,
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100vh - 16px) !important;
    border-radius: 14px !important;
  }

  .modal-body {
    overflow-y: auto !important;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer .btn,
  .modal-footer button {
    min-height: 42px;
  }
}


/* =========================================================
   FIX KUAT: MODAL PALING DEPAN + MODE HP + SIDEBAR SCROLL
   ========================================================= */

body > .modal-overlay,
.modal-overlay.show {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 18px 12px 28px !important;
  background: rgba(2, 6, 23, 0.72) !important;
  backdrop-filter: blur(3px);
  -webkit-overflow-scrolling: touch;
}

body > .modal-overlay > .modal,
.modal-overlay.show > .modal {
  position: relative !important;
  z-index: 2147483001 !important;
  width: min(96vw, 760px) !important;
  max-width: 760px !important;
  max-height: calc(100dvh - 36px) !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: var(--bg-card, #111827) !important;
}

body > .modal-overlay > .modal .modal-header,
.modal-overlay.show > .modal .modal-header {
  flex: 0 0 auto !important;
}

body > .modal-overlay > .modal .modal-body,
.modal-overlay.show > .modal .modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: none !important;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 18px !important;
}

body > .modal-overlay > .modal .modal-footer,
.modal-overlay.show > .modal .modal-footer {
  flex: 0 0 auto !important;
  position: sticky !important;
  bottom: 0 !important;
  z-index: 3 !important;
  background: var(--bg-card, #111827) !important;
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.25)) !important;
}

@media (max-width: 768px) {
  body > .modal-overlay,
  .modal-overlay.show {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  body > .modal-overlay > .modal,
  .modal-overlay.show > .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  body > .modal-overlay > .modal .modal-body,
  .modal-overlay.show > .modal .modal-body {
    overflow-y: auto !important;
    min-height: 0 !important;
    padding-bottom: 24px !important;
  }

  body > .modal-overlay > .modal .modal-footer,
  .modal-overlay.show > .modal .modal-footer {
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }

  .sidebar.open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(86vw, 330px) !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 2147482000 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transform: translateX(0) !important;
  }

  .sidebar.open .sidebar-nav {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px !important;
  }

  .sidebar.open .sidebar-footer {
    flex: 0 0 auto !important;
    position: relative !important;
    bottom: auto !important;
    margin-top: 0 !important;
  }

  .sidebar-backdrop.show {
    z-index: 2147481999 !important;
  }
}
/* =========================================================
   FIX DETAIL STOK BARANG MODAL
   - Judul part lebih kecil
   - Teks kanan tidak terpotong
   - Header detail stok lebih fleksibel
   ========================================================= */

.modal .stock-detail-header,
.modal .detail-stok-header,
.modal .stok-detail-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

.modal .stock-detail-title,
.modal .detail-stok-title,
.modal .stok-detail-title {
  font-size: 20px !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  color: #ff4d4f !important;
  margin: 0 !important;
  flex: 1 1 260px !important;
  min-width: 0 !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.modal .stock-detail-meta-right,
.modal .detail-stok-meta-right,
.modal .stok-detail-meta-right,
.modal .stock-part-badge,
.modal .stok-part-badge {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-align: right !important;
}

.modal .stock-detail-info,
.modal .detail-stok-info,
.modal .stok-detail-info {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px 16px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
}

.modal .stock-detail-info > *,
.modal .detail-stok-info > *,
.modal .stok-detail-info > * {
  white-space: normal !important;
  word-break: break-word !important;
}

/* Khusus mobile */
@media (max-width: 768px) {
  .modal .stock-detail-header,
  .modal .detail-stok-header,
  .modal .stok-detail-header {
    align-items: flex-start !important;
  }

  .modal .stock-detail-title,
  .modal .detail-stok-title,
  .modal .stok-detail-title {
    font-size: 16px !important;
    flex: 1 1 100% !important;
  }

  .modal .stock-detail-meta-right,
  .modal .detail-stok-meta-right,
  .modal .stok-detail-meta-right,
  .modal .stock-part-badge,
  .modal .stok-part-badge {
    width: 100% !important;
    text-align: left !important;
    font-size: 13px !important;
  }

  .modal .stock-detail-info,
  .modal .detail-stok-info,
  .modal .stok-detail-info {
    font-size: 12px !important;
  }
}

/* =========================================================
   FIX DETAIL STOK BARANG POPUP
   Tujuan:
   - Nama part merah lebih kecil
   - Kategori/Jenis tidak kepotong
   - Stok dan nilai tetap rapi
   ========================================================= */

.stock-detail-topline {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  grid-template-areas:
    "name stock value"
    "path stock value" !important;
  gap: 4px 14px !important;
  align-items: center !important;
}

.stock-detail-name {
  grid-area: name !important;
  font-size: 16px !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  color: #ff4d4f !important;
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.stock-detail-path {
  grid-area: path !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  opacity: 0.9 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  text-align: left !important;
}

.stock-detail-stock {
  grid-area: stock !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  align-self: center !important;
}

.stock-detail-value {
  grid-area: value !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  align-self: center !important;
}

.stock-detail-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px 14px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.stock-detail-meta span {
  white-space: normal !important;
  word-break: break-word !important;
}

/* Tampilan HP */
@media (max-width: 768px) {
  .stock-detail-topline {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "name"
      "path"
      "stock"
      "value" !important;
    gap: 5px !important;
  }

  .stock-detail-name {
    font-size: 14px !important;
  }

  .stock-detail-path,
  .stock-detail-stock,
  .stock-detail-value {
    font-size: 12px !important;
    text-align: left !important;
  }

  .stock-detail-meta {
    font-size: 11px !important;
  }
}
/* =========================================================
   FIX: Pembelian & Return banyak item
   - tabel item scroll sendiri
   - header tabel sticky
   - tombol simpan/total sticky di bawah
   ========================================================= */

body:has(#beliTB) #pageContent,
body:has(#returnTB) #pageContent {
  padding-bottom: 110px !important;
}

body:has(#beliTB) .table-container:has(#beliTB),
body:has(#returnTB) .table-container:has(#returnTB) {
  max-height: calc(100vh - 380px) !important;
  min-height: 260px !important;
  overflow: auto !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 14px !important;
  background: rgba(15, 23, 42, 0.45) !important;
}

body:has(#beliTB) .table-container:has(#beliTB) table,
body:has(#returnTB) .table-container:has(#returnTB) table {
  min-width: 980px !important;
}

body:has(#beliTB) .table-container:has(#beliTB) thead th,
body:has(#returnTB) .table-container:has(#returnTB) thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 8 !important;
  background: rgba(30, 41, 59, 0.98) !important;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.22) !important;
}

.long-form-sticky-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 50 !important;
  margin-top: 12px !important;
  padding: 12px !important;
  border: 1px solid rgba(139, 92, 246, 0.35) !important;
  border-radius: 14px !important;
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.35) !important;
}

.long-form-toolbar {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  margin: 10px 0 12px 0 !important;
  padding: 10px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.035) !important;
}

.long-form-row-count {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  margin-left: auto !important;
}

@media (max-width: 768px) {
  body:has(#beliTB) .table-container:has(#beliTB),
  body:has(#returnTB) .table-container:has(#returnTB) {
    max-height: calc(100vh - 330px) !important;
  }

  .long-form-row-count {
    width: 100% !important;
    margin-left: 0 !important;
  }
}

/* =========================================================
   FORCE FIX: Return Supplier banyak item
   ========================================================= */
.return-long-form-active {
  padding-bottom: 120px !important;
}

.return-long-form-active .return-long-table-scroll {
  max-height: calc(100vh - 380px) !important;
  min-height: 260px !important;
  overflow: auto !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 14px !important;
  background: rgba(15, 23, 42, 0.45) !important;
}

.return-long-form-active .return-long-table-scroll table {
  min-width: 980px !important;
}

.return-long-form-active .return-long-table-scroll thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 9 !important;
  background: rgba(30, 41, 59, 0.98) !important;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.22) !important;
}

.return-force-sticky-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 70 !important;
  margin-top: 12px !important;
  padding: 12px !important;
  border: 1px solid rgba(139, 92, 246, 0.35) !important;
  border-radius: 14px !important;
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.35) !important;
}

.return-force-toolbar {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  margin: 10px 0 12px 0 !important;
  padding: 10px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.035) !important;
}

.return-force-row-count {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  margin-left: auto !important;
}

/* SERVICEPRO_GLOBAL_THEME_START */

/* =========================================================
   SERVICEPRO GLOBAL THEME V2
   Tema terang: putih hangat + merah + hitam + gold
   Login logo orbit modern
   Mobile lebih rapi
   ========================================================= */

/* =========================
   BASE LIGHT THEME
   ========================= */
html.sp-light,
body.sp-light {
  --bg-primary: #f8f4ec !important;
  --bg-secondary: #fffaf2 !important;
  --bg-card: #fffaf5 !important;
  --bg-sidebar: #f6efe3 !important;
  --text-primary: #171717 !important;
  --text-secondary: #2b2b2b !important;
  --text-muted: #6b7280 !important;
  --border-color: rgba(17, 17, 17, 0.12) !important;
  --input-bg: #fffdf9 !important;
  --primary: #b91c1c !important;
  --primary-hover: #991b1b !important;
  --accent-gold: #c89b3c !important;
  color: #171717 !important;
  background: linear-gradient(135deg, #f8f4ec 0%, #fff8ef 40%, #f5e3bd 100%) !important;
}

html.sp-light body {
  background: linear-gradient(135deg, #f8f4ec 0%, #fff8ef 40%, #f5e3bd 100%) !important;
  color: #171717 !important;
}

/* area utama */
body.sp-light,
body.sp-light .main-content,
body.sp-light .content,
body.sp-light .app-main,
body.sp-light main,
body.sp-light #pageContent,
body.sp-light .page-content {
  color: #171717 !important;
  background: transparent !important;
}

/* sidebar */
body.sp-light .sidebar,
body.sp-light aside {
  background: linear-gradient(180deg, #fff8ef 0%, #f3e7d2 100%) !important;
  color: #171717 !important;
  border-right: 1px solid rgba(17, 17, 17, 0.08) !important;
  box-shadow: 10px 0 28px rgba(0, 0, 0, 0.06) !important;
}

body.sp-light .sidebar a,
body.sp-light .nav-item,
body.sp-light .menu-item,
body.sp-light .sidebar .section-title,
body.sp-light .sidebar * {
  color: #2b2b2b !important;
}

body.sp-light .sidebar a.active,
body.sp-light .nav-item.active,
body.sp-light .menu-item.active {
  background: linear-gradient(90deg, rgba(185,28,28,.10), rgba(200,155,60,.14)) !important;
  color: #8a1313 !important;
  border-color: rgba(185, 28, 28, 0.18) !important;
}

/* header/top */
body.sp-light header,
body.sp-light .topbar,
body.sp-light .page-header,
body.sp-light .content-header {
  background: rgba(255, 250, 242, 0.72) !important;
  color: #171717 !important;
  border-color: rgba(17, 17, 17, 0.08) !important;
  backdrop-filter: blur(10px) !important;
}

/* card/panel */
body.sp-light .card,
body.sp-light .panel,
body.sp-light .stat-card,
body.sp-light .dashboard-card,
body.sp-light .modal-content,
body.sp-light .modal-dialog,
body.sp-light .table-container,
body.sp-light .content-card,
body.sp-light .widget,
body.sp-light .box {
  background: rgba(255, 250, 245, 0.95) !important;
  color: #171717 !important;
  border: 1px solid rgba(17, 17, 17, 0.08) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.06) !important;
}

/* text */
body.sp-light h1,
body.sp-light h2,
body.sp-light h3,
body.sp-light h4,
body.sp-light h5,
body.sp-light h6,
body.sp-light .page-title,
body.sp-light .card-title,
body.sp-light .section-title,
body.sp-light strong {
  color: #171717 !important;
}

body.sp-light .text-muted,
body.sp-light .page-subtitle,
body.sp-light small,
body.sp-light .form-label {
  color: #6b7280 !important;
}

/* input */
body.sp-light input,
body.sp-light select,
body.sp-light textarea,
body.sp-light .form-control {
  background: #fffdf9 !important;
  color: #171717 !important;
  border: 1px solid rgba(17, 17, 17, 0.14) !important;
}

body.sp-light input::placeholder,
body.sp-light textarea::placeholder {
  color: #9ca3af !important;
}

/* tombol */
body.sp-light .btn-primary,
body.sp-light .btn.btn-primary,
body.sp-light button.primary {
  background: linear-gradient(90deg, #b91c1c 0%, #d4a64a 100%) !important;
  color: #ffffff !important;
  border: none !important;
}

body.sp-light .btn-outline {
  background: rgba(255, 253, 249, 0.95) !important;
  color: #171717 !important;
  border: 1px solid rgba(17, 17, 17, 0.14) !important;
}

/* tabel */
body.sp-light table,
body.sp-light .data-table {
  background: transparent !important;
  color: #171717 !important;
}

body.sp-light table th,
body.sp-light .data-table th {
  background: rgba(200, 155, 60, 0.10) !important;
  color: #2b2b2b !important;
  border-color: rgba(17, 17, 17, 0.08) !important;
}

body.sp-light table td,
body.sp-light .data-table td {
  color: #171717 !important;
  border-color: rgba(17, 17, 17, 0.08) !important;
}

body.sp-light table tr:hover td,
body.sp-light .data-table tr:hover td {
  background: rgba(185, 28, 28, 0.04) !important;
}

/* modal overlay */
body.sp-light .modal,
body.sp-light .modal-overlay {
  background: rgba(17, 17, 17, 0.32) !important;
}

/* =========================
   THEME BUTTON
   ========================= */
#spThemeToggle {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 10080;
  min-width: 118px;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 14, 30, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(0,0,0,0.24);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

body.sp-light #spThemeToggle {
  background: linear-gradient(90deg, #fffaf2 0%, #f5e3bd 100%) !important;
  color: #171717 !important;
  border: 1px solid rgba(17,17,17,0.12) !important;
}

/* =========================
   LOGIN ORBIT STAGE
   ========================= */
.login-orbit-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

#loginBranchOrbitCard {
  position: relative;
  z-index: 2;
}

.login-orbit-logos {
  position: absolute;
  inset: -34px;
  z-index: 1;
  pointer-events: none;
}

.login-orbit-logo {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(20, 28, 48, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 12px 24px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
}

.login-orbit-logo:nth-child(1) {
  left: -38px;
  top: 24px;
}
.login-orbit-logo:nth-child(2) {
  right: -38px;
  top: 24px;
}
.login-orbit-logo:nth-child(3) {
  left: -38px;
  bottom: 32px;
}
.login-orbit-logo:nth-child(4) {
  right: -38px;
  bottom: 32px;
}

.login-orbit-logo-inner {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.login-orbit-logo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 999px;
}

.login-orbit-logo span {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #d4d8e2;
}

/* orbit versi tema terang */
body.sp-light .login-orbit-logo {
  background: linear-gradient(180deg, #fffaf2 0%, #f3e0bb 100%) !important;
  border: 1px solid rgba(17,17,17,0.10) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,0.10) !important;
}

body.sp-light .login-orbit-logo-inner {
  background: linear-gradient(180deg, #ffffff 0%, #f8efe0 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(17,17,17,0.08) !important;
}

body.sp-light .login-orbit-logo span {
  color: #171717 !important;
}

/* login card tema terang */
body.sp-light #loginBranchOrbitCard,
body.sp-light .login-card,
body.sp-light .login-container,
body.sp-light form {
  background: rgba(255, 250, 245, 0.96) !important;
  color: #171717 !important;
  border-color: rgba(17,17,17,0.10) !important;
}

/* =========================
   MOBILE IMPROVEMENT
   ========================= */
@media (max-width: 768px) {
  html,
  body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .modal-body,
  .table-container {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #spThemeToggle {
    right: 12px;
    bottom: 12px;
    min-width: 104px;
    height: 38px;
    font-size: 12px;
    border-radius: 12px;
  }

  .login-orbit-stage {
    max-width: 360px;
    padding-top: 10px;
  }

  .login-orbit-logos {
    position: static !important;
    inset: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 0 0 14px 0;
    pointer-events: none;
  }

  .login-orbit-logo {
    position: static !important;
    width: 100%;
    height: auto;
    min-height: 86px;
    border-radius: 22px;
    padding: 10px 6px;
  }

  .login-orbit-logo-inner {
    width: 48px;
    height: 48px;
  }

  .login-orbit-logo img {
    width: 38px;
    height: 38px;
  }

  .login-orbit-logo span {
    font-size: 11px;
  }
}

/* SERVICEPRO_GLOBAL_THEME_END */

/* =========================================================
   SERVICEPRO TUNING:
   - Light mode lebih soft
   - Logo login lebih besar
   ========================================================= */

/* =========================
   LIGHT MODE LEBIH SOFT
   ========================= */
html.sp-light,
body.sp-light {
  background: linear-gradient(135deg, #f6f1e7 0%, #f3ede2 38%, #eadfc9 72%, #e5d2ab 100%) !important;
  color: #1d1d1d !important;
}

body.sp-light {
  --bg-primary: #f6f1e7 !important;
  --bg-secondary: #f8f3ea !important;
  --bg-card: #fdf9f2 !important;
  --bg-sidebar: #efe5d4 !important;
  --text-primary: #1d1d1d !important;
  --text-secondary: #2d2d2d !important;
  --text-muted: #6e6a63 !important;
  --border-color: rgba(50, 40, 25, 0.12) !important;
  --input-bg: #fcf8f1 !important;
  --primary: #b32025 !important;
  --primary-hover: #8d1b1f !important;
  --accent-gold: #c79a3b !important;
}

/* background utama semua halaman */
body.sp-light,
body.sp-light .main-content,
body.sp-light .content,
body.sp-light .app-main,
body.sp-light main,
body.sp-light #pageContent,
body.sp-light .page-content {
  background: transparent !important;
  color: #1d1d1d !important;
}

/* sidebar */
body.sp-light .sidebar,
body.sp-light aside {
  background: linear-gradient(180deg, #f4ede1 0%, #eadfca 100%) !important;
  border-right: 1px solid rgba(60, 45, 25, 0.10) !important;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.05) !important;
}

body.sp-light .sidebar a,
body.sp-light .nav-item,
body.sp-light .menu-item,
body.sp-light .sidebar * {
  color: #2b2925 !important;
}

body.sp-light .sidebar a.active,
body.sp-light .nav-item.active,
body.sp-light .menu-item.active {
  background: linear-gradient(90deg, rgba(179,32,37,.08), rgba(199,154,59,.16)) !important;
  color: #8d1b1f !important;
  border-color: rgba(179,32,37,.12) !important;
}

/* header/topbar */
body.sp-light header,
body.sp-light .topbar,
body.sp-light .page-header,
body.sp-light .content-header {
  background: rgba(252, 247, 239, 0.78) !important;
  border-color: rgba(50, 40, 25, 0.08) !important;
  backdrop-filter: blur(10px) !important;
}

/* card/panel */
body.sp-light .card,
body.sp-light .panel,
body.sp-light .stat-card,
body.sp-light .dashboard-card,
body.sp-light .modal-content,
body.sp-light .modal-dialog,
body.sp-light .table-container,
body.sp-light .content-card,
body.sp-light .widget,
body.sp-light .box {
  background: rgba(252, 248, 241, 0.96) !important;
  border: 1px solid rgba(72, 54, 25, 0.08) !important;
  box-shadow: 0 8px 22px rgba(82, 60, 22, 0.06) !important;
  color: #1d1d1d !important;
}

/* input */
body.sp-light input,
body.sp-light select,
body.sp-light textarea,
body.sp-light .form-control {
  background: #fffaf3 !important;
  color: #1d1d1d !important;
  border: 1px solid rgba(60, 45, 25, 0.14) !important;
}

body.sp-light input::placeholder,
body.sp-light textarea::placeholder {
  color: #8a8378 !important;
}

/* tombol utama */
body.sp-light .btn-primary,
body.sp-light .btn.btn-primary,
body.sp-light button.primary {
  background: linear-gradient(90deg, #b32025 0%, #c79a3b 100%) !important;
  color: #fff !important;
  border: none !important;
}

body.sp-light .btn-outline {
  background: rgba(255, 250, 244, 0.94) !important;
  color: #1d1d1d !important;
  border: 1px solid rgba(60, 45, 25, 0.12) !important;
}

/* tabel */
body.sp-light table th,
body.sp-light .data-table th {
  background: rgba(199, 154, 59, 0.10) !important;
  color: #2b2925 !important;
}

body.sp-light table td,
body.sp-light .data-table td {
  color: #1d1d1d !important;
  border-color: rgba(60, 45, 25, 0.08) !important;
}

body.sp-light table tr:hover td,
body.sp-light .data-table tr:hover td {
  background: rgba(179, 32, 37, 0.04) !important;
}

/* tombol dark/light */
body.sp-light #spThemeToggle {
  background: linear-gradient(90deg, #fbf5ea 0%, #ead7b3 100%) !important;
  color: #1d1d1d !important;
  border: 1px solid rgba(60, 45, 25, 0.12) !important;
  box-shadow: 0 8px 20px rgba(82, 60, 22, 0.08) !important;
}

/* =========================
   LOGIN LOGO LEBIH BESAR
   ========================= */
.login-orbit-stage {
  max-width: 460px !important;
  min-height: 620px !important;
  margin: 0 auto !important;
  position: relative !important;
}

#loginBranchOrbitCard {
  position: relative !important;
  z-index: 5 !important;
}

.login-orbit-logos {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2 !important;
  pointer-events: none !important;
}

/* ukuran logo diperbesar */
.login-orbit-logo {
  width: 132px !important;
  height: 132px !important;
  border-radius: 999px !important;
  background: rgba(14, 24, 46, 0.90) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  box-shadow: 0 14px 30px rgba(0,0,0,0.24) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  backdrop-filter: blur(10px) !important;
}

/* posisi lebih jauh supaya area kosong terisi */
.login-orbit-logo:nth-child(1) {
  left: -125px !important;
  top: -8px !important;
}
.login-orbit-logo:nth-child(2) {
  right: -125px !important;
  top: -8px !important;
}
.login-orbit-logo:nth-child(3) {
  left: -125px !important;
  bottom: -6px !important;
}
.login-orbit-logo:nth-child(4) {
  right: -125px !important;
  bottom: -6px !important;
}

/* isi logo juga diperbesar */
.login-orbit-logo-inner {
  width: 74px !important;
  height: 74px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10) !important;
}

.login-orbit-logo img {
  width: 58px !important;
  height: 58px !important;
  object-fit: contain !important;
  border-radius: 999px !important;
}

.login-orbit-logo span {
  margin-top: 8px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: .4px !important;
  color: #e8eaf0 !important;
}

/* versi terang */
body.sp-light .login-orbit-logo {
  background: linear-gradient(180deg, #f8f1e6 0%, #ead8b8 100%) !important;
  border: 1px solid rgba(65, 48, 21, 0.10) !important;
  box-shadow: 0 12px 24px rgba(82, 60, 22, 0.10) !important;
}

body.sp-light .login-orbit-logo-inner {
  background: linear-gradient(180deg, #fffaf3 0%, #f1e2c4 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(65, 48, 21, 0.08) !important;
}

body.sp-light .login-orbit-logo span {
  color: #1d1d1d !important;
}

/* login card versi terang */
body.sp-light #loginBranchOrbitCard,
body.sp-light .login-card,
body.sp-light .login-container,
body.sp-light form {
  background: rgba(250, 245, 237, 0.96) !important;
  border-color: rgba(65, 48, 21, 0.10) !important;
}

/* =========================
   TABLET
   ========================= */
@media (max-width: 1200px) {
  .login-orbit-logo {
    width: 118px !important;
    height: 118px !important;
  }

  .login-orbit-logo:nth-child(1) {
    left: -95px !important;
  }
  .login-orbit-logo:nth-child(2) {
    right: -95px !important;
  }
  .login-orbit-logo:nth-child(3) {
    left: -95px !important;
  }
  .login-orbit-logo:nth-child(4) {
    right: -95px !important;
  }

  .login-orbit-logo-inner {
    width: 66px !important;
    height: 66px !important;
  }

  .login-orbit-logo img {
    width: 52px !important;
    height: 52px !important;
  }
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 768px) {
  .login-orbit-stage {
    min-height: auto !important;
    max-width: 360px !important;
  }

  .login-orbit-logos {
    position: static !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    margin: 0 0 16px 0 !important;
  }

  .login-orbit-logo {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100px !important;
    border-radius: 22px !important;
    padding: 10px 6px !important;
  }

  .login-orbit-logo-inner {
    width: 56px !important;
    height: 56px !important;
  }

  .login-orbit-logo img {
    width: 44px !important;
    height: 44px !important;
  }

  .login-orbit-logo span {
    font-size: 13px !important;
  }
}

