/* Halaman Dashboard */
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sub { color: var(--mu); font-size: 12px; margin: 2px 0 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.sub input { font-size: 12px; background: var(--card); padding: 2px 6px; border-radius: 6px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.bar .src { font-size: 12px; color: var(--mu); }
.m .l { font-size: 12px; color: var(--mu); }
.m .v { font-size: 26px; font-weight: 600; line-height: 1.2; }
.m .n { font-size: 11px; color: var(--mu); }
.cv { position: relative; height: 230px; }
.sec { margin: 20px 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mu); }
.exec { border-left: 4px solid var(--bad); margin-bottom: 12px; }
.exec p { margin: 0; }
.bn { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.bn i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); color: #fff; text-align: center; font: 600 12px/22px system-ui; font-style: normal; }
.empty { text-align: center; padding: 40px 16px; }
.c-ok { color: var(--ok); } .c-bad { color: var(--bad); } .c-hold { color: var(--hold); }

/* ---------- Grid widget (GridStack: posisi x/y & ukuran w/h bebas, 12 kolom) ---------- */
.grid-stack.dgrid { margin: 0 -6px; }
.grid-stack-item-content { overflow: visible !important; }
.wd { height: 100%; min-width: 0; display: flex; flex-direction: column; }
.wd > .card, .wd > .g { flex: 1; min-height: 0; }
.wd > .card { display: flex; flex-direction: column; overflow: auto; }
/* Kartu KPI: satu angka per kartu, isi tidak memunculkan scrollbar */
.wd > .card.m { overflow: hidden; }
.wd-h { justify-content: flex-end; }
.wd-h .sec { margin: 0 0 2px; }
.dgrid .exec { margin-bottom: 0; }
/* Chart mengisi sisa tinggi kartu, jadi ikut berubah saat kartu di-resize */
.dgrid .cv { flex: 1; min-height: 60px; height: auto; }
.dgrid .cv.tall { height: auto; }
.ch { display: flex; align-items: flex-start; gap: 8px; }
.ch > div { flex: 1; min-width: 0; }
.ch h2 { margin-bottom: 4px; }
.ch .fn { margin: 0 0 8px; }
.ch .tb { font-size: 11px; padding: 2px 8px; }
.card > h2 + .cv, .ch + .cv { margin-top: 6px; }
.hb { align-self: end; }

/* Kartu teks */
.tcard .tx p { margin: 0 0 8px; }
.tcard .tx p:last-child, .tcard .tx ul:last-child { margin-bottom: 0; }
.tcard .tx ul { margin: 0 0 8px; }
.tcard.tone-info { border-left: 4px solid var(--wip); }
.tcard.tone-ok { border-left: 4px solid var(--ok); }
.tcard.tone-warn { border-left: 4px solid var(--hold); }
.tcard.tone-bad { border-left: 4px solid var(--bad); }

/* Kartu angka (hero) */
.hero { padding: 6px 0 2px; }
.hero .hv { font-size: 44px; font-weight: 600; line-height: 1.1; }
.hero .n { font-size: 12px; color: var(--mu); margin-top: 4px; }

/* Bar tersegmen */
.segbar { display: flex; gap: 2px; height: 40px; margin: 10px 0 12px; }
.seg { min-width: 3px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; overflow: hidden; white-space: nowrap; }
.seg:first-child { border-radius: 4px 0 0 4px; } .seg:last-child { border-radius: 0 4px 4px 0; } .seg:only-child { border-radius: 4px; }
.seglegend { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 12px; }
.seglegend li { display: grid; grid-template-columns: 10px 1fr auto 40px; gap: 8px; align-items: center; margin: 0; }
.seglegend i { width: 10px; height: 10px; border-radius: 2px; }
.seglegend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.seglegend .muted { text-align: right; font-variant-numeric: tabular-nums; }

/* Tabel data chart */
.tblwrap { overflow: auto; max-height: 340px; margin-top: 6px; }
table.dt { width: 100%; border-collapse: collapse; font-size: 12px; }
table.dt th, table.dt td { padding: 5px 8px; border-bottom: 1px solid var(--bd); text-align: left; }
table.dt th { color: var(--mu); font-weight: 600; position: sticky; top: 0; background: var(--card); }
table.dt td.num, table.dt th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Mode atur ---------- */
.editbar { position: sticky; top: 0; z-index: 15; margin: 0 0 12px; background: var(--card); border: 1px solid var(--wip); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0, 0, 0, .08); }
.eb-in { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; }
.eb-t { display: flex; flex-direction: column; flex: 1 1 280px; }
.editbar .btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 520px; }
.editbar select { font-size: 12px; padding: 4px 8px; }

