/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 10px 20px; border-radius: var(--r-pill); border: 1px solid transparent;
  font-weight: 500; font-size: var(--text-sm); cursor: pointer; text-decoration: none !important;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-mid), box-shadow var(--t-mid);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-dark); box-shadow: var(--shadow-spot); }
.btn-primary:hover:not(:disabled) { background: var(--accent-press); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-dark { background: var(--ink); color: var(--on-dark); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-danger { background: var(--card); color: var(--bad-ink); border-color: var(--bad-wash); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: var(--text-md); padding: 12px 24px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-dark) var(--on-dark) transparent transparent; animation: spin .7s linear infinite; }
.btn-secondary.is-busy::after { border-color: var(--ink) var(--ink) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink); }

/* Kartu */
.card { background: var(--card); border: 0; border-radius: var(--r-tile); padding: var(--s4); box-shadow: var(--shadow-tile); }
.card-dark { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.card-link { display: block; color: inherit; text-decoration: none !important; transition: border-color var(--t-mid), transform var(--t-fast); }
.card-link:hover { box-shadow: var(--shadow-spot); }
.card-link:active { transform: scale(.99); }

/* Lencana status */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 500; padding: 3px 10px; border-radius: var(--r-pill); background: var(--info-wash); color: var(--info-ink); white-space: nowrap; }
.badge.ok { background: var(--ok-wash); color: var(--ok-ink); }
.badge.warn { background: var(--warn-wash); color: var(--warn-ink); }
.badge.bad { background: var(--bad-wash); color: var(--bad-ink); }
.badge.neutral { background: var(--neutral-wash); color: var(--muted); }

/* Formulir */
.field { display: block; }
.field > span { display: block; font-size: var(--text-sm); font-weight: 500; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: var(--text-xs); margin-top: 6px; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--r-input); font-size: var(--text-md); transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--wash); }
.field.has-error .input, .field.has-error .textarea { border-color: var(--bad); }
.field .error { color: var(--bad-ink); font-size: var(--text-xs); margin-top: 6px; }
.check { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--text-sm); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }

/* Tab pil dengan penanda bergeser */
.tabs { position: relative; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; }
.tab { position: relative; z-index: 1; flex: 1; min-height: 40px; border: 0; background: none; border-radius: var(--r-pill); font-size: var(--text-sm); font-weight: 500; color: var(--muted); cursor: pointer; transition: color var(--t-mid); }
.tab[aria-selected="true"] { color: var(--on-dark); }
.tabs-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; background: var(--ink); border-radius: var(--r-pill); transition: transform var(--t-mid) var(--ease), width var(--t-mid) var(--ease); }
.tabpanel { animation: view-in var(--t-mid) var(--ease); }

/* Navigasi: HP bilah bawah, laptop bilah atas */
.topbar { display: none; }
.bottomnav {
  position: fixed; z-index: 20; left: var(--s3); right: var(--s3); bottom: calc(var(--s3) + env(safe-area-inset-bottom));
  display: flex; justify-content: space-around; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 6px; box-shadow: var(--shadow-float); max-width: 520px; margin: 0 auto;
}
.bottomnav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: var(--r-pill); color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none !important; }
.bottomnav a[aria-current="page"] { color: var(--accent); background: var(--wash); }
.bottomnav a, .topbar nav a { position: relative; }
.nav-count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-dark); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.topbar .nav-count { position: static; display: inline-block; margin-right: 6px; vertical-align: 1px; }
.logo { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -0.03em; color: var(--ink); text-decoration: none !important; }
.logo-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
@media (min-width: 900px) {
  .bottomnav { display: none; }
  .topbar { display: flex; position: sticky; top: var(--s3); z-index: 20; max-width: var(--page); margin: var(--s3) auto 0; align-items: center; justify-content: space-between; gap: var(--s4); background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 8px 8px 8px 20px; }
  .topbar nav { display: flex; gap: 4px; }
  .topbar nav a { padding: 10px 14px; border-radius: var(--r-pill); color: var(--muted); font-size: var(--text-sm); font-weight: 500; text-decoration: none !important; }
  .topbar nav a[aria-current="page"] { color: var(--ink); background: var(--bg); }
  .page { padding-bottom: var(--s8); }
}

/* Toast */
.toasts { position: fixed; z-index: 60; left: 0; right: 0; top: calc(var(--s3) + env(safe-area-inset-top)); display: grid; justify-items: center; gap: var(--s2); pointer-events: none; padding: 0 var(--s4); }
.toast { pointer-events: auto; max-width: 480px; background: var(--ink); color: var(--on-dark); padding: 12px 16px; border-radius: var(--r-card); box-shadow: var(--shadow-float); font-size: var(--text-sm); display: flex; gap: var(--s2); align-items: center; animation: toast-in var(--t-mid) var(--ease); }
.toast.ok .ic { color: var(--toast-ok); } .toast.bad .ic { color: var(--toast-bad); }
.toast.out { animation: toast-out var(--t-mid) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* Lembar bawah */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(59, 10, 36, .35); opacity: 0; transition: opacity var(--t-mid); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-float);
  transform: translateY(105%); transition: transform var(--t-slow) var(--ease); padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { transform: none; }
/* Wadah lembar difokuskan saat dibuka (pembaca layar mulai dari atas); garisnya tidak perlu tampil. Fokus tombol/kolom tetap terlihat. */
.sheet:focus { outline: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4) var(--s2); }
.sheet-grab { width: 40px; height: 4px; border-radius: 9px; background: var(--line-strong); margin: 10px auto 0; }
.sheet-body { overflow-y: auto; padding: 0 var(--s4) var(--s4); }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; width: 560px; bottom: 50%; border-radius: 22px; transform: translate(-50%, 60%) scale(.98); opacity: 0; transition: transform var(--t-mid) var(--ease), opacity var(--t-mid); }
  .sheet.open { transform: translate(-50%, 50%); opacity: 1; }
  .sheet-grab { display: none; }
}

/* Keadaan layar */
.skeleton { border-radius: var(--r-card); background: linear-gradient(90deg, var(--wash) 0%, var(--card) 50%, var(--wash) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state { text-align: center; padding: var(--s7) var(--s4); display: grid; justify-items: center; gap: var(--s3); }
.state .ic { color: var(--muted); }

/* Konfeti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.6s var(--ease) forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .2; } }
