/* =====================================================================
   Klyvo · sistem desain user (revisi 2027)
   File ini identik dengan client/css/input.css (sumber build Tailwind).

   Prinsip:
   - Semua warna berasal dari variabel tema (GET /api/theme, lewat theme.js).
     Tidak ada warna tetap pada komponen; warna turunan dibuat dengan color-mix
     dari variabel tema, sehingga semua elemen selalu selaras dengan tema admin.
   - Nama kelas yang dipakai JavaScript dipertahankan.
   - Mobile-first. Breakpoint: 480, 768, 1100, 1440 px.
   - Target sentuh minimal 44 px. Aman dari area poni dan home indicator (safe-area).
   ===================================================================== */

:root {
  --primary: #1e3a5f;
  --primary-contrast: #ffffff;
  --accent: #0ea5e9;
  --background: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e6ebf2;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #b45309;
  /* Teks di atas aksen, success, dan danger: dihitung otomatis dari luminansi di theme.js */
  --on-accent: #ffffff;
  --on-success: #ffffff;
  --on-danger: #ffffff;

  /* Turunan tema (selalu mengikuti variabel di atas) */
  --primary-soft: color-mix(in srgb, var(--primary) 11%, transparent);
  --primary-ink: color-mix(in srgb, var(--primary) 82%, var(--text));
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --line: color-mix(in srgb, var(--text) 8%, transparent);
  --glass: color-mix(in srgb, var(--surface) 84%, transparent);
  --shadow-ink: color-mix(in srgb, var(--text) 10%, transparent);
  --shadow-brand: color-mix(in srgb, var(--primary) 34%, transparent);

  --radius: 20px;
  --radius-lg: 26px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px var(--shadow-ink), 0 2px 8px color-mix(in srgb, var(--text) 4%, transparent);
  --shadow-md: 0 12px 30px color-mix(in srgb, var(--text) 9%, transparent);
  --shadow-lg: 0 26px 60px color-mix(in srgb, var(--text) 18%, transparent);
  --ring: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  position: relative;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--background);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Cahaya lembut dari aksen dan primer di belakang seluruh halaman */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 420px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 80% at 100% 0%, var(--accent-soft) 0%, transparent 70%),
    radial-gradient(55% 70% at 0% 0%, var(--primary-soft) 0%, transparent 72%);
}
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* ---------- Top bar (navbar) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  color: var(--text);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.topbar.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
  color: inherit;
  text-decoration: none;
}
.brand-mark,
.brand-logo {
  display: inline-flex;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 13px;
}
.brand-mark {
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 62%, var(--accent)) 100%);
  color: var(--primary-contrast);
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 6px 16px var(--shadow-brand);
}
.brand-logo {
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px;
}
.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.desktop-nav {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  margin-left: 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  -webkit-overflow-scrolling: touch;
}
.desktop-nav::-webkit-scrollbar { display: none; }
.desktop-nav a {
  flex: 0 0 auto;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.desktop-nav a:hover { color: var(--text); background: var(--surface); }
.desktop-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.icon-btn,
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.icon-btn:hover { color: var(--primary); background: var(--primary-soft); }
.avatar {
  background: linear-gradient(145deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 62%, var(--accent)) 100%);
  color: var(--primary-contrast);
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 6px 16px var(--shadow-brand);
}
.icon-btn:active, .avatar:active { transform: scale(0.93); }
.topbar.is-app .brand-name { max-width: 42vw; }

/* ---------- Layout & tipografi ---------- */
.app-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px calc(120px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
}
.page-title {
  font-size: 25px;
  line-height: 1.2;
  margin: 4px 0 6px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.page-sub { color: var(--muted); margin: 0 0 18px; font-size: 15px; }

/* ---------- Bottom navigation (mobile) ---------- */
/* Bar mengambang berkaca. Slot aktif diberi pil lembut, ikon dan label tetap rata tengah. */
.bottomnav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  height: 68px;
  padding: 6px;
  border-radius: 26px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  margin: 0 auto;
}
.bottomnav a,
.bn-toggle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 2px;
  border: 0;
  border-radius: 20px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: clamp(10.5px, 2.9vw, 12px);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.bottomnav a:active, .bn-toggle:active { transform: scale(0.96); }
