/* jaspayaja v32 — modern dashboard (Panel Admin + konsol agen) and order confetti banner. */
:root { --jd-ease: cubic-bezier(0.16, 1, 0.3, 1); }

/* ---------- shared surface ---------- */
html.jpa-on .jd-card, html.jpa-on .jd-kpi, .jd-akpi {
  --jd-surface: color-mix(in oklab, var(--card, #fff) 70%, transparent);
  --jd-line: color-mix(in oklab, #ffffff 65%, transparent);
  --jd-shadow: 0 14px 34px -18px rgba(124, 58, 237, 0.28), 0 2px 6px -2px rgba(15, 23, 42, 0.05);
  --jd-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
html.dark.jpa-on .jd-card, html.dark.jpa-on .jd-kpi, html.dark .jd-akpi {
  --jd-surface: color-mix(in oklab, var(--card, #131923) 58%, transparent);
  --jd-line: rgba(255, 255, 255, 0.08);
  --jd-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  --jd-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------- KPI cards: pastel gradient + sparkline ---------- */
html.jpa-on .jd-kpi {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(145deg, color-mix(in oklab, var(--jd-c) 16%, var(--jd-surface)) 0%, var(--jd-surface) 70%) !important;
  border: 1px solid var(--jd-line) !important;
  box-shadow: var(--jd-shadow), var(--jd-inset) !important;
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  min-height: 128px;
  transition: transform 0.45s var(--jd-ease), box-shadow 0.45s var(--jd-ease);
  animation: jd-rise 0.7s var(--jd-ease) backwards;
}
html.jpa-on .jd-kpi:nth-child(2) { animation-delay: 0.05s; } html.jpa-on .jd-kpi:nth-child(3) { animation-delay: 0.1s; }
html.jpa-on .jd-kpi:nth-child(4) { animation-delay: 0.15s; } html.jpa-on .jd-kpi:nth-child(5) { animation-delay: 0.2s; } html.jpa-on .jd-kpi:nth-child(6) { animation-delay: 0.25s; }
html.jpa-on .jd-kpi:hover { transform: translateY(-5px); box-shadow: 0 24px 44px -20px color-mix(in oklab, var(--jd-c) 70%, transparent), var(--jd-inset) !important; }
html.jpa-on .jd-kpi > [data-slot="card-content"] { position: relative; z-index: 1; align-items: flex-start !important; }
html.jpa-on .jd-kpi > [data-slot="card-content"] > span:first-child {
  background: linear-gradient(135deg, var(--jd-c), color-mix(in oklab, var(--jd-c) 55%, #ec4899)) !important; color: #fff !important;
  box-shadow: 0 10px 22px -10px var(--jd-c) !important; border-radius: 14px !important;
}
html.jpa-on .jd-kpi::after { content: ""; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--jd-c); box-shadow: 0 0 0 4px color-mix(in oklab, var(--jd-c) 22%, transparent); }
html.jpa-on .jd-kpi .jd-spark { position: absolute; z-index: 0; right: 0; bottom: 0; width: 72%; height: 52px; opacity: 0.95; pointer-events: none; }
.jd-spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.jd-line { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: jd-draw 1.6s var(--jd-ease) forwards; }
@keyframes jd-draw { to { stroke-dashoffset: 0; } }
@keyframes jd-rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } }

/* ---------- analytics grid ---------- */
#jd-analytics { margin-top: 22px; display: grid; gap: 18px; }
.jd-row { display: grid; gap: 18px; }
.jd-row-1 { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.1fr) minmax(0, 1fr); }
.jd-row-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); }
.jd-card {
  border-radius: 22px; padding: 18px 20px; min-width: 0;
  background: var(--jd-surface); border: 1px solid var(--jd-line);
  box-shadow: var(--jd-shadow), var(--jd-inset);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  animation: jd-rise 0.8s var(--jd-ease) backwards;
  transition: transform 0.45s var(--jd-ease), box-shadow 0.45s var(--jd-ease);
}
.jd-row .jd-card:nth-child(2) { animation-delay: 0.08s; } .jd-row .jd-card:nth-child(3) { animation-delay: 0.16s; }
.jd-card:hover { transform: translateY(-3px); box-shadow: 0 24px 46px -22px rgba(124, 58, 237, 0.45), var(--jd-inset); }
.jd-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.jd-card h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.jd-card header p { margin: 3px 0 0; font-size: 12px; color: var(--muted-foreground, #64748b); }
.jd-seg-btns { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: color-mix(in oklab, #8b5cf6 12%, transparent); }
.jd-seg-btns button { border: 0; cursor: pointer; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: transparent; color: var(--muted-foreground, #64748b); transition: background-color 0.25s, color 0.25s; }
.jd-seg-btns button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, #8b5cf6, #c026d3); box-shadow: 0 8px 18px -8px rgba(192, 38, 211, 0.8); }
.jd-legend { display: flex; gap: 14px; font-size: 12px; font-weight: 700; color: var(--muted-foreground, #64748b); margin-bottom: 4px; }
.jd-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 4px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.jd-area { width: 100%; height: auto; display: block; overflow: visible; }
.jd-grid { stroke: color-mix(in oklab, var(--muted-foreground, #64748b) 18%, transparent); stroke-dasharray: 4 6; }
.jd-axis { font-size: 11px; fill: var(--muted-foreground, #64748b); font-weight: 600; }
.jd-dot { fill: var(--card, #fff); stroke: var(--c); stroke-width: 3; transition: r 0.2s; }
.jd-dot:hover { r: 7; }
.jd-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 7px; align-items: end; height: 200px; padding-top: 8px; }
.jd-bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.jd-bar span { width: 100%; max-width: 22px; height: var(--h); border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #ec4899, #8b5cf6); transform-origin: bottom; animation: jd-grow 0.9s var(--jd-ease) backwards; animation-delay: var(--d); transition: filter 0.2s, transform 0.3s var(--jd-ease); }
.jd-bar:nth-child(3n+2) span { background: linear-gradient(180deg, #f472b6, #a855f7); }
.jd-bar:nth-child(3n) span { background: linear-gradient(180deg, #fb923c, #ec4899); }
.jd-bar:hover span { filter: brightness(1.15) saturate(1.2); transform: scaleY(1.03); }
.jd-bar small { font-size: 10px; color: var(--muted-foreground, #64748b); font-weight: 700; }
@keyframes jd-grow { from { transform: scaleY(0); } }
.jd-donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.jd-donut svg { width: 150px; height: 150px; flex: none; }
.jd-seg { transition: stroke-width 0.25s; animation: jd-spin 1.1s var(--jd-ease) backwards; transform-origin: 70px 70px; }
.jd-seg:hover { stroke-width: 26; }
@keyframes jd-spin { from { opacity: 0; transform: rotate(-60deg); } }
.jd-donut-n { font-size: 26px; font-weight: 800; fill: var(--foreground, #0f172a); }
.jd-donut ul, .jd-hbars, .jd-pay, .jd-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.jd-donut ul { flex: 1; min-width: 120px; }
.jd-donut li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.jd-donut li i { width: 10px; height: 10px; border-radius: 50%; }
.jd-donut li b { margin-left: auto; }
.jd-hbars li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.jd-hbars li > i { width: 14px; height: 14px; border-radius: 50%; }
.jd-hbars li > div > span { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.jd-track { height: 9px; border-radius: 999px; background: color-mix(in oklab, var(--muted-foreground, #64748b) 14%, transparent); overflow: hidden; }
.jd-track span { display: block; height: 100%; width: var(--w); border-radius: inherit; animation: jd-fill 1.1s var(--jd-ease) backwards; }
@keyframes jd-fill { from { width: 0; } }
.jd-hbars b { font-size: 12px; color: var(--muted-foreground, #64748b); }
.jd-pay li { display: grid; grid-template-columns: 34px minmax(0, 1fr) 90px; gap: 10px; align-items: center; }
.jd-pay li > i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--c), color-mix(in oklab, var(--c) 50%, #ec4899)); box-shadow: 0 8px 16px -8px var(--c); }
.jd-pay b { display: block; font-size: 13px; } .jd-pay span { font-size: 12px; color: var(--muted-foreground, #64748b); }
.jd-pay svg { width: 90px; height: 30px; }
.jd-recent li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 14px; transition: background-color 0.2s; }
.jd-recent li:hover { background: color-mix(in oklab, #8b5cf6 9%, transparent); }
.jd-recent li > i { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-style: normal; font-weight: 800; font-size: 14px; }
.jd-recent b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jd-recent span { display: block; font-size: 11px; color: var(--muted-foreground, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jd-recent strong { font-size: 12px; white-space: nowrap; }
.jd-recent em { font-style: normal; font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px; color: var(--c); background: color-mix(in oklab, var(--c) 15%, transparent); white-space: nowrap; }
.jd-empty { margin: 0; padding: 24px 0; text-align: center; font-size: 13px; color: var(--muted-foreground, #64748b); }
.jd-skel { height: 260px; border-radius: 22px; background: linear-gradient(90deg, rgba(139, 92, 246, 0.08), rgba(236, 72, 153, 0.14), rgba(139, 92, 246, 0.08)); background-size: 200% 100%; animation: jd-sk 1.4s ease infinite; }
@keyframes jd-sk { to { background-position: -200% 0; } }
@media (max-width: 1180px) { .jd-row-1, .jd-row-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .jd-span-area, .jd-span-recent { grid-column: 1 / -1; } }
@media (max-width: 700px) { .jd-row-1, .jd-row-2 { grid-template-columns: minmax(0, 1fr); } .jd-pay li { grid-template-columns: 34px minmax(0, 1fr); } .jd-pay svg { display: none; } .jd-recent li { grid-template-columns: 34px minmax(0, 1fr) auto; } .jd-recent strong { display: none; } }

/* ---------- agent console ---------- */
.jd-akpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.jd-akpi {
  position: relative; overflow: hidden; display: flex; justify-content: space-between; gap: 10px; min-height: 112px; padding: 16px 18px; border-radius: 22px;
  background: linear-gradient(145deg, color-mix(in oklab, var(--jd-c) 24%, rgba(20, 14, 40, 0.6)) 0%, rgba(20, 14, 40, 0.55) 75%);
  border: 1px solid rgba(255, 255, 255, 0.09); box-shadow: 0 18px 40px -20px color-mix(in oklab, var(--jd-c) 60%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: jd-rise 0.7s var(--jd-ease) backwards; transition: transform 0.45s var(--jd-ease);
}
.jd-akpi:nth-child(2) { animation-delay: 0.06s; } .jd-akpi:nth-child(3) { animation-delay: 0.12s; } .jd-akpi:nth-child(4) { animation-delay: 0.18s; }
.jd-akpi:hover { transform: translateY(-4px); }
.jd-akpi::before { content: ""; position: absolute; top: 16px; right: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--jd-c); box-shadow: 0 0 12px var(--jd-c); }
.jd-akpi > div:first-child { position: relative; z-index: 1; display: grid; align-content: start; gap: 2px; }
.jd-akpi span { font-size: 12px; font-weight: 700; color: #c4b5fd; text-transform: uppercase; letter-spacing: 0.06em; }
.jd-akpi b { font-size: 28px; font-weight: 800; color: #fff; line-height: 1.15; }
.jd-akpi small { font-size: 12px; color: #a1a1aa; }
.jd-akpi .jd-spark { position: absolute; right: 0; bottom: 0; width: 62%; height: 50px; }
@media (max-width: 900px) { .jd-akpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- order confetti ---------- */
.jpc-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 9998; pointer-events: none; }
.jpc-banner {
  position: fixed; z-index: 9999; left: 50%; top: 88px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
  width: min(520px, calc(100vw - 28px)); padding: 14px 16px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.88), rgba(219, 39, 119, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.35); box-shadow: 0 24px 50px -18px rgba(192, 38, 211, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  animation: jpc-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.jpc-banner.out { animation: jpc-out 0.4s ease forwards; }
.jpc-ico { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.22); animation: jpc-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s backwards; }
.jpc-banner b { display: block; font-size: 16px; }
.jpc-banner p { margin: 2px 0 0; font-size: 13px; opacity: 0.92; line-height: 1.4; }
.jpc-banner button { margin-left: auto; flex: none; width: 30px; height: 30px; border-radius: 10px; border: 0; cursor: pointer; font-size: 20px; color: #fff; background: rgba(255, 255, 255, 0.18); }
@keyframes jpc-in { from { opacity: 0; transform: translate(-50%, -24px) scale(0.95); } }
@keyframes jpc-out { to { opacity: 0; transform: translate(-50%, -16px) scale(0.97); } }
@keyframes jpc-pop { from { transform: scale(0); } }

@media (prefers-reduced-motion: reduce) {
  .jd-line { animation: none; stroke-dashoffset: 0; }
  .jd-card, .jd-kpi, .jd-akpi, .jd-bar span, .jd-seg, .jd-track span, .jpc-banner, .jpc-ico { animation: none !important; }
}
html.jpa-on .jd-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 18px !important; }
html.jpa-on .jd-kpi .truncate { overflow: visible !important; white-space: normal !important; text-overflow: clip !important; }
html.jpa-on .jd-kpi [data-slot="card-content"] p:last-child, html.jpa-on .jd-kpi [data-slot="card-content"] .font-heading { font-size: 24px; }
@media (max-width: 900px) { html.jpa-on .jd-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 520px) { html.jpa-on .jd-kpi-grid { grid-template-columns: minmax(0, 1fr) !important; } }
