/* Al-Hikmah Student App, revisi tampilan 2026-11-24
   Design read: aplikasi siswa MA Al Hikmah, gaya madrasah modern yang rapi,
   dial ENERGY 2 / RHYTHM 2 / MOTION 1.
   Alasan tiap keputusan (R-31):
   - Hijau tua sebagai warna sekolah, emas sebagai satu-satunya aksen (warna
     madrasah, bukan gradien biru ungu bawaan AI).
   - Motif bintang segi delapan di permukaan hijau (header, hero login, kartu
     profil): satu motif identitas yang diulang, khas madrasah, bukan grid
     generik tanpa maksud.
   - Ikon garis di navigasi bawah: tiap ikon menggambarkan tujuannya (rumah,
     kalender, bintang poin, orang). Tab aktif ditandai bentuk + warna, bukan
     warna saja.
   - Login dua bagian: panel hijau bermotif di atas, kartu form putih di
     bawah yang sedikit menumpuk. Satu titik fokus per layar.
   - Kartu profil hijau bermotif, avatar berbingkai emas, kelas sebagai chip
     emas: nama siswa yang paling menonjol.
   - Angka total poin diberi garis emas tipis di atasnya: aksen dipakai di
     satu momen kunci saja.
   - Bayangan hanya di tombol utama: tombol utama yang terangkat, sisanya
     rata.
   - Font sistem: cepat di HP, tidak ada font pihak ketiga yang menghambat
     render.
*/
:root {
  --green: #14532d;
  --green-deep: #0d3a1f;
  --green-soft: #e7f2e9;
  --gold: #b98a1d;
  --gold-bright: #d9a441;
  --gold-soft: #faf3dd;
  --paper: #f7f4ec;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #5b6660;
  --line: #e4ddcd;
  --amber: #92400e;
  --amber-bg: #fef3c7;
  --good: #166534;
  --good-bg: #dcfce7;
  --bad: #991b1b;
  --bad-bg: #fee2e2;
  --info: #1e40af;
  --info-bg: #dbeafe;
  --radius: 14px;
  --tap: 44px;
  --star-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='76' viewBox='0 0 40 40'%3E%3Cpath d='M20 5 L23 17 L35 20 L23 23 L20 35 L17 23 L5 20 L17 17 Z' fill='none' stroke='%23ffffff' stroke-opacity='0.13' stroke-width='1.1'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: clamp(1.5rem, 5.5vw, 2rem); line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
.lede { color: var(--muted); }
a, button { cursor: pointer; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* Header hijau bermotif */
.topbar { background: var(--green) var(--star-pattern); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 880px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-star { flex: 0 0 auto; width: 30px; height: 30px; fill: var(--gold-bright); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #d1fae5; font-size: 0.8rem; }

main { max-width: 880px; margin: 0 auto; padding: 0 16px 110px; }
.view { max-width: 560px; margin: 0 auto; }
#view-app { max-width: 680px; padding-top: 20px; }

/* Tombol: hijau hanya untuk aksi utama */
.btn-primary, .btn-secondary, .btn-ghost {
  min-height: var(--tap); border-radius: 11px; padding: 10px 18px;
  font-weight: 650; border: 1px solid transparent;
}
.btn-primary { background: var(--green); color: #fff; width: 100%; box-shadow: 0 2px 8px rgba(20, 83, 45, 0.28); }
.btn-primary:hover { background: var(--green-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--card); color: var(--green); border-color: var(--green); }
.btn-secondary:hover { background: var(--green-soft); }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; min-height: var(--tap); padding: 6px 10px; }
.topbar .btn-ghost { color: #fff; }
.btn-ghost:hover { text-decoration: underline; }
.full { width: 100%; }

/* Form */
label { display: block; font-weight: 650; margin: 14px 0 6px; }
input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid #c9c2b4; border-radius: 11px; background: #fff;
  font: inherit; color: var(--ink);
}
input:focus { border-color: var(--green); outline: 3px solid #bbf7d0; outline-offset: 0; }
.password-row { display: flex; gap: 8px; }
.password-row input { flex: 1; min-width: 0; }
.password-row .btn-ghost { color: var(--green); border: 1.5px solid #c9c2b4; border-radius: 11px; flex: 0 0 auto; }
.error { color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.ok { color: var(--good); background: var(--good-bg); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.hint { font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }

/* Login: panel hijau bermotif + kartu form menumpuk */
.login-hero {
  background: var(--green) var(--star-pattern);
  color: #fff; border-radius: 0 0 20px 20px;
  padding: 30px 22px 44px; margin: 0 -16px; text-align: left;
}
.hero-star { width: 44px; height: 44px; fill: var(--gold-bright); margin-bottom: 10px; }
.login-kicker { font-weight: 700; color: var(--gold-bright); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.8rem; margin-bottom: 8px; }
.login-hero h1 { color: #fff; }
.hero-sub { color: #d1fae5; margin-bottom: 0; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px 20px; margin-top: -26px; position: relative;
  box-shadow: 0 6px 20px rgba(29, 36, 32, 0.08);
}

/* Peringatan kata sandi awal: satu-satunya pemakaian amber */
.notice {
  background: var(--amber-bg); color: var(--amber); border: 1px solid #fcd34d;
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-weight: 600;
}
.notice .btn-ghost { color: var(--amber); font-weight: 700; padding: 4px 6px; min-height: 0; }

/* Beranda: kartu profil hijau bermotif */
.profile-card {
  background: var(--green) var(--star-pattern); color: #fff; border-radius: 18px;
  padding: 22px 20px; display: flex; gap: 16px; align-items: flex-start;
}
.avatar {
  flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%;
  background: #fff; color: var(--green); border: 3px solid var(--gold-bright);
  display: grid; place-items: center; font-weight: 800; font-size: 1.3rem;
}
.profile-main { min-width: 0; flex: 1; }
.profile-main h1 { color: #fff; font-size: 1.35rem; }
.class-chip {
  display: inline-block; background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--gold-bright); color: #fde68a;
  border-radius: 999px; padding: 3px 12px; font-size: 0.88rem; font-weight: 700;
}
.profile-facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 14px 0 0; }
.profile-facts div { display: flex; gap: 8px; }
.profile-facts dt { color: #a7f3d0; font-weight: 600; }
.profile-facts dd { margin: 0; font-weight: 650; }
.profile-facts.stacked { flex-direction: column; gap: 10px; }
.profile-facts.stacked dt { color: var(--muted); min-width: 110px; }
.profile-facts.stacked dd { color: var(--ink); }

/* Poin: garis emas di atas angka sebagai satu aksen */
.poin-hero {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 20px; margin-top: 16px; position: relative; overflow: hidden;
}
.poin-hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--gold-bright);
}
.poin-label { font-weight: 700; color: var(--muted); margin-bottom: 0; }
.poin-number { font-size: clamp(2.6rem, 11vw, 3.4rem); font-weight: 800; line-height: 1.1; margin: 2px 0 6px; letter-spacing: -0.02em; }
.poin-number.neg { color: var(--bad); }
.poin-number.pos { color: var(--good); }

.month-summary { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px; margin-top: 16px; }
.month-summary .btn-secondary { margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  background: #f1efe9; border-radius: 999px; padding: 6px 12px;
  font-size: 0.9rem; font-weight: 650;
}
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }

/* Daftar riwayat: ubin tanggal hijau lembut + baris polos */
.record-list { list-style: none; margin: 8px 0 0; padding: 0; }
.record-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
}
.record-date {
  flex: 0 0 auto; text-align: center; width: 54px; padding: 6px 0 7px;
  background: var(--green-soft); border-radius: 10px;
}
.record-date b { display: block; font-size: 1.3rem; line-height: 1.1; color: var(--green); }
.record-date span { font-size: 0.8rem; color: var(--muted); font-weight: 650; text-transform: capitalize; }
.record-body { flex: 1; min-width: 0; }
.record-body strong { display: block; }
.record-body .muted { font-size: 0.9rem; }
.record-poin { flex: 0 0 auto; font-weight: 800; font-size: 1.05rem; }
.record-poin.pos { color: var(--good); }
.record-poin.neg { color: var(--bad); }
.status { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 0.85rem; font-weight: 700; }
.status.hadir { background: var(--good-bg); color: var(--good); }
.status.sakit { background: var(--amber-bg); color: var(--amber); }
.status.izin { background: var(--info-bg); color: var(--info); }
.status.alpha, .status.alpa { background: var(--bad-bg); color: var(--bad); }

.tab-title { margin-top: 4px; }
.filter-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.filter-row label { margin: 0; }
.filter-row input { width: auto; flex: 1; min-width: 180px; }
.chip-filter {
  min-height: var(--tap); padding: 8px 16px; border-radius: 999px;
  border: 1.5px solid #c9c2b4; background: var(--card); font-weight: 650;
}
.chip-filter.is-active { background: var(--green); border-color: var(--green); color: #fff; }
.state { padding: 24px 8px; text-align: center; }

.account-card, .change-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px; margin-bottom: 16px;
}
.change-card .btn-primary { margin-top: 16px; }
#logoutBtn { margin-top: 4px; }

/* Navigasi bawah: ikon + label, aktif ditandai bentuk + warna */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav button {
  flex: 1; min-height: 56px; background: none; border: 0; border-radius: 12px;
  font-weight: 650; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 0.72rem; padding: 6px 2px;
}
.bottomnav button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav button[data-tab="poin"] svg { fill: currentColor; stroke: none; }
.bottomnav button.is-active { color: var(--green); background: var(--green-soft); }

/* Tablet dan desktop: konten melebar, daftar jadi dua kolom */
@media (min-width: 640px) {
  main { padding: 0 20px 110px; }
  #view-app { padding-top: 28px; }
  .login-hero { margin: 0; border-radius: 0 0 20px 20px; }
  .login-card { padding: 28px; }
  .record-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; }
}
@media (min-width: 900px) {
  .bottomnav { left: 50%; transform: translateX(-50%); max-width: 680px; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
