:root {
    --bg: #0f1115;
    --panel: #161a22;
    --muted: #8b93a7;
    --text: #e7ecf3;
    --primary: #4f8cff;
    --danger: #ff5d5d;
    --border: #2a3242;
}
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    display: flex;
    background: var(--bg);
    color: var(--text);
    font:
        14px/1.5 system-ui,
        Segoe UI,
        Roboto,
        Arial;
}

/* Loader */
.loading {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 999;
}
.loading.hidden {
    display: none;
}
.loading-box {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 16px 18px;
    border-radius: 12px;
    min-width: 260px;
}
.bar {
    height: 6px;
    background: #0c0f14;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.bar-progress {
    height: 100%;
    width: 40%;
    background: var(--primary);
    border-radius: 999px;
    animation: progress 1.2s linear infinite;
}
@keyframes progress {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(300%);
    }
}

.sidebar {
    width: 220px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    font-weight: 700;
    font-size: 18px;
}
.nav-btn {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
}
.nav-btn.active,
.nav-btn:hover {
    border-color: var(--primary);
}
.sidebar footer {
    margin-top: auto;
    color: var(--muted);
}

.content {
    flex: 1;
    padding: 24px;
    max-width: 1360px;
    margin: 0 auto;
    width: 100%;
}
.screen {
    display: none;
}
.screen.visible {
    display: block;
}

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

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}
.card-title {
    color: var(--muted);
    font-size: 12px;
}
.card-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 6px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0 12px;
}
.toolbar input[type="search"] {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0c0f14;
    color: var(--text);
}
.toolbar select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0c0f14;
    color: var(--text);
}
.checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
}
.muted {
    color: var(--muted);
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
}
th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
th {
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 1;
    text-align: left;
}
.sortable {
    cursor: pointer;
}
.sortable::after {
    content: " ↕";
    color: var(--muted);
    font-weight: 400;
}

.btn {
    background: #1a2130;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
}
.btn:hover {
    border-color: var(--primary);
}
.btn.primary {
    background: var(--primary);
    border-color: transparent;
    color: #fff;
}
.btn.danger {
    background: var(--danger);
    color: #000;
    border-color: transparent;
}
.btn.xs {
    padding: 4px 8px;
    font-size: 12px;
}

.cell-price {
    font-variant-numeric: tabular-nums;
}
.cell-actions {
    display: flex;
    gap: 6px;
}
.cell-updated,
.cell-deletedAt {
    white-space: nowrap;
}

.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
}

/* ==== Fix <dialog> putih & kontras modal ==== */
dialog {
    /* Hilangkan kotak putih bawaan dialog */
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text);
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.6); /* lebih gelap biar fokus */
    backdrop-filter: blur(2px);
}

/* Kontainer isi modal (form) */
.modal {
    background: #0c0f14; /* lebih gelap dari panel */
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    min-width: 720px;
    max-width: 920px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); /* hilangkan “kotak putih” */
    color-scheme: dark; /* bikin kontrol native (file input, dsb) pakai tema gelap */
}
.modal h3 {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 700;
}

/* Grid modal lebih rapi */
.modal-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
}
.modal-col label {
    display: block;
    font-size: 13px;
    margin-bottom: 10px;
}

/* Input/textarea gelap + fokus jelas */
.modal input,
.modal textarea,
.modal input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0a0e14;
    color: var(--text);
}
.modal input::placeholder,
.modal textarea::placeholder {
    color: var(--muted);
}
.modal input:focus,
.modal textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}

/* Frame gambar & placeholder */
.image-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.image-frame {
    position: relative;
    background: #0a0e14;
    border: 1px dashed var(--border);
    border-radius: 14px;
    overflow: hidden;
    min-height: 220px;
    display: grid;
    place-items: center;
}
.image-frame img {
    max-width: 100%;
    max-height: 360px;
    display: none;
    border-radius: 8px;
}
#img-placeholder {
    color: var(--muted);
    font-size: 13px;
}

/* Tombol area modal */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
.img-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 920px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .sidebar {
        width: 200px;
    }
    .modal {
        min-width: unset;
        max-width: 95vw;
    }
    .modal-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 640px) {
    .sidebar {
        display: none;
    }
    .content {
        padding: 16px;
    }
    .cards {
        grid-template-columns: 1fr;
    }
}
