/* ===========================================================
   BUKU HAFALAN — design tokens
   Palet: kertas mushaf, tinta hijau zamrud, aksen emas prada
   Tipografi: Amiri (judul, nuansa manuskrip) + Plus Jakarta Sans (isi)
   Signature: motif bintang delapan (khatam) + progres manik tasbih
   =========================================================== */
:root{
  --paper:        #F7F2E7;
  --paper-raised: #FFFDF8;
  --ink:          #1E2A22;
  --ink-soft:     #4B5A50;
  --emerald:      #0E6E4E;
  --emerald-dark: #0A4F38;
  --emerald-tint: #E4EFE9;
  --gold:         #B8912F;
  --gold-tint:    #F1E6C6;
  --sky:          #2B6CB0;
  --amber:        #C98A1A;
  --rose:         #B23A2E;
  --sage:         #6E8F7A;
  --line:         #E1D8C2;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --font-display: 'Amiri', 'Georgia', serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Menlo', monospace;

  --shadow-card: 0 1px 2px rgba(30,42,34,.04), 0 8px 24px -8px rgba(30,42,34,.14);
  --shadow-pop:  0 4px 10px rgba(30,42,34,.08), 0 20px 40px -16px rgba(14,110,78,.28);
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-tap-highlight-color: transparent; }
body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(1100px 600px at 85% -10%, var(--emerald-tint) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--gold-tint) 0%, transparent 55%),
    var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  line-height:1.5;
}
h1,h2,h3{ font-family:var(--font-display); margin:0; }
button{ font-family:inherit; }
input,select{ font-family:inherit; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}

/* ---------- layout shell ---------- */
.app-shell{ max-width:1040px; margin:0 auto; padding:0 20px 60px; }

/* ---------- topbar ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; padding:22px 4px 18px;
  border-bottom:1px solid var(--line);
  margin-bottom:28px;
}
.topbar__brand{ display:flex; align-items:center; gap:12px; }
.brand__mark{ width:34px; height:34px; fill:var(--gold); flex-shrink:0; }
.brand__eyebrow{
  margin:0; font-size:.72rem; letter-spacing:.14em; text-transform:uppercase;
  color:var(--emerald); font-weight:700;
}
.brand__title{ font-size:1.28rem; color:var(--ink); }
.topbar__user{ display:flex; align-items:center; gap:14px; }
.topbar__hello{ font-size:.92rem; color:var(--ink-soft); }
.topbar__hello strong{ color:var(--emerald-dark); }

/* ---------- buttons ---------- */
.btn{
  cursor:pointer; border:none; border-radius:999px;
  font-weight:700; font-size:.95rem; letter-spacing:.01em;
  padding:13px 22px; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active{ transform:translateY(1px) scale(.99); }
.btn--primary{ background:var(--emerald); color:#fff; box-shadow:var(--shadow-pop); }
.btn--primary:hover{ background:var(--emerald-dark); }
.btn--ghost{ background:transparent; color:var(--ink-soft); border:1px solid var(--line); }
.btn--ghost:hover{ border-color:var(--emerald); color:var(--emerald-dark); }
.btn--sm{ padding:8px 16px; font-size:.82rem; }
.btn--block{ width:100%; }
.btn--back{ margin-bottom:18px; }
.btn__spinner{
  width:15px; height:15px; border-radius:50%;
  border:2px solid rgba(255,255,255,.4); border-top-color:#fff;
  animation:spin .7s linear infinite;
}
.btn--ghost .btn__spinner{ border:2px solid rgba(14,110,78,.25); border-top-color:var(--emerald); }
@keyframes spin{ to{ transform:rotate(360deg); } }
.btn[data-loading="1"] .btn__label{ opacity:.55; }

/* ---------- toast ---------- */
.toast{
  position:fixed; top:18px; left:50%; transform:translate(-50%,-140%);
  background:var(--ink); color:#fff; padding:12px 20px; border-radius:999px;
  font-size:.88rem; font-weight:600; box-shadow:0 12px 30px rgba(0,0,0,.25);
  z-index:100; opacity:0; transition:transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s ease;
  pointer-events:none;
}
.toast.is-visible{ transform:translate(-50%,0); opacity:1; }
.toast.is-error{ background:var(--rose); }
.toast.is-success{ background:var(--emerald-dark); }

/* ---------- views / transitions ---------- */
.view{ animation:riseIn .38s cubic-bezier(.2,.8,.2,1) both; }
@keyframes riseIn{
  from{ opacity:0; transform:translateY(10px); }
  to{ opacity:1; transform:translateY(0); }
}
.view--center{ min-height:86vh; display:flex; align-items:center; justify-content:center; }

/* ---------- login ---------- */
.login-card{
  position:relative; overflow:hidden;
  width:min(440px, 100%); background:var(--paper-raised);
  border:1px solid var(--line); border-radius:var(--radius-lg);
  padding:40px 34px 32px; box-shadow:var(--shadow-card); text-align:left;
}
.login-card__motif{
  position:absolute; top:-30px; right:-30px; width:130px; height:130px;
  fill:var(--gold-tint); opacity:.9; z-index:0;
}
.login-card > *{ position:relative; z-index:1; }
.login-card__title{ font-size:1.5rem; margin:10px 0 8px; color:var(--ink); }
.login-card__sub{ color:var(--ink-soft); font-size:.93rem; margin:0 0 24px; }
.login-card__form{ display:flex; flex-direction:column; gap:18px; }
.login-card__note{ margin:18px 0 0; font-size:.78rem; color:var(--sage); text-align:center; }

/* ---------- fields ---------- */
.field{ display:flex; flex-direction:column; gap:7px; }
.field__label{ font-size:.78rem; font-weight:700; color:var(--emerald-dark); letter-spacing:.02em; }
.field input, .field select{
  border:1.5px solid var(--line); background:#fff; border-radius:var(--radius-sm);
  padding:12px 14px; font-size:.96rem; color:var(--ink); outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus{
  border-color:var(--emerald); box-shadow:0 0 0 3px rgba(14,110,78,.14);
}
.field--half{ display:inline-flex; }
.field--filter{ min-width:220px; }

/* ---------- hero / dashboard ---------- */
.hero{
  display:flex; flex-wrap:wrap; gap:30px; align-items:flex-end; justify-content:space-between;
  padding:14px 4px 28px;
}
.hero__text{ max-width:560px; }
.hero__title{ font-size:1.9rem; line-height:1.28; color:var(--ink); margin:8px 0 10px; }
.hero__sub{ color:var(--ink-soft); margin:0; }
.hero__actions{ display:flex; gap:16px; flex-wrap:wrap; }

.action-card{
  cursor:pointer; text-align:left; border:1px solid var(--line); background:var(--paper-raised);
  border-radius:var(--radius-md); padding:22px; width:230px;
  display:flex; flex-direction:column; gap:10px;
  box-shadow:var(--shadow-card); transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.action-card:hover{ transform:translateY(-3px); border-color:var(--emerald); box-shadow:var(--shadow-pop); }
.action-card__icon{ font-size:1.5rem; color:var(--gold); font-weight:800; }
.action-card__star{ width:26px; height:26px; fill:var(--gold); }
.action-card__label{ font-weight:800; font-size:1.02rem; color:var(--ink); }
.action-card__desc{ font-size:.82rem; color:var(--ink-soft); }
.action-card--primary{ background:var(--emerald); border-color:var(--emerald); }
.action-card--primary .action-card__label, .action-card--primary .action-card__desc{ color:#fff; }
.action-card--primary .action-card__icon{ color:var(--gold-tint); }
.action-card--primary:hover{ border-color:var(--emerald-dark); }

.stat-strip{ display:flex; gap:14px; flex-wrap:wrap; margin-top:6px; }
.stat-pill{
  background:var(--paper-raised); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:16px 22px; min-width:150px; box-shadow:var(--shadow-card);
}
.stat-pill__num{ display:block; font-family:var(--font-mono); font-size:1.6rem; font-weight:600; color:var(--emerald-dark); }
.stat-pill__label{ font-size:.78rem; color:var(--ink-soft); }

/* ---------- panel (form / records) ---------- */
.panel{
  background:var(--paper-raised); border:1px solid var(--line); border-radius:var(--radius-lg);
  padding:30px 28px 34px; box-shadow:var(--shadow-card);
}
.panel__title{ font-size:1.55rem; margin:6px 0 24px; }

.record-form__grid{
  display:grid; grid-template-columns:1fr 1fr; gap:18px 20px; margin-bottom:26px;
}
.record-form__grid .field:nth-child(1),
.record-form__grid .field:nth-child(2){ grid-column:span 2; }
@media (max-width:600px){
  .record-form__grid{ grid-template-columns:1fr; }
  .record-form__grid .field{ grid-column:span 1 !important; }
}

/* ---------- filter bar & tasbih progress ---------- */
.filter-bar{ display:flex; gap:16px; align-items:flex-end; flex-wrap:wrap; margin-bottom:22px; }
.tasbih{
  background:var(--emerald-tint); border:1px solid #cfe3d8; border-radius:var(--radius-md);
  padding:16px 18px; margin-bottom:24px;
}
.tasbih__label{ margin:0 0 10px; font-size:.86rem; color:var(--emerald-dark); font-weight:600; }
.tasbih__beads{ display:flex; flex-wrap:wrap; gap:6px; }
.tasbih__beads span{
  width:14px; height:14px; border-radius:50%; background:#cfe3d8;
  display:inline-block; transition:background .2s ease, transform .2s ease;
}
.tasbih__beads span.is-filled{ background:var(--gold); }

/* ---------- table ---------- */
.table-wrap{ overflow-x:auto; }
.record-table{ width:100%; border-collapse:collapse; min-width:560px; }
.record-table thead th{
  text-align:left; font-size:.72rem; letter-spacing:.08em; text-transform:uppercase;
  color:var(--sage); padding:0 12px 10px; border-bottom:2px solid var(--line);
}
.record-table tbody td{
  padding:13px 12px; border-bottom:1px solid var(--line); font-size:.92rem; vertical-align:middle;
}
.record-table tbody tr:hover{ background:rgba(14,110,78,.05); }
.record-table td:nth-child(3), .record-table td:nth-child(4){ font-family:var(--font-mono); }
.status-chip{
  display:inline-block; padding:4px 11px; border-radius:999px; font-size:.76rem; font-weight:700;
}
.status-chip--lancar{ background:var(--emerald-tint); color:var(--emerald-dark); }
.status-chip--ulang{ background:#fbe9d7; color:var(--amber); }
.status-chip--belum{ background:#f7e0dd; color:var(--rose); }

.table-empty, .table-loading{ text-align:center; padding:34px 10px; color:var(--ink-soft); font-size:.9rem; }

/* ---------- footer ---------- */
.app-footer{ text-align:center; padding-top:30px; color:var(--sage); font-size:.78rem; }

/* ---------- responsive ---------- */
@media (max-width:640px){
  .topbar{ flex-direction:column; align-items:flex-start; gap:10px; }
  .hero{ flex-direction:column; align-items:stretch; }
  .action-card{ width:100%; }
  .panel{ padding:24px 18px 28px; }
}

/* ---------- focus visibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline:3px solid var(--sky); outline-offset:2px;
}
