/* Widyatika Konsol Universitas */
:root {
  --sidebar: #1b3a5c;
  --sidebar-active: #2c5a8a;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #24313f;
  --muted: #7a8899;
  --border: #e3e8ef;
  --hijau: #1e9e6a; --hijau-bg: #e3f5ec;
  --kuning: #c99207; --kuning-bg: #fdf3d8;
  --merah: #d64545; --merah-bg: #fce6e6;
  --info: #5b7a99; --info-bg: #e8eef5;
  --q1: #1e9e6a; --q2: #3b82c4; --q3: #e0a417; --q4: #d64545;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
#layout { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar { width: 220px; background: var(--sidebar); color: #dce6f0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.brand { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; color: #fff; background: linear-gradient(135deg, #2c5a8a 0%, #7fb5e8 130%); border: 1px solid rgba(255,255,255,.25); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.login-brand .brand-logo { width: 44px; height: 44px; font-size: 22px; border-radius: 11px; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 1px; color: #fff; }
.brand-sub { font-size: 10px; letter-spacing: 2px; color: #9db4c8; margin-top: 2px; }
#menu { display: flex; flex-direction: column; padding: 8px 0; }
#menu a { color: #c3d3e2; text-decoration: none; padding: 10px 18px; font-size: 13.5px; border-left: 3px solid transparent; }
#menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
#menu a.active { background: var(--sidebar-active); color: #fff; border-left-color: #7fb5e8; }

/* Main */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 10px 22px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
#tenant-name { font-weight: 600; font-size: 15px; }
#global-filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
#global-filters select { max-width: 200px; }
#global-filters label { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sidebar); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
#content { padding: 22px; }

select, input[type=text], input[type=number] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 13px; color: var(--text); }
button { padding: 6px 14px; border: none; border-radius: 6px; background: var(--sidebar); color: #fff; cursor: pointer; font-size: 13px; }
button:hover { background: var(--sidebar-active); }

h2.page-title { margin: 0 0 4px; font-size: 20px; }
p.page-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
h3.section-title { margin: 22px 0 10px; font-size: 15px; }

/* Kartu */
.cards { display: grid; gap: 14px; }
.cards.c6 { grid-template-columns: repeat(6, 1fr); }
.cards.c4 { grid-template-columns: repeat(4, 1fr); }
.cards.c3 { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.kpi-card .kpi-label { font-size: 12px; color: var(--muted); }
.kpi-card .kpi-value { font-size: 26px; font-weight: 700; margin: 6px 0; }
.kpi-card .kpi-extra { font-size: 11px; color: var(--muted); }

/* Badge & chip */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.hijau { background: var(--hijau-bg); color: var(--hijau); }
.badge.kuning { background: var(--kuning-bg); color: var(--kuning); }
.badge.merah { background: var(--merah-bg); color: var(--merah); }
.badge.info { background: var(--info-bg); color: var(--info); }
.chip { display: inline-block; background: #eef2f7; border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-size: 11px; margin: 2px 3px 2px 0; color: #4a5a6a; }

/* Panel */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 18px; }
.panel h4 { margin: 0 0 12px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart { width: 100%; height: 320px; }
.chart.tall { height: 420px; }

/* Tabel */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f0f5fa; }
.tbl tr.row-hl td { background: #fff3d6; }
.tbl tr.row-hl { outline: 2px solid #e0a417; outline-offset: -2px; }
.tbl td.num, .tbl th.num { text-align: right; }
tr.row-merah td { background: var(--merah-bg); }

.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-track { flex: 1; height: 8px; background: #eef2f7; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar-fill { height: 100%; border-radius: 4px; }

/* Temuan otomatis */
.insights { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; }
.insights .insights-title { font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--sidebar); margin-bottom: 6px; }
.insights ul { margin: 0; padding-left: 18px; }
.insights li { margin: 3px 0; font-size: 13px; }

/* Filter lokal */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* Pagination */
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.pager button { padding: 4px 10px; }
.pager button:disabled { opacity: .4; cursor: default; }

/* Sparkbar */
.sparkbar { display: flex; gap: 2px; align-items: flex-end; height: 26px; }
.sparkbar .sb { width: 12px; background: var(--sidebar-active); border-radius: 2px 2px 0 0; }

/* Loading / error */
.loading { padding: 40px; text-align: center; color: var(--muted); }
.error-box { padding: 24px; background: var(--merah-bg); border: 1px solid var(--merah); border-radius: 8px; color: var(--merah); }
.empty-box { padding: 28px; text-align: center; color: var(--muted); background: #f4f6f9; border: 1px dashed var(--border); border-radius: 8px; margin: 8px 0; }

/* Sparkline di kartu KPI */
.kpi-spark { height: 36px; margin: 4px 0 6px; }

/* Timeline status mahasiswa (M4) */
.tl-strip { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 8px; }
.tl-box { width: 30px; height: 30px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.tl-mini { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; border-radius: 3px; }

/* Pencarian NIM */
.search-box { display: flex; gap: 10px; align-items: center; }
.search-results { margin-top: 12px; }

/* Profil header M4 */
.profile-head { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.profile-head .pfield { font-size: 13px; }
.profile-head .pfield b { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.mk-checklist { columns: 3; font-size: 12.5px; }
.mk-checklist .mk-item { break-inside: avoid; padding: 3px 0; }
.mk-checklist .smt { color: var(--muted); font-size: 11px; }

/* Kuadran cards */
.qcard .q-name { font-weight: 700; font-size: 14px; }
.qcard .q-count { font-size: 24px; font-weight: 700; margin: 4px 0; }
.qcard .q-desc { font-size: 11.5px; color: var(--muted); }

/* Heatmap table pewarnaan (M2) */
td.heat-hijau { background: var(--hijau-bg); }
td.heat-kuning { background: var(--kuning-bg); }
td.heat-merah { background: var(--merah-bg); }

.footer-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* Login */
/* Layar login — split screen: panel brand kiri (navy), form kanan */
#login-screen { position: fixed; inset: 0; z-index: 100; }
.login-split { display: flex; height: 100vh; width: 100%; min-width: 0; flex: 1; }
.login-brand { width: 45%; background: linear-gradient(160deg, #1b3a5c 0%, #24486e 60%, #2c5a8a 100%); color: #dce6f0; padding: 56px 52px; display: flex; flex-direction: column; justify-content: center; }
.lb-top { margin-bottom: 36px; }
.lb-badge { display: inline-block; margin-top: 14px; font-size: 10.5px; letter-spacing: 1.5px; font-weight: 600; color: #cfe0f0; border: 1px solid #5b80a6; border-radius: 999px; padding: 3px 10px; }
.lb-headline { font-size: 30px; line-height: 1.25; color: #fff; margin: 0 0 14px; }
.lb-desc { font-size: 14px; line-height: 1.6; color: #b7c9da; margin: 0 0 26px; }
.lb-features { list-style: none; margin: 0; padding: 0; }
.lb-features li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; margin-bottom: 13px; color: #d6e3ef; }
.lb-features svg { flex-shrink: 0; margin-top: 3px; color: #7fb5e8; }
.login-form-panel { flex: 1; min-width: 0; background: #f6f8fb; display: flex; align-items: center; justify-content: center; padding: 32px; overflow-y: auto; }
.login-card { width: 400px; max-width: 100%; }
.lf-title { font-size: 24px; color: var(--sidebar); margin: 0 0 6px; }
.lf-sub { font-size: 13px; color: var(--muted); margin: 0 0 22px; }
.lf-label { display: block; font-size: 12.5px; font-weight: 600; color: #35506b; margin: 12px 0 5px; }
.login-card input[type="text"], .login-card input[type="password"] { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff; }
.login-card input[type="text"]:focus, .login-card input[type="password"]:focus { outline: none; border-color: var(--sidebar-active); box-shadow: 0 0 0 3px rgba(44,90,138,.15); }
.lf-remember { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #35506b; margin-top: 12px; }
.lf-submit { width: 100%; margin-top: 16px; padding: 11px; font-size: 14px; font-weight: 600; border-radius: 8px; }
.login-error { color: var(--merah); font-size: 12.5px; min-height: 18px; margin-top: 10px; }
.lf-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--muted); font-size: 12px; }
.lf-divider::before, .lf-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.persona-grid button { background: #fff; color: var(--sidebar); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: 12.5px; font-weight: 600; text-align: left; }
.persona-grid button:hover { background: #eaf1f8; border-color: var(--sidebar-active); }
.persona-grid button small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }
.lf-note { font-size: 11.5px; color: var(--muted); margin: 12px 0 0; text-align: center; }
@media (max-width: 860px) {
  .login-brand { display: none; }
  .login-form-panel { width: 100%; }
}
.user-box { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }

/* Mode demo — selektor persona (di dasar sidebar) */
#sidebar { display: flex; flex-direction: column; }
#menu { flex: 1; overflow-y: auto; }
#persona-box { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.15); }
.demo-chip { background: #7c3aed; color: #fff; font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.4; text-align: center; overflow: hidden; text-overflow: ellipsis; }
#gf-persona { width: 100%; background: rgba(255,255,255,.10); color: #dce6f0; border: 1px solid rgba(255,255,255,.22); border-radius: 6px; padding: 6px 8px; font-size: 12px; }
#gf-persona option { color: #222; }
#sidebar.collapsed #persona-box { padding: 10px 0; align-items: center; }
#sidebar.collapsed #gf-persona { display: none; }
#sidebar.collapsed .demo-chip { width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 0; }
#sidebar.collapsed .demo-chip::after { content: "D"; font-size: 11px; line-height: 22px; display: block; }
#user-info { text-align: right; line-height: 1.3; }
#user-info small { color: var(--muted); display: block; }
.btn-logout { background: #e8eef5; color: var(--sidebar); padding: 5px 12px; }
.btn-logout:hover { background: #d5e2ee; }

/* Konsol pusat */
.menu-group { padding: 14px 18px 6px; font-size: 10px; letter-spacing: 2px; color: #7e97ad; }
.privacy-banner { background: #eaf1f8; border: 1px solid #c8d8e8; color: #35506b; border-radius: 8px; padding: 8px 14px; font-size: 12px; margin-bottom: 16px; }
.minibar { display: flex; height: 10px; border-radius: 4px; overflow: hidden; min-width: 120px; }
.minibar div { height: 100%; }
.delta-up { color: var(--hijau); font-weight: 600; }
.delta-down { color: var(--merah); font-weight: 600; }
.legend { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend .badge { margin-right: 4px; }

@media (max-width: 1200px) {
  .cards.c6 { grid-template-columns: repeat(3, 1fr); }
  .cards.c4, .cards.c3 { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .mk-checklist { columns: 2; }
}

/* ---------- responsif: tablet & HP ---------- */
#btn-menu { display: none; background: #fff; border: 1px solid var(--border); color: var(--sidebar); border-radius: 6px; width: 34px; height: 34px; padding: 0; font-size: 17px; line-height: 1; flex-shrink: 0; }
#btn-menu:hover { background: #eef2f7; }
#sidebar-overlay { display: none; }

@media (max-width: 1024px) {
  .cards.c6 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  /* Sidebar jadi off-canvas; tampil lewat tombol hamburger */
  #btn-menu { display: block; }
  #sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 240px; transform: translateX(-100%); transition: transform .2s ease; }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  /* Keadaan "ciut" tidak berlaku di HP — sidebar off-canvas selalu tampil penuh */
  #sidebar.collapsed { width: 240px; }
  #sidebar.collapsed .brand { flex-direction: row; gap: 6px; padding: 20px 18px 14px; }
  #sidebar.collapsed .brand-logo { width: 34px; height: 34px; font-size: 17px; border-radius: 9px; }
  #sidebar.collapsed .brand-text { display: block; }
  #sidebar.collapsed .menu-text { display: inline; }
  #sidebar.collapsed .menu-group { display: block; }
  #sidebar.collapsed #menu a { justify-content: flex-start; padding: 10px 18px; border-left: 3px solid transparent; }
  #sidebar.collapsed #menu a svg { margin-right: 9px; }
  #sidebar.collapsed #persona-box { padding: 12px 14px; align-items: stretch; }
  #sidebar.collapsed #gf-persona { display: block; }
  #sidebar.collapsed .demo-chip { width: auto; height: auto; padding: 5px 10px; border-radius: 999px; font-size: 11px; }
  #sidebar.collapsed .demo-chip::after { content: none; }
  #btn-collapse { display: none; }
  #sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(15,25,35,.45); z-index: 55; }

  /* Topbar membungkus rapi */
  #topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
  #tenant-name { font-size: 14px; }
  #global-filters { width: 100%; justify-content: flex-start; gap: 8px; row-gap: 8px; }
  #global-filters label { flex: 1 1 130px; flex-direction: column; align-items: stretch; gap: 3px; }
  #global-filters select { max-width: none; width: 100%; }
  .user-box { margin-left: auto; }

  /* Konten */
  #content { padding: 14px 12px; }
  .cards.c6, .cards.c4, .cards.c3 { grid-template-columns: 1fr 1fr; }
  .panel { padding: 12px; overflow-x: auto; }
  .chart { height: 260px; }
  .chart.tall { height: 320px; }
  .filters label { flex: 1 1 130px; }
  .profile-head { gap: 14px; }
  h2.page-title { font-size: 18px; }
}

@media (max-width: 520px) {
  .cards.c6, .cards.c4, .cards.c3 { grid-template-columns: 1fr; }
  .mk-checklist { columns: 1; }
  .kpi-card .kpi-value { font-size: 22px; }
  .about-hero { padding: 20px 18px; }
  .about-hero h2 { font-size: 20px; }
}

/* ---------- sidebar ciut/kembangkan ---------- */
#sidebar { transition: width .18s ease; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#btn-collapse { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #c3d3e2; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: 13px; line-height: 1; flex-shrink: 0; }
#btn-collapse:hover { background: rgba(255,255,255,.16); color: #fff; }
#menu a svg { width: 15px; height: 15px; margin-right: 9px; vertical-align: -2.5px; flex-shrink: 0; }
#menu a { display: flex; align-items: center; white-space: nowrap; overflow: hidden; }
.menu-tentang { margin-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
#sidebar.collapsed { width: 58px; }
#sidebar.collapsed .brand { flex-direction: column; gap: 8px; padding: 14px 0 10px; }
#sidebar.collapsed .brand-text { display: none; }
#sidebar.collapsed .brand-logo { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
#sidebar.collapsed .brand-sub,
#sidebar.collapsed .menu-text,
#sidebar.collapsed .menu-group { display: none; }
#sidebar.collapsed #menu a { justify-content: center; padding: 12px 0; border-left: none; border-left: 3px solid transparent; }
#sidebar.collapsed #menu a svg { margin-right: 0; }
#sidebar.collapsed .menu-tentang { margin-top: 8px; }

/* ---------- halaman Tentang ---------- */
.about-hero { background: linear-gradient(135deg, var(--sidebar), #2c5a8a); color: #fff; border-radius: 10px; padding: 28px 32px; margin-bottom: 18px; }
.about-hero h2 { margin: 0 0 6px; font-size: 24px; }
.about-hero .about-sub { color: #c8d6e5; font-size: 13.5px; }
.creator-card { }
.creator-name { font-size: 18px; font-weight: 700; }
.creator-role { color: #666; font-size: 13px; margin-top: 2px; }
.about-list { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }
