/* ================================================================
   FERPEDIA DASHBOARD v4 — Natural Navy & White (tema terang)
   Khusus dashboard.html.
   Struktur: tokens > base > header > saldo > quick > ringkasan >
             pesanan > floating nav > skeleton > responsive
   ================================================================ */

/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --bg:        #F7F9FC;   /* off white */
  --bg-2:      #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #EAF2F8;   /* soft blue */
  --line:      #DFE7EF;
  --line-2:    rgba(40, 87, 122, 0.30);

  --deep:      #102A43;   /* deep navy */
  --blue:      #163B5C;   /* primary navy */
  --blue-2:    #28577A;   /* secondary blue */
  --blue-soft: #28577A;
  --cyan:      #0E7490;
  --violet:    #5B5FC7;
  --green:     #1F7A4D;
  --amber:     #9A6A00;
  --red:       #B42318;

  --text:      #172B3A;
  --text-2:    #647789;
  --text-3:    #647789;

  --hdr-h:     60px;
  --nav-h:     66px;
  --nav-gap:   14px;
  --gutter:    16px;
  --r-lg:      24px;
  --r-md:      18px;
  --r-sm:      12px;

  --ease:      cubic-bezier(.22, .8, .24, 1);
  --font:      'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ── BASE ────────────────────────────────────────────────── */
html { background: var(--bg); overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
svg { display: block; flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; border-radius: 8px; }

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

/* ── HEADER ──────────────────────────────────────────────── */
.hdr {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--hdr-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(247, 249, 252, .94);
  border-bottom: 1px solid var(--line);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .hdr { background: rgba(247, 249, 252, .78); -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px); }
}

.hdr-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.hdr-logo-wrap {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0; overflow: hidden;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px var(--line);
}
.hdr-logo { width: 100%; height: 100%; object-fit: cover; }

.hdr-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.hdr-name { font-size: 1.02rem; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.hdr-tag  { font-size: .62rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-2); }

.hdr-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.hdr-btn {
  position: relative; width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--text-2);
  background: #FFFFFF;
  border: 1px solid var(--line);
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.hdr-btn:hover { color: var(--blue); background: var(--surface-2); border-color: var(--line-2); }
.hdr-btn:active { transform: scale(.92); }

.notif-dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue-2); box-shadow: 0 0 0 2px #FFFFFF;
}
.notif-dot[hidden] { display: none; }

.hdr-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: block;
  padding: 2px;
  background: linear-gradient(140deg, var(--blue-2), var(--blue));
  transition: transform .15s var(--ease);
}
.hdr-avatar:active { transform: scale(.92); }
.hdr-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #FFFFFF; background: var(--surface-2); }

/* ── SEARCH DRAWER ───────────────────────────────────────── */
.search-drawer {
  position: sticky; top: calc(var(--hdr-h) + env(safe-area-inset-top, 0px)); z-index: 39;
  max-height: 0; overflow: hidden; background: #FFFFFF;
  border-bottom: 1px solid transparent;
  transition: max-height .25s var(--ease), border-color .25s;
}
.search-drawer.open { max-height: 68px; border-bottom-color: var(--line); }
.search-inner { display: flex; align-items: center; gap: 10px; padding: 12px var(--gutter); color: var(--text-3); }
.search-inner input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: 0;
  color: var(--text); font: inherit; font-size: 16px; caret-color: var(--blue-2);
}
.search-inner input::placeholder { color: var(--text-3); }
.search-x {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); background: var(--bg); border: 1px solid var(--line);
}

/* ── PAGE ────────────────────────────────────────────────── */
.page {
  display: flex; flex-direction: column; gap: 22px;
  padding: 16px var(--gutter) calc(var(--nav-h) + var(--nav-gap) + 28px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
.page > * { animation: rise .55s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .06s; }
.page > *:nth-child(3) { animation-delay: .12s; }
.page > *:nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-title { font-size: .98rem; font-weight: 700; letter-spacing: -.01em; }
.sec-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 4px 6px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; color: var(--blue-2);
  transition: color .2s, background .2s;
}
.sec-link:hover { color: var(--blue); background: var(--surface-2); }

/* ── SALDO CARD ──────────────────────────────────────────── */
.balance {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r-lg); padding: 20px; color: #FFFFFF;
  background: linear-gradient(145deg, #28577A 0%, #163B5C 52%, #102A43 100%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.10),
    inset 0 1px 0 rgba(255,255,255,.18),
    0 18px 36px -16px rgba(16,42,67,.45);
}
/* kilau kaca halus di sisi atas */
.balance::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0) 42%);
}
/* watermark logo — sangat halus; multiply membuat latar terang logo menyatu dengan kartu */
.balance-mark {
  position: absolute; z-index: -1; right: -40px; bottom: -52px; width: 200px; height: 200px;
  object-fit: cover; opacity: .10; mix-blend-mode: multiply; pointer-events: none; user-select: none;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 68%);
  mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 68%);
}

