/* modules.css — kartu, tombol, form, beranda, progress, pengaturan */

/* ---------- dasar komponen ---------- */
.card {
  background: var(--surface);
  border: 1px solid rgba(230, 234, 231, .7);
  border-radius: var(--r-card);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 {
  font-size: var(--fs-17);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.2px;
}
.section-head svg { color: var(--muted-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: var(--fs-16);
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  transition: transform .12s ease, background .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: var(--emerald);
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 113, 90, .2);
}
.btn-primary:disabled { opacity: .6; box-shadow: none; }
.btn-block { width: 100%; }

/* ---------- form ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > span {
  color: var(--ink-2);
  font-size: var(--fs-16);
  font-weight: 650;
  line-height: 1.3;
}
.field > span small { color: var(--muted-3); font-weight: 500; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-4);
  font-size: var(--fs-16);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--emerald);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(18, 113, 90, .1);
}
.field > small { color: var(--muted-3); font-size: var(--fs-11); line-height: 1.4; }
.field-count { text-align: right; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.field-row .field { margin-bottom: 0; }

/* ---------- badge & status ---------- */
.day-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-10);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.day-badge.is-sempurna,
.status-pill.is-masjid { background: var(--mint-soft-2); color: var(--emerald-2); }
.day-badge.is-gagal,
.status-pill.is-tinggal { background: var(--danger-soft); color: var(--danger); }
.day-badge.is-empty,
.status-pill.is-empty { background: var(--surface-2); color: var(--muted-3); }
.status-pill.is-sendiri { background: var(--gold-soft); color: var(--amber-ink); }

/* ---------- beranda ---------- */
/* Baris aksi cepat di atas hero (notifikasi, impor, ekspor). */
.top-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  margin-bottom: 6px;
}
.top-action-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  transition: opacity .15s ease, background-color .15s ease, transform .12s ease;
}
.top-action-btn .ico { display: block; width: 24px; height: 24px; }
.top-action-btn svg { color: #fff; }
.top-action-btn:active {
  opacity: .6;
  transform: scale(.94);
}
.top-action-btn:disabled { opacity: .5; cursor: progress; }
@media (hover: hover) {
  .top-action-btn:hover { background: rgba(255, 255, 255, .18); }
}

.home-hero {
  position: relative;
  overflow: hidden;
  padding: calc(18px + env(safe-area-inset-top)) var(--gutter) 24px;
  background: linear-gradient(145deg, var(--deep) 0%, var(--deep-2) 100%);
  color: #fff;
  border-radius: 0 0 28px 28px;
}
.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, rgba(143, 227, 194, .07) 25%, transparent 25%, transparent 75%, rgba(143, 227, 194, .07) 75%),
    linear-gradient(45deg, rgba(143, 227, 194, .07) 25%, transparent 25%, transparent 75%, rgba(143, 227, 194, .07) 75%);
  background-size: 70px 70px;
  background-position: 0 0, 35px 35px;
  pointer-events: none;
}
.home-hero > * { position: relative; z-index: 1; }

.home-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.home-hero-copy { min-width: 0; }
.hero-eyebrow {
  color: var(--on-dark);
  font-size: var(--fs-10);
  font-weight: 800;
  letter-spacing: 1px;
}
.home-hero h1 {
  margin-top: 7px;
  font-size: var(--fs-36);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.9px;
}
.home-hero-copy p {
  margin-top: 6px;
  color: var(--on-dark-3);
  font-size: var(--fs-12);
  line-height: 1.4;
}
.hero-debt {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 128px;
  padding: 10px 12px;
  border: 1px solid rgba(240, 203, 132, .34);
  border-radius: 16px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  text-align: right;
}
.hero-debt span {
  color: var(--on-dark-3);
  font-size: var(--fs-10);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.hero-debt strong {
  color: var(--gold);
  font-size: var(--fs-28);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero-debt small { color: var(--on-dark-3); font-size: var(--fs-10); }

.hero-bar {
  height: 8px;
  margin-top: 22px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .17);
  overflow: hidden;
}
.hero-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--on-dark-4));
}
.hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--on-dark-3);
  font-size: var(--fs-10);
  font-weight: 600;
}

.home-page { padding-top: 16px; padding-bottom: 72px; }

.today-card { padding: 18px 18px 16px; }
.today-times {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 12px 0 16px;
}
.today-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 68px;
  padding: 8px 1px;
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
}
.today-time span {
  max-width: 100%;
  color: var(--muted);
  font-size: var(--fs-10);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.1px;
}
.today-time b {
  max-width: 100%;
  color: var(--muted-3);
  font-size: var(--fs-10);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.1px;
}
.today-time.is-masjid { background: var(--mint-soft-2); }
.today-time.is-masjid b { color: var(--emerald-2); }
.today-time.is-sendiri { background: var(--gold-soft); }
.today-time.is-sendiri b { color: var(--amber-ink); }
.today-time.is-tinggal { background: var(--danger-soft); }
.today-time.is-tinggal b { color: var(--danger); }

.today-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.today-foot p {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: 1.5;
}
.today-foot .btn { flex: 0 0 auto; padding: 0 16px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-card {
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid rgba(230, 234, 231, .7);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 600;
  line-height: 1.2;
}
.stat-card strong {
  display: block;
  margin-top: 7px;
  font-size: var(--fs-28);
  line-height: 1.05;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stat-card small { color: var(--muted-3); font-size: var(--fs-10); }
.stat-card.is-good strong { color: var(--emerald); }
.stat-card.is-bad strong { color: var(--danger); }

.recent-card .section-head { margin-bottom: 4px; }
.recent-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.recent-row:first-of-type { border-top: 0; }
.recent-date b { display: block; font-size: var(--fs-12); font-weight: 750; }
.recent-date small { color: var(--muted-3); font-size: var(--fs-10); }
.recent-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.recent-track span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--emerald);
}
.recent-status {
  padding: 5px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-10);
  font-weight: 750;
}
.recent-status.is-sempurna { background: var(--mint-soft-2); color: var(--emerald-2); }
.recent-status.is-gagal { background: var(--danger-soft); color: var(--danger); }

/* ---------- progress ---------- */
.pg-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}
.pg-ring {
  position: relative;
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
}
.pg-ring-track { stroke: var(--surface-3); }
.pg-ring-fill { stroke: var(--emerald); }
.pg-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.pg-ring-label strong { font-size: var(--fs-17); line-height: 1; font-weight: 800; }
.pg-ring-label small { margin-top: 3px; color: var(--muted); font-size: var(--fs-10); }
.pg-summary-copy { min-width: 0; }
.pg-big {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 4px 0 5px;
}
.pg-big strong {
  font-size: var(--fs-28);
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pg-big span { color: var(--muted); font-size: var(--fs-11); font-weight: 600; }
.pg-summary-copy p {
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: 1.5;
}

.pg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: var(--fs-10);
}
.pg-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pg-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.pg-legend i.is-sempurna { background: var(--emerald); }
.pg-legend i.is-gagal { background: var(--danger-soft); border: 1px solid var(--danger-line); }
.pg-legend i.is-empty { background: var(--surface-3); }
.pg-legend i.is-today { background: #fff; border: 2px solid var(--gold-d); }

.pg-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px 6px;
}
.pg-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted-3);
  font-size: var(--fs-10);
  font-weight: 700;
}
.pg-cell.is-sempurna { background: var(--emerald); color: #fff; }
.pg-cell.is-gagal {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: var(--danger);
}
.pg-cell.is-today {
  outline: 2px solid var(--gold-d);
  outline-offset: 2px;
  font-weight: 850;
}

.pg-time-list { display: grid; gap: 14px; }
.pg-time-row { display: grid; gap: 6px; }
.pg-time-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.pg-time-head b { font-size: var(--fs-13); font-weight: 750; }
.pg-time-head small { color: var(--muted-3); font-size: var(--fs-10); }
.pg-stack {
  display: flex;
  height: 7px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.pg-stack span { display: block; height: 100%; }
.pg-stack .is-masjid { background: var(--emerald); }
.pg-stack .is-sendiri { background: var(--gold-d); }
.pg-stack .is-tinggal { background: var(--danger); }
.pg-time-count {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  font-size: var(--fs-10);
  color: var(--muted-3);
}
.pg-time-count .is-masjid { color: var(--emerald); }
.pg-time-count .is-sendiri { color: var(--amber-ink); }
.pg-time-count .is-tinggal { color: var(--danger); }

.pg-policy {
  display: flex;
  gap: 12px;
  border-color: transparent;
  background: var(--mint-soft);
  box-shadow: none;
}
.pg-policy-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--emerald);
}
.pg-policy b { font-size: var(--fs-13); font-weight: 750; }
.pg-policy p {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: var(--fs-12);
  line-height: 1.55;
}

/* ---------- pengaturan ---------- */
.setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 14px;
}
.setting-field input { font-variant-numeric: tabular-nums; }
.setting-info-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.setting-info-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-info-row b { font-size: var(--fs-12); font-weight: 750; }
.setting-info-row span {
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: 1.5;
}
.setting-about { box-shadow: none; background: var(--surface-4); }
.setting-danger { border-color: var(--danger-line); }
.setting-danger .section-head { margin-bottom: 6px; }
.setting-danger .muted-note { margin-bottom: 14px; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 8px 18px rgba(176, 74, 62, .18);
}
.btn-danger:disabled { opacity: .6; box-shadow: none; }
.btn-ghost {
  background: var(--surface-4);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

/* ---------- modal ---------- */
body.is-modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 20, 15, .5);
}
.modal-card {
  position: relative;
  width: min(100%, 340px);
  padding: 22px 18px 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-deep);
}
.modal-card h2 {
  font-size: var(--fs-17);
  font-weight: 800;
  line-height: 1.3;
}
.modal-card p {
  margin: 10px 0 16px;
  color: var(--ink-2);
  font-size: var(--fs-12);
  line-height: 1.55;
}
.modal-actions { display: grid; gap: 10px; }

/* ---------- toast & empty ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: var(--r-pill);
  background: var(--deep);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow-deep);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--emerald); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px;
  color: var(--muted-3);
  text-align: center;
}
.empty-state p { font-size: var(--fs-12); line-height: 1.5; }

/* ---------- layar sempit (<=360px): jaga teks tetap utuh ---------- */
@media (max-width: 360px) {
  .page-title h1 { font-size: 27px; }
  .section-head h2 { font-size: 20px; }
  .home-hero h1 { font-size: 34px; }
  .stat-card { padding: 12px 10px; }
  .stat-card span { font-size: var(--fs-10); }
  .stat-card strong { font-size: 31px; }
  .recent-row { grid-template-columns: 78px 1fr auto; gap: 8px; }
  .today-foot { flex-wrap: wrap; }
  .today-foot .btn { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .setting-info-row { grid-template-columns: 76px 1fr; }
}
