/* ══════════════════════════════════════════════════════════════════════
   Tabel Dinamis — Accordion Sequential Wizard
   BKKBN Kalimantan Selatan
   ══════════════════════════════════════════════════════════════════════ */

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.font-mono-num {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* ── Toast Container ── */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

/* ── Scrollbar ── */
.qb-custom-scrollbar::-webkit-scrollbar,
.qb-table-scroll-wrap::-webkit-scrollbar {
    width: 6px; height: 6px;
}
.qb-custom-scrollbar::-webkit-scrollbar-track,
.qb-table-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.8); border-radius: 4px;
}
.qb-custom-scrollbar::-webkit-scrollbar-thumb,
.qb-table-scroll-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1; border-radius: 4px;
}
.qb-custom-scrollbar::-webkit-scrollbar-thumb:hover,
.qb-table-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ══════════════════════════════════════════════════════════════
   ACCORDION STEPS
   ══════════════════════════════════════════════════════════════ */
.qb-accordion {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.qb-accordion:has(.qb-accordion-body.open) {
    border-color: #0284c7;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.08);
}

.qb-accordion.locked .qb-accordion-header {
    opacity: 0.5;
    cursor: not-allowed;
}

.qb-accordion.done {
    border-color: #a7f3d0;
}

.qb-accordion.done .qb-step-num {
    background: #059669;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.qb-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.qb-accordion-header:hover {
    background: #f8fafc;
}

.qb-acc-chevron {
    color: #94a3b8;
    font-size: 12px;
    transition: transform 0.25s ease;
}

.qb-accordion-body.open ~ .qb-accordion-header .qb-acc-chevron,
.qb-accordion:has(.qb-accordion-body.open) .qb-acc-chevron {
    transform: rotate(180deg);
}

.qb-accordion-body {
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
}

.qb-accordion-body.open {
    max-height: 800px;
    padding: 0 20px 20px 20px;
    opacity: 1;
}

/* Step Number */
.qb-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-weight: 800;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.qb-step-num.active {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* ── Kategori Buttons ── */
.qb-kategori-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    min-width: 140px;
}

.qb-kategori-btn i {
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    flex-shrink: 0;
    transition: all 0.2s;
}

.qb-kategori-btn:hover {
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.qb-kategori-btn.active {
    border-color: #0284c7;
    background: #f0f9ff;
    color: #0c4a6e;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.15);
}

.qb-kategori-btn.active i {
    background: #0284c7;
    color: #ffffff;
}

/* ── Indicator / Wilayah Grids ── */
.qb-indicator-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
@media (min-width: 768px) {
    .qb-indicator-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.qb-wilayah-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 640px) {
    .qb-wilayah-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .qb-wilayah-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ── Measure Grid ── */
.qb-measure-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
}
@media (min-width: 640px) {
    .qb-measure-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.qb-measure-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.qb-measure-card:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-1px);
}

.qb-measure-card.active {
    border-color: #0284c7;
    background: #f0f9ff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12);
}

.qb-measure-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.qb-measure-content {
    flex: 1;
    min-width: 0;
}

/* ── Checkbox Items ── */
.qb-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    min-width: 0;
    box-sizing: border-box;
}

.qb-check-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.qb-check-item.selected {
    background: #f0f9ff;
    border-color: #bae6fd;
}

/* ══════════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════════ */
.qb-table-scroll-wrap {
    max-height: calc(100vh - 220px);
    overflow: auto;
    position: relative;
    background: #ffffff;
}

