* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

details.edit-box summary::-webkit-details-marker { display: none; }
details.edit-box summary { cursor: pointer; list-style: none; }

/* Menu sidebar bertingkat (accordion) */
details.app-nav-group>summary { list-style: none; }
details.app-nav-group>summary::-webkit-details-marker { display: none; }
details.app-nav-group[open]>summary .nav-chevron { transform: rotate(180deg); }
details.app-nav-group .nav-sub { border-left: 1px solid #e2e8f0; margin-left: 1.1rem; }
details.app-nav-group[open] .nav-sub .app-nav-link { border-radius: .625rem; }

.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .875rem;
    line-height: 1.25rem;
    border-radius: .75rem;
    padding: .625rem 1rem;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    cursor: pointer;
    white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: #4f46e5; color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .35); }
.btn-primary:hover { background: #4338ca; }

.btn-secondary { background: #fff; border: 1px solid #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #f8fafc; }

.btn-danger { background: #fff; border: 1px solid #fecdd3; color: #e11d48; }
.btn-danger:hover { background: #fff1f2; }

.btn-ghost { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; }

.btn-sm { padding: .375rem .75rem; font-size: .8125rem; border-radius: .625rem; }

.input, .select, .textarea {
    display: block;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    padding: .625rem .875rem;
    font-size: .875rem;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.input::placeholder { color: #94a3b8; }

.label { display: block; font-size: .8125rem; font-weight: 600; color: #334155; margin-bottom: .375rem; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    border-radius: .75rem;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.45;
}
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.alert-error   { background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

.toast { transition: opacity .3s ease, transform .3s ease; }

.bar-anim { animation: grow .7s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes grow { from { width: 0; } }

table.data-table th {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    font-weight: 700;
}
table.data-table td { font-size: .875rem; }

/* ============================================================
   KERANGKA LAYOUT (struktur posisi sidebar + isi — TIAP browser)
   Tidak bergantung pada Tailwind (yang dihasilkan JavaScript).
   Bila Tailwind jalan, property detailnya melengkapi di sini.
   ============================================================ */

.app-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

.app-main { display: flex; flex-direction: column; min-width: 0; }

.app-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 4rem;
    padding: 0 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, .9);
}

.app-content {
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem .75rem;
    margin-bottom: .25rem;
    border-radius: .75rem;
    font-size: .875rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
}
.app-nav-link:hover { background: #f1f5f9; }
.app-nav-link.is-active { background: #eef2ff; color: #4338ca; }

/* Desktop (lg ke atas): sidebar kiri + isi di kanan */
@media (min-width: 1024px) {
    .app-shell { display: flex; align-items: stretch; }

    .app-sidebar {
        position: sticky !important;
        top: 0;
        align-self: flex-start;
        flex: 0 0 16rem;
        width: 16rem;
        height: 100vh;
        overflow-y: auto;
        transform: none !important;
    }

    .app-main { flex: 1 1 0%; }
    .app-content { max-width: 80rem; padding: 1.5rem 2rem; }
    .app-toolbar { padding: 0 2rem; }
    .app-hamburger { display: none; }
}

/* Fallback minimal halaman login & instalasi bila Tailwind tidak jalan */
.min-h-screen { min-height: 100vh; }
.bg-slate-100 { background-color: #f1f5f9; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.items-start { align-items: flex-start; }
.font-sans { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; }