/* Editor widget (modal) */
.mb.xwide { max-width: 1040px; }
.ed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
@media (max-width: 820px) { .ed { grid-template-columns: 1fr; } }
.edf { display: grid; gap: 10px; }
.edp { position: sticky; top: 0; display: grid; gap: 6px; }
.edp .card { box-shadow: 0 1px 0 var(--bd); }
.r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.r2[hidden], label.f[hidden] { display: none; }
.fs { border: 1px solid var(--bd); border-radius: 8px; padding: 8px 10px 10px; margin: 0; }
.fs legend { font-size: 12px; color: var(--mu); padding: 0 4px; }
.fl { font-size: 11px; color: var(--mu); margin: 6px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; border: 1px solid var(--bd); border-radius: 99px; padding: 2px 9px 2px 6px; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--wip); background: color-mix(in srgb, var(--wip) 12%, transparent); }
.hint code, .note code { font-size: 11px; }
.frm { display: grid; gap: 12px; }

/* ---------- Efek hover kartu & chart: menandai kartu yang sedang ditunjuk kursor ---------- */
.dgrid .card {
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.dgrid .card:hover, .dgrid .card:focus-within {
  border-color: color-mix(in srgb, var(--wip) 45%, var(--bd));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--wip) 55%, transparent), 0 10px 24px -10px var(--shadow-hover);
  transform: translateY(-2px);
  position: relative; z-index: 1;
}
/* Kartu beraksen kiri (Executive Summary, kartu teks) tetap mempertahankan warna aksennya */
.dgrid .card.exec:hover, .dgrid .card.exec:focus-within { border-left-color: var(--bad); }
.dgrid .tcard.tone-info:hover { border-left-color: var(--wip); }
.dgrid .tcard.tone-ok:hover { border-left-color: var(--ok); }
.dgrid .tcard.tone-warn:hover { border-left-color: var(--hold); }
.dgrid .tcard.tone-bad:hover { border-left-color: var(--bad); }
@media (prefers-reduced-motion: reduce) {
  .dgrid .card { transition: none; }
  .dgrid .card:hover, .dgrid .card:focus-within { transform: none; }
}

/* ---------- Lebar halaman (diatur di mode atur dashboard) ---------- */
body[data-width="wide"] .w { width: 95%; }
body[data-width="xwide"] .w { width: 98%; }
body[data-width="full"] .w { width: 100%; box-sizing: border-box; padding-left: clamp(16px, 2vw, 32px); padding-right: clamp(16px, 2vw, 32px); }
/* Chart sedikit lebih tinggi saat halaman lebar agar tidak gepeng */
.editbar .pw { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mu); }

