/* ============================================================
   SIM-SDM & PELATIHAN KERJA - AHASS NAGA SAKTI
   app.css
   ============================================================ */
:root {
  --red: #d81f2a;
  --red-dark: #ab1620;
  --red-soft: #fdeceb;
  --ink: #141a24;
  --ink-2: #2b3440;
  --muted: #6b7383;
  --bg: #f2f4f8;
  --card: #ffffff;
  --line: #e4e8ef;
  --green: #178a50;
  --green-soft: #e6f6ee;
  --amber: #a8760a;
  --amber-soft: #fdf3e1;
  --blue: #2563eb;
  --blue-soft: #e9f0fe;
  --sidebar: #ffffff;
  --sidebar-2: #fff1f1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .05);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--sidebar);
  color: #303846;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  box-shadow: 5px 0 18px rgba(24, 31, 43, .05);
}

.brand {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  padding: 4px 6px 20px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.brand-logo-panel {
  width: 100%; height: 52px; display: grid; place-items: center;
  border-bottom: 3px solid var(--red); border-radius: 2px;
}
.brand-logo { width: 190px; height: 48px; object-fit: contain; background: #fff; border-radius: 3px; padding: 4px 7px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(145deg, var(--red), #8d1019);
  color: #fff; font-weight: 800; font-size: 19px;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(216, 31, 42, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; text-align: center; }
.brand-text strong { color: #20252b; font-size: 13.5px; letter-spacing: .4px; }
.brand-text small { color: #8792a6; font-size: 10.5px; letter-spacing: .3px; }

.menu-label {
  font-size: 10px; letter-spacing: 1.2px; color: #8b94a3;
  padding: 6px 10px 8px; font-weight: 700;
}
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  color: #596273; text-decoration: none;
  padding: 10px 11px; border-radius: 9px;
  font-size: 13.2px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.menu a:hover { background: var(--sidebar-2); color: #fff; }
.menu a.active {
  background: #fff1f1;
  color: var(--red-dark); border-left-color: var(--red);
  font-weight: 700;
}
.menu a:hover { color: var(--red-dark); }
.menu a .ico { width: 18px; height: 18px; display: inline-grid; place-items: center; opacity: .85; }
.menu a .ico svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.sidebar-foot {
  margin-top: auto; padding: 12px 10px 2px;
  font-size: 11px; color: #8b94a3;
  display: flex; align-items: center; gap: 7px;
}
.sidebar-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: #35c07a; box-shadow: 0 0 0 3px rgba(53, 192, 122, .18); }
.sidebar-foot .dot.local { background: #e0a11a; box-shadow: 0 0 0 3px rgba(224, 161, 26, .16); }

/* ---------- hero bergaya Astra Honda ---------- */
.hero-banner {
  min-height: 142px; border-radius: 14px; padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  color: #fff; overflow: hidden; position: relative;
  background: linear-gradient(115deg, #b81420 0%, #d71920 56%, #ef3c42 100%);
  box-shadow: 0 10px 24px rgba(183, 20, 32, .16);
  margin-bottom: 16px;
}
.hero-banner::after {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  right: -80px; top: -110px; border: 28px solid rgba(255,255,255,.1);
}
.hero-copy { position: relative; z-index: 1; }
.hero-copy .eyebrow { display: block; font-size: 10px; letter-spacing: 1.7px; font-weight: 800; opacity: .8; margin-bottom: 7px; }
.hero-copy h2 { margin: 0; font-size: 24px; letter-spacing: -.4px; }
.hero-copy p { margin: 7px 0 0; font-size: 12.5px; opacity: .88; }
.hero-badge {
  position: relative; z-index: 1; flex: 0 0 auto; width: 78px; height: 78px;
  display: grid; place-items: center; text-align: center; line-height: 1.15;
  border: 1px solid rgba(255,255,255,.5); border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .7px;
  background: rgba(118, 0, 9, .2);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--red);
  padding: 13px 26px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.hamburger {
  display: none; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; font-size: 16px; padding: 5px 9px; cursor: pointer;
}
.title-wrap { flex: 1; min-width: 0; }
.title-wrap h1 { margin: 0; font-size: 16.5px; letter-spacing: .2px; }
.title-wrap p { margin: 2px 0 0; font-size: 11.8px; color: var(--muted); }

.user { display: flex; align-items: center; gap: 9px; cursor: default; }
.avatar {
  width: 35px; height: 35px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-meta strong { font-size: 12.5px; }
.user-meta small { font-size: 10.5px; color: var(--muted); }
.chev { font-size: 10px; color: var(--muted); }

.view { padding: 22px 26px 40px; max-width: none; width: 100%; }

/* ---------- komponen ---------- */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: 1.55fr 1fr; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 13.5px; letter-spacing: .2px; }
.card-head .hint { font-size: 11.5px; color: var(--muted); }

.stat { padding: 15px 17px; position: relative; overflow: hidden; }
.stat .label { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.6px; margin: 6px 0 3px; line-height: 1; }
.stat .value small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat .sub { font-size: 11.5px; color: var(--muted); }
.stat .flag {
  position: absolute; top: 14px; right: 14px;
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--red); opacity: .85;
}
.stat.s-green::after { background: var(--green); }
.stat.s-blue::after { background: var(--blue); }
.stat.s-amber::after { background: var(--amber); }

.flag.up { background: var(--green-soft); color: var(--green); }
.flag.warn { background: var(--amber-soft); color: var(--amber); }
.flag.info { background: var(--blue-soft); color: var(--blue); }

.section-title { margin: 0 0 12px; font-size: 12px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
  text-align: left; font-size: 10.8px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfe; }
.table .name { font-weight: 600; }
.table .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.table .num { text-align: center; font-variant-numeric: tabular-nums; }
.table .right { text-align: right; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.8px; font-weight: 700; letter-spacing: .2px;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.red { background: var(--red-soft); color: var(--red-dark); }
.badge.gray { background: #eef1f6; color: #55607a; }
.badge.dark { background: #242c3a; color: #e8edf6; }

/* ---------- tombol & form ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 8px 13px; border-radius: 9px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: #f7f9fc; border-color: #d3d9e3; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }
.btn.danger { color: var(--red-dark); border-color: #f1c9c6; background: #fff7f6; }
.btn.danger:hover { background: var(--red-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.input, .select, textarea.input {
  font-family: inherit; font-size: 12.8px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: #e9a7ab; box-shadow: 0 0 0 3px rgba(216, 31, 42, .1);
}
.input.search { min-width: 240px; }
.select { padding-right: 28px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.3px; font-weight: 700; color: var(--ink-2); letter-spacing: .2px; }
.field label span { color: var(--muted); font-weight: 500; }
.field-hint { font-size: 10.8px; color: var(--muted); }

/* ---------- chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #e9edf4; stroke-width: 1; }
.chart .axis { fill: #8a93a5; font-size: 10px; font-family: var(--font); }
.chart .lbl { fill: #6b7383; font-size: 10.5px; font-family: var(--font); }
.chart .dot { stroke: #fff; stroke-width: 2; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-left: 38px; margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.insight { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.insight li {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12.4px; color: var(--ink-2); line-height: 1.45;
  background: #fafbfd; border: 1px solid #eef1f6; border-radius: 9px; padding: 10px 12px;
}
.insight li b { color: var(--ink); }
.insight .ico { flex: 0 0 auto; color: var(--green); font-weight: 800; }

/* ---------- progress ---------- */
.bar { height: 7px; background: #edf0f5; border-radius: 20px; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, #e5484d, var(--red)); }
.bar.green > i { background: linear-gradient(90deg, #34a16b, var(--green)); }
.bar.amber > i { background: linear-gradient(90deg, #d9a02b, var(--amber)); }
.bar.blue > i { background: linear-gradient(90deg, #5b8def, var(--blue)); }
.progress-cell { display: flex; align-items: center; gap: 9px; min-width: 130px; }
.progress-cell .pct { font-size: 11.5px; font-weight: 700; color: var(--ink-2); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- chart bar ---------- */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bars-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; }
.bars-top b { font-variant-numeric: tabular-nums; color: var(--ink); }

.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar { display: flex; align-items: center; gap: 11px; }
.hbar .hlabel {
  flex: 0 0 132px; font-size: 12px; color: var(--ink-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hbar .bar { flex: 1; height: 9px; }
.hbar .hval { flex: 0 0 38px; text-align: right; font-size: 11.8px; font-variant-numeric: tabular-nums; }

/* ---------- skill matrix ---------- */
.matrix td.cell { text-align: center; font-weight: 700; font-size: 12px; border-left: 1px solid #fff; }
.matrix td.cell.lvl-hi { background: #dff3e8; color: #10683c; }
.matrix td.cell.lvl-md { background: #fdf2d8; color: #8a6108; }
.matrix td.cell.lvl-lo { background: #fbe2e0; color: #a3201a; }
.legend-cell { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 11.3px; color: var(--muted); }
.legend-cell .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13, 18, 28, .5);
  display: grid; place-items: center; padding: 18px; z-index: 60;
  animation: fade .12s ease-out;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 620px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(10, 15, 25, .3);
  animation: pop .14s ease-out;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .x { border: 0; background: transparent; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 7px; border-radius: 7px; }
.modal-head .x:hover { background: #f2f4f8; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 90; }
.toast {
  background: #17202c; color: #eef2f8; border-radius: 10px;
  padding: 11px 15px; font-size: 12.6px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(10, 15, 25, .28);
  display: flex; align-items: center; gap: 9px;
  animation: slide .18s ease-out;
}
.toast .t-ico { color: #4ade80; font-weight: 800; }
.toast.err .t-ico { color: #fb7185; }

/* ---------- misc ---------- */
.note {
  background: var(--amber-soft); border: 1px solid #f2e2bd; color: #6b4c05;
  font-size: 11.8px; padding: 10px 13px; border-radius: 9px; line-height: 1.5;
}
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed #e8ecf3; font-size: 12.6px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 12.6px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1080px) {
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .3);
  }
  .sidebar.open { transform: none; }
  .hamburger { display: inline-block; }
  .view { padding: 16px 15px 32px; }
  .stats, .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 11px 15px; }
  .user-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats, .stats-4 { grid-template-columns: 1fr; }
  .toolbar .input.search { min-width: 0; width: 100%; }
  .hero-banner { padding: 20px; }
  .hero-copy h2 { font-size: 19px; }
  .hero-copy p { max-width: 230px; }
  .hero-badge { width: 62px; height: 62px; font-size: 9px; }
}

/* ---------- cetak laporan ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toolbar, .no-print, .toasts { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #d8dde6; break-inside: avoid; }
  .app { display: block; }
  .grid.stats { grid-template-columns: repeat(4, 1fr); }
}