.balance-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.balance-user { min-width: 0; }
.balance-greet { font-size: .74rem; color: rgba(226,235,255,.72); margin-bottom: 2px; }
.balance-name  { font-size: .98rem; font-weight: 700; min-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 6px 11px 6px 9px; border-radius: 999px;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em; color: rgba(236,242,255,.9);
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16);
}

.balance-label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.balance-label { font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(226,235,255,.72); }

.eye-btn {
  width: 28px; height: 28px; border-radius: 9px; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(236,242,255,.85); background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.14);
  transition: background .2s, transform .15s var(--ease);
}
.eye-btn:hover { background: rgba(255,255,255,.18); }
.eye-btn:active { transform: scale(.9); }
.eye-btn .ic-off { display: none; }
.eye-btn[aria-pressed="true"] .ic-on  { display: none; }
.eye-btn[aria-pressed="true"] .ic-off { display: block; }

.balance-amount {
  font-size: clamp(1.75rem, 8.4vw, 2.3rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.15;
  min-height: 2.7rem; display: flex; align-items: center;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.balance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 12px; min-width: 0; border-radius: 15px;
  font-size: .86rem; font-weight: 700; letter-spacing: -.005em; white-space: nowrap; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), filter .2s;
}
.btn:active { transform: scale(.96); }
.btn-solid { color: #102A43; background: #FFFFFF; box-shadow: 0 8px 18px -8px rgba(16,42,67,.5); }
.btn-solid:hover { background: #EAF2F8; }
.btn-glass { color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.24); }
.btn-glass:hover { background: rgba(255,255,255,.2); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .btn-glass { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
}

/* ── QUICK ACCESS ────────────────────────────────────────── */
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick > .q-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

.q-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 14px; border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,42,67,.04);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.q-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 10px 22px -14px rgba(16,42,67,.25); }
.q-card:active { transform: scale(.97); }

.q-ic {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  color: var(--tone, var(--blue-2));
  background: color-mix(in srgb, var(--tone, var(--blue-2)) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--blue-2)) 30%, transparent);
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .q-ic { background: rgba(40,87,122,.10); box-shadow: inset 0 0 0 1px rgba(40,87,122,.22); }
}
.q-body { min-width: 0; }
.q-title { font-size: .88rem; font-weight: 700; margin-bottom: 2px; }
.q-desc  { font-size: .72rem; line-height: 1.4; color: var(--text-2); }
.q-arrow {
  position: absolute; top: 14px; right: 14px; color: var(--text-3);
  transition: transform .2s var(--ease), color .2s;
}
.q-card:hover .q-arrow { transform: translate(2px, -2px); color: var(--blue); }

