:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 14px 35px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #0f172a; color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 8px 25px rgba(15, 23, 42, .2); }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 18px; }
.brand { font-weight: 800; color: #fff; font-size: 1.25rem; letter-spacing: .2px; }
.nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.nav-links a, .nav-links button { color: #e2e8f0; background: transparent; border: 0; padding: 9px 11px; border-radius: 10px; font: inherit; cursor: pointer; }
.nav-links a:hover, .nav-links button:hover, .nav-links .active { background: rgba(255,255,255,.12); text-decoration: none; }
.main { padding: 28px 0 48px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-header h1 { margin: 0; font-size: 1.7rem; }
.page-header p { margin: 6px 0 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; }
.stat { display: flex; flex-direction: column; gap: 7px; }
.stat .value { font-size: 2rem; font-weight: 800; }
.stat .label { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 13px; border-radius: 10px; border: 1px solid transparent; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; font-size: .92rem; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { color: #fff; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: #e2e8f0; color: #334155; }
.badge-admin { background: #dbeafe; color: #1d4ed8; }
.badge-staff { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; gap: 7px; }
.form-row label { font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 11px; padding: 11px 12px; font: inherit; background: #fff; color: var(--text); }
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(37, 99, 235, .16); border-color: var(--primary); }
.helper { color: var(--muted); font-size: .9rem; }
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; border: 1px solid; }
.alert-success { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.auth-card { width: min(460px, calc(100% - 32px)); margin: 48px auto; }
.auth-logo { text-align: center; font-size: 2rem; font-weight: 900; margin-bottom: 16px; color: #0f172a; }
.pagination { margin-top: 18px; }
.inline-form { display: inline; }
.kbd { display: inline-block; padding: 2px 6px; border-radius: 6px; background: #e2e8f0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.copy-box { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pie-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pie { width: 210px; height: 210px; border-radius: 50%; border: 10px solid #fff; box-shadow: var(--shadow); }
.legend { display: grid; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; }
.footer { color: var(--muted); text-align: center; padding: 24px; }
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .nav { align-items: flex-start; flex-direction: column; padding: 12px 0; }
}
@media print {
    .topbar, .no-print, .btn, .actions { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 0; }
    .main { padding: 0; }
    .container { width: 100%; }
}


.card-lite { display: block; border: 1px dashed var(--line); border-radius: 14px; padding: 14px; background: #f8fafc; }
.badge-qa { background: #fef3c7; color: #92400e; }
.badge-gmg { background: #ede9fe; color: #6d28d9; }
.badge-admin { background: #dbeafe; color: #1d4ed8; }
.badge-staff { background: #dcfce7; color: #15803d; }
.sop-reader { max-height: 72vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; scroll-behavior: smooth; }
.sop-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.sop-content { line-height: 1.72; }
.sop-file-frame { width: 100%; min-height: 720px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.sop-image-preview { max-width: 100%; border: 1px solid var(--line); border-radius: 14px; display: block; }
.reader-end-marker { margin-top: 28px; padding: 14px; border-radius: 12px; background: #ecfdf5; color: #166534; font-weight: 800; text-align: center; }
.sop-sensitive, .sop-sensitive * { -webkit-user-select: none; user-select: none; }
.sop-sensitive iframe { pointer-events: auto; }
@media (max-width: 900px) {
    .sop-meta-grid { grid-template-columns: 1fr; }
    .sop-file-frame { min-height: 520px; }
}
@media print {
    .sop-sensitive { display: none !important; }
}

/* SOP compliance additions */
.checkbox-card { display: flex; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.checkbox-card input { width: auto; margin-top: 4px; }
.progress { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 150px; }
.progress > span, .progress-bar { display: block; height: 100%; background: var(--primary); }
.sop-reader { max-height: 72vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; scroll-behavior: smooth; }
.sop-content { line-height: 1.72; }
.sop-file-frame { width: 100%; min-height: 720px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.reader-end-marker { margin-top: 28px; padding: 14px; border-radius: 12px; background: #ecfdf5; color: #166534; font-weight: 800; text-align: center; }
.sop-protected, .sop-protected * { -webkit-user-select: none; user-select: none; }
@media print {
    body.sop-sensitive-view .main { display: none !important; }
    body.sop-sensitive-view::before { content: "Cetakan SOP sensitive tidak dibenarkan."; display: block; padding: 40px; font-size: 20px; font-weight: 800; }
}

