/* =============================================================
   YEARLY DETAIL TABLE — Desktop & Mobile
   ============================================================= */

/* Desktop: tabel tampil, mobile cards disembunyikan */
#yr-tbl-desktop { display: block; }
#yr-mobile-cards { display: none; }

/* Desktop tabel — identik standar Budget */
#yr-tbl-head th {
  white-space: nowrap;
  background: var(--bg3);
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 12px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx3);
  border-bottom: 1px solid var(--bd);
  font-family: -apple-system,'Inter','Roboto','Segoe UI',sans-serif;
}
#yr-tbl-head th:not(:first-child) { text-align: right; }
#yr-tbl-body td { white-space: nowrap; font-family: -apple-system,'Inter','Roboto','Segoe UI',sans-serif; }
#yr-tbl-body td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
/* Section header rows — identik Budget */
.yr-sec-row td { padding: 9px 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
/* Category rows — left indent + dot, identik Budget */
.yr-cat-row td { font-size: 11px; padding: 8px 12px; }
.yr-cat-row td:first-child { padding-left: 20px; }
.yr-cat-row:hover td { background: var(--tbl-hover) !important; }
.yr-sec-row { border-left: 3px solid transparent; }

/* =============================================================
   YEARLY MOBILE CARD VIEW
   Layout: setiap section punya header + horizontal scroll bulan
   Setiap kategori: dot berwarna | nama | aktual | budget | selisih
   ============================================================= */
/* yearly: desktop table always shown, horizontal scroll */

.yr-mob-cat { background: var(--bg2); }
.yr-mob-month-chip {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}

/* =============================================================
   LIGHT MODE — Global fixes
   Tambahan override yang belum ada di LIGHT_CSS_OVERRIDES
   ============================================================= */

/* Pastikan input di light mode tidak inherit dark background */
.light-mode input,
.light-mode select,
.light-mode textarea {
  background: var(--input-bg);
  color: var(--tx);
  border-color: var(--bd);
}

/* Yearly table di light mode */
#yr-tbl-body tr.yr-sec-row td {
  border-bottom: 1px solid var(--bd);
}
#yr-tbl-body tr.yr-cat-row td {
  border-bottom: 1px solid rgba(0,0,0,0.04);
}


/* =============================================================
   PORTFOLIO DONUT CARDS — Equal height, 2-col mobile
   ============================================================= */

/* Grid wrapper: stretch = kedua card sama tinggi */
.p-donut-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

/* Card: flexbox column agar legend mengisi ruang tersisa */
.p-alloc-card {
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
  height: auto !important;
  min-height: 0 !important;
}

/* Donut canvas wrapper: fixed height, sama di kedua card */
.p-donut-wrap {
  position: relative;
  height: 180px;
  flex-shrink: 0;
  width: 100%;
}
.p-donut-wrap canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto !important;
  height: auto !important;
  display: block;
}
/* Dashboard donut: centered, not stretched */
#d-pie-chart, #d-inc-pie-chart {
  display: block;
  margin: 0 auto;
}

/* Legend: mengisi sisa tinggi, overflow hidden + scroll tipis */
.p-leg-v {
  flex: 1;
  overflow: hidden;
  width: 100%;
  margin-top: 10px;
  min-height: 0;
}
.p-leg-v > div {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  min-width: 0;
  width: 100%;
}

/* Mobile: 1 baris 2 diagram, tetap sama besar */
@media (max-width: 768px) {
  .p-donut-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  .p-alloc-card {
    padding: 10px 10px !important;
  }
  .p-donut-wrap {
    height: 130px !important;
  }
  /* Legend: font lebih kecil, semua teks wrap dengan benar */
  .p-leg-v > div {
    gap: 4px !important;
    padding: 3px 0 !important;
  }
  .p-leg-v > div span:nth-child(2) {
    /* nama aset */
    font-size: 9px !important;
    line-height: 1.3 !important;
  }
  .p-leg-v > div span:nth-child(3) {
    /* persentase */
    font-size: 8px !important;
  }
  .p-leg-v > div span:nth-child(4) {
    /* nominal Rp */
    font-size: 9px !important;
  }
}
@media (max-width: 440px) {
  .p-donut-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
  .p-donut-wrap { height: 110px !important; }
  .p-alloc-card { padding: 8px 8px !important; }
}

