/* AVOID STORE — CSS lokal tanpa proses build */
:root {
    --navy-900: #0b1f3f;
    --navy-800: #11305f;
    --navy-700: #1a4380;
    --navy-100: #e3eaf5;
    --bg: #f3f5f9;
    --surface: #ffffff;
    --border: #dde3ec;
    --text: #1b2433;
    --muted: #5d6b82;
    --green: #1b8a4c;
    --green-bg: #e3f5eb;
    --amber: #b86e00;
    --amber-bg: #fff2d9;
    --red: #c0312b;
    --red-bg: #fde8e7;
    --blue-bg: #e3eefc;
    --radius: 8px;
    --sidebar-w: 260px;
    --shadow: 0 1px 2px rgba(11, 31, 63, .06), 0 2px 8px rgba(11, 31, 63, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; color: var(--navy-900); }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Layout aplikasi */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--navy-900); color: #cfd9ea; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s ease; overflow-y: auto; }
.sidebar__brand { padding: 1.1rem 1.25rem; font-weight: 700; letter-spacing: .08em; color: #fff; font-size: 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar__brand small { display: block; font-weight: 400; letter-spacing: 0; font-size: .75rem; color: #8fa3c4; }
.sidebar__nav { padding: .75rem; flex: 1; }
.sidebar__group { margin: 1rem .5rem .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f95b8; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--radius); color: #cfd9ea; font-size: .92rem; min-height: 42px; }
.nav-link:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.nav-link.is-active { background: var(--navy-700); color: #fff; }
.sidebar-backdrop { display: none; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; min-height: 56px; }
.topbar__title { font-weight: 600; font-size: 1.05rem; color: var(--navy-900); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__menu { display: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: var(--radius); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-700); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
.user-menu__info { line-height: 1.2; text-align: left; }
.user-menu__info small { color: var(--muted); display: block; font-size: .75rem; }
.user-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .35rem; z-index: 50; }
.user-menu__panel a, .user-menu__panel button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .75rem; background: none; border: 0; border-radius: 6px; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.user-menu__panel a:hover, .user-menu__panel button:hover { background: var(--bg); text-decoration: none; }
.content { padding: 1.25rem; max-width: 1280px; width: 100%; margin: 0 auto; }
.conn { font-size: .75rem; padding: .15rem .6rem; border-radius: 99px; background: var(--red-bg); color: var(--red); display: none; }
.conn.is-offline { display: inline-block; }

/* Breadcrumb & page header */
.breadcrumb { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .82rem; color: var(--muted); margin-bottom: .75rem; list-style: none; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: .35rem; color: #a7b2c5; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

/* Kartu */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__body { padding: 1.25rem; }
.card__head { padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card__head h2 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { padding: 1.1rem 1.25rem; display: flex; gap: .9rem; align-items: center; }
.stat__icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); }
.stat--green .stat__icon { background: var(--green-bg); color: var(--green); }
.stat--amber .stat__icon { background: var(--amber-bg); color: var(--amber); }
.stat--red .stat__icon { background: var(--red-bg); color: var(--red); }
.stat__value { font-size: 1.6rem; font-weight: 700; color: var(--navy-900); line-height: 1.1; }
.stat__label { color: var(--muted); font-size: .85rem; }

/* Tombol */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .55rem 1rem; min-height: 42px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; background: var(--navy-700); color: #fff; text-decoration: none; }
.btn:hover { background: var(--navy-800); text-decoration: none; }
.btn:disabled, .btn.is-loading { opacity: .65; cursor: progress; }
.btn--secondary { background: var(--surface); color: var(--navy-800); border-color: var(--border); }
.btn--secondary:hover { background: var(--bg); }
.btn--danger { background: var(--red); }
.btn--danger:hover { background: #9f2722; }
.btn--sm { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
.btn--block { width: 100%; }

/* Form */
.form-row { margin-bottom: 1rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
label.form-label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.form-control { width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1px solid #c4cddc; border-radius: var(--radius); font: inherit; background: #fff; color: var(--text); }
.form-control:focus { outline: 2px solid var(--navy-700); outline-offset: 0; border-color: var(--navy-700); }
.form-control.is-invalid { border-color: var(--red); }
textarea.form-control { min-height: 90px; }
.form-help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.form-error { font-size: .82rem; color: var(--red); margin-top: .25rem; }
.check { display: flex; align-items: center; gap: .55rem; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--navy-700); }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }

/* Filter */
.filter { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.filter .form-row { margin: 0; flex: 1 1 170px; }

/* Tabel */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .92rem; }
.table th { background: #f7f9fc; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tbody tr:hover { background: #fafbfd; }
.table .actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.table td.num, .table th.num { text-align: right; }

/* Badge */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--navy-100); color: var(--navy-800); white-space: nowrap; }
.badge--green { background: var(--green-bg); color: var(--green); }
.badge--amber { background: var(--amber-bg); color: var(--amber); }
.badge--red { background: var(--red-bg); color: var(--red); }
.badge--blue { background: var(--blue-bg); color: var(--navy-700); }
.badge--gray { background: #eceff4; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; }

/* Alert, empty, error, loading */
.alert { display: flex; gap: .7rem; padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1rem; }
.alert--success { background: var(--green-bg); border-color: #b5e2c8; color: #12663a; }
.alert--warning { background: var(--amber-bg); border-color: #f2d596; color: #8a5200; }
.alert--danger { background: var(--red-bg); border-color: #f5c0bd; color: #8e231f; }
.alert--info { background: var(--blue-bg); border-color: #bcd3f2; color: #1a4380; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; color: #a7b2c5; margin-bottom: .5rem; }
.empty h3 { color: var(--text); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.is-loading .spinner { display: inline-block; }
.loading-box { padding: 2rem; text-align: center; color: var(--muted); }
.loading-box .spinner { display: inline-block; border-color: #c4cddc; border-top-color: var(--navy-700); width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toasts { position: fixed; right: 1rem; top: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .6rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast { padding: .8rem 1rem; border-radius: var(--radius); color: #fff; background: var(--navy-800); box-shadow: 0 6px 20px rgba(11, 31, 63, .25); display: flex; align-items: flex-start; gap: .6rem; animation: slide-in .2s ease; }
.toast--success { background: var(--green); } .toast--error { background: var(--red); } .toast--warning { background: var(--amber); }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.2rem; line-height: 1; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Modal */
dialog.modal { border: 0; border-radius: 12px; padding: 0; width: min(440px, calc(100vw - 2rem)); box-shadow: 0 20px 50px rgba(11, 31, 63, .35); }
dialog.modal::backdrop { background: rgba(11, 31, 63, .55); }
.modal__body { padding: 1.4rem; }
.modal__foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 0 1.4rem 1.4rem; flex-wrap: wrap; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; }
.pagination__links { display: flex; gap: .3rem; flex-wrap: wrap; }
.pagination a, .pagination span.page { min-width: 38px; height: 38px; padding: 0 .6rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: #fff; font-size: .88rem; }
.pagination a:hover { background: var(--bg); text-decoration: none; }
.pagination .is-current { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.pagination .is-disabled { color: #a7b2c5; background: #f7f9fc; }

/* Halaman tamu (login, error) */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); }
.guest__card { width: min(420px, 100%); background: #fff; border-radius: 12px; padding: 2rem 1.6rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.guest__brand { text-align: center; margin-bottom: 1.4rem; }
.guest__brand strong { display: block; font-size: 1.5rem; letter-spacing: .1em; color: var(--navy-900); }
.guest__brand span { color: var(--muted); font-size: .85rem; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--navy-700); text-align: center; line-height: 1; }

/* Matriks izin */
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; }
.perm-group__head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 1rem; background: #f7f9fc; border-bottom: 1px solid var(--border); font-weight: 600; }
.perm-group__body { padding: .5rem 1rem; display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.install-hint { font-size: .85rem; }

/* Responsif */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
    .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(11, 31, 63, .5); z-index: 35; }
    .main { margin-left: 0; }
    .topbar__menu { display: inline-flex; }
    .user-menu__info { display: none; }
    .content { padding: 1rem; }
    .table th, .table td { padding: .6rem .7rem; }
}
@media (max-width: 560px) {
    .stat__value { font-size: 1.35rem; }
    .btn { width: auto; }
    .form-actions .btn { flex: 1 1 auto; }
    .pagination { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Produksi: galeri bukti foto, kartu tahap */
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; margin: .5rem 0; }
.evidence-item { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; font-size: .75rem; }
.evidence-item img { display: block; width: 100%; height: 90px; object-fit: cover; background: var(--bg); }
.evidence-item div { padding: .3rem .4rem; }
.stage-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: #fff; }
.stage-card--done { border-left: 4px solid var(--green); }
.stage-card--active { border-left: 4px solid var(--navy-700); }
.metrics { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .5rem 0; }
.metrics span strong { font-size: 1.1rem; color: var(--navy-900); }
.queue { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; align-items: start; }
.queue__col { background: #eef1f6; border-radius: var(--radius); padding: .75rem; }
.queue__col h3 { margin: 0 0 .6rem; }
.queue__card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .75rem; margin-bottom: .5rem; font-size: .88rem; }