.qb-dynamic-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.qb-dynamic-table th,
.qb-dynamic-table td {
    padding: 8px 14px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.qb-dynamic-table thead th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 20;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.qb-dynamic-table thead tr:first-child th {
    top: 0;
    z-index: 22;
}

.qb-dynamic-table thead tr.qb-thead-subrow th {
    z-index: 21;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 6px 10px;
    border-right: 1px solid #cbd5e1;
}

/* ── Year Theme Colors for Table ── */
.qb-year-th-2024 {
    background: #fef3c7 !important;
    color: #78350f !important;
    border-bottom: 2.5px solid #d97706 !important;
}
.qb-year-td-2024 {
    background-color: rgba(254, 243, 199, 0.25) !important;
}

.qb-year-th-2025 {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border-bottom: 2.5px solid #0284c7 !important;
}
.qb-year-td-2025 {
    background-color: rgba(224, 242, 254, 0.25) !important;
}

.qb-year-th-2026 {
    background: #d1fae5 !important;
    color: #065f46 !important;
    border-bottom: 2.5px solid #059669 !important;
}
.qb-year-td-2026 {
    background-color: rgba(209, 250, 229, 0.25) !important;
}

.qb-year-th-2023 {
    background: #ede9fe !important;
    color: #5b21b6 !important;
    border-bottom: 2.5px solid #7c3aed !important;
}
.qb-year-td-2023 {
    background-color: rgba(237, 233, 254, 0.25) !important;
}

.qb-year-th-2022 {
    background: #ffe4e6 !important;
    color: #9f1239 !important;
    border-bottom: 2.5px solid #e11d48 !important;
}
.qb-year-td-2022 {
    background-color: rgba(255, 228, 230, 0.25) !important;
}

.qb-year-th-default {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-bottom: 2.5px solid #64748b !important;
}
.qb-year-td-default {
    background-color: rgba(241, 245, 249, 0.25) !important;
}

.qb-corner-cell {
    position: sticky !important;
    left: 0 !important; top: 0 !important;
    z-index: 30 !important;
    background: #f1f5f9 !important;
    border-right: 1px solid #cbd5e1 !important;
}

.qb-corner-cell-2 {
    position: sticky !important;
    left: 48px !important; top: 0 !important;
    z-index: 30 !important;
    background: #f1f5f9 !important;
    border-right: 2px solid #cbd5e1 !important;
}

.qb-sticky-col-idx {
    position: sticky; left: 0; z-index: 10;
    background: #ffffff;
    text-align: center;
    color: #94a3b8;
    font-size: 10px;
    width: 48px; min-width: 48px;
    border-right: 1px solid #e2e8f0;
}

.qb-sticky-col-title {
    position: sticky; left: 48px; z-index: 10;
    background: #ffffff;
    font-weight: 600;
    color: #1e293b;
    border-right: 2px solid #cbd5e1 !important;
    max-width: 340px; min-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.06);
}

.qb-dynamic-table tbody tr:nth-child(even) td { background-color: #fafbfc; }
.qb-dynamic-table tbody tr:nth-child(even) td.qb-sticky-col-idx,
.qb-dynamic-table tbody tr:nth-child(even) td.qb-sticky-col-title { background-color: #fafbfc; }

.qb-dynamic-table tbody tr:hover td { background-color: #f0f9ff !important; }
.qb-dynamic-table tbody tr:hover td.qb-sticky-col-idx,
.qb-dynamic-table tbody tr:hover td.qb-sticky-col-title { background-color: #e0f2fe !important; color: #0369a1; }

.qb-cell-empty { color: #cbd5e1; font-weight: 400; font-size: 11px; }

.qb-status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.qb-status-good { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.qb-status-bad { background-color: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

/* ── Print ── */
@media print {
    header, footer, #query-panel-card, #table-toolbar, #toast-container, .btn { display: none !important; }
    body { background: #ffffff !important; }
    main { max-width: 100% !important; padding: 0 !important; }
    .qb-table-scroll-wrap { max-height: none !important; overflow: visible !important; }
    .qb-dynamic-table { font-size: 9px !important; }
    .qb-dynamic-table th, .qb-dynamic-table td { padding: 4px 6px !important; border: 1px solid #000 !important; }
    .qb-corner-cell, .qb-sticky-col-idx, .qb-sticky-col-title { position: static !important; }
    #chart-wrapper { border: none !important; padding: 0 !important; }
    #chart-wrapper canvas { max-width: 100% !important; max-height: 500px !important; }
}
