/*
 * CSS gabungan APBDes
 * Bagian 1: apbdes.css
 * Bagian 2: apbdes-realisasi.css (menimpa properti yang sama)
 */

/* ===== APBDES DASAR ===== */
:root {
  --blue: #0d6efd;
  --blue-dark: #084298;
  --orange: #ff7a00;
  --cyan: #15b7d3;
  --green: #20b547;
  --purple: #5a4be7;
  --yellow: #f2c500;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --border: #e4e9f1;
  --text: #182230;
  --muted: #6f7a89;
  --shadow: 0 10px 24px rgba(29, 54, 86, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    sans-serif;
  color: var(--text);
  background: radial-gradient(
      circle at top left,
      rgba(13, 110, 253, 0.12),
      transparent 28%
    ),
    linear-gradient(180deg, #edf5ff 0%, #f8fafc 48%, #eef2f7 100%);
}

body {
  padding: 12px;
}

.dashboard {
  width: min(1240px, 100%);
  margin: auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(13, 110, 253, 0.08);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(30, 60, 100, 0.14);
  overflow: hidden;
}

.topbar {
  position: relative;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, #0756b8, #0e89df 68%, #36b6ec);
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -115px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
}

.brand-title {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.brand-title span {
  color: #ffe066;
}

.brand-subtitle {
  position: relative;
  z-index: 2;
  margin-top: 4px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 600;
}

.identity {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #169649, #ffd400);
  color: white;
  text-align: center;
  font-size: 0.54rem;
  font-weight: 900;
  line-height: 1.05;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #ff8500;
}

.identity-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.05;
}

.identity-meta {
  margin-top: 2px;
  color: #5c6674;
  font-size: 0.72rem;
  font-weight: 650;
}

.content {
  padding: 12px;
}

.card-box {
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #fafbfd);
}

.head-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
}

.head-blue {
  background: linear-gradient(135deg, #0d6efd, #084298);
}
.head-yellow {
  background: linear-gradient(135deg, #ffd43b, #f59f00);
  color: #3a2c00;
}
.head-orange {
  background: linear-gradient(135deg, #ff8a00, #ff5f00);
}

.card-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.card-head small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.card-body-compact {
  padding: 10px 12px;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #e5eaf1;
}

.data-row:last-child {
  border-bottom: 0;
}

.data-label {
  font-size: 0.79rem;
  line-height: 1.2;
  color: #3d4856;
  font-weight: 650;
}

.data-value {
  font-size: 0.79rem;
  font-weight: 850;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.total-box {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 11px;
  background: linear-gradient(135deg, #eaf3ff, #f4f8ff);
  border: 1px solid #d0e1ff;
}

.total-box .data-label,
.total-box .data-value {
  color: #0a4a98;
  font-size: 0.86rem;
  font-weight: 950;
}

.budget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.budget-item {
  position: relative;
  min-height: 92px;
  padding: 10px;
  border-radius: 12px;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 7px 16px rgba(27, 39, 65, 0.11);
}

.budget-item::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  right: -22px;
  bottom: -26px;
  background: rgba(255, 255, 255, 0.17);
}

.budget-item i {
  font-size: 1rem;
}

.budget-title {
  margin-top: 6px;
  font-size: 0.72rem;
  line-height: 1.15;
  font-weight: 800;
  min-height: 31px;
}

.budget-value {
  margin-top: 4px;
  font-size: 0.76rem;
  font-weight: 950;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bg-orange {
  background: linear-gradient(135deg, #ff7600, #ff963d);
}
.bg-cyan {
  background: linear-gradient(135deg, #0fa7c5, #38cce3);
}
.bg-green {
  background: linear-gradient(135deg, #19a83c, #40cf61);
}
.bg-purple {
  background: linear-gradient(135deg, #5444df, #7364f0);
}

.emergency {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff6b0, #ffe15b);
  border: 1px solid #efd14b;
}

.emergency-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #655100;
  background: rgba(255, 255, 255, 0.48);
  font-size: 1rem;
}

.emergency-title {
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.15;
}

.emergency-value {
  margin-top: 2px;
  font-size: 0.82rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 0.77rem;
  font-weight: 850;
}

.summary-row strong {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.finance-title {
  margin-bottom: 4px;
  color: #2d3948;
  font-size: 0.75rem;
  font-weight: 900;
}

.finance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed #e5eaf1;
}

.finance-row:last-child {
  border-bottom: 0;
}

.finance-label {
  color: #52606f;
  font-size: 0.75rem;
  font-weight: 650;
}

.finance-value {
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.grand-total {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #ff7900, #ff5f00);
  box-shadow: 0 7px 16px rgba(255, 104, 0, 0.16);
}

.grand-total .finance-row {
  border-bottom-color: rgba(255, 255, 255, 0.23);
}

.grand-total .finance-label,
.grand-total .finance-value {
  color: #fff;
  font-weight: 900;
}

.footer {
  padding: 8px 12px 10px;
  color: #7c8795;
  text-align: center;
  font-size: 0.66rem;
}

/* Desktop: dibuat satu layar */
@media (min-width: 992px) {
  body {
    height: 100vh;
    overflow: hidden;

    display: flex;
    flex-direction: column;
    gap: 8px;

    padding: 12px;
  }

  .dashboard {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;

    width: min(1240px, 100%);
    margin: 0 auto;

    display: flex;
    flex-direction: column;
  }

  .topbar {
    flex: 0 0 auto;
  }

  .content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .footer {
    flex: 0 0 auto;
  }
}

/* Laptop pendek */
@media (min-width: 992px) and (max-height: 760px) {
  body {
    padding: 8px;
  }
  .dashboard {
    height: calc(100vh - 16px);
  }
  .topbar {
    padding: 9px 14px;
  }
  .brand-title {
    font-size: 1.7rem;
  }
  .brand-subtitle {
    font-size: 0.7rem;
  }
  .identity {
    padding: 6px 8px;
  }
  .logo {
    width: 36px;
    height: 36px;
  }
  .identity-name {
    font-size: 0.9rem;
  }
  .identity-meta {
    font-size: 0.65rem;
  }
  .content {
    padding: 9px;
  }
  .card-head {
    padding: 8px 10px;
  }
  .head-icon {
    width: 30px;
    height: 30px;
  }
  .card-head h2 {
    font-size: 0.9rem;
  }
  .card-head small {
    font-size: 0.62rem;
  }
  .card-body-compact {
    padding: 8px 10px;
  }
  .data-row {
    padding: 4px 0;
  }
  .data-label,
  .data-value {
    font-size: 0.71rem;
  }
  .budget-item {
    min-height: 80px;
    padding: 8px;
  }
  .budget-title {
    font-size: 0.65rem;
    min-height: 26px;
  }
  .budget-value {
    font-size: 0.68rem;
  }
  .emergency {
    padding: 7px 8px;
  }
  .emergency-title {
    font-size: 0.65rem;
  }
  .emergency-value {
    font-size: 0.72rem;
  }
  .summary-row {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  .finance-title {
    font-size: 0.68rem;
  }
  .finance-row {
    padding: 5px 0;
  }
  .finance-label,
  .finance-value {
    font-size: 0.68rem;
  }
  .grand-total {
    padding: 6px 8px;
  }
  .footer {
    font-size: 0.58rem;
    padding: 5px 8px;
  }
}

/* HP dan tablet: scroll normal agar tetap terbaca */
@media (max-width: 991.98px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;

    display: block;
    padding: 0;
  }

  .no-print {
    width: 100%;
    margin: 0 0 8px;
    padding: 10px 12px;
  }

  .dashboard {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
  }

  .content {
    overflow: visible;
  }
}

@media (max-width: 575.98px) {
  .brand-title {
    font-size: 1.5rem;
  }
  .brand-subtitle {
    font-size: 0.72rem;
  }
  .identity-name {
    font-size: 0.95rem;
  }
  .identity-meta {
    font-size: 0.67rem;
  }

  .budget-grid {
    grid-template-columns: 1fr;
  }

  .data-row,
  .finance-row,
  .summary-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .data-value,
  .finance-value {
    text-align: left;
  }

  .budget-item {
    min-height: auto;
  }

  .budget-title {
    min-height: auto;
  }
}

@media print {
  body {
    padding: 0;
    background: #fff;
    overflow: visible;
  }

  .dashboard {
    height: auto;
    box-shadow: none;
    border: 0;
    border-radius: 0;
  }
}

.no-print {
  width: min(1240px, 100%);
  margin: 0 auto 8px;
}

.no-print .form-label {
  font-size: 0.75rem;
  font-weight: 700;
}

.no-print .form-select,
.no-print .btn {
  min-height: 34px;
  font-size: 0.78rem;
}

@media print {
  .no-print {
    display: none !important;
  }
}

.logo {
  width: 60px;
  height: 60px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #fff;
  border-radius: 50%;

  overflow: hidden;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.filter-box {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(29, 54, 86, 0.08);
}

/* ===== APBDES REALISASI / OVERRIDE ===== */
:root {
  --primary: #0d6efd;
  --primary-dark: #084298;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --border: #e2e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --shadow: 0 12px 28px rgba(31, 55, 88, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 16px;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    sans-serif;

  background: radial-gradient(
      circle at top left,
      rgba(13, 110, 253, 0.1),
      transparent 28%
    ),
    linear-gradient(180deg, #eef5ff 0%, #f8fafc 45%, #eef2f7 100%);
}

.page-shell {
  width: min(1240px, 100%);
  margin: auto;
}

.filter-box {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(29, 54, 86, 0.08);
}

.filter-box .form-label {
  margin-bottom: 4px;
  color: #52606f;
  font-size: 0.72rem;
  font-weight: 800;
}

.filter-box .form-select,
.filter-box .btn {
  min-height: 34px;
  font-size: 0.78rem;
}

.report {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(13, 110, 253, 0.08);
  border-radius: 22px;
  box-shadow: 0 20px 55px rgba(30, 60, 100, 0.14);
}

.report-header {
  padding: 18px 22px;
  color: #fff;
  background: linear-gradient(135deg, #0757b8, #0e89df 68%, #35b7ec);
}

.header-title {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1;
}

.header-title span {
  color: #ffe066;
}

.header-subtitle {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  font-weight: 600;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 330px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.logo {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 2px solid #e9edf3;
  border-radius: 50%;
}

.logo img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.identity-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.1;
}

.identity-meta {
  margin-top: 3px;
  color: #5b6674;
  font-size: 0.78rem;
  font-weight: 650;
}

.report-body {
  padding: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.summary-card.success {
  border-left-color: var(--success);
}

.summary-card.warning {
  border-left-color: var(--warning);
}

.summary-card.dark {
  border-left-color: #334155;
}

.summary-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-value {
  margin-top: 5px;
  font-size: 1rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.summary-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 1.08rem;
  font-weight: 900;
}

.section-title .icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.field-card {
  overflow: hidden;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.field-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.field-title h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.2;
}

.field-title small {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 650;
  opacity: 0.85;
}

.field-total {
  text-align: right;
  white-space: nowrap;
}

.field-total span {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  opacity: 0.82;
}

.field-total strong {
  display: block;
  margin-top: 2px;
  font-size: 0.86rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.table {
  margin: 0;
  font-size: 0.77rem;
}

.table thead th {
  padding: 0.55rem 0.65rem;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.69rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.table tbody td,
.table tfoot td {
  padding: 0.5rem 0.65rem;
  border-color: #edf1f5;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fbfdff;
}

.sub-code {
  margin-right: 5px;
  color: var(--primary);
  font-weight: 900;
  white-space: nowrap;
}

.sub-name {
  font-weight: 700;
  line-height: 1.25;
}

.money {
  text-align: right;
  white-space: nowrap;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.percent {
  text-align: center;
  white-space: nowrap;
}

.badge-percent {
  display: inline-block;
  min-width: 58px;
  padding: 0.34rem 0.45rem;
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
}

.high {
  background: var(--success);
}

.medium {
  color: #3b2f00;
  background: var(--warning);
}

.low {
  background: var(--danger);
}

.table tfoot td {
  background: #f8fafc;
  border-top: 2px solid var(--border);
  font-weight: 950;
}

.empty-state {
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.report-footer {
  padding: 10px 16px 14px;
  color: #7b8592;
  text-align: center;
  font-size: 0.7rem;
}

@media (max-width: 991.98px) {
  .identity {
    width: 100%;
    min-width: 0;
    margin-top: 12px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  body {
    padding: 0;
    background: #f3f6fa;
  }

  .filter-box {
    margin: 0 0 8px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .report {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .report-header {
    padding: 16px 14px;
  }

  .report-body {
    padding: 12px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-total {
    text-align: left;
  }

  .table {
    min-width: 820px;
  }
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .no-print {
    display: none !important;
  }

  body {
    padding: 0;
    background: #fff;
  }

  .report {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .field-card {
    break-inside: avoid;
  }
}

/* ===== IZINKAN SCROLL UNTUK KEDUA HALAMAN ===== */
html,
body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  display: block;
}

.dashboard,
.report,
.page-shell {
  height: auto;
  min-height: 0;
}

.content,
.report-body {
  overflow: visible;
}

@media (min-width: 992px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    display: block;
  }

  .dashboard {
    height: auto;
    min-height: 0;
  }

  .content {
    overflow: visible;
  }
}

/* Halaman realisasi harus dapat di-scroll meskipun CSS APBDes utama
   menggunakan tinggi satu layar pada desktop. */
body.realisasi-page {
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
}
