/* ==========================================================================
   1. LAYOUT UTAMA (ANTI-SCROLL CORE)
   ========================================================================== */
.setup-layout { 
    display: flex; 
    flex-direction: column; 
    height: calc((100vh / var(--global-zoom, 1)) - var(--topbar-tinggi, 60px) - var(--topbar-jarak-atas, 20px) - 2px); 
    padding: 0 var(--padding-x) 12px var(--padding-x); 
    overflow: hidden; 
}
.fade-in { animation: fadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes fadeIn { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   2. TOP CONTROL BAR (1 BARIS)
   ========================================================================== */
.tmc-action-btn { height: 38px; border-radius: 50px; font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: 0.2s; border: 1px solid #cbd5e1; background: #fff; color: #475569; padding: 0 16px; cursor: pointer; outline: none; }
.tmc-action-btn:hover { background: #f8fafc; border-color: var(--tirta-blue); color: var(--tirta-blue); }
.tmc-action-btn.icon-only { width: 38px; padding: 0; }
.tmc-action-btn .fa-rotate-right { transition: transform 0.4s ease; }
.tmc-action-btn:hover .fa-rotate-right { transform: rotate(180deg); }

.tmc-primary-btn { height: 38px; border-radius: 50px; font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: 0.2s; background: var(--tirta-blue); border: none; color: white; padding: 0 20px; box-shadow: 0 4px 6px -1px rgba(48, 82, 138, 0.2); cursor: pointer; }
.tmc-primary-btn:hover { background: #25416e; color: white; transform: translateY(-1px); box-shadow: 0 6px 8px -1px rgba(48, 82, 138, 0.3); }

.search-pill-container { background-color: #ffffff; border: 1px solid #cbd5e1; display: flex; align-items: center; transition: 0.2s; padding: 0 16px; border-radius: 50px; height: 38px; box-shadow: 0 2px 4px rgba(0,0,0,0.01); }
.search-pill-container:focus-within { border-color: var(--tirta-blue); box-shadow: 0 0 0 3px rgba(48,82,138,0.1); }
.search-pill-container input { border: none !important; outline: none !important; background: transparent !important; }

.view-toggle-group { background-color: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 50px; padding: 4px; display: flex; align-items: center; height: 38px; }
.view-toggle-btn { border: none; background: transparent; color: #64748b; border-radius: 50px; padding: 0 18px; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); cursor: pointer; outline: none; }
.view-toggle-btn:hover:not(.active) { color: var(--tirta-blue); }
.view-toggle-btn.active { background-color: #ffffff; color: var(--tirta-blue); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }

/* ==========================================================================
   3. BODY, TABLE & PAGINATION (CAPSULE UI)
   ========================================================================== */
.setup-main-card { 
    background: #f8fafc; 
    border-radius: 16px !important; 
    border: 1px solid #e2e8f0; 
    overflow: hidden !important; 
    display: flex; 
    flex-direction: column; 
    width: 100%; 
    flex: 1; 
    min-height: 0; 
    height: 100%; /* TAMBAHIN INI BIAR SCROLLNYA JALAN */
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.02);
}

.table-responsive-wrapper { 
    flex: 1; 
    min-height: 0; 
    overflow-y: auto !important; 
    overflow-x: auto;
    padding: 0 16px !important; 
    margin: 0 !important; 
    position: relative;
}

.t-table { 
    width: 100%; 
    border-collapse: separate !important; 
    border-spacing: 0 10px !important; 
    table-layout: fixed; 
    min-width: 900px; 
    margin: 0 !important; 
    border: none !important; 
}
.t-table thead { position: static !important; }

.t-table th { 
    position: sticky !important; 
    top: 0 !important; 
    z-index: 50 !important; 
    background-color: #f8fafc !important; 
    color: #64748b; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    font-weight: 800; 
    box-shadow: 0 8px 8px -8px rgba(0,0,0,0.08), inset 0 -2px 0 #e2e8f0 !important; 
    padding: 14px 12px; 
    letter-spacing: 0.5px; 
    white-space: nowrap !important; 
    text-align: left; 
    border: none !important; 
    outline: none !important; 
}

.t-table td { 
    padding: 14px 16px; 
    vertical-align: middle; 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: #1e293b; 
    background: #ffffff; 
    border-top: 1px solid #e2e8f0; 
    border-bottom: 1px solid #e2e8f0; 
    transition: all 0.2s ease; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    border-left: none; 
    border-right: none; 
}

.t-table td:first-child {
    border-left: 1px solid #e2e8f0;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.t-table td:last-child {
    border-right: 1px solid #e2e8f0;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.t-table tbody tr.data-row { 
    box-shadow: 0 2px 4px rgba(0,0,0,0.01); 
    transition: transform 0.2s ease, box-shadow 0.2s ease; 
}
.t-table tbody tr.data-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(48, 82, 138, 0.08);
}
.t-table tbody tr.data-row:hover td { 
    border-color: #cbd5e1; 
}

.dt-pagination-wrapper { 
    flex-shrink: 0; 
    background: #ffffff; 
    border-top: 1px solid #e2e8f0; 
    padding: 10px 24px; 
    z-index: 5; 
    min-height: 50px; 
}
.dataTables_info { font-size: 0.8rem; font-weight: 600; color: #64748b; padding: 0 !important; }
.pagination { margin: 0 !important; gap: 4px; }
.page-link { border-radius: 8px !important; border: none; color: #475569; font-weight: 700; font-size: 0.8rem; padding: 6px 12px; transition: 0.2s; }
.page-item.active .page-link { background-color: var(--tirta-blue); color: #fff; box-shadow: 0 2px 5px rgba(48,82,138,0.3); }
.page-link:hover:not(.active) { background-color: #f1f5f9; color: var(--tirta-blue); }

/* ==========================================================================
   4. INLINE ACTION ICONS & AVATAR
   ========================================================================== */
.action-container { display: flex; align-items: center; justify-content: center; gap: 6px; }
.inline-action-btn { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: #f8fafc; border: 1px solid transparent; cursor: pointer; transition: 0.2s; font-size: 0.85rem; }
.inline-action-btn:hover { transform: scale(1.15); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.btn-edit { color: var(--tirta-gold); border-color: #e2e8f0; }
.btn-edit:hover { background: rgba(167,135,89,0.1); border-color: var(--tirta-gold); }
.btn-delete { color: var(--tirta-red); border-color: #e2e8f0; }
.btn-delete:hover { background: rgba(236,54,58,0.1); border-color: var(--tirta-red); color: white !important; }

.avatar-circle { display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: bold; flex-shrink: 0; }
.wa-badge { transition: all 0.2s ease; cursor: pointer; text-decoration: none !important; }
.wa-badge:hover { background-color: #dcfce7 !important; transform: scale(1.05); }

/* ==========================================================================
   5. SPINNER OVERLAY
   ========================================================================== */
.sch-loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(3px); z-index: 50; display: flex; justify-content: center; align-items: center; border-radius: 8px; }
.mini-spinner { width: 3.5rem; height: 3.5rem; border-radius: 50%; border: 4px solid rgba(48, 82, 138, 0.1); border-top-color: var(--tirta-blue); border-right-color: var(--tirta-red); animation: tmc-spin-1 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite; position: relative; box-shadow: 0 0 15px rgba(48, 82, 138, 0.1); }
.mini-spinner::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--tirta-gold); border-left-color: var(--tirta-gold); animation: tmc-spin-2 0.7s linear infinite reverse; }
@keyframes tmc-spin-1 { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes tmc-spin-2 { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================================================
   6. THE REAL INNER SCROLL & ANTI-BOCOR FIX
   ========================================================================== */
/* Efek Loading Kapsul */
.shimmer-box {
    background: #f6f7f8;
    background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%;
    animation-duration: 1.5s;
    animation-fill-mode: forwards;
    animation-iteration-count: infinite;
    animation-name: placeholderShimmer;
    animation-timing-function: linear;
}
@keyframes placeholderShimmer { 0% { background-position: -468px 0; } 100% { background-position: 468px 0; } }

/* 1. KUNCI MATI KOTAK PUTIH UTAMA (Nggak Boleh Melar & Nggak Boleh Scroll) */
.setup-main-card {
    flex: 1 !important;
    min-height: 0 !important; 
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important; 
}

/* 2. AREA INI DOANG YANG BOLEH SCROLL (Scroll Dalam) */
.table-responsive-wrapper {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important; 
    overflow-x: hidden !important;
    padding-bottom: 20px !important; /* Biar baris paling bawah nggak nempel banget */
}

/* 3. JINAKKAN DATATABLES BIAR NGGAK NGEBLOKIR SCROLL KITA */
.table-responsive-wrapper .dataTables_wrapper {
    display: block !important;
    height: auto !important;
    min-height: min-content !important;
    overflow: visible !important;
}