:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-d: #1e40af;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #dc2626;
  --blue: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.05);
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f1f5f9; color: var(--ink); line-height: 1.5; font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: var(--bg); color: #cbd5e1; padding: 18px 12px;
  position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 40;
  transition: transform .25s ease;
}
.sidebar .brand { color: #fff; font-weight: 800; font-size: 16px; padding: 8px 12px 4px; letter-spacing: .3px; }
.sidebar .brand small { display: block; color: #64748b; font-weight: 500; font-size: 11px; margin-top: 2px; }
.nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #cbd5e1; font-weight: 500; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: var(--bg-soft); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav a .ic { width: 18px; text-align: center; }
.sidebar .nav-sep { color: #475569; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; padding: 14px 12px 6px; font-weight: 700; }

.main { flex: 1; margin-left: 248px; min-width: 0; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.topbar .hamb { display: none; font-size: 22px; background: none; border: none; }
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.topbar .user b { color: var(--ink); }
.content { padding: 22px; max-width: 1280px; margin: 0 auto; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.stat-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat .num { font-size: 30px; font-weight: 800; line-height: 1; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.accent .num { color: var(--brand); }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--bad); }

.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge.green { background: #dcfce7; color: #15803d; }
.badge.blue  { background: #dbeafe; color: #1d4ed8; }
.badge.yellow{ background: #fef9c3; color: #a16207; }
.badge.orange{ background: #ffedd5; color: #c2410c; }
.badge.red   { background: #fee2e2; color: #b91c1c; }
.badge.gray  { background: #e2e8f0; color: #475569; }

/* skill color */
.sk-red{color:#dc2626} .sk-orange{color:#ea580c} .sk-yellow{color:#ca8a04} .sk-green{color:#16a34a} .sk-blue{color:#2563eb}
.sk-bg-red{background:#fee2e2} .sk-bg-orange{background:#ffedd5} .sk-bg-yellow{background:#fef9c3} .sk-bg-green{background:#dcfce7} .sk-bg-blue{background:#dbeafe}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13px; color: var(--ink);
  transition: .15s;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-d); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: #334155; }
.input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink);
}
.input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 0 14px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: #475569; position: sticky; top: 0; }
tr:hover td { background: #f8fafc; }
.center { text-align: center; }

/* skill cell */
.skcell { font-weight: 700; text-align: center; min-width: 38px; }

/* ---------- Worker card ---------- */
.worker-card { display: flex; gap: 14px; align-items: flex-start; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.rating-pill { font-size: 22px; font-weight: 800; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 30px 14px; overflow-y: auto; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 720px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.lg { max-width: 940px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: none; font-size: 22px; color: var(--muted); line-height: 1; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); animation: slidein .25s; max-width: 340px; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); } .toast.warn { background: var(--warn); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: grid; place-items: center; padding: 50px; color: var(--muted); }

.warning-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 12px 14px; margin: 8px 0; }
.warning-box ul { margin-left: 18px; }
.warning-box li { color: #92400e; font-size: 13px; margin: 3px 0; }
.info-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px 14px; color: #1e40af; font-size: 13px; }

.balance-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.balance-bar > div { height: 100%; border-radius: 999px; }

.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; }
.member-row .grow { flex: 1; min-width: 0; }
.member-row small { color: var(--muted); display: block; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.tabbar { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabbar button { background: none; border: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13.5px; }
.tabbar button.active { color: var(--brand); border-bottom-color: var(--brand); }

.bar-chart { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 16px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg,#1e3a8a,#0f172a); padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 34px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card h2 { font-size: 21px; margin-bottom: 4px; }
.login-card p { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); background: #f8fafc; padding: 10px 12px; border-radius: 8px; }

/* ---------- Responsive ---------- */
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .hamb { display: block; }
  .backdrop.open { display: block; }
  .content { padding: 16px; }
}
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ===== Ikon SVG (pengganti emoji) ===== */
.svg-ic { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
.section-title .svg-ic { vertical-align: middle; color: var(--brand); }
.empty .big .svg-ic, .empty .big svg { width: 34px; height: 34px; color: #94a3b8; }
.btn .svg-ic { vertical-align: -0.18em; }
.btn.sm .svg-ic { vertical-align: -0.2em; }

/* Brand di sidebar */
.sidebar .brand { display: flex; align-items: center; gap: 10px; }
.sidebar .brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 9px; background: linear-gradient(135deg, #2563eb, #1e3a8a); color: #fff; flex-shrink: 0; }
.sidebar .brand-mark svg { width: 20px; height: 20px; }
.sidebar .brand-txt { display: flex; flex-direction: column; line-height: 1.1; }

/* Ikon nav: jadikan flex agar SVG center rapi */
.nav a .ic { display: inline-grid; place-items: center; width: 20px; height: 20px; color: inherit; }
.nav a .ic svg { width: 18px; height: 18px; }

/* Hamburger pakai SVG */
.topbar .hamb { display: none; background: none; border: none; padding: 4px; line-height: 0; color: var(--text, #0f172a); cursor: pointer; }
.topbar .hamb svg { width: 24px; height: 24px; }

/* Logo di halaman login */
.login-logo { display: inline-grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 16px; background: linear-gradient(135deg, #2563eb, #1e3a8a); color: #fff;
  box-shadow: 0 10px 26px rgba(37,99,235,.4); }
.login-logo svg { width: 34px; height: 34px; }
.login-card { text-align: center; }
.login-card .field, .login-card .login-hint { text-align: left; }
