/* AdaptifPDF web UI. Brand colours come from the logo: red #e40d1a on near-black navy #020815. */
:root {
  --bg: #f7f7f9; --card: #ffffff; --text: #141826; --muted: #5d6475; --line: #e3e5eb;
  --accent: #d10f1b; --accent2: #f0443c; --accent-soft: #fdecee; --ok: #1a7f37; --warn: #9a6700; --bad: #b42318; --info: #1d4ed8;
  --radius: 12px;
}
/* Dark theme: follows the OS unless the user picked one with the theme switch (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* --bg must equal the DARK_PAGE_BG printed by branding/make_assets.py so the faded logo melts into the page */
    --bg: #020815; --card: #0b1220; --text: #eceef3; --muted: #9aa2b4; --line: #1f2737;
    --accent: #ff4d55; --accent2: #ff7a4d; --accent-soft: #2a1118; --ok: #3fb950; --warn: #d29922; --bad: #ff8a80; --info: #6ea8fe;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] {
  --bg: #020815; --card: #0b1220; --text: #eceef3; --muted: #9aa2b4; --line: #1f2737;
  --accent: #ff4d55; --accent2: #ff7a4d; --accent-soft: #2a1118; --ok: #3fb950; --warn: #d29922; --bad: #ff8a80; --info: #6ea8fe;
  color-scheme: dark;
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; }
main.wide { max-width: 1100px; }
a { color: var(--accent); }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.brand { text-align: center; margin: 4px 0 14px; position: relative; }
.brand img { width: min(280px, 65vw); height: auto; display: block; margin: 0 auto; }
.brand .logo-dark { display: none; }  /* must outrank ".brand img" above */
.brand .muted { display: block; margin-top: 2px; }
.theme-switch { position: absolute; top: 0; right: 0; display: inline-flex; border: 1px solid var(--line);
                border-radius: 999px; overflow: hidden; background: var(--card); }
.theme-switch button { background: transparent; color: var(--muted); padding: 5px 11px; border-radius: 0; font-size: 12.5px; }
.theme-switch button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
@media (max-width: 560px) { .theme-switch { position: static; margin-bottom: 10px; } }

.userbar { display: flex; gap: 14px; justify-content: flex-end; align-items: center; font-size: 13.5px;
           margin: -4px 0 12px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 400px; margin-left: auto; margin-right: auto; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px 16px; text-align: center;
        cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { display: block; margin-bottom: 4px; }
.filelist { list-style: none; margin: 10px 0 0; padding: 0; }
.filelist li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px solid var(--line);
               font-size: 14px; }
