/* ─── Aplikasi CPL OBE — custom stylesheet ─────────────────────────────── */
:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --teal: #0d9488;
    --teal-dark: #0f766e;
    --teal-light: #ccfbf1;
    --blue: #2563eb;
    --violet: #7c3aed;
    --amber: #d97706;
    --rose: #e11d48;
    --red: #dc2626;
    --green: #16a34a;
    --sidebar: #0f172a;
    --sidebar-ink: #cbd5e1;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.5;
}

.app-shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: 258px;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex; gap: 12px; align-items: center;
    padding: 20px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-icon {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.brand-title { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 10.5px; color: #64748b; }

.sidebar-nav { padding: 10px 10px 24px; }
.nav-group-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
    color: #475569; padding: 16px 10px 6px; font-weight: 700;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 9px;
    color: var(--sidebar-ink); text-decoration: none;
    font-size: 13.5px; margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(20, 184, 166, .18); color: #5eead4; font-weight: 600; }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }

/* ─── Main ──────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 28px; background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 700; font-size: 16px; }
.sidebar-toggle { display: none; }
.content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ─── Alerts ────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid transparent; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--line);
    margin-bottom: 22px;
}
.card-header {
    padding: 15px 20px; border-bottom: 1px solid var(--line);
    font-weight: 700; font-size: 14.5px;
    display: flex; align-items: center; gap: 8px; justify-content: space-between;
}
.card-header .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

/* ─── Page title ────────────────────────────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 15px; border-radius: 9px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
    background: var(--teal); color: #fff; transition: filter .15s;
    line-height: 1.35;
}
.btn:hover { filter: brightness(1.06); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { color: var(--ink); background: #f9fafb; }
.btn-danger { background: var(--red); }
.btn-outline-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-outline-danger:hover { background: #fef2f2; color: var(--red); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-icon {
    background: none; border: 1px solid var(--line); border-radius: 8px;
    padding: 5px 10px; cursor: pointer; font-size: 15px; background: #fff;
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: #374151; }
.form-group .req::after { content: " *"; color: var(--red); }
input[type=text], input[type=password], input[type=number], select, textarea {
    padding: 8px 11px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink);
    width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(13, 148, 136, .25); border-color: var(--teal); }
textarea { resize: vertical; min-height: 64px; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; }

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
    text-align: left; padding: 10px 14px; background: #f9fafb;
    border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase;
    letter-spacing: .05em; color: #4b5563; white-space: nowrap;
}
.tbl td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafafa; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .ctr { text-align: center; }
.tbl tfoot td { background: #f9fafb; font-weight: 700; border-top: 2px solid var(--line); }
.tbl td.mat-cell, .tbl th.mat-cell { text-align: center; min-width: 58px; }
.tbl .sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; }
.tbl tr:hover td.sticky-col { background: #fafafa; }
.tbl tfoot td.sticky-col { background: #f9fafb; }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.badge-teal { background: var(--teal-light); color: var(--teal-dark); }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-violet { background: #ede9fe; color: #5b21b6; }

/* ─── Stats grid (dashboard) ────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.stat-card .strip { height: 5px; }
.stat-card .inner { padding: 16px 18px; display: flex; justify-content: space-between; align-items: flex-start; }
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; }

.progress { background: #eef1f4; border-radius: 999px; height: 9px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #0d9488, #34d399); }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(90deg, #0f172a, #134e4a 55%, #0f172a);
    border-radius: var(--radius); color: #fff; padding: 24px 28px;
    display: flex; align-items: center; gap: 18px; margin-bottom: 24px; flex-wrap: wrap;
}
.hero .hero-icon { width: 54px; height: 54px; border-radius: 15px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.hero h1 { margin: 0; font-size: 21px; }
.hero p { color: #5eead4; margin: 3px 0 0; font-size: 13px; }
.hero .hero-right { margin-left: auto; text-align: right; }
.hero .hero-right .big { font-size: 30px; font-weight: 800; }
.hero .hero-right .cap { color: #94a3b8; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

.identity-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,.15); }
.identity-row:last-child { border-bottom: none; }
.identity-row .k { color: #99f6e4; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.identity-row .v { color: #fff; font-weight: 600; }

/* ─── CPL progress list ─────────────────────────────────────────────────── */
.cpl-row { margin-bottom: 14px; }
.cpl-row .cpl-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.cpl-row .cpl-code { font-weight: 800; width: 64px; flex-shrink: 0; }
.cpl-row .cpl-desc { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 330px; }
.cpl-row .cpl-val { font-weight: 700; width: 52px; text-align: right; }

/* ─── Legend chips ──────────────────────────────────────────────────────── */
.legend-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.legend-row .range { color: var(--muted); font-size: 12px; }

/* ─── Matrix editors ────────────────────────────────────────────────────── */
.matrix-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.total-ok { color: var(--green); font-weight: 700; }
.total-bad { color: var(--red); font-weight: 700; }
.cell-input { width: 84px !important; text-align: right; }
.cor-cell { font-size: 15px; cursor: pointer; user-select: none; }
.cor-cell.on { color: var(--teal); font-weight: 800; }
.cor-cell.off { color: #d1d5db; }
.cor-1 { color: #f59e0b !important; }
.cor-2 { color: #3b82f6 !important; }
.cor-3 { color: #059669 !important; }

/* ─── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
    padding: 9px 18px; text-decoration: none; color: var(--muted);
    font-weight: 600; font-size: 13.5px; border-radius: 9px 9px 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); background: #f9fafb; }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); background: var(--teal-light); }

/* ─── Dropzone / import ─────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 34px;
    text-align: center; color: var(--muted); background: #f8fafc; margin-bottom: 16px;
}
.dropzone b { color: var(--ink); }
.result-banner { border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; font-size: 13.5px; }
.result-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.result-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.list-status { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.list-status .st-new { color: var(--green); }
.list-status .st-dup { color: var(--amber); }
.list-status .st-err { color: var(--red); }

/* ─── Chart containers ──────────────────────────────────────────────────── */
.chart-box { position: relative; height: 340px; }
.chart-box-sm { position: relative; height: 280px; }

/* ─── Misc ──────────────────────────────────────────────────────────────── */
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--teal-light);
    color: var(--teal-dark); display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 12.5px; margin-right: 10px; flex-shrink: 0;
}
.search-box { display: flex; gap: 8px; }
.search-box input { width: 260px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.right { margin-left: auto; }
.center-page { text-align: center; padding: 60px 20px; color: var(--muted); }
.error-page { text-align: center; padding: 80px 20px; }
.link { color: var(--teal-dark); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .sidebar { position: fixed; z-index: 50; left: -270px; transition: left .2s; }
    .sidebar.open { left: 0; }
    .sidebar-toggle { display: inline-block; }
    .content { padding: 18px 14px 50px; }
    .topbar { padding: 12px 14px; }
}

/* ─── Print ─────────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    body { background: #fff; }
    .content { max-width: 100%; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .print-only { display: block !important; }
}
.print-only { display: none; }

/* ─── Login ─────────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: linear-gradient(160deg, #0f172a, #134e4a 60%, #0f172a);
}
.login-card {
    width: 100%; max-width: 390px; background: #fff; border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(2, 6, 23, .45); overflow: hidden;
}
.login-head { padding: 28px 26px 4px; text-align: center; }
.login-brand {
    width: 54px; height: 54px; border-radius: 16px; margin-bottom: 10px;
    background: linear-gradient(135deg, #0d9488, #14b8a6); display: inline-flex;
    align-items: center; justify-content: center; font-size: 26px;
}
.login-head h1 { margin: 0; font-size: 19px; }
.login-head p { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.login-body { padding: 20px 26px 28px; }
.login-body .form-group { margin-bottom: 12px; }
.login-body .form-actions { margin-top: 4px; }
.login-body .btn { width: 100%; justify-content: center; }
.field-error { color: var(--red); font-size: 12px; }
.chk-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; cursor: pointer; }
.chk-row input[type=checkbox], .chk input[type=checkbox] { width: 16px; height: 16px; margin: 0; flex-shrink: 0; }

/* ─── Hak akses (checkbox grid) ─────────────────────────────────────────── */
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.chk {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: 9px; background: #fff;
    font-size: 13px; cursor: pointer;
}
.chk:hover { background: #f9fafb; }
.chk code { margin-left: auto; color: var(--muted); font-size: 11.5px; }

/* ─── User sidebar ──────────────────────────────────────────────────────── */
.sidebar-user {
    margin-top: auto; display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .08);
    background: var(--sidebar);
    position: sticky; bottom: 0;
}
.sidebar-user .avatar { margin: 0; background: rgba(20, 184, 166, .2); color: #5eead4; }
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
    color: #fff; font-weight: 600; font-size: 13px; line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role { color: #64748b; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-user .logout-form { margin-left: auto; }
.sidebar-user .logout-form button {
    background: transparent; border: 1px solid rgba(255, 255, 255, .15); color: #cbd5e1;
    border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 14px; line-height: 1;
}
.sidebar-user .logout-form button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