.bottomnav a[aria-current="page"],
.bn-toggle[aria-current="page"] {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-soft);
}
.bn-ico {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}
.bn-ico > svg { display: block; }
.bn-dropup.is-open .bn-toggle { color: var(--primary); }
.bn-dropup { position: static; display: flex; min-width: 0; height: 100%; }
.bn-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 0;
  width: 232px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  animation: pop 0.2s var(--ease);
}
.bn-menu[hidden] { display: none; }
.bn-menu::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: var(--arrow-x, 50%);
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.bn-menu a {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}
.bn-menu a:hover { background: var(--background); }
.bn-menu a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.bn-menu-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: 0 0 auto;
}
.bn-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Kartu & grid ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
a.card {
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
a.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-title { font-size: 17px; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.02em; }
.section-title { font-size: 17px; font-weight: 800; margin: 0 0 12px; letter-spacing: -0.02em; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.amount { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.price { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.link-more { color: var(--primary); font-weight: 700; text-decoration: none; }
.link-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ---------- Beranda (struktur; gaya halaman di ux.css) ---------- */
.home-greeting { margin-top: 2px; }
.home-hello { margin: 0; }
.home-greeting .page-title { margin-top: 2px; }
.stack.home-body { gap: 18px; }
.home-section { margin: 0; }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 20px;
  border-radius: var(--radius-lg);
  color: var(--primary-contrast);
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 58%, var(--accent)) 100%);
  box-shadow: 0 18px 40px var(--shadow-brand);
  isolation: isolate;
}
.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary-contrast) 10%, transparent);
  pointer-events: none;
}
.hero-card::before { width: 250px; height: 250px; top: -120px; right: -80px; }
.hero-card::after { width: 180px; height: 180px; bottom: -100px; left: -60px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; }
.hero-label { font-size: 14px; font-weight: 600; opacity: 0.9; }
.hero-plan {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--primary-contrast) 20%, transparent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.hero-plan.is-muted { background: color-mix(in srgb, var(--primary-contrast) 12%, transparent); opacity: 0.9; }
.hero-amount {
  display: block;
  margin: 10px 0 20px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--primary-contrast) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary-contrast) 18%, transparent);
  color: var(--primary-contrast);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.hero-action:hover { background: color-mix(in srgb, var(--primary-contrast) 24%, transparent); }
.hero-action:active { transform: scale(0.98); }
.hero-action:focus-visible { outline-color: var(--primary-contrast); }

.admin-entry { gap: 12px; }
.admin-entry-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-entry-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: 0 0 auto;
}
.admin-entry-go { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 700; }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; }
.service-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  transition: transform 0.15s var(--ease);
}
.service-tile:hover .service-icon { box-shadow: var(--shadow-md); }
.service-tile:active { transform: scale(0.96); }
.service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  transition: box-shadow 0.2s var(--ease);
}
.service-label {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  min-height: 2.5em;
  overflow-wrap: anywhere;
}

/* Warna ikon layanan: semuanya turunan dari tema (primer, aksen, success, warn, danger) */
.tone-blue { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: color-mix(in srgb, var(--accent) 78%, var(--text)); }
.tone-violet { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: color-mix(in srgb, var(--primary) 82%, var(--text)); }
.tone-pink { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: color-mix(in srgb, var(--danger) 78%, var(--text)); }
.tone-amber { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: color-mix(in srgb, var(--warn) 85%, var(--text)); }
.tone-green { background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: color-mix(in srgb, var(--success) 80%, var(--text)); }
.tone-teal { background: color-mix(in srgb, var(--accent) 10%, color-mix(in srgb, var(--success) 10%, var(--surface))); color: color-mix(in srgb, var(--success) 70%, var(--accent)); }

.txn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.txn-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.txn-row:first-child { border-top: 0; padding-top: 4px; }
.txn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: var(--background);
  color: var(--text);
}
.txn-ico.is-in { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: color-mix(in srgb, var(--success) 80%, var(--text)); }
.txn-ico.is-out { background: color-mix(in srgb, var(--text) 8%, var(--surface)); color: var(--text); }
.txn-main { min-width: 0; }
.txn-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt-in { color: color-mix(in srgb, var(--success) 75%, var(--text)); }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 44px;
  padding: 11px 18px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.12s var(--ease), opacity 0.2s, border-color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 22%, var(--border)); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background: linear-gradient(160deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 78%, var(--accent)) 100%);
  color: var(--primary-contrast);
  border-color: transparent;
  box-shadow: 0 10px 22px var(--shadow-brand);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 28px var(--shadow-brand); filter: brightness(1.04); }