/* ---------- Mode atur: kontrol di dalam kartu (tanpa garis putus-putus) ---------- */
.dgrid .wd { position: relative; }
.wtools { position: absolute; z-index: 5; top: 10px; right: 10px; display: flex; align-items: center; gap: 4px; }
.dgrid:not(.editing) .wtools.ltb { right: 76px; }
.wd-h .wtools { top: 50%; transform: translateY(-50%); right: 4px; }
.wtools .wt, .wtools .wtag { display: none; }
.dgrid .grid-stack-item:hover .wtools .wt, .dgrid .grid-stack-item:focus-within .wtools .wt,
.dgrid .grid-stack-item:hover .wtools .wtag, .dgrid .grid-stack-item:focus-within .wtools .wtag { display: inline-flex; }
@media (hover: none) { .wtools .wt, .wtools .wtag { display: inline-flex; } }
.wt { align-items: center; gap: 3px; height: 24px; min-width: 24px; justify-content: center; padding: 0 7px; font: inherit; font-size: 11px; line-height: 1; color: var(--tx); background: var(--card); border: 1px solid var(--bd); border-radius: 6px; cursor: pointer; box-shadow: 0 1px 2px var(--shadow); }
.wt:hover { background: var(--hover); }
.wt.danger { color: var(--bad); }
.wt[aria-pressed="true"] { color: var(--wip); }
.wtag { align-items: center; height: 20px; padding: 0 7px; font-size: 10px; font-weight: 600; color: var(--mu); background: var(--grid); border-radius: 99px; }
.wh { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; font-size: 15px; line-height: 1; color: var(--mu); border-radius: 6px; cursor: grab; user-select: none; }
.wh:hover { background: var(--hover); color: var(--tx); }
.wh:active { cursor: grabbing; }
.dgrid.editing .wh:focus-visible { outline: 2px solid var(--wip); outline-offset: 1px; color: var(--wip); }
/* Tombol "Tabel" disembunyikan selama mengatur agar tidak bertabrakan dengan kontrol */
.dgrid.editing .ch .tb { display: none; }
/* Judul bagian (tanpa kartu): sorot ringan saat ditunjuk */
.dgrid.editing .wd-h { border-radius: 8px; }
.dgrid.editing .grid-stack-item:hover .wd-h { background: var(--hover); }
/* Resize: siku kecil di pojok kanan bawah kartu saat ditunjuk; tepi kiri/kanan/bawah tetap bisa ditarik (tanpa garis) */
.dgrid.editing .grid-stack-item > .ui-resizable-handle { background: none; }
.dgrid.editing .grid-stack-item > .ui-resizable-e, .dgrid.editing .grid-stack-item > .ui-resizable-w { top: 6px; bottom: 6px; width: 8px; }
.dgrid.editing .grid-stack-item > .ui-resizable-e { right: -1px; }
.dgrid.editing .grid-stack-item > .ui-resizable-w { left: -1px; }
.dgrid.editing .grid-stack-item > .ui-resizable-s { bottom: -1px; height: 8px; }
.dgrid.editing .grid-stack-item > .ui-resizable-sw { display: none; }
.dgrid.editing .grid-stack-item > .ui-resizable-se { width: 18px; height: 18px; right: 8px; bottom: 8px; transform: none; opacity: 0; transition: opacity .15s; }
.dgrid.editing .grid-stack-item > .ui-resizable-se::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 9px; height: 9px; border-right: 2px solid var(--mu); border-bottom: 2px solid var(--mu); border-radius: 0 0 3px 0; }
.dgrid.editing .grid-stack-item:hover > .ui-resizable-se { opacity: 1; }
.dgrid.editing .grid-stack-item > .ui-resizable-se:hover::after { border-color: var(--wip); }
/* Kartu sangat pendek (judul bagian): tanpa siku, cukup tarik tepinya (GridStack menghapus gs-h bila tingginya 1) */
.dgrid.editing .grid-stack-item:not([gs-h]) > .ui-resizable-se, .dgrid.editing .grid-stack-item[gs-h="1"] > .ui-resizable-se { display: none; }
.grid-stack-item.ui-draggable-dragging .card, .grid-stack-item.ui-resizable-resizing .card { box-shadow: 0 16px 40px -12px var(--shadow-hover); }

/* Tinggi otomatis: kartu memakai tinggi alami isinya (GridStack mengukur & menyesuaikan baris grid) */
.grid-stack-item.size-to-content .wd { height: auto; }
.grid-stack-item.size-to-content .wd > .card { flex: none; overflow: visible; }
/* Label narasi manual */
.note.nm { margin-top: 10px; }
.note.nm.stale { color: color-mix(in srgb, var(--hold) 70%, var(--tx)); font-weight: 600; }
/* Fokus keyboard pada label kartu di mode atur */
