@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --green-950: #102f25;
  --green-900: #123c2d;
  --green-800: #18513b;
  --green-700: #22664a;
  --green-100: #e8f1eb;
  --cream: #f7f7f1;
  --gold: #c9a65b;
  --ink: #1f2b25;
  --muted: #6c7770;
  --line: #e5e9e4;
  --white: #ffffff;
  --red: #a8413b;
  --shadow: 0 12px 32px rgba(20, 49, 36, .07);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
.site-header {
  color: white;
  background: linear-gradient(115deg, var(--green-950), var(--green-800));
  padding: 25px 0;
  border-bottom: 3px solid var(--gold);
}
.header-inner, .container {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-mark {
  width: 58px; height: 58px; flex: 0 0 58px;
  display: grid; place-items: center;
  border: 1px solid rgba(230, 203, 139, .7);
  border-radius: 16px;
  color: #f3dfae;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 14px;
  background: rgba(255,255,255,.06);
}
.eyebrow { margin: 0 0 5px; font-size: 10px; letter-spacing: 1.6px; font-weight: 700; color: #d6c18c; }
.eyebrow.green { color: var(--green-700); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font: 700 clamp(20px, 3vw, 27px) "Playfair Display", Georgia, serif; color: white; }
h2 { margin-bottom: 0; font: 700 22px "Playfair Display", Georgia, serif; color: var(--green-950); }
.subtitle { margin: 0; color: rgba(255,255,255,.76); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.status-pill { border-radius: 30px; padding: 7px 10px; font-size: 11px; background: rgba(255,255,255,.12); color: #fff; white-space: nowrap; }
.status-online { background: rgba(210,240,219,.18); color: #d8f1df; }
.status-error { background: rgba(255,220,220,.16); color: #ffe0dc; }
.status-wait { color: #f4e5bf; }
.btn { border: 0; border-radius: 9px; padding: 10px 15px; cursor: pointer; font-weight: 700; font-size: 12px; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-light { color: var(--green-900); background: #fff; }
.btn-primary { color: #fff; background: var(--green-800); }
.btn-primary:hover { background: var(--green-900); }
.btn-outline { color: var(--green-800); border: 1px solid #b9cdbf; background: white; }
.btn-muted { color: #48564d; background: #e9ede9; }
.btn-full { width: 100%; }
.container { padding: 30px 0 45px; }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.intro-row h2 { font-size: 27px; margin-bottom: 5px; }
.muted { color: var(--muted); margin: 0; font-size: 13px; }
.admin-badge { padding: 8px 12px; color: var(--green-800); background: var(--green-100); border: 1px solid #c8dccd; border-radius: 30px; font-size: 11px; font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 22px; }
.summary-card { position: relative; overflow: hidden; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.summary-card::after { content: ""; position: absolute; right: -25px; top: -35px; width: 100px; height: 100px; border-radius: 50%; background: rgba(34,102,74,.055); }
.summary-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.summary-value { margin: 9px 0 5px; color: var(--green-950); font-size: clamp(20px, 2.5vw, 28px); font-weight: 700; letter-spacing: -.6px; overflow-wrap: anywhere; }
.summary-foot { color: #8a948d; font-size: 11px; }
.income-card { border-top: 3px solid #4d9870; }
.expense-card { border-top: 3px solid #c87868; }
.balance-card { border-top: 3px solid var(--gold); }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.admin-panel { border-top: 3px solid var(--gold); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.private-note { color: #8b7543; background: #faf4e6; border-radius: 30px; padding: 7px 10px; font-size: 10px; font-weight: 700; }
.transaction-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
label { display: flex; flex-direction: column; gap: 7px; color: #48564d; font-size: 11px; font-weight: 700; }
input, select {
  min-width: 0; width: 100%; height: 40px; padding: 0 11px;
  border: 1px solid #dce4dd; border-radius: 8px; background: #fff; color: var(--ink);
  outline: none; font-size: 12px;
}
input:focus, select:focus { border-color: #76a58a; box-shadow: 0 0 0 3px rgba(34,102,74,.09); }
.description-field, .party-name-field { grid-column: span 2; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.form-message { margin: 0; color: var(--red); font-size: 11px; font-weight: 500; }
.form-message.success { color: var(--green-700); }
.filters { display: grid; grid-template-columns: 190px 190px 1fr; gap: 12px; margin-bottom: 16px; }
.search-field { min-width: 180px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
thead { background: #f3f7f3; }
th { padding: 12px 13px; text-align: left; color: #53645a; font-size: 10px; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 13px; border-top: 1px solid #edf0ed; color: #35443b; font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: #fbfcfa; }
.number { text-align: right; }
.amount-in { color: var(--green-700); font-weight: 700; white-space: nowrap; }
.amount-out { color: var(--red); font-weight: 700; white-space: nowrap; }
.type-tag { display: inline-block; border-radius: 20px; padding: 5px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.tag-in { color: #276b49; background: #e7f3ea; }
.tag-out { color: #a3433b; background: #faece9; }
.row-actions { display: flex; gap: 6px; }
.mini-btn { border: 1px solid #dce4dd; background: white; border-radius: 6px; padding: 5px 8px; font-size: 10px; cursor: pointer; color: #405349; }
.mini-btn.delete { color: #a3433b; }
.mini-btn.receipt { color: #1c6848; border-color: #b9d2c2; font-weight: 700; }
.row-actions { flex-wrap: wrap; }
.empty-state { text-align: center; padding: 28px 12px; color: #87928a; }
.table-footer { display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 11px; padding-top: 13px; }
.public-note { padding: 15px 17px; border-left: 3px solid var(--gold); background: #f1f4ed; border-radius: 0 9px 9px 0; color: #667269; font-size: 11px; line-height: 1.6; }
.public-note strong { color: var(--green-900); }
.site-footer { border-top: 1px solid var(--line); text-align: center; padding: 18px; color: #89938c; font-size: 10px; }
.site-footer p { margin: 0; }
.login-dialog { width: min(420px, calc(100% - 30px)); border: 0; border-radius: 15px; padding: 25px; box-shadow: 0 25px 70px rgba(0,0,0,.2); }
.login-dialog::backdrop { background: rgba(9, 28, 20, .55); backdrop-filter: blur(2px); }
.login-dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 5px; }
.dialog-heading h2 { font-size: 21px; }
.close-btn { border: 0; background: transparent; color: #65736a; font-size: 25px; cursor: pointer; line-height: 1; }
.login-hint { color: #8a948d; font-size: 10px; line-height: 1.5; margin: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(380px, calc(100% - 40px)); padding: 12px 16px; background: var(--green-950); color: white; border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; z-index: 10; }
.toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 760px) {
  .site-header { padding: 20px 0; }
  .header-inner { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .intro-row { align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: 1fr; gap: 10px; }
  .summary-card { padding: 16px 18px; }
  .summary-value { margin: 5px 0; }
  .transaction-form { grid-template-columns: repeat(2, 1fr); }
  .description-field { grid-column: span 2; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .list-heading { align-items: flex-start; flex-direction: column; }
  .table-footer { flex-direction: column; gap: 6px; }
}
@media (max-width: 430px) {
  .header-inner, .container { width: min(100% - 24px, 1120px); }
  .brand { align-items: flex-start; gap: 10px; }
  .brand-mark { width: 46px; height: 46px; flex-basis: 46px; border-radius: 12px; font-size: 11px; }
  .subtitle { line-height: 1.5; }
  .transaction-form { grid-template-columns: 1fr; }
  .description-field, .party-name-field { grid-column: auto; }
  .filters { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .panel { padding: 16px; }
  .form-actions { flex-wrap: wrap; }
}


/* Pengaturan profil masjid */
.brand-mark { overflow: hidden; }
.brand-mark.has-logo { padding: 3px; background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 11px; display: block; }
.profile-editor-grid { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.profile-photo-card { display: flex; flex-direction: column; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
.profile-preview-frame { width: 150px; height: 150px; margin: 0 auto; display: grid; place-items: center; border: 1px dashed #c7d6cb; border-radius: 14px; background: white; overflow: hidden; }
.profile-logo-preview { width: 100%; height: 100%; object-fit: contain; }
.profile-logo-placeholder { color: var(--green-800); font-size: 25px; font-weight: 700; letter-spacing: 1px; }
.file-label input[type="file"] { height: auto; padding: 9px; background: white; }
.checkbox-label { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.checkbox-label input { width: 15px; height: 15px; margin: 0; }
.help-text { margin: 0; color: #78847b; font-size: 10px; line-height: 1.55; font-weight: 400; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.profile-description-field { grid-column: 1 / -1; }
.profile-fields textarea { width: 100%; min-height: 78px; padding: 10px 11px; border: 1px solid #dce4dd; border-radius: 8px; color: var(--ink); font: inherit; font-size: 12px; resize: vertical; }
.profile-fields textarea:focus { outline: none; border-color: #76a58a; box-shadow: 0 0 0 3px rgba(34,102,74,.09); }
.profile-form-actions { margin-top: 16px; }
@media (max-width: 760px) { .profile-editor-grid { grid-template-columns: 1fr; } .profile-photo-card { max-width: none; } .profile-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 430px) { .profile-fields { grid-template-columns: 1fr; } .profile-description-field { grid-column: auto; } .profile-preview-frame { width: 125px; height: 125px; } }


/* Pilihan tanggal yang dicetak pada titimangsa laporan PDF */
.report-actions { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.print-date-field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; color: var(--ink); font-size: 11px; font-weight: 600; }
.print-date-field input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
.print-date-field input:focus { outline: none; border-color: #76a58a; box-shadow: 0 0 0 3px rgba(34,102,74,.09); }
@media (max-width: 760px) { .report-actions { width: 100%; justify-content: flex-start; } .print-date-field { flex: 1 1 180px; } }


/* Jadwal salat: perhitungan astronomis lokal berdasarkan koordinat masjid */
.prayer-widget-panel {
  border-top: 3px solid var(--green-700);
}
.prayer-widget-heading {
  align-items: flex-start;
  margin-bottom: 16px;
}
.prayer-widget-location {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.prayer-coordinate-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}
.prayer-source-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8e8dd;
  border-radius: 999px;
  padding: 7px 11px;
  background: #f3f8f4;
  color: var(--green-800, #245b3e);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.prayer-next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  margin: 4px 0 14px;
  border: 1px solid #d8e8dd;
  border-radius: 12px;
  background: #f3f8f4;
}
.prayer-next-card > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.prayer-next-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
}
#prayerNextName {
  color: #123c2d;
  font-size: 21px;
  line-height: 1.2;
}
.prayer-next-date {
  color: var(--muted);
  font-size: 10px;
}
.prayer-next-time-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.prayer-next-time {
  color: #123c2d;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.prayer-countdown {
  color: var(--green-700);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.prayer-today-date {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.prayer-times-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.prayer-time-card {
  min-width: 0;
  padding: 13px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfa;
  text-align: center;
}
.prayer-time-card.is-next {
  border-color: #8eb99e;
  background: #f3f8f4;
}
.prayer-time-name {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
}
.prayer-time-value {
  display: block;
  color: #123c2d;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.prayer-loading {
  grid-column: 1 / -1;
  padding: 22px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.prayer-calculation-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}
@media (max-width: 640px) {
  .prayer-widget-heading {
    flex-direction: column;
  }
  .prayer-next-card {
    padding: 13px;
  }
  .prayer-times-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prayer-next-time {
    font-size: 24px;
  }
}

/* Navigasi halaman */
[data-page][hidden], .profile-details [hidden] { display: none !important; }
.section-nav { display: flex; gap: 6px; width: fit-content; max-width: 100%; padding: 5px; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.section-nav a { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 8px; color: var(--green-900); text-decoration: none; font-weight: 700; }
.section-nav a:hover { background: var(--green-100); }
.section-nav a[aria-current="page"] { background: var(--green-900); color: white; }
.section-nav a:focus-visible { outline: 2px solid var(--green-700); outline-offset: 3px; }
.section-nav a span { font-size: 16px; line-height: 1; }
.profile-details { display: grid; gap: 14px; margin: 0; }
.profile-details dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.profile-details dd { margin: 0; overflow-wrap: anywhere; }
#profil .public-note { margin-bottom: 18px; }
@media (max-width: 600px) {
  /* Navigasi dibuat dua kolom agar semua menu, termasuk Jadwal Sholat,
     tetap terlihat dan mudah disentuh pada layar HP. */
  .section-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    box-sizing: border-box;
    overflow: visible;
  }
  .section-nav a {
    display: flex;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
    white-space: normal;
    text-align: center;
    padding: 11px 6px;
    font-size: 13px;
    line-height: 1.25;
  }
  .section-nav a span { flex: 0 0 auto; }
}

#fundStatus { margin-bottom: 12px; }
.fund-detail h3 { margin: 0 0 14px; color: var(--green-950); font-size: 17px; }
.fund-detail dl { margin: 0 0 16px; }
.fund-detail dl div { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; padding: 7px 0; }
.fund-detail dt { color: var(--muted); }
.fund-detail dd { margin: 0; text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.fund-detail .fund-balance { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.fund-balance dd { color: var(--green-950); font-size: clamp(18px, 2.2vw, 25px); }
.fund-detail .btn { display: inline-block; text-decoration: none; }
@media (max-width: 800px) { .fund-details { grid-template-columns: 1fr; } }

.prayer-widget-compact { padding: 16px 18px; }
.prayer-widget-compact .prayer-widget-heading { align-items: center; margin-bottom: 10px; }
.prayer-widget-compact .prayer-widget-location { margin: 4px 0 0; }
.prayer-date-badge { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--green-800); font-size: 12px; font-weight: 700; }
.prayer-date-badge span:last-child { border-radius: 5px; padding-inline: 5px; background: var(--green-100); }
.prayer-widget-compact .prayer-next-card { padding: 10px 14px; margin-bottom: 10px; }
.prayer-widget-compact .prayer-next-time { font-size: 26px; }
.prayer-widget-compact .prayer-times-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.prayer-widget-compact .prayer-time-card { padding: 7px 5px; text-align: center; min-height: 0; }
.prayer-widget-compact .prayer-time-value { font-size: 16px; }
.prayer-method { margin-top: 9px; font-size: 11px; color: var(--muted); }
.prayer-method summary { width: fit-content; cursor: pointer; color: var(--green-800); }
@media (max-width: 760px) { .prayer-widget-compact .prayer-times-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 480px) { .prayer-widget-compact { padding: 12px; } .prayer-widget-compact .prayer-widget-heading { align-items: start; } }