.filelist li span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.profile { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; display: block; }
.profile:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.profile input { margin-right: 6px; }
.profile b { font-size: 14px; }
.profile span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.chips input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
div.field { margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
label.field { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
/* Home: "Apa yang ingin Anda lakukan?" — four modes, each shows only its own options */
h2.ask { font-size: 17px; margin: 6px 0 10px; text-align: center; }
.modes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 900px) { .modes { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .modes { grid-template-columns: repeat(2, 1fr); } }
.modes button { background: var(--card); border: 1px solid var(--line); color: var(--text); text-align: left;
                padding: 12px 14px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 3px; }
.modes button b { font-size: 15px; }
.modes button span { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.modes button:hover { border-color: var(--accent); }
.modes button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft);
                                      box-shadow: inset 0 0 0 1px var(--accent); }
.profile span.star { display: inline; color: var(--accent); font-size: 12px; font-weight: 700; margin-left: 6px; }
main.doc { max-width: 760px; }
main.doc h1 { font-size: 22px; }
main.doc h2 { font-size: 16px; margin-top: 22px; }
main.doc li { margin-bottom: 6px; }
.sitefoot { text-align: center; margin-top: 8px; }
textarea { resize: vertical; min-height: 80px; }
.filelist button.link { margin-left: 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 10px; font-size: 14px; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }
button { font: inherit; border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer; }
button.small { padding: 5px 10px; font-size: 13px; }
button.link { background: none; padding: 0; color: var(--accent); font-size: inherit; }
button.link.danger-link { color: var(--bad); }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-weight: 600;
           box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.primary:disabled { opacity: .5; cursor: not-allowed; }
.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.error { color: var(--bad); font-size: 13.5px; margin-top: 10px; min-height: 1em; }
.okmsg { color: var(--ok); font-size: 13.5px; margin-top: 10px; }

/* optimization report */
#report h3 { font-size: 14px; margin: 18px 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tile-value { font-size: 20px; font-weight: 700; margin: 2px 0; }
.verdict { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.verdict.ok { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.verdict.bad { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
#privacy h3 { font-size: 14px; margin: 18px 0 8px; }
#privacy table { width: 100%; }
.verdict.warn { background: color-mix(in srgb, var(--warn) 13%, transparent); color: var(--warn); }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 76px 40px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-track { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr 70px 36px; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }
ul.plain { margin: 0; padding-left: 18px; font-size: 14px; }
#report table { width: 100%; }
table.qchecks td:first-child { white-space: nowrap; font-weight: 600; width: 1%; padding-right: 16px; }
td.bad { color: var(--bad); font-weight: 600; }
#report details { margin-top: 14px; }

table.jobs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.jobs th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 6px 6px;
                border-bottom: 1px solid var(--line); }
table.jobs td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.jobs td.name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.jobs .num { text-align: right; white-space: nowrap; }
.mini { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; width: 160px; max-width: 100%; }
.mini > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
.mini.busy > div { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { margin-left: -35%; } to { margin-left: 100%; } }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.b-warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.b-bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.b-info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }  /* not red: red reads as an error */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* Security report (security.js): score before/after, criteria, certificate */
.score { display: flex; align-items: baseline; gap: 6px; }
.score b { font-size: 30px; line-height: 1.1; }
.risk-high { color: var(--bad); } .risk-medium { color: var(--warn); } .risk-low, .risk-clean { color: var(--ok); }
.sev { display: inline-block; min-width: 58px; text-align: center; font-size: 11.5px; font-weight: 700; border-radius: 999px;
       padding: 1px 8px; border: 1px solid currentColor; }
td.zero { color: var(--muted); }
.hash { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
@media print {
  body { background: #fff; color: #000; }
  body.print-security main > *:not(#app), body.print-security #app > *:not(#security), .noprint { display: none !important; }
  body.print-security #security { border: 0; }
}
.link-tile { cursor: pointer; border-color: var(--bad); }

/* Admin: side menu, status overview, insight pages (admin.js) */
main.wide:has(.admin-layout:not(.hidden)) { max-width: 1280px; }
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.side-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--card);
            border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; }
.side-nav .nav-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
                       color: var(--muted); margin: 10px 8px 4px; }
.side-nav .nav-group:first-child { margin-top: 2px; }
.side-nav button { background: transparent; color: var(--text); text-align: left; padding: 6px 10px; font-size: 13.5px;
                   border-radius: 8px; border: 0; }
.side-nav button:hover { background: var(--bg); }
.side-nav button[aria-selected="true"] { background: var(--accent-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.period-bar { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.period-bar.hidden { display: none; }
@media (max-width: 760px) {
  .admin-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .side-nav .nav-group { width: 100%; margin: 6px 4px 0; }
  .side-nav button { border: 1px solid var(--line); padding: 5px 9px; font-size: 13px; }
}
.lv { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; border-radius: 999px; padding: 2px 9px;
      white-space: nowrap; }
.lv-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.lv-info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.lv-warn { background: color-mix(in srgb, var(--warn) 17%, transparent); color: var(--warn); }
.lv-high, .lv-critical { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.lv-critical { box-shadow: inset 0 0 0 1px var(--bad); }
.health { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 760px) { .health { grid-template-columns: 1fr; } }
.health-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.health-box h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.health-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 6px 0;
              border-bottom: 1px solid var(--line); font-size: 14px; }
.health-row:last-of-type { border-bottom: 0; }
.health-row .muted { grid-column: 1 / -1; margin-top: -2px; }
.overall { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px;
           border-top: 2px solid var(--line); font-weight: 700; }
ul.actions-list { list-style: none; margin: 0; padding: 0; }
ul.actions-list li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
ul.actions-list li:last-child { border-bottom: 0; }
ul.actions-list button.link { text-align: left; }
.section-gap { margin-top: 18px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .s0 { stroke: var(--bad); } .chart .s1 { stroke: var(--ok); } .chart .s2 { stroke: var(--info); }
.chart circle.s0 { fill: var(--bad); } .chart circle.s1 { fill: var(--ok); } .chart circle.s2 { fill: var(--info); }
.chart polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin: 4px 0 0; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 3px; margin-right: 5px; vertical-align: middle;
                       background: currentColor; }
.legend .s0 { color: var(--bad); } .legend .s1 { color: var(--ok); } .legend .s2 { color: var(--info); }
details.incident { border-bottom: 1px solid var(--line); }
details.incident > summary { display: grid; grid-template-columns: 112px minmax(0, 150px) minmax(0, 1fr) auto; gap: 10px;
                             align-items: baseline; padding: 8px 2px; cursor: pointer; list-style: none; font-size: 13.5px; }
details.incident > summary::-webkit-details-marker { display: none; }
details.incident > summary .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.incident[open] > summary { background: var(--bg); }
details.incident .body { padding: 6px 4px 12px; font-size: 13.5px; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
details.incident .body dt { color: var(--muted); }
details.incident .body dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  details.incident > summary { grid-template-columns: 1fr auto; }
  details.incident > summary .src { display: none; }
}
tr.flag td { background: color-mix(in srgb, var(--warn) 9%, transparent); }
.lv-medium { background: color-mix(in srgb, var(--warn) 17%, transparent); color: var(--warn); }
.lv-low { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
button.bell { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 3px 10px; font-size: 13px;
              border-radius: 999px; }
button.bell b { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--line); font-size: 12px; }
button.bell.sev-critical b, button.bell.sev-high b { background: var(--bad); color: #fff; }
button.bell.sev-medium b { background: var(--warn); color: #fff; }
.alert-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
             padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.alert-row .muted { display: block; }
@media (max-width: 560px) { .alert-row { grid-template-columns: auto minmax(0, 1fr); } .alert-row .when { display: none; } }
.meter { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.meter.warn > span { background: var(--warn); } .meter.bad > span { background: var(--bad); }
.side-nav a.nav-link { padding: 6px 10px; font-size: 13.5px; color: var(--text); text-decoration: none; border-radius: 8px; }
.side-nav a.nav-link:hover { background: var(--bg); }
@media (max-width: 760px) { .side-nav a.nav-link { border: 1px solid var(--line); padding: 5px 9px; font-size: 13px; } }
.integrity-big { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; margin: 4px 0 14px; }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* Monthly report (laporan.html): screen and print */
.report-page { max-width: 900px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
               border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 18px; }
.report-head img { height: 54px; width: auto; }
.report-head h1 { font-size: 22px; margin: 6px 0 2px; }
.report-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.report-controls input { width: auto; }
.report-section { break-inside: avoid; margin-bottom: 20px; }
.report-section h2 { font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; break-inside: avoid; }
.kpi .v { font-size: 22px; font-weight: 700; margin: 2px 0; }
.kpi .d { font-size: 12.5px; color: var(--muted); }
.kpi .d.up { color: var(--ok); } .kpi .d.down { color: var(--bad); }
@media print {
  body.report { background: #fff; color: #000; font-size: 12px; }
  body.report .report-controls, body.report .theme-switch { display: none !important; }
  body.report main { max-width: none; padding: 0; }
  body.report .kpi, body.report .card { border-color: #ccc; }
  @page { margin: 14mm; }
}
@media print {
  body.report { --bg: #fff; --card: #fff; --text: #000; --muted: #555; --line: #ccc; --ok: #1a7f37; --bad: #b42318; }
  body.report .logo-dark { display: none !important; }
  body.report .logo-light { display: block !important; }
}
details.playbook { margin-top: 4px; font-size: 13px; }
details.playbook summary { cursor: pointer; color: var(--accent); }
details.playbook p { margin: 4px 0 0; color: var(--text); }
.ack-note { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.ack-note input { flex: 1; min-width: 0; }
/* document journey (common.js journey) */
ol.journey-list { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; border-left: 2px solid var(--line); }
ol.journey-list > li { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 10px; padding: 5px 0 5px 12px;
                       position: relative; font-size: 13.5px; }
ol.journey-list > li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px;
                               border-radius: 50%; background: var(--card); border: 2px solid var(--muted); }
ol.journey-list > li.j-stage::before { border-color: var(--info); }
ol.journey-list > li.j-audit::before { border-color: var(--accent); }
ol.journey-list > li.j-state::before { border-color: var(--ok); }
ol.journey-list .j-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
ol.journey-list ul.plain { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 560px) { ol.journey-list > li { grid-template-columns: 1fr; gap: 0; } }
details.why-score { margin: 10px 0; }
details.why-score summary { cursor: pointer; color: var(--accent); font-weight: 600; }
tr.journey-row td { background: var(--bg); }