.tone-blue   { --tone: #28577A; }
.tone-cyan   { --tone: #0E7490; }
.tone-violet { --tone: #5B5FC7; }
.tone-green  { --tone: #1F7A4D; }
.tone-amber  { --tone: #9A6A00; }

/* ── RINGKASAN ───────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.stat {
  position: relative; overflow: hidden; min-width: 0; padding: 14px 14px 14px 16px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,42,67,.04);
}
.stat::before { /* aksen warna sisi kiri */
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--tone, var(--blue-2));
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.stat-lbl { font-size: .72rem; font-weight: 500; color: var(--text-2); }
.stat-ic  { color: var(--tone, var(--blue-2)); opacity: .9; }
.stat-val {
  font-size: 1.12rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; min-height: 1.35rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* ── PESANAN TERAKHIR ────────────────────────────────────── */
.orders-list { display: flex; flex-direction: column; gap: 10px; }

.order {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,42,67,.04);
  cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.order:hover { border-color: var(--line-2); background: #FBFCFE; }
.order:active { transform: scale(.985); }

.order-thumb {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; color: var(--blue-2);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.order-thumb img { width: 100%; height: 100%; object-fit: cover; }

.order-main { flex: 1; min-width: 0; }
.order-name { font-size: .88rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.order-meta { display: flex; align-items: center; gap: 6px; font-size: .7rem; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.order-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }

.order-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; max-width: 46%; }
.order-price { font-size: .86rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 8px; border-radius: 999px;
  font-size: .66rem; font-weight: 700; white-space: nowrap;
  color: var(--b); background: color-mix(in srgb, var(--b) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--b) 28%, transparent);
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
@supports not (color: color-mix(in srgb, red, blue)) {
  .badge { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
}
.badge-success { --b: var(--green); }
.badge-pending { --b: var(--amber); }
.badge-process { --b: var(--blue-2); }
.badge-failed  { --b: var(--red); }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 30px 20px; border-radius: var(--r-md);
  border: 1px dashed var(--line-2); background: #FFFFFF;
}
.empty-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; margin-bottom: 4px; color: var(--blue-2); background: var(--surface-2); }
.empty-title { font-size: .9rem; font-weight: 700; }
.empty-desc  { font-size: .76rem; color: var(--text-2); max-width: 240px; line-height: 1.5; }
.empty .btn  { margin-top: 10px; min-height: 40px; padding: 0 18px; font-size: .8rem; color: #FFFFFF; background: var(--blue); }

/* ── FLOATING GLASS NAV ──────────────────────────────────── */
.bnav {
  position: fixed; z-index: 9999;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-gap) + env(safe-area-inset-bottom, 0px));
  width: min(calc(100% - 2 * var(--gutter)), 440px);
  height: var(--nav-h);
  display: grid; grid-template-columns: 1fr 1fr 78px 1fr 1fr; align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px -12px rgba(16,42,67,.30), 0 1px 2px rgba(16,42,67,.06);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bnav { background: rgba(255, 255, 255, .80); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px); }
}

.bnav-item {
  position: relative; height: 100%; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-2); font-size: .62rem; font-weight: 600; letter-spacing: .01em;
  transition: color .25s var(--ease), transform .15s var(--ease);
}
.bnav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; }
.bnav-item svg { transition: transform .3s var(--ease); }
.bnav-item:hover { color: var(--blue); }
.bnav-item:active { transform: scale(.92); }
.bnav-item.is-active { color: var(--blue); }
.bnav-item.is-active svg { transform: translateY(-1px); color: var(--blue); }
.bnav-item.is-active::after { /* indikator aktif: garis kecil bercahaya lembut */
  content: ''; position: absolute; bottom: 7px; left: 50%; width: 16px; height: 3px; margin-left: -8px;
  border-radius: 3px; background: linear-gradient(90deg, var(--blue-2), var(--blue));
  animation: pop .35s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: scaleX(.3); } to { opacity: 1; transform: none; } }

.bnav-fab-slot { position: relative; height: 100%; display: flex; justify-content: center; }
.bnav-fab {
  position: absolute; top: -20px; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #28577A 0%, #163B5C 100%);
  box-shadow:
    0 0 0 5px rgba(247,249,252,.98),            /* cincin pemisah dari kapsul */
    0 10px 20px -6px rgba(22,59,92,.50),
    inset 0 1px 0 rgba(255,255,255,.22);
  transition: transform .2s var(--ease), box-shadow .25s var(--ease);
}
.bnav-fab svg { transition: transform .3s var(--ease); }
.bnav-fab:hover svg { transform: rotate(90deg); }
.bnav-fab:active { transform: scale(.92); box-shadow: 0 0 0 5px rgba(247,249,252,.98), 0 4px 10px -4px rgba(22,59,92,.5), inset 0 1px 0 rgba(255,255,255,.2); }

/* ── SKELETON ────────────────────────────────────────────── */
.sk {
  display: inline-block; border-radius: 8px; vertical-align: middle;
  background: linear-gradient(100deg, rgba(16,42,67,.06) 30%, rgba(16,42,67,.12) 50%, rgba(16,42,67,.06) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
/* skeleton di atas kartu navy memakai tinta putih */
.balance .sk { background: linear-gradient(100deg, rgba(255,255,255,.10) 30%, rgba(255,255,255,.24) 50%, rgba(255,255,255,.10) 70%); background-size: 220% 100%; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.sk-name   { width: 110px; height: 16px; }
.sk-amount { width: 62%; max-width: 200px; height: 30px; border-radius: 10px; }
.sk-stat   { width: 70%; max-width: 90px; height: 18px; }

.order-sk { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.order-sk .sk-icon { width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; }
.order-sk-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.order-sk-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.sk-l1 { width: 70%; height: 12px; } .sk-l2 { width: 45%; height: 10px; }
.sk-l3 { width: 62px; height: 12px; } .sk-l4 { width: 56px; height: 16px; border-radius: 999px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 359px) {
  :root { --gutter: 12px; --nav-h: 62px; }
  .balance { padding: 16px; }
  .balance-actions { gap: 8px; }
  .btn { font-size: .78rem; gap: 6px; padding: 0 8px; min-height: 46px; }
  .chip { display: none; }
  .q-card { padding: 12px; }
  .q-desc { font-size: .68rem; }
  .bnav { grid-template-columns: 1fr 1fr 66px 1fr 1fr; padding: 0 4px; }
  .bnav-fab { width: 54px; height: 54px; top: -18px; }
  .hdr-tag { display: none; }
}
@media (max-width: 319px) {
  .order-side { max-width: 52%; }
  .order-thumb { width: 40px; height: 40px; }
}
@media (min-width: 768px) {
  body { box-shadow: 0 0 0 1px var(--line); }
}
@media (hover: none) {
  .q-card:hover, .order:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
