/* OPERA — tema mengikuti mockup: sidebar navy, aksen merah, kartu putih. */
:root {
    --brand: #c8102e;
    --brand-ink: #9e0c24;
    --navy: #0f1b2d;
    --navy-2: #182840;
    --bg: #f2f4f8;
    --surface: #ffffff;
    --line: #e3e7ee;
    --ink: #1a2333;
    --muted: #6b7587;
    --ok: #10915a;
    --warn: #d98a00;
    --info: #2563eb;
    --radius-lg: 14px;
    --radius: 9px;
    --radius-sm: 6px;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.mt { margin-top: 18px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--navy) 260px, var(--bg) 260px); }
.sidebar { background: var(--navy); color: #c6cfdd; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding: 4px 10px 18px; }
.brand--dark { color: var(--ink); padding: 0 0 24px; }
.brand__mark { display: grid; grid-template-columns: repeat(2, 9px); gap: 2px; }
.brand__mark i { width: 9px; height: 9px; border-radius: 50%; }
.brand__mark i:nth-child(1) { background: #e63946; } .brand__mark i:nth-child(2) { background: #f4a261; }
.brand__mark i:nth-child(3) { background: #2a9d8f; } .brand__mark i:nth-child(4) { background: #457bdd; }
.brand__name { font-weight: 800; letter-spacing: .08em; font-size: 16px; }
.nav__group { font-size: 11px; font-weight: 600; color: #6f7d94; margin: 16px 10px 6px; }
.nav__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; font-size: 13px; font-weight: 500; }
.nav__item svg { width: 17px; height: 17px; flex: none; }
.nav__item:hover { background: var(--navy-2); color: #fff; }
.nav__item.is-active { background: var(--brand); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 500; }
.topbar__title { display: flex; flex-direction: column-reverse; }
.topbar__title h1 { font-size: 18px; font-weight: 800; }
.crumb { margin: 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .topbar__menu { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.user-chip__text { display: flex; flex-direction: column; font-size: 12px; line-height: 1.3; }
.user-chip__text small { color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--info); color: #fff; display: grid; place-items: center; font-weight: 700; }
.content { padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 18px; }

/* Building blocks */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.box { background: #f8f9fb; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.box h3 { margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.title-lg { font-size: 17px; }
.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--map { grid-template-columns: 1.7fr 1fr; }
.grid--detail { grid-template-columns: 1fr 300px; }
.link { color: var(--brand); font-weight: 600; font-size: 13px; text-decoration: none; }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: #f1f3f7; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 600; font-size: 13px; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-ink); }
.btn--block { width: 100%; }
.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 14px; text-decoration: none; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.is-active { color: var(--brand); border-color: var(--brand); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.kpi__icon { width: 42px; height: 42px; flex: none; border-radius: var(--radius); background: var(--brand); color: #fff; display: grid; place-items: center; }
.kpi__label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi__value { margin: 2px 0; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi__hint { margin: 0; font-size: 12px; color: var(--muted); }

/* Charts & lists */
.donut { position: relative; width: 190px; margin: 0 auto 14px; }
.donut strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; pointer-events: none; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i, .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.legend b { margin-left: auto; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border: 0; }
.feed a, .feed span:not(.badge):not(.dot) { flex: 1; display: flex; flex-direction: column; text-decoration: none; min-width: 0; }
.feed small { color: var(--muted); }
.feed svg { width: 18px; color: var(--muted); }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.badge--new, .badge--reopened { background: #e8efff; color: var(--info); }
.badge--assigned, .badge--in_progress { background: #fff4dd; color: var(--warn); }
.badge--escalated, .badge--offline { background: #fde8eb; color: var(--brand); }
.badge--resolved, .badge--verified, .badge--online { background: #e3f6ec; color: var(--ok); }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-sm); color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.sev { font-weight: 700; font-size: 12px; }
.sev--critical { color: var(--brand); } .sev--high { color: #e0531f; } .sev--medium { color: var(--warn); } .sev--low { color: var(--ok); }

/* Tables & forms */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: #fafbfd; }
.table a { font-weight: 600; text-decoration: none; }
.sub { display: block; color: var(--muted); }
.table td.mono { white-space: nowrap; }
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; }
.pagination a { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; font-size: 13px; }
.pagination .active a { background: var(--brand); border-color: var(--brand); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; min-height: 36px; }
input[type=checkbox] { min-height: 0; }
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto; gap: 12px; align-items: end; }
.form { display: grid; gap: 14px; }
.form--grid { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: span 2; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
legend { font-weight: 700; padding: 0 6px; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 10px; }
.form__actions { display: flex; justify-content: flex-end; gap: 10px; }
.action { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.person span:last-child { display: flex; flex-direction: column; }
.person small { color: var(--muted); }
.person .avatar { background: #fde8eb; color: var(--brand); }
input[type=file] { padding: 6px; font-size: 13px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #f4f6f9; border-radius: var(--radius-sm); padding: 4px 10px; margin-right: 10px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
.summary { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.summary li { background: #f6f7fa; border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; color: var(--muted); }
.summary b { display: block; font-size: 18px; color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.flash { padding: 10px 14px; border-radius: var(--radius); font-weight: 600; }
.flash--ok { background: #e3f6ec; color: var(--ok); }
.flash--err { background: #fde8eb; color: var(--brand); }

/* Timeline & media */
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 8px; }
.timeline li::before { content: ""; position: absolute; left: -23px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.timeline p { margin: 4px 0; }
.timeline small { color: var(--muted); }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.media img, .media video { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); display: block; background: #000; }
.doc { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.upload { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Maps */
.map { width: 100%; border-radius: var(--radius); z-index: 1; }
.map--mini { height: 320px; }
.map--pick { height: 280px; margin-top: 8px; }
.map--full { height: calc(100vh - 140px); min-height: 460px; border-radius: 0; }
.map-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; }
.checks { display: grid; gap: 8px; margin-top: 10px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 13px; }

/* CCTV wall — satu-satunya area gelap selain sidebar, supaya video terasa seperti control room */
.cams { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 12px; background: var(--navy); padding: 12px; border-radius: var(--radius-lg); }
.cam { margin: 0; background: #0a1322; border-radius: var(--radius); overflow: hidden; color: #d9e0ea; }
.cam figcaption, .cam footer { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; font-weight: 600; }
.cam figcaption small { margin-left: auto; color: #7d8aa0; font-weight: 500; }
.cam footer { justify-content: space-between; color: #7d8aa0; font-weight: 500; }
.cam .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(16,145,90,.25); }
.cam--offline .dot, .cam--unknown .dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(200,16,46,.25); }
.cam figcaption small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam__view { aspect-ratio: 16/9; background: #000; display: grid; place-items: center; position: relative; }
.cam--offline .cam__view img { filter: grayscale(1) brightness(.35); }
.cam--offline .cam__view::after { content: "Sinyal terputus · menampilkan frame terakhir"; position: absolute; inset: auto 0 50%; transform: translateY(50%); text-align: center; font-size: 12px; font-weight: 700; color: #ffb3bf; }
.cam__view img, .cam__view video { width: 100%; height: 100%; object-fit: cover; }
.cam__off { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #7d8aa0; font-size: 12px; }
.seg { display: flex; gap: 4px; }

/* Login */
.login { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; min-height: 100vh; background: var(--surface); }
.login__panel { padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.login__panel h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login__panel .form { margin-top: 24px; }
.login__art { background: radial-gradient(circle at 75% 20%, #23395c, var(--navy) 65%); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: flex-end; }
.login__art h2 { font-size: 34px; font-weight: 800; line-height: 1.15; max-width: 16ch; }
.login__art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 560px; }
.login__art li { border-top: 2px solid var(--brand); padding-top: 10px; color: #c6cfdd; font-size: 13px; }
.login__art li strong { display: block; color: #fff; font-size: 14px; }

.sidebar-scrim { display: none; }

/* Responsive */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .grid--map, .grid--2, .grid--detail, .map-layout { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr 1fr; }
    .facts { grid-template-columns: repeat(2, 1fr); }
    .cams { --cols: 2 !important; }
}
@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; background: var(--bg); }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 1000; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.is-open { transform: none; }
    .sidebar.is-open + .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(15,27,45,.5); z-index: 999; }
    .topbar .topbar__menu { display: inline-grid; }
    .user-chip__text { display: none; }
    .content { padding: 16px; }
    .filters, .form--grid { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi { flex-direction: column; gap: 8px; padding: 12px; }
    .kpi__icon { width: 32px; height: 32px; }
    .kpi__icon svg { width: 17px; height: 17px; }
    .kpi__value { font-size: 22px; }
    .topbar { padding: 10px 14px; gap: 10px; }
    .topbar__title h1 { font-size: 16px; }
    .facts { grid-template-columns: 1fr 1fr; }
    .media { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    input[type=file] { max-width: 100%; }
    .span-2 { grid-column: auto; }
    .cams { --cols: 1 !important; }
    .login { grid-template-columns: 1fr; }
    .login__art { display: none; }
    .login__panel { padding: 40px 24px; }
}
/* ---------- Sidebar modul (accordion) ---------- */
.nav__module { margin: 1px 0; }
.nav__module summary { list-style: none; cursor: pointer; }
.nav__module summary::-webkit-details-marker { display: none; }
.nav__item.is-current { color: #fff; }
.nav__caret { margin-left: auto; width: 15px !important; height: 15px !important; opacity: .55; transition: transform .15s; }
.nav__module[open] .nav__caret { transform: rotate(180deg); }
.nav__sub { display: block; padding: 6px 10px 6px 37px; font-size: 12.5px; text-decoration: none; color: #9aa6b8; border-radius: var(--radius-sm); position: relative; }
.nav__sub:hover { color: #fff; background: var(--navy-2); }
.nav__sub.is-active { color: #fff; background: var(--brand); }
.nav__sub.is-planned::after { content: ""; position: absolute; right: 10px; top: 50%; width: 5px; height: 5px; margin-top: -2px; border-radius: 50%; background: #3b4a62; }

/* ---------- Umum admin ---------- */
.kpis--slim .kpi { align-items: center; padding: 14px 16px; }
.kpis--slim .kpi__value { font-size: 22px; margin: 0; }
.filters--users { grid-template-columns: 2fr 1fr 1.4fr 1fr auto; }
.filters--audit { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.avatar--sm { width: 30px; height: 30px; font-size: 13px; background: #e8efff; color: var(--info); flex: none; }
.person a { font-weight: 600; text-decoration: none; }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 2px; border-radius: 99px; background: color-mix(in srgb, var(--app) 9%, white); color: color-mix(in srgb, var(--app) 80%, black); white-space: nowrap; }
.role-chip b { font-size: 10px; letter-spacing: .03em; padding: 2px 6px; border-radius: 99px; background: var(--app); color: #fff; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.row-actions .icon-btn { width: 32px; height: 32px; }
.btn--sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn--ghost-danger { color: var(--brand); border-color: #f3c3cb; margin-right: auto; }
.chip--xs { font-size: 10.5px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
.coverage { min-width: 160px; }
.bar { height: 6px; border-radius: 99px; background: #edf0f5; overflow: hidden; margin-bottom: 4px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.coverage small { color: var(--muted); }
.stack { display: grid; gap: 18px; align-content: start; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state > svg { width: 36px; height: 36px; color: var(--muted); margin-bottom: 10px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-state p { max-width: 60ch; margin: 6px auto; }

/* ---------- Form user ---------- */
.form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.form-layout__main, .form-layout__side { display: grid; gap: 18px; }
.form-layout__side { position: sticky; top: 84px; }
.form--narrow { max-width: 760px; }
.form__actions--stack { display: grid; gap: 8px; justify-content: stretch; }
.table--middle td { vertical-align: middle; }
.app-tile__roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.app-tile__roles span { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--app) 10%, white); color: color-mix(in srgb, var(--app) 80%, black); }
.app-access { border: 1px solid var(--line); border-left: 4px solid var(--app); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.app-access__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.app-access__head .muted { margin-left: auto; font-size: 12px; }
.app-dot { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--app, #475569); color: #fff; flex: none; }
.app-dot svg { width: 16px; height: 16px; }
.app-dot--lg { width: 40px; height: 40px; border-radius: 11px; }
.app-dot--lg svg { width: 21px; height: 21px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check-card { flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; color: var(--ink); font-weight: 400; }
.check-card:has(input:checked) { border-color: var(--app, var(--brand)); background: color-mix(in srgb, var(--app, var(--brand)) 6%, white); }
.check-card input { margin-top: 2px; flex: none; }
.check-card span { display: flex; flex-direction: column; font-size: 13px; }
.check-card small { color: var(--muted); font-size: 12px; }
.switch { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; font-size: 13px; cursor: pointer; }
.switch--inline { align-self: end; padding-bottom: 8px; }
.meta { display: grid; gap: 10px; margin: 6px 0 12px; font-size: 13px; }
.meta dt { color: var(--muted); font-size: 12px; }
.meta dd { margin: 2px 0 0; font-weight: 600; word-break: break-all; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.secret { display: block; padding: 8px; background: #fff7e0; border-radius: var(--radius-sm); font-size: 12px; word-break: break-all; margin-bottom: 4px; }
input[type=color] { padding: 3px; height: 38px; }

/* ---------- Matriks akses ---------- */
.matrix-bar { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.matrix-bar__pick { display: flex; gap: 12px; flex-wrap: wrap; }
.matrix-bar__pick label { min-width: 200px; }
.matrix-bar__info { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; }
.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix-form { overflow: visible; }
.matrix thead th { position: sticky; top: 64px; z-index: 2; background: #f6f7fa; font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: center; width: 84px; }
.matrix thead th.matrix__menu { text-align: left; width: auto; padding-left: 18px; }
.matrix td { text-align: center; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.matrix th[scope=row] { text-align: left; font-weight: 600; padding: 9px 8px 9px 52px; border-bottom: 1px solid var(--line); }
.matrix th[scope=row] .sub { font-weight: 400; font-size: 11px; }
.matrix__module th, .matrix__module td { background: #fbfbfd; border-bottom: 1px solid var(--line); }
.matrix__module th { text-align: left; padding: 10px 8px 10px 14px; font-weight: 700; }
.matrix__module th > svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 8px; color: var(--brand); }
.matrix__fold { border: 0; background: none; padding: 0; margin-right: 4px; cursor: pointer; color: var(--muted); vertical-align: middle; }
.matrix__fold svg { width: 16px; height: 16px; transition: transform .15s; }
.matrix__group.is-folded .matrix__fold svg { transform: rotate(-90deg); }
.matrix__group.is-folded .matrix__row { display: none; }
.matrix__count { margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--muted); background: #eef1f6; padding: 1px 8px; border-radius: 99px; }
.matrix__count.is-full { background: #e3f6ec; color: var(--ok); }
.matrix__row:hover th, .matrix__row:hover td { background: #fcf6f7; }
.matrix__row.is-off { opacity: .5; }
.matrix input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
.matrix .na { color: #c9ced8; }
.matrix-save { position: sticky; bottom: 0; z-index: 3; border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); flex-wrap: wrap; }
.matrix-save div { display: flex; gap: 8px; }

/* ---------- Aplikasi ---------- */
.app-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.app-card { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--app); border-radius: var(--radius-lg); padding: 18px; text-decoration: none; }
.app-card:hover { border-color: color-mix(in srgb, var(--app) 45%, var(--line)); border-top-color: var(--app); }
.app-card header { display: flex; align-items: center; gap: 12px; }
.app-card header > span:nth-child(2) { display: flex; flex-direction: column; margin-right: auto; }
.app-card header small { color: var(--muted); }
.app-card p { margin: 0; }
.app-card__stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-top: 1px solid var(--line); padding-top: 12px; }
.app-card__stats dt { font-size: 11px; color: var(--muted); }
.app-card__stats dd { margin: 0; font-size: 20px; font-weight: 800; }
.menu-tree details { border-bottom: 1px solid var(--line); }
.menu-tree summary { display: flex; align-items: center; gap: 10px; padding: 12px 4px; cursor: pointer; list-style: none; }
.menu-tree summary svg { width: 16px; height: 16px; color: var(--brand); }
.menu-tree summary .muted { margin-left: auto; font-size: 12px; }
.menu-tree ul { list-style: none; margin: 0 0 10px; padding: 0 0 0 30px; }
.menu-tree li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--line); }
.menu-tree li.is-off .menu-tree__name { opacity: .45; text-decoration: line-through; }
.menu-tree__name { flex: 1; display: flex; flex-direction: column; font-size: 13px; font-weight: 600; }
.menu-tree__name small { font-weight: 400; font-size: 11px; }
.acts { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.act { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: #eef1f6; color: var(--muted); }
.act--approve { background: #e3f6ec; color: var(--ok); } .act--delete { background: #fde8eb; color: var(--brand); } .act--export { background: #e8efff; color: var(--info); }
.toggle { width: 36px; height: 20px; border-radius: 99px; border: 0; background: #d5dae3; position: relative; cursor: pointer; flex: none; }
.toggle span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.is-on { background: var(--ok); }
.toggle.is-on span { left: 18px; }
.payload code { font-size: 11.5px; color: var(--muted); }

/* ---------- Portal ---------- */
.portal__hello { font-size: 15px; color: var(--muted); margin: 0 0 4px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.app-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 24px; min-height: 250px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); text-decoration: none; overflow: hidden; }
.app-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--app); }
.app-tile:hover { border-color: var(--app); }
.app-tile__icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: var(--app); color: #fff; margin-bottom: 8px; }
.app-tile__code { font-size: 11px; font-weight: 700; color: var(--app); }
.app-tile strong { font-size: 18px; }
.app-tile__go { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; color: var(--app); }
.app-tile__go svg { width: 15px; height: 15px; }

@media (min-width: 900px) { .matrix-form .table-wrap { overflow: visible; } }
@media (max-width: 899px) { .matrix thead th { top: 0; } }
@media (max-width: 1100px) {
    .form-layout { grid-template-columns: 1fr; }
    .form-layout__side { position: static; }
    .filters--users, .filters--audit { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
    .filters--users, .filters--audit { grid-template-columns: 1fr; }
    .matrix thead th { width: 56px; font-size: 10.5px; padding: 10px 4px; }
    .matrix th[scope=row] { padding-left: 14px; min-width: 150px; }
    .matrix-bar__pick label { min-width: 0; flex: 1 1 140px; }
    .matrix-bar__info { align-items: flex-start; }
    .danger-zone { flex-direction: column; align-items: stretch; }
    .row-actions .btn--sm { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