.btn-accent { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-danger { background: var(--danger); color: var(--on-danger); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: var(--primary-soft); box-shadow: none; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.label { font-size: 14px; font-weight: 700; color: var(--text); }
.input, .select {
  width: 100%;
  min-height: 52px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* mencegah zoom otomatis di iOS */
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input::placeholder { color: var(--muted); opacity: 0.85; }
.input:hover:not(:disabled), .select:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 22%, var(--border)); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.help { font-size: 13px; color: var(--muted); margin: 0; }
.field-error { font-size: 13px; color: var(--danger); margin: 0; font-weight: 600; }
.input-invalid { border-color: var(--danger); }
.input-invalid:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent); }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.choice:hover { border-color: color-mix(in srgb, var(--primary) 22%, var(--border)); }
.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.choice input { width: 20px; height: 20px; margin: 0; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Tautan polos (tanpa kelas) ---------- */
/* Hanya menyasar <a> tanpa atribut class, sehingga komponen yang sudah punya gaya tidak berubah. */
a:not([class]) {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 35%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}
a:not([class]):hover {
  color: var(--primary-ink);
  text-decoration-color: currentColor;
}

/* ---------- Pesan, badge ---------- */
.error-box {
  padding: 13px 15px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  color: color-mix(in srgb, var(--danger) 82%, var(--text));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  font-size: 14px;
}
.notice {
  padding: 13px 15px;
  border-radius: 15px;
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 14px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
  color: var(--text);
  white-space: nowrap;
}
.badge-success { background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: color-mix(in srgb, var(--success) 80%, var(--text)); }
.badge-danger { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.badge-warn { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: color-mix(in srgb, var(--warn) 85%, var(--text)); }
.badge-info { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 80%, var(--text)); }

/* ---------- Tab ---------- */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  /* Padding dengan margin negatif: bayangan tab aktif tidak terpotong, tata letak tetap */
  padding: 6px 8px 16px;
  margin: -6px -8px -16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.tab:hover { color: var(--text); border-color: color-mix(in srgb, var(--primary) 22%, var(--border)); }
.tab[aria-current="page"] {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: transparent;
  box-shadow: 0 8px 18px var(--shadow-brand);
}

/* ---------- Katalog produk ---------- */
.product {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.product:not(:disabled):active { transform: scale(0.98); }
.product:disabled { opacity: 0.6; cursor: not-allowed; }
.product-name { font-weight: 700; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.product .price { font-size: 15px; margin-top: auto; }

/* ---------- State, loading, toast ---------- */
.state { text-align: center; padding: 44px 16px; color: var(--muted); }
.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 13px 16px;
  border-radius: 17px;
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--surface);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  animation: toast-in 0.3s var(--ease);
}
.toast-success { background: color-mix(in srgb, var(--success) 94%, transparent); color: var(--on-success); }
.toast-error { background: color-mix(in srgb, var(--danger) 94%, transparent); color: var(--on-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Overlay & sheet ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: color-mix(in srgb, var(--text) 45%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s var(--ease);
}
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.3s var(--ease);
}
.sheet::before {
  content: "";
  align-self: center;
  width: 40px;
  height: 5px;
  border-radius: 5px;
  background: var(--border);
  margin-bottom: 4px;
}
.sheet-title { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
@keyframes sheet-up { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 14px; }

/* ---------- Pembayaran deposit ---------- */
.pay-card { box-shadow: none; background: var(--background); }
.pay-qr {
  display: block;
  margin: 0 auto;
  width: 220px;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  background: #fff;
  padding: 8px;
}
.pay-string {
  margin: 0;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px dashed var(--border);
  overflow-wrap: anywhere;
}
.pay-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.pay-code-value { font-size: 18px; letter-spacing: 0.04em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Visually hidden (aksesibilitas) */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Logo (admin) */
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-actions { flex: 1 1 240px; min-width: 0; }
.logo-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 24px;
  border: 1px dashed var(--border);
  background: var(--background);
  overflow: hidden;
}
.logo-preview-img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.logo-preview-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 62%, var(--accent)) 100%);
  color: var(--primary-contrast);
  font-weight: 800;
  font-size: 40px;
}

/* Detail pembayaran di sheet */
.pay-block { display: flex; flex-direction: column; gap: 8px; }
.pay-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.pay-actions .btn { flex: 1 1 140px; }

/* ---------- Ponsel kecil (di bawah 360 px) ---------- */
@media (max-width: 359px) {
  .hero-amount { font-size: 30px; }
  .hero-action { font-size: 14px; padding: 10px 8px; }
  .grid-products { gap: 10px; }
  .product { padding: 12px; }
}

/* ---------- Tablet (480 px ke atas) ---------- */
@media (min-width: 480px) {
  .service-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- Tablet dan desktop (768 px ke atas) ---------- */
@media (min-width: 768px) {
  .desktop-nav { display: flex; }
  .bottomnav { display: none; }
  .topbar { padding-left: 24px; padding-right: 24px; min-height: 68px; }
  .app-main { padding: 30px 24px 64px; }
  .page-title { font-size: 30px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
  .stack.home-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
  }
  .stack.home-body > .hero-card,
  .stack.home-body > .admin-entry { grid-column: 1 / -1; }
  .hero-amount { font-size: 40px; }
  .toasts { left: auto; right: 24px; bottom: 24px; width: 384px; }
  .overlay { align-items: center; padding: 16px; }
  .sheet { border-radius: 26px; padding-top: 18px; max-height: 86vh; }
  .sheet::before { display: none; }
}

/* ---------- Desktop (1100 px ke atas) ---------- */
@media (min-width: 1100px) {
  .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .service-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- Layar lebar (1440 px ke atas) ---------- */
@media (min-width: 1440px) {
  .app-main { max-width: 1320px; }
  .grid-products { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
