:root {
    --navy: #0b1f3a;
    --navy-2: #123158;
    --blue: #1d4ed8;
    --blue-soft: #dbeafe;
    --green: #15803d;
    --green-soft: #dcfce7;
    --amber: #b45309;
    --amber-soft: #fef3c7;
    --red: #b91c1c;
    --red-soft: #fee2e2;
    --slate: #475569;
    --slate-soft: #f1f5f9;
    --line: #e2e8f0;
    --ink: #0f172a;
    --card: #ffffff;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: #eef2f7;
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body.busy { cursor: progress; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.86em; background: #eef2f7; padding: 1px 5px; border-radius: 5px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--navy), var(--navy-2));
    color: #fff;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.25);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 18px; line-height: 1.1; font-weight: 750; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: #b9cbe5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #e2ecff;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 11px;
    font-family: var(--mono);
    white-space: nowrap;
    cursor: pointer;
}
.pill-ok { background: rgba(34,197,94,0.22); border-color: rgba(34,197,94,0.55); color: #dcfce7; }
.pill-bad { background: rgba(239,68,68,0.22); border-color: rgba(239,68,68,0.55); color: #fee2e2; }
.pill-wait { color: #cbd5e1; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 64px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin: 16px 0;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; }

h2 { margin: 0 0 6px; font-size: 21px; }
h3 { margin: 0 0 10px; font-size: 15px; }
p { margin: 6px 0; }
.muted { color: var(--slate); font-size: 13px; }
.hint { color: var(--slate); font-size: 12px; margin: 10px 0 0; }
.good { color: var(--green); font-weight: 700; }
.bad { color: var(--red); font-weight: 700; }
.mono { font-family: var(--mono); font-size: 11px; word-break: break-all; }

.intro-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.intro-head p { max-width: 760px; }
.mvp-badge {
    background: var(--blue-soft);
    color: var(--blue);
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    letter-spacing: 0.08em;
}

.pick-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; margin: 16px 0 12px; }
.pick {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 16px 14px;
    text-align: left;
    cursor: pointer;
    color: #fff;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    min-height: 86px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.pick:hover { transform: translateY(-1px); filter: brightness(1.04); }
.pick:active { transform: translateY(0); }
.pick:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.pick-title { font-size: 17px; font-weight: 750; }
.pick-sub { font-size: 11px; opacity: 0.85; font-family: var(--mono); }
.pick-camera { background: linear-gradient(135deg, #1d4ed8, #1e40af); box-shadow: 0 8px 18px rgba(29,78,216,0.28); }
.pick-gallery { background: linear-gradient(135deg, #0f766e, #115e59); box-shadow: 0 8px 18px rgba(15,118,110,0.28); }
.pick-synthetic { background: linear-gradient(135deg, #b45309, #92400e); box-shadow: 0 8px 18px rgba(180,83,9,0.28); }

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    color: var(--slate);
    font-size: 13px;
    cursor: pointer;
    background: #f8fafc;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.over { border-color: var(--blue); background: #eff6ff; }

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 14px 0; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #334155; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--blue); }
.check.inline { white-space: nowrap; }

.pick-note {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: #334155;
    font-family: var(--mono);
    word-break: break-all;
}
.pick-note.busy { border-color: #93c5fd; background: #eff6ff; }

/* step guide */
.steps { list-style: none; margin: 16px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.step-num {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 800;
    font-size: 13px;
    border: 1px solid #bfdbfe;
}
.step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-text strong { font-size: 13px; }
.step-text em { font-style: normal; font-size: 12px; color: var(--slate); }

/* run progress banner */
.run-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}
.run-banner[hidden] { display: none; }
.run-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.run-text strong { font-size: 14px; }
.run-text span { font-size: 12px; color: #475569; }
.spinner {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 3px solid #bfdbfe;
    border-top-color: var(--blue);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* advanced controls */
.advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.advanced > summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--blue); user-select: none; }
.advanced-inner { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

/* report */
.report-card { border-width: 2px; border-color: #bfdbfe; }
.report-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.report-actions .btn, .report-actions a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 13px;
}
.report-preview { margin-top: 12px; }
.report-preview > summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--blue); user-select: none; }
.report-preview pre {
    margin: 8px 0 0;
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    color: #1e293b;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 360px;
    overflow: auto;
}

/* technical details */
.tech > details > summary { list-style: none; }
.tech > details > summary::-webkit-details-marker { display: none; }
.tech-summary {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
}
.tech-summary::before {
    content: "▸";
    color: var(--slate);
    font-size: 12px;
    line-height: 1.6;
    transition: transform 0.15s ease;
}
.tech > details[open] > .tech-summary::before { transform: rotate(90deg); }
.tech-summary strong { display: block; font-size: 15px; }
.tech-summary small { display: block; color: var(--slate); font-size: 12px; font-weight: 400; margin-top: 2px; }
.tech-inner { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.tech-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tech-section:last-child { border-bottom: 0; padding-bottom: 0; }
.tech-section .card-head { margin-bottom: 10px; }

.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-two .card { margin: 0; }

/* stage timeline */
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stages li {
    border-left: 4px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 8px;
    padding: 7px 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1px 10px;
    min-height: 44px;
}
.stage-name { font-size: 13px; font-weight: 650; }
.stage-detail { font-size: 11px; color: var(--slate); grid-column: 1; }
.stage-status {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
    white-space: nowrap;
}
.stages li[data-status="run"] { border-left-color: #2563eb; background: #eff6ff; }
.stages li[data-status="run"] .stage-status { color: #2563eb; }
.stages li[data-status="ok"] { border-left-color: #16a34a; }
.stages li[data-status="ok"] .stage-status { color: #15803d; }
.stages li[data-status="fail"] { border-left-color: #dc2626; background: #fff1f2; }
.stages li[data-status="fail"] .stage-status { color: #b91c1c; }
.stages li[data-status="warn"] { border-left-color: #d97706; background: #fffbeb; }
.stages li[data-status="warn"] .stage-status { color: #b45309; }
.stages li[data-status="skip"] { opacity: 0.65; }

/* key-value tables */
.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 5px 12px; margin: 0; font-size: 12px; }
.kv dt { color: var(--slate); font-weight: 650; }
.kv dd { margin: 0; word-break: break-word; }
.kv dd.mono { font-family: var(--mono); font-size: 10.5px; word-break: break-all; color: #334155; }

/* verdict */
.verdict-card { border-width: 2px; }
.verdict-card.verdict-pass { border-color: #86efac; background: linear-gradient(180deg, #f0fdf4, #fff); }
.verdict-card.verdict-fail { border-color: #fca5a5; background: linear-gradient(180deg, #fef2f2, #fff); }
.verdict-card.verdict-warn { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb, #fff); }
.verdict-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verdict-code {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    border-radius: 6px;
    padding: 3px 8px;
    background: #0f172a;
    color: #e2e8f0;
}
.verdict-pass .verdict-code { background: #166534; color: #dcfce7; }
.verdict-fail .verdict-code { background: #991b1b; color: #fee2e2; }
.verdict-warn .verdict-code { background: #92400e; color: #fef3c7; }
.verdict-headline { font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--slate); }
.verdict-status {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    border-radius: 999px;
    padding: 5px 13px;
    background: #0f172a;
    color: #e2e8f0;
}
.verdict-pass .verdict-status { background: #166534; color: #dcfce7; }
.verdict-fail .verdict-status { background: #991b1b; color: #fee2e2; }
.verdict-warn .verdict-status { background: #92400e; color: #fef3c7; }
.verdict-code { font-size: 10px; background: var(--slate-soft); color: var(--slate); padding: 3px 8px; }
.verdict-title { margin: 10px 0 4px; font-size: 19px; }
.verdict-detail { margin: 0; color: #334155; }
.verdict-rec { margin: 12px 0 0; background: rgba(255,255,255,0.7); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.verdict-meta { margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--slate); word-break: break-word; }
.verdict-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* buttons */
.btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}
.btn:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-small { padding: 5px 9px; font-size: 11px; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.btn-primary:hover { background: #1e40af; border-color: #1e40af; }

/* log */
.log-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.count { font-family: var(--mono); font-size: 11px; color: var(--slate); background: var(--slate-soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.log-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.log-toolbar select, .log-toolbar input[type="search"] {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 12px;
    background: #fff;
    color: var(--ink);
    min-width: 0;
}
.log-toolbar input[type="search"] { flex: 1 1 180px; }
.log-list {
    background: #0b1220;
    border-radius: 12px;
    padding: 8px;
    max-height: 520px;
    overflow: auto;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.45;
    color: #cbd5e1;
}
.log-list:empty::before { content: "Belum ada log."; color: #64748b; display: block; padding: 12px; }
.log-row {
    border-left: 3px solid #334155;
    background: rgba(255,255,255,0.025);
    border-radius: 6px;
    padding: 5px 8px;
    margin-bottom: 4px;
}
.log-main { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.log-rel { color: #64748b; white-space: nowrap; }
.log-stage {
    color: #93c5fd;
    background: rgba(59,130,246,0.14);
    border-radius: 4px;
    padding: 0 4px;
    white-space: nowrap;
}
.log-msg { color: #e2e8f0; word-break: break-word; flex: 1 1 240px; }
.log-row.level-debug { border-left-color: #475569; }
.log-row.level-debug .log-msg { color: #94a3b8; }
.log-row.level-ok { border-left-color: #22c55e; }
.log-row.level-ok .log-stage { color: #86efac; background: rgba(34,197,94,0.14); }
.log-row.level-warn { border-left-color: #f59e0b; }
.log-row.level-warn .log-msg { color: #fde68a; }
.log-row.level-warn .log-stage { color: #fcd34d; background: rgba(245,158,11,0.14); }
.log-row.level-error { border-left-color: #ef4444; background: rgba(239,68,68,0.09); }
.log-row.level-error .log-msg { color: #fecaca; }
.log-row.level-error .log-stage { color: #fca5a5; background: rgba(239,68,68,0.16); }
.log-detail { margin-top: 4px; }
.log-detail summary { cursor: pointer; color: #60a5fa; font-size: 10.5px; user-select: none; }
.log-detail pre {
    margin: 6px 0 2px;
    padding: 8px;
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 10.5px;
    line-height: 1.4;
    overflow: auto;
    max-height: 260px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* previews */
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview { margin: 0; }
.preview-box {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
}
.preview-box img { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.preview figcaption { font-size: 11px; color: var(--slate); margin-top: 6px; word-break: break-word; }

/* upload */
.upload-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 10.5px; font-weight: 700; font-family: var(--mono); }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-bad { background: var(--red-soft); color: var(--red); }
.badge-muted { background: var(--slate-soft); color: var(--slate); }
.sim-table { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.sim-row { border-radius: 8px; padding: 6px 9px; display: flex; gap: 10px; flex-wrap: wrap; }
.sim-ok { background: var(--green-soft); color: #14532d; }
.sim-bad { background: var(--red-soft); color: #7f1d1d; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.file-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; }
.file-list a { font-family: var(--mono); font-size: 11px; word-break: break-all; }

.lan-row { font-size: 13px; padding: 4px 0; }
.lan-row a { font-family: var(--mono); }
.lan-row .muted { font-size: 11px; }

/* toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translate(-50%, 20px);
    background: #0f172a;
    color: #f8fafc;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    box-shadow: 0 12px 30px rgba(2,6,23,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: min(92vw, 560px);
    z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #14532d; }
.toast.warn { background: #78350f; }
.toast.error { background: #7f1d1d; }

@media (max-width: 820px) {
    .grid-two { grid-template-columns: 1fr; }
    .grid-two .card { margin: 0; }
    .steps { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .topbar { padding: 11px 14px; align-items: flex-start; flex-direction: column; }
    .header-meta { justify-content: flex-start; }
    .wrap { padding: 14px 10px 54px; }
    .card { padding: 14px; border-radius: 14px; }
    .pick-grid { grid-template-columns: 1fr; }
    .pick { min-height: 64px; padding: 12px 14px; }
    .options { grid-template-columns: 1fr; }
    .preview-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 108px minmax(0, 1fr); }
    .log-list { max-height: 60vh; }
    .brand-text p { white-space: normal; }
    .intro-head { flex-direction: column; }
}
