/* ==========================================================================
   ELS Sales Kit — base styles (core)
   Reset · typography · app shell · every App.ui component · charts · utilities
   Breakpoints: md >= 720px, lg >= 1024px (sidebar).
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px);
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .5s ease, color .3s ease;
}
img, svg, video, canvas { display: block; max-width: 100%; }
svg { overflow: visible; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--text); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--text); text-wrap: balance; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); font-weight: 700; }
p { text-wrap: pretty; }
strong, b { font-weight: 700; color: var(--text); }
small { font-size: var(--fs-sm); }
code, kbd { font-family: var(--mono); font-size: .88em; }
kbd { padding: 1px 7px; border-radius: 7px; border: 1px solid var(--stroke-strong); background: var(--surface-2); }
.tabular, .num { font-variant-numeric: tabular-nums; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink);
}
.grad-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rich strong { font-weight: 750; }

/* ---------- Focus ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.btn:focus-visible, .chip:focus-visible, .seg:focus-visible, .tab:focus-visible { outline-offset: 3px; }

/* ==========================================================================
   SHELL
   ========================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; align-content: center; gap: 18px;
  background: var(--bg); color: var(--text);
  transition: opacity .45s ease, visibility 0s linear .45s;
}
.splash-mark { width: 76px; height: 76px; border-radius: 22px; box-shadow: 0 18px 50px -12px var(--brand-glow); animation: splashPulse 1.6s var(--ease) infinite alternate; }
.splash-name { font-weight: 800; letter-spacing: -.01em; font-size: var(--fs-lg); }
.splash-tag { margin-top: -12px; color: var(--muted); font-size: var(--fs-sm); }
.splash.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes splashPulse { from { transform: scale(.96); } to { transform: scale(1.03); } }

.shell { position: relative; min-height: 100vh; min-height: 100dvh; isolation: isolate; }

/* Ambient aurora — tinted by the current module accent (body.c-<color>) */
.aurora {
  position: fixed; inset: -25%; z-index: var(--z-aurora); pointer-events: none; overflow: hidden;
}
.aurora i {
  position: absolute; width: 64vmax; height: 64vmax; border-radius: 50%;
  background: radial-gradient(circle at center, currentColor 0%, transparent 62%);
  opacity: var(--aurora-opacity);
  transition: color 1.4s ease, opacity .6s ease;
  animation: auroraDrift 28s ease-in-out infinite alternate;
  will-change: transform;
}
.aurora i:nth-child(1) { color: var(--accent); left: -6%; top: -10%; }
.aurora i:nth-child(2) { color: var(--accent-2); right: -10%; top: 6%; animation-duration: 34s; animation-delay: -9s; opacity: calc(var(--aurora-opacity) * .8); }
.aurora i:nth-child(3) { color: var(--violet); left: 24%; bottom: -30%; animation-duration: 40s; animation-delay: -17s; opacity: calc(var(--aurora-opacity) * .6); }
.aurora::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--stroke) 1px, transparent 1px), linear-gradient(90deg, var(--stroke) 1px, transparent 1px);
  background-size: 64px 64px; opacity: .22;
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000 0%, transparent 55%);
  mask-image: radial-gradient(ellipse at 50% 20%, #000 0%, transparent 55%);
}
@keyframes auroraDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(7vw, 5vh, 0) scale(1.12); }
  100% { transform: translate3d(-5vw, 3vh, 0) scale(.94); }
}

/* ---------- Sidebar (desktop) ---------- */
.sidebar { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; flex: none; box-shadow: 0 10px 26px -10px var(--brand-glow); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 800; font-size: var(--fs-md); letter-spacing: -.015em; line-height: 1.2; }
.brand-tag { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }

.side-nav { flex: 1; overflow-y: auto; padding: 4px 2px 12px; margin: 0 -4px; scrollbar-width: thin; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label {
  padding: 0 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 6px 10px; margin: 2px 4px; border-radius: 14px;
  color: var(--muted); font-weight: 650; font-size: var(--fs-base); text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item:active { transform: scale(.98); }
.nav-item .tile { width: 34px; height: 34px; border-radius: 11px; transition: transform var(--dur) var(--ease-spring); }
.nav-item:hover .tile { transform: scale(1.06); }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item.active::before {
  content: ""; position: absolute; left: -4px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.nav-item.active .tile { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); box-shadow: 0 8px 20px -8px var(--accent-glow); }
.nav-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-foot { padding-top: 12px; border-top: 1px solid var(--stroke); }
.side-level {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
  padding: 14px; border-radius: 18px; border: 1px solid var(--stroke);
  background: linear-gradient(135deg, var(--violet-soft), var(--cyan-soft));
  color: var(--text); text-align: left;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.side-level:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.side-level-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-level-name { font-weight: 750; font-size: var(--fs-sm); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-level-sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.side-level-meta { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); font-weight: 650; }
.side-actions { display: flex; gap: 6px; margin-top: 10px; }
.side-actions .btn { flex: 1; }

/* ---------- Main column / top bar ---------- */
.main-col { position: relative; z-index: var(--z-content); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  display: flex; align-items: center; gap: 6px;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(10px + var(--safe-right)) 0 calc(10px + var(--safe-left));
  background: transparent; border-bottom: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.is-scrolled .topbar, .topbar.is-solid {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--stroke);
}
.topbar .topbar-back { display: none; }
.topbar.has-back .topbar-back { display: inline-grid; }
.topbar.has-back .topbar-brand { display: none; }
.topbar-brand { display: inline-flex; align-items: center; padding: 6px; border-radius: 12px; }
.topbar-brand .brand-mark { width: 32px; height: 32px; border-radius: 10px; box-shadow: none; }
.topbar-title {
  flex: 1; min-width: 0; padding: 0 6px;
  font-weight: 750; font-size: var(--fs-md); letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.is-scrolled .topbar-title, .topbar.title-always .topbar-title { opacity: 1; transform: none; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-avatar { display: inline-flex; padding: 4px; border-radius: 50%; text-decoration: none; }
.topbar-avatar:hover { text-decoration: none; }
.topbar-avatar .avatar { transition: transform var(--dur) var(--ease-spring); }
.topbar-avatar:hover .avatar { transform: scale(1.06); }
.theme-toggle .ico { transition: transform .5s var(--ease-spring); }
.theme-toggle:active .ico { transform: rotate(-40deg) scale(.9); }

.main { display: block; outline: none; }
.view {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: 4px calc(var(--gutter) + var(--safe-right)) calc(var(--bottomnav-h) + var(--safe-bottom) + 36px) calc(var(--gutter) + var(--safe-left));
}
.view > * + * { margin-top: var(--space-5); }
.view > .page-hero + * { margin-top: var(--space-5); }

/* page enter: soft fade-up with tiny stagger */
.page-enter > * { animation: pageIn var(--dur-slow) var(--ease-out) both; }
.page-enter > *:nth-child(2) { animation-delay: 40ms; }
.page-enter > *:nth-child(3) { animation-delay: 80ms; }
.page-enter > *:nth-child(4) { animation-delay: 120ms; }
.page-enter > *:nth-child(5) { animation-delay: 160ms; }
.page-enter > *:nth-child(n+6) { animation-delay: 200ms; }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch;
  height: calc(var(--bottomnav-h) + var(--safe-bottom));
  padding: 0 calc(6px + var(--safe-right)) var(--safe-bottom) calc(6px + var(--safe-left));
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid var(--stroke);
  box-shadow: var(--shadow-up);
}
.bn-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; min-height: 44px; padding: 6px 2px; color: var(--dim);
  font-size: 11px; font-weight: 700; letter-spacing: .01em; text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.bn-item:hover { text-decoration: none; color: var(--text); }
.bn-item .bn-icon {
  display: grid; place-items: center; width: 48px; height: 30px; border-radius: 999px;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
}
.bn-item:active .bn-icon { transform: scale(.9); }
.bn-item.active { color: var(--accent-ink); }
.bn-item.active .bn-icon { background: var(--accent-soft); }
.bn-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-plus-wrap { display: flex; justify-content: center; align-items: flex-start; }
.bn-plus {
  display: grid; place-items: center; width: 58px; height: 58px; margin-top: -20px; border-radius: 50%;
  color: var(--on-brand);
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border: 4px solid var(--bg);
  box-shadow: 0 12px 28px -8px var(--violet-glow), 0 4px 12px -4px var(--cyan-glow);
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
}
.bn-plus .ico { transition: transform var(--dur-slow) var(--ease-spring); }
.bn-plus:hover { transform: translateY(-2px); }
.bn-plus:active { transform: scale(.92); }
.qa-open .bn-plus .ico, .qa-open .fab .ico { transform: rotate(135deg); }

/* ---------- FAB (desktop) ---------- */
.fab { display: none; }

/* ---------- Desktop layout ---------- */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 36px; --topbar-h: 64px; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: var(--z-nav);
    width: var(--sidebar-w); padding: 20px 14px 16px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(22px) saturate(1.4);
    backdrop-filter: blur(22px) saturate(1.4);
    border-right: 1px solid var(--stroke);
  }
  .main-col { margin-left: var(--sidebar-w); }
  .bottomnav { display: none; }
  .topbar { padding-left: var(--gutter); padding-right: var(--gutter); gap: 8px; }
  .topbar .topbar-brand, .topbar .topbar-avatar { display: none; }
  .topbar .topbar-back, .topbar.has-back:not(.has-back-detail) .topbar-back { display: none; }
  .topbar.has-back.has-back-detail .topbar-back { display: inline-grid; }
  .view { padding-bottom: 96px; }
  .fab {
    position: fixed; right: 32px; bottom: 32px; z-index: var(--z-fab);
    display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 22px 0 18px; border-radius: 999px;
    color: var(--on-brand); font-weight: 750; font-size: var(--fs-base);
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    box-shadow: 0 16px 36px -12px var(--violet-glow), 0 6px 14px -6px var(--cyan-glow);
    transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
  }
  .fab .ico { transition: transform var(--dur-slow) var(--ease-spring); }
  .fab:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -12px var(--violet-glow), 0 6px 14px -6px var(--cyan-glow); }
  .fab:active { transform: scale(.96); }
}
@media (min-width: 1440px) {
  :root { --sidebar-w: 288px; }
}

/* Full-screen flow container (e.g. onboarding). Give it class "m-<module>" for scoped CSS. */
.overlay-screen {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg); color: var(--text);
  padding: calc(var(--safe-top) + 16px) calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 16px);
  /* focus scrolling keeps fields off the screen edges */
  scroll-padding: calc(var(--safe-top) + 16px) 0 calc(var(--safe-bottom) + 24px);
}
html.has-overlay-screen { overflow: hidden; }

/* Soft keyboard rules for full-screen flows and sheets: see "SOFT KEYBOARD" after the components (they must come
   after .sheet-layer's own `inset: 0`). */
:root { --kb-inset: 0px; }

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* ---------- Icons & tiles ---------- */
.ico { flex: none; display: inline-block; vertical-align: middle; }
.tile {
  flex: none; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.tile-sm { width: 32px; height: 32px; border-radius: 10px; }
.tile-lg { width: 52px; height: 52px; border-radius: 16px; }
.tile-xl { width: 68px; height: 68px; border-radius: 22px; }
.tile-solid { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); box-shadow: 0 10px 24px -10px var(--accent-glow); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill);
  font-weight: 700; font-size: var(--fs-base); line-height: 1.1; white-space: nowrap;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--stroke);
  text-decoration: none; user-select: none; -webkit-user-select: none;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--stroke-strong); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn-primary {
  color: var(--on-accent); border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -10px var(--accent-glow), inset 0 1px 0 var(--inset-hi);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 14px 30px -10px var(--accent-glow), inset 0 1px 0 var(--inset-hi); filter: brightness(1.04); }
.btn-soft { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.btn-soft:hover { background: var(--accent-soft); border-color: var(--accent-glow); }
.btn-ghost { color: var(--accent-ink); background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--on-red); background: var(--red); border-color: transparent; box-shadow: 0 10px 22px -12px var(--red-glow); }
.btn-danger:hover { background: var(--red); border-color: transparent; filter: brightness(1.06); }
.btn-outline { background: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); gap: 6px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: var(--fs-md); }
.btn-block { display: flex; width: 100%; }
.btn-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%;
  color: var(--muted); background: transparent; border: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon:active { transform: scale(.92); }
.btn.btn-icon { padding: 0; }
.btn-icon.btn-sm { width: 36px; height: 36px; }
.btn-icon.btn-primary, .btn-icon.btn-soft, .btn-icon.btn-danger { border-radius: 50%; border-color: transparent; }
.btn-icon.btn-primary, .btn-icon.btn-primary:hover { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-icon.btn-soft, .btn-icon.btn-soft:hover { color: var(--accent-ink); background: var(--accent-soft); }
.btn-icon.btn-danger, .btn-icon.btn-danger:hover { color: var(--on-red); background: var(--red); }
.btn.btn-icon:not(.btn-primary):not(.btn-soft):not(.btn-danger) { border-color: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Invisible hit-area extension (SPEC §2: min tap target 44px) for compact controls.
   Vertical only for wide controls; icon-only small buttons also grow horizontally. */
.chip, .seg, .stepper-btn, .btn-icon, .rating-star { position: relative; }
button.chip::after, .btn-sm::after, .seg::after, .tab::after, .stepper-btn::after, .rating.is-sm .rating-star::after,
.toast-close::after, .search-clear::after, .btn-icon.btn-sm::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%);
}
.toast-close::after, .search-clear::after, .btn-icon.btn-sm::after { left: 50%; right: auto; width: 44px; transform: translate(-50%, -50%); }

/* ---------- Cards ---------- */
.card {
  position: relative; display: block;
  padding: var(--space-5); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--highlight);
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 12px; }
.card-head + .card-body { margin-top: var(--space-4); }
.card-head-text { flex: 1; min-width: 0; }
.card-title { font-size: var(--fs-md); font-weight: 750; letter-spacing: -.01em; line-height: 1.3; }
.card-sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.card-action { flex: none; margin-left: auto; display: flex; align-items: center; gap: 6px; }
.card-body { min-width: 0; }
.card-hero {
  overflow: hidden; border-color: var(--accent-glow);
  background:
    radial-gradient(120% 120% at 0% 0%, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(90% 120% at 100% 100%, var(--accent-soft) 0%, transparent 60%),
    var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 var(--highlight);
}
.card-soft { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.card-outline { background: transparent; box-shadow: none; border-style: dashed; border-color: var(--stroke-strong); }
.card-flat { box-shadow: none; }
.card-tight { padding: var(--space-4); }
.card-click { cursor: pointer; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.card-click:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--stroke-strong); }
.card-click:active { transform: translateY(0) scale(.99); }

/* ---------- Page header hero ---------- */
.page-hero {
  position: relative; overflow: hidden; isolation: isolate;
  margin-top: 4px; padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke);
  background:
    radial-gradient(130% 160% at 0% 0%, var(--accent-soft) 0%, transparent 50%),
    linear-gradient(135deg, var(--surface) 0%, var(--surface) 100%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--highlight);
}
.page-hero::before {
  content: ""; position: absolute; z-index: -1; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%); opacity: .55;
}
.page-hero::after {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); opacity: .7;
}
.page-hero-main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); }
.page-hero-icon { width: 56px; height: 56px; border-radius: 18px; }
.page-hero-avatar { flex: none; display: inline-flex; }
.page-hero-avatar .avatar { box-shadow: 0 0 0 3px var(--surface-solid), 0 0 0 5px var(--accent-glow), 0 14px 30px -12px var(--accent-glow); }
.page-hero-text { flex: 1; min-width: 0; }
.page-hero-kicker { margin-bottom: 4px; }
.page-hero-title { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.025em; line-height: 1.12; }
.page-hero-sub { margin-top: 6px; color: var(--muted); font-size: var(--fs-base); max-width: 60ch; }
.page-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.page-hero-extra { margin-top: var(--space-5); }
@media (min-width: 720px) {
  .page-hero { padding: var(--space-7); }
  .page-hero-icon { width: 64px; height: 64px; border-radius: 20px; }
  .page-hero-main { flex-wrap: nowrap; align-items: center; gap: var(--space-5); }
  .page-hero-actions { flex: none; flex-basis: auto; margin-left: auto; align-self: center; }
}

/* ---------- Sections ---------- */
.section { min-width: 0; }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: var(--space-3); padding: 0 2px; }
.section-head-text { flex: 1; min-width: 0; }
.section-title { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.015em; }
.section-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.section-action { flex: none; }
.section-body > * + * { margin-top: var(--space-3); }

/* ---------- Lists ---------- */
.list {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--highlight);
}
.list > .li + .li { border-top: 1px solid var(--stroke); }
.li {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 12px var(--space-4); text-align: left; width: 100%; color: var(--text);
  transition: background-color var(--dur) var(--ease);
}
.li-click { cursor: pointer; }
.li-click:hover { background: var(--surface-2); }
.li-click:active { background: var(--surface-3); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 650; font-size: var(--fs-base); line-height: 1.35; overflow-wrap: anywhere; }
.li-sub { color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; margin-top: 1px; overflow-wrap: anywhere; }
.li-meta { flex: none; color: var(--dim); font-size: var(--fs-xs); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.li-right { flex: none; display: flex; align-items: center; gap: 6px; }
.li-chevron { color: var(--dim); transition: transform var(--dur) var(--ease); }
.li-click:hover .li-chevron { transform: translateX(2px); color: var(--muted); }
.list-plain { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
.list-plain > .li { padding-left: 0; padding-right: 0; }

/* ---------- KPI ---------- */
.kpi {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px;
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--highlight); min-width: 0;
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%); pointer-events: none;
}
.kpi-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi-head .tile { width: 30px; height: 30px; border-radius: 10px; }
/* labels wrap to two lines (narrow 2-column grids at 360px) */
.kpi-label {
  font-size: var(--fs-xs); font-weight: 750; color: var(--muted); letter-spacing: .02em; line-height: 1.3; min-width: 0;
  overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.kpi-value { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-sub { font-size: var(--fs-xs); color: var(--dim); font-weight: 600; }
.kpi-click { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.kpi-click:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--stroke-strong); }
.kpi-click:active { transform: translateY(0) scale(.99); }
.kpi-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; cursor: pointer; }
.kpi-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: inherit; }
.trend { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 750; }
.trend-up { background: var(--green-soft); color: var(--green-ink); }
.trend-down { background: var(--red-soft); color: var(--red-ink); }
.trend-flat { background: var(--surface-3); color: var(--muted); }

/* ---------- Grid ---------- */
.grid { display: grid; gap: var(--grid-gap, 12px); grid-template-columns: repeat(var(--g-base, 1), minmax(0, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(var(--g-md, var(--g-base, 1)), minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(var(--g-lg, var(--g-md, var(--g-base, 1))), minmax(0, 1fr)); } }
.grid > * { margin-top: 0 !important; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--stroke);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 14px; border-radius: 12px;
  color: var(--muted); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--stroke); }
.tab.active .ico { color: var(--accent-ink); }
.tab-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Segmented ---------- */
.segmented {
  display: inline-flex; gap: 2px; padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  border-radius: var(--radius-pill); background: var(--surface-3); border: 1px solid var(--stroke);
}
.segmented.is-block { display: flex; width: 100%; }
.segmented.is-block .seg { flex: 1; }
.seg {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border-radius: var(--radius-pill);
  color: var(--muted); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.seg:hover { color: var(--text); }
.seg:active { transform: scale(.97); }
.seg.active { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px -8px var(--accent-glow); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 650; line-height: 1.2; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--stroke);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
button.chip:hover { color: var(--text); border-color: var(--stroke-strong); }
button.chip:active { transform: scale(.96); }
.chip.active { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-glow); }
.chip.active .chip-check { display: inline-block; }
.chip-check { display: none; }
.chip-static { min-height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.chip[class*="c-"]:not(.active) .ico { color: var(--accent-ink); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; vertical-align: middle;
  background: var(--accent-soft); color: var(--accent-ink);
}
.badge-solid { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); }

/* ---------- Avatar ---------- */
.avatar {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  width: 40px; height: 40px; border-radius: 50%;
  color: var(--on-accent); font-weight: 800; letter-spacing: .01em; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent-glow);
  user-select: none;
}

/* ---------- Form fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field + .field { margin-top: var(--space-4); }
.field-label { font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.field-label .req { color: var(--red-ink); margin-left: 2px; }
.field-hint { font-size: var(--fs-xs); color: var(--dim); font-weight: 550; }
.field-error { display: none; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--red-ink); font-weight: 700; }
.field.has-error .field-error { display: flex; animation: shakeX .32s var(--ease); }
.field.has-error .input, .field.has-error .input-wrap { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.field.has-error .input-wrap > .input { border-color: transparent; box-shadow: none; }
@keyframes shakeX { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row > .field + .field { margin-top: 0; }

.input, .input-wrap {
  width: 100%; min-height: 48px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--stroke-strong);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.input { padding: 11px 14px; font-size: 16px; line-height: 1.4; color: var(--text); -webkit-appearance: none; appearance: none; }
.input::placeholder { color: var(--dim); opacity: 1; }
/* PIN fields bring their own show/hide button: hide Edge's built-in reveal/clear icons (a second eye) */
.input::-ms-reveal, .input::-ms-clear { display: none; }
.input:hover, .input-wrap:hover { border-color: var(--accent-glow); }
.input:focus, .input-wrap:focus-within { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-solid); }
.input:disabled { opacity: .6; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input-wrap { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 14px; }
.input-wrap > .input { flex: 1; min-width: 0; min-height: 46px; padding-left: 8px; border: 0; background: transparent; box-shadow: none; }
.input-wrap > .input:focus { box-shadow: none; background: transparent; }
.input-icon { color: var(--dim); }
.input-prefix, .input-suffix { color: var(--muted); font-weight: 750; font-size: var(--fs-sm); flex: none; }
.input-suffix { padding-right: 10px; }
.money .input { font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.select-wrap { position: relative; width: 100%; }
.select { padding-right: 42px; cursor: pointer; }
.select option { background: var(--surface-solid); color: var(--text); }
.select-chevron { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input[type="date"].input, input[type="time"].input { min-height: 48px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* ---------- Stepper ---------- */
.stepper {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px;
  border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--stroke-strong);
}
.stepper-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--accent-ink); background: var(--accent-soft);
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur) var(--ease);
  touch-action: manipulation;
}
.stepper-btn:active { transform: scale(.88); }
.stepper-btn:disabled { opacity: .35; }
.stepper-value { min-width: 48px; text-align: center; font-weight: 800; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.stepper-value.bump { animation: bump .28s var(--ease-spring); }
@keyframes bump { 50% { transform: scale(1.25); } }

/* ---------- Rating ---------- */
.rating { display: inline-flex; flex-direction: column; gap: 6px; }
.rating-stars { display: inline-flex; gap: 2px; }
.rating-star {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--stroke-strong);
  transition: transform var(--dur) var(--ease-spring), color var(--dur) var(--ease);
}
.rating-star:hover { transform: scale(1.12); }
.rating-star.on { color: var(--accent); }
.rating-star.on .ico { fill: currentColor; }
.rating-star.pop { animation: starPop .4s var(--ease-spring); }
@keyframes starPop { 40% { transform: scale(1.35) rotate(-8deg); } 100% { transform: none; } }
.rating-label { min-height: 1.2em; font-size: var(--fs-sm); color: var(--muted); font-weight: 650; padding-left: 4px; }
.rating.is-sm .rating-star { width: 34px; height: 34px; }

/* ---------- Toggle ---------- */
.toggle { display: flex; align-items: center; gap: 14px; min-height: 44px; cursor: pointer; user-select: none; }
.toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle-track {
  position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--stroke-strong);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--knob); box-shadow: var(--knob-shadow);
  transition: transform var(--dur) var(--ease-spring), background-color var(--dur) var(--ease);
}
.toggle-input:checked + .toggle-track { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); background: var(--knob); }
.toggle-input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.toggle-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toggle-label { font-weight: 650; }
.toggle-sub { font-size: var(--fs-sm); color: var(--muted); }
.toggle.is-end { flex-direction: row-reverse; }

/* ---------- Checkbox (signature animated round check) ---------- */
.check {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 52px; padding: 10px 4px; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.check-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.check-box {
  position: relative; flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--stroke-strong); background: var(--surface-2); color: var(--on-accent);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.check-box::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--accent);
  opacity: 0; transform: scale(1); pointer-events: none;
}
.check-box svg { width: 16px; height: 16px; }
.check-box path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .28s var(--ease) .04s; }
.check:hover .check-box { border-color: var(--accent); }
.check.is-checked .check-box {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -6px var(--accent-glow);
}
.check.is-checked .check-box path { stroke-dashoffset: 0; }
.check.pop .check-box { animation: checkPop .42s var(--ease-spring); }
.check.pop .check-box::after { animation: checkRing .6s var(--ease-out); }
@keyframes checkPop { 0% { transform: scale(1); } 35% { transform: scale(.82); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes checkRing { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
.check-input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 3px; }
.check-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.check-label {
  font-weight: 600; line-height: 1.4; overflow-wrap: anywhere;
  text-decoration: line-through; text-decoration-color: transparent; text-decoration-thickness: 1.5px;
  transition: color var(--dur) var(--ease), text-decoration-color .3s var(--ease);
}
.check.is-checked .check-label { color: var(--muted); }
.check.is-checked:not(.no-strike) .check-label { text-decoration-color: var(--muted); }
.check.no-strike .check-label { text-decoration: none; }
.check-sub { font-size: var(--fs-sm); color: var(--dim); line-height: 1.4; }
.check-right { flex: none; display: flex; align-items: center; gap: 4px; }
.check.is-disabled { opacity: .55; cursor: not-allowed; }
.list > .check { padding: 10px var(--space-4); }
.list > .check + .check { border-top: 1px solid var(--stroke); }

/* ---------- Progress ring ---------- */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-track { stroke: var(--surface-3); }
.ring-value { transition: stroke-dashoffset 1.1s var(--ease-out); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12%; }
.ring-label { font-weight: 800; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ring-sublabel { margin-top: 2px; color: var(--muted); font-size: var(--fs-xs); font-weight: 650; line-height: 1.2; }

/* ---------- Progress bar ---------- */
.progress { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: var(--fs-sm); }
.progress-label { color: var(--muted); font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.progress-track { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .9s var(--ease-out);
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  transform: translateX(-100%); animation: shimmer 2.4s ease-in-out 1s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

/* ---------- Empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: var(--space-7) var(--space-5); }
.empty-art { position: relative; margin-bottom: 10px; }
.empty-art::before {
  content: ""; position: absolute; inset: -16px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
}
.empty-art .tile { position: relative; animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.empty-title { font-size: var(--fs-md); font-weight: 750; }
.empty-text { color: var(--muted); font-size: var(--fs-sm); max-width: 38ch; }
.empty .btn { margin-top: 12px; }
.card > .empty, .list > .empty { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* ---------- Callout ---------- */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px var(--space-4); border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent-glow); color: var(--text);
}
.callout > .ico { color: var(--accent-ink); margin-top: 2px; }
.callout-title { font-weight: 750; }
.callout-text { color: var(--muted); font-size: var(--fs-sm); }
.callout-title + .callout-text { margin-top: 2px; }

/* ---------- Search box ---------- */
.search {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 6px 0 16px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search > .ico { color: var(--dim); }
.search-input { flex: 1; min-width: 0; height: 46px; border: 0; background: transparent; font-size: 16px; color: var(--text); }
.search-input:focus { outline: none; }
.search-input::placeholder { color: var(--dim); }
.search-clear { width: 36px; height: 36px; }
.search:not(.has-value) .search-clear { visibility: hidden; }

/* ---------- Divider / spacer ---------- */
.divider { height: 1px; background: var(--stroke); margin: var(--space-4) 0; }
.spacer { flex: none; }

/* ---------- Sheet / dialog ---------- */
html.sheet-open { overflow: hidden; }
.sheet-layer { position: fixed; inset: 0; z-index: var(--z-sheet); display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop {
  position: absolute; inset: 0; background: var(--backdrop);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity var(--dur-slow) var(--ease);
}
.sheet {
  position: relative; display: flex; flex-direction: column;
  width: 100%; max-height: calc(100vh - var(--safe-top) - 24px); max-height: calc(100dvh - var(--safe-top) - 24px);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--surface-solid); border: 1px solid var(--stroke); border-bottom: 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .34s var(--ease-out);
  outline: none; overflow: hidden;
}
.sheet::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 120px; pointer-events: none;
  background: radial-gradient(80% 120px at 20% 0%, var(--accent-soft), transparent 70%);
}
.sheet-layer.is-open .sheet-backdrop { opacity: 1; }
.sheet-layer.is-open .sheet { transform: none; }
.sheet-layer.is-closing .sheet-backdrop { opacity: 0; }
.sheet-layer.is-closing .sheet { transform: translateY(100%); transition-duration: .24s; transition-timing-function: var(--ease); }
.sheet.is-dragging { transition: none; }
.sheet-handle { position: relative; display: flex; justify-content: center; padding: 10px 0 2px; touch-action: none; cursor: grab; }
.sheet-handle::before { content: ""; width: 42px; height: 5px; border-radius: 999px; background: var(--stroke-strong); }
.sheet-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px var(--space-5) 12px; touch-action: none; }
.sheet-head-text { flex: 1; min-width: 0; }
.sheet-title { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.015em; line-height: 1.25; }
.sheet-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.sheet-close { margin-right: -8px; }
.sheet-body {
  position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 4px var(--space-5) var(--space-5);
}
.sheet-foot {
  position: relative; display: flex; gap: 10px; flex-wrap: wrap;
  padding: 12px var(--space-5) calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--stroke); background: var(--surface-solid);
}
.sheet-foot .btn { flex: 1 1 0; min-width: 120px; }
.sheet:not(.has-foot) .sheet-body { padding-bottom: calc(var(--space-5) + var(--safe-bottom)); }
.sheet-full { height: calc(100dvh - var(--safe-top) - 12px); max-height: none; }
.sheet-msg { color: var(--muted); }
@media (min-width: 720px) {
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet {
    width: min(560px, 100%); max-height: min(86vh, 860px); border-radius: var(--radius-xl); border-bottom: 1px solid var(--stroke);
    transform: translateY(16px) scale(.97); opacity: 0;
    transition: transform .3s var(--ease-out), opacity .22s ease;
  }
  .sheet-layer.is-open .sheet { transform: none; opacity: 1; }
  .sheet-layer.is-closing .sheet { transform: translateY(10px) scale(.98); opacity: 0; }
  .sheet-handle { display: none; }
  .sheet-head { padding-top: var(--space-5); }
  .sheet-foot { padding-bottom: 16px; justify-content: flex-end; }
  .sheet-foot .btn { flex: 0 0 auto; }
  .sheet-sm { width: min(420px, 100%); }
  .sheet-lg { width: min(780px, 100%); }
  .sheet-full { width: min(1000px, 100%); height: min(92vh, 980px); }
}

/* Action sheet items */
.action-list { display: flex; flex-direction: column; gap: 4px; }
.action-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 10px; border-radius: 14px;
  font-weight: 650; color: var(--text); text-align: left;
  transition: background-color var(--dur) var(--ease);
}
.action-item:hover { background: var(--surface-2); }
.action-item:active { background: var(--surface-3); }
.action-item.is-danger { color: var(--red-ink); }
.action-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.action-item-sub { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }

/* Quick actions grid */
.qa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 520px) { .qa-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qa-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-height: 104px; padding: 14px;
  border-radius: 18px; border: 1px solid var(--stroke); background: var(--surface-2);
  font-weight: 700; font-size: var(--fs-sm); line-height: 1.3; color: var(--text); text-align: left;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  animation: qaIn .36s var(--ease-out) both;
}
.qa-item:hover { transform: translateY(-2px); border-color: var(--accent-glow); background: var(--accent-soft); box-shadow: var(--shadow); }
.qa-item:active { transform: scale(.97); }
@keyframes qaIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 14px);
  width: min(460px, calc(100vw - 24px));
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
@media (min-width: 1024px) { .toasts { bottom: 104px; left: calc(50% + var(--sidebar-w) / 2); } }
/* while a sheet/dialog is open, toasts move to the top so they never cover its fields or buttons */
html.sheet-open .toasts { top: calc(var(--safe-top) + 12px); bottom: auto; flex-direction: column; }
@media (min-width: 1024px) { html.sheet-open .toasts, html.has-overlay-screen .toasts { left: 50%; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; border-radius: 18px;
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.4;
  opacity: 0; transform: translateY(14px) scale(.97);
  transition: opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease-spring);
}
.toast.show { opacity: 1; transform: none; }
.toast.hide { opacity: 0; transform: translateY(8px) scale(.97); transition-duration: .2s; }
.toast-icon { width: 32px; height: 32px; border-radius: 10px; }
.toast-msg { flex: 1; min-width: 0; padding: 4px 0; }
.toast-action { flex: none; }
.toast-close { width: 32px; height: 32px; }

/* ---------- Celebrate ---------- */
.celebrate-layer { position: fixed; inset: 0; z-index: var(--z-celebrate); display: grid; place-items: center; padding: 24px; }
.celebrate-layer .sheet-backdrop { opacity: 0; }
.celebrate-layer.is-open .sheet-backdrop { opacity: 1; }
.celebrate {
  position: relative; width: min(380px, 100%); padding: 34px 26px 24px; text-align: center; overflow: hidden;
  border-radius: var(--radius-xl); background: var(--surface-solid); border: 1px solid var(--accent-glow);
  box-shadow: var(--shadow-lg), 0 0 80px -20px var(--accent-glow);
  transform: scale(.86) translateY(20px); opacity: 0;
  transition: transform .5s var(--ease-spring), opacity .25s ease;
}
.celebrate::before { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 60% at 50% 0%, var(--accent-soft), transparent 70%); pointer-events: none; }
.celebrate-layer.is-open .celebrate { transform: none; opacity: 1; }
.celebrate-layer.is-closing .celebrate { transform: scale(.94); opacity: 0; transition-duration: .2s; }
.celebrate-layer.is-closing .sheet-backdrop { opacity: 0; }
.celebrate-medal { position: relative; width: 112px; height: 112px; margin: 0 auto 18px; display: grid; place-items: center; }
.celebrate-rays {
  position: absolute; inset: -34px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--accent-soft) 0deg 10deg, transparent 10deg 30deg);
  -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%); mask-image: radial-gradient(circle, #000 30%, transparent 70%);
  animation: spin 14s linear infinite;
}
.celebrate-medal .tile { position: relative; width: 96px; height: 96px; border-radius: 30px; animation: medalIn .7s var(--ease-spring) .1s both; }
.celebrate-medal .tile::after { content: ""; position: absolute; inset: -6px; border-radius: 36px; border: 2px solid var(--accent-glow); }
@keyframes medalIn { from { transform: scale(.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.celebrate-kicker { position: relative; }
.celebrate-title { position: relative; margin-top: 6px; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; }
.celebrate-text { position: relative; margin-top: 8px; color: var(--muted); }
.celebrate-xp {
  position: relative; display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(135deg, var(--amber), var(--pink)); color: var(--on-amber); font-weight: 800; font-size: var(--fs-sm);
  box-shadow: 0 10px 24px -10px var(--amber-glow);
}
.celebrate .btn { position: relative; margin-top: 22px; }
.celebrate:focus { outline: none; }

/* ---------- Floating XP chip ---------- */
.xp-float {
  position: fixed; z-index: var(--z-float); pointer-events: none;
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px 6px 9px; border-radius: 999px;
  background: linear-gradient(135deg, var(--amber), var(--pink)); color: var(--on-amber);
  font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
  box-shadow: 0 10px 24px -8px var(--amber-glow);
  transform: translate(-50%, -50%);
  animation: xpFloat 1.15s var(--ease-out) forwards;
}
@keyframes xpFloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  18% { opacity: 1; transform: translate(-50%, -80%) scale(1.08); }
  70% { opacity: 1; transform: translate(-50%, -160%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -210%) scale(.96); }
}
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: var(--z-confetti); pointer-events: none; }

/* ---------- Error card ---------- */
.error-card { text-align: center; }
.error-card .empty { padding-bottom: var(--space-5); }
.error-detail { margin-top: 8px; font-size: var(--fs-xs); color: var(--dim); text-align: left; }
.error-detail summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.error-detail pre { margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); }

/* ---------- Module hub (core fallback for menu/home) ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .hub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hub-tile { display: flex; flex-direction: column; gap: 12px; min-height: 132px; }
.hub-tile .card-title { font-size: var(--fs-base); }
.hub-tile .card-sub { font-size: var(--fs-xs); }

/* ==========================================================================
   CHARTS (App.charts)
   ========================================================================== */
.chart { position: relative; width: 100%; min-width: 0; color: var(--muted); }
.chart svg { width: 100%; height: auto; font-family: var(--font); }
.chart-fixed svg { margin: 0 auto; }
.ch-grid { stroke: var(--stroke); stroke-width: 1; stroke-dasharray: 3 4; }
.ch-axis { stroke: var(--stroke-strong); stroke-width: 1; }
.ch-label { fill: var(--dim); font-size: 10.5px; font-weight: 650; }
.ch-label-strong { fill: var(--text); font-weight: 800; }
.ch-value { fill: var(--muted); font-size: 10.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
.ch-value.is-hi { fill: var(--text); }
.ch-target { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ch-target-label { fill: var(--amber-ink); font-size: 10px; font-weight: 800; }
.ch-bar { transition: opacity var(--dur) var(--ease); }
.ch-anim .ch-bar { transform-box: fill-box; transform-origin: 50% 100%; animation: barGrow .7s var(--ease-out) both; }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ch-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ch-anim .ch-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: lineDraw 1.1s var(--ease-out) forwards; }
@keyframes lineDraw { to { stroke-dashoffset: 0; } }
.ch-area { opacity: .9; }
.ch-anim .ch-area, .ch-anim .ch-dot { animation: fadeIn .8s ease .3s both; }
.ch-dot { stroke-width: 2; fill: var(--surface-solid); }
.ch-radar-ring { fill: none; stroke: var(--stroke); stroke-width: 1; }
.ch-radar-spoke { stroke: var(--stroke); stroke-width: 1; }
.ch-radar-area { stroke-width: 2; stroke-linejoin: round; }
.ch-radar-compare { fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-dasharray: 4 4; }
.ch-anim .ch-radar-area { transform-box: view-box; transform-origin: 50% 50%; animation: radarIn .8s var(--ease-out) both; }
@keyframes radarIn { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.ch-donut-track { stroke: var(--surface-3); fill: none; }
.ch-donut-seg { fill: none; transition: opacity var(--dur) var(--ease); }
.ch-anim .ch-donut-seg { animation: fadeIn .6s ease both; }
.ch-donut-value { fill: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.ch-donut-label { fill: var(--muted); font-weight: 650; }
.ch-heat-cell { rx: 3px; }
.ch-heat-empty { fill: var(--surface-3); }
.ch-heat-today { stroke: var(--text); stroke-width: 1.5; }
.ch-spark { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-xs); color: var(--muted); font-weight: 650; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--accent)); }

/* ==========================================================================
   ONLINE MODE — auth screens (Masuk, Siapkan Akun GM, Buat PIN Baru), sync indicator
   ========================================================================== */
.auth-screen {
  z-index: calc(var(--z-overlay) + 20);
  display: block; padding: 0;
  overflow-x: hidden;
  transition: opacity .26s ease;
}
.auth-screen.is-leaving { opacity: 0; pointer-events: none; }
/* auto margins centre the card vertically when it fits and let the screen scroll when it does not */
.auth-wrap {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: 100%; min-height: 100%;
  padding: calc(var(--safe-top) + 28px) calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 16px);
}
.auth-card {
  position: relative; overflow: hidden; isolation: isolate;
  flex: none; margin-top: auto;
  width: min(440px, 100%);
  padding: 28px 22px 22px;
  border-radius: var(--radius-xl);
  background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--highlight);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  outline: none;
  animation: authIn .5s var(--ease-out) both;
}
.auth-card::before {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); opacity: .8;
}
.auth-card::after {
  content: ""; position: absolute; z-index: -1; right: -90px; top: -110px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%); opacity: .45; pointer-events: none;
}
.auth-card.is-shake { animation: shakeX .4s var(--ease); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-mark { width: 56px; height: 56px; border-radius: 17px; flex: none; box-shadow: 0 16px 40px -14px var(--brand-glow); }
.auth-brand-text { display: flex; flex-direction: column; min-width: 0; }
.auth-brand-name { font-weight: 800; font-size: var(--fs-md); letter-spacing: -.015em; line-height: 1.2; }
.auth-brand-tag { font-size: var(--fs-xs); color: var(--muted); font-weight: 650; }
.auth-head { margin-bottom: 18px; }
.auth-title { margin-top: 4px; font-size: var(--fs-2xl); letter-spacing: -.025em; }
.auth-sub { margin-top: 8px; color: var(--muted); font-size: var(--fs-sm); max-width: 44ch; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field + .field { margin-top: 0; }
.auth-field .field-label { font-size: var(--fs-sm); }
.auth-input { min-height: 56px; border-radius: 16px; padding: 0 4px 0 16px; }
.auth-input > .input { min-height: 54px; font-size: 17px; }
.auth-input > .input-icon { color: var(--muted); }
.auth-pin-input[type="password"] { letter-spacing: .3em; font-weight: 800; }
.auth-pin-input[type="password"]::placeholder { letter-spacing: .18em; font-weight: 700; }
.auth-pin-input.auth-plain[type="password"] { letter-spacing: .12em; font-weight: 700; }
.auth-pin-input.auth-plain::placeholder { letter-spacing: normal; font-weight: 450; }
.auth-eye { width: 46px; height: 46px; color: var(--muted); }
.auth-eye[aria-pressed="true"] { color: var(--accent-ink); }
.auth-submit { margin-top: 6px; min-height: 56px; font-size: var(--fs-md); }
.auth-submit.is-busy { opacity: .85; }
.auth-spinner {
  display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
.auth-spinner-lg { width: 46px; height: 46px; border-width: 4px; color: var(--accent); }
.auth-busy-art { display: grid; place-items: center; padding: 14px 0 10px; }
.auth-alert {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 16px; padding: 12px 14px; border-radius: 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-glow);
  animation: authAlert .3s var(--ease-out) both;
}
.auth-alert-icon { display: inline-flex; margin-top: 1px; color: var(--accent-ink); }
.auth-alert-title { font-weight: 750; font-size: var(--fs-sm); line-height: 1.35; }
.auth-alert-text { margin-top: 2px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }
.auth-countdown { color: var(--text); font-size: var(--fs-md); }
.auth-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border-radius: 10px;
  color: var(--accent-ink); font-weight: 700; font-size: var(--fs-sm); text-align: left;
}
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-kbd { align-self: flex-start; margin-top: -8px; color: var(--muted); font-weight: 650; }
.auth-rules {
  display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--stroke);
  font-size: var(--fs-sm); color: var(--muted);
}
.auth-rule { display: flex; align-items: center; gap: 8px; transition: color var(--dur) var(--ease); }
.auth-rule-icon { display: inline-flex; flex: none; color: var(--dim); }
.auth-rule.is-ok { color: var(--text); }
.auth-rule.is-ok .auth-rule-icon { color: var(--green); }
.auth-help {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--stroke);
  color: var(--muted); font-size: var(--fs-sm);
}
.auth-help > .ico { margin-top: 2px; flex: none; }
.auth-help-center { justify-content: center; padding-top: 10px; }
.auth-foot { flex: none; margin-bottom: auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--dim); font-size: var(--fs-xs); font-weight: 600; text-align: center; }
/* Butuh koneksi internet: first launch of an online build without signal (auth.js showConnect) */
.auth-connect-status {
  --cn-c: var(--amber); --cn-soft: var(--amber-soft); --cn-ink: var(--amber-ink); --cn-glow: var(--amber-glow);
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--stroke);
  color: var(--muted); font-size: var(--fs-sm); line-height: 1.45;
}
.auth-connect-status[data-state="offline"] { --cn-c: var(--slate); --cn-soft: var(--slate-soft); --cn-ink: var(--slate-ink); --cn-glow: var(--slate-glow); }
.auth-connect-status[data-state="checking"] { --cn-c: var(--blue); --cn-soft: var(--blue-soft); --cn-ink: var(--blue-ink); --cn-glow: var(--blue-glow); }
.auth-connect-status[data-state="ok"] { --cn-c: var(--green); --cn-soft: var(--green-soft); --cn-ink: var(--green-ink); --cn-glow: var(--green-glow); }
.auth-connect-art {
  position: relative; flex: none; display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 15px;
  color: var(--cn-ink); background: var(--cn-soft); border: 1px solid var(--cn-glow);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.auth-connect-ring { position: absolute; inset: -5px; border-radius: 19px; border: 2px solid var(--cn-glow); opacity: 0; }
.auth-connect-status[data-state="checking"] .auth-connect-ring { animation: authRing 1.4s var(--ease-out) infinite; }
.auth-connect-text { flex: 1; min-width: 0; }
.auth-connect-form .auth-submit { margin-top: 0; }
.auth-connect-hint { font-size: var(--fs-xs); line-height: 1.5; }
@keyframes authRing { 0% { opacity: .85; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.22); } }
@keyframes authIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes authAlert { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (min-width: 720px) {
  .auth-card { padding: 36px 34px 28px; }
  .auth-mark { width: 64px; height: 64px; border-radius: 19px; }
}
@media (max-width: 380px) {
  .auth-wrap { padding-left: calc(var(--safe-left) + 12px); padding-right: calc(var(--safe-right) + 12px); }
  .auth-card { padding: 22px 16px 18px; border-radius: var(--radius-lg); }
  .auth-title { font-size: var(--fs-xl); }
  .auth-brand { margin-bottom: 18px; }
}

/* Sync indicator (top bar dot + sidebar row) */
.sync-ind, .side-sync { --sync-c: var(--green); }
.sync-ind[data-state="pending"], .side-sync[data-state="pending"] { --sync-c: var(--amber); }
.sync-ind[data-state="syncing"], .side-sync[data-state="syncing"] { --sync-c: var(--blue); }
.sync-ind[data-state="offline"], .side-sync[data-state="offline"] { --sync-c: var(--slate); }
.sync-ind[data-state="error"], .side-sync[data-state="error"] { --sync-c: var(--red); }
.sync-ind[data-state="disabled"], .side-sync[data-state="disabled"] { --sync-c: var(--dim); }
.sync-ind { position: relative; }
.sync-ind .sync-dot {
  position: absolute; right: 8px; bottom: 9px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sync-c); border: 2px solid var(--bg);
}
.sync-ind[data-state="syncing"] .sync-cloud, .sync-ind[data-state="syncing"] .sync-dot,
.side-sync[data-state="syncing"] .sync-dot { animation: syncPulse 1.1s ease-in-out infinite; }
.sync-ind[data-state="error"] .sync-cloud { color: var(--red-ink); }
.side-sync {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; margin-bottom: 10px; padding: 8px 12px;
  border-radius: 12px; border: 1px solid var(--stroke); background: var(--surface-2);
  color: var(--muted); font-size: var(--fs-xs); font-weight: 650; text-align: left;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.side-sync:hover { color: var(--text); border-color: var(--stroke-strong); }
.side-sync .sync-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--sync-c); }
.side-sync .sync-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-sync .sync-again { color: var(--dim); }
@keyframes syncPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* First login: backup offer before the account data replaces offline data (long labels: stacked, primary first) */
.sync-backup-sheet .sheet-foot { flex-direction: column-reverse; flex-wrap: nowrap; }
.sync-backup-sheet .sheet-foot .btn { flex: 0 0 auto; width: 100%; min-width: 0; white-space: normal; text-align: center; }

/* ==========================================================================
   SOFT KEYBOARD (app.js: html.kb-open while a field is focused and the keyboard is up; --kb-inset = the height of
   a keyboard drawn OVER the page). The focused field is never covered:
   - Android adjustResize (the APK): --kb-inset stays 0, the fixed layers shrink with the viewport and app.js centres
     the field (scrollIntoView block:'center', nudged above sticky footers).
   - Keyboard drawn over the page (iOS, Android edge-to-edge, VirtualKeyboard overlaysContent): full-screen flows and
     sheets end at the keyboard's top edge (--kb-inset / env(keyboard-inset-height)).
   Placed after the components on purpose: `.sheet-layer { inset: 0 }` would otherwise reset `bottom`.
   ========================================================================== */
.overlay-screen, .sheet-layer { bottom: var(--kb-inset, 0px); }
@supports (bottom: max(0px, env(keyboard-inset-height, 0px))) {
  .overlay-screen, .sheet-layer { bottom: max(var(--kb-inset, 0px), env(keyboard-inset-height, 0px)); }
}
/* native focus scrolling keeps the field clear of the screen edge (and of a sticky footer: --kb-cover) */
html.kb-open .overlay-screen { scroll-padding-top: calc(var(--safe-top) + 12px); scroll-padding-bottom: calc(var(--kb-cover, 0px) + 24px); }
/* Masuk / Siapkan Akun GM / Buat PIN Baru: start at the top so the card can scroll its fields above the keyboard */
html.kb-open .auth-wrap { padding-top: calc(var(--safe-top) + 12px); padding-bottom: 40vh; }
html.kb-open .auth-card { margin-top: 0; }
html.kb-open .auth-foot { display: none; }
/* sheets: the sheet ends at the keyboard; its body scrolls the field into view above the action bar */
html.kb-open .sheet { max-height: calc(100% - var(--safe-top) - 12px); }
html.kb-open .sheet-full { height: calc(100% - var(--safe-top) - 12px); }
html.kb-open .sheet-body { scroll-padding: 12px 0 16px; }
html.kb-open .sheet-handle { padding-top: 6px; }
/* the bottom nav and the FAB would ride up on the keyboard and cover the field being typed in */
html.kb-open .bottomnav, html.kb-open .fab { display: none; }
html.kb-open .toasts { bottom: calc(var(--kb-inset, 0px) + 12px); }

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.stack > * { margin-top: 0; }
.stack > .segmented:not(.is-block), .stack > .rating, .stack > .stepper,
.field > .segmented:not(.is-block), .field > .rating, .field > .stepper { align-self: flex-start; }
.row { display: flex; align-items: center; gap: var(--gap, 12px); min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.start { align-items: flex-start; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.none { flex: none; }
.center { display: flex; align-items: center; justify-content: center; text-align: center; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.ink { color: var(--accent-ink); }
.strong { font-weight: 750; }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.big { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.015em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nowrap { white-space: nowrap; }
.gap-0 { --gap: 0; gap: 0; } .gap-1 { --gap: 4px; gap: 4px; } .gap-2 { --gap: 8px; gap: 8px; } .gap-3 { --gap: 12px; gap: 12px; }
.gap-4 { --gap: 16px; gap: 16px; } .gap-5 { --gap: 20px; gap: 20px; } .gap-6 { --gap: 24px; gap: 24px; } .gap-7 { --gap: 32px; gap: 32px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px !important; } .mt-2 { margin-top: 8px !important; } .mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; } .mt-5 { margin-top: 20px !important; } .mt-6 { margin-top: 24px !important; } .mt-7 { margin-top: 32px !important; } .mt-8 { margin-top: 48px !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 8px !important; } .mb-3 { margin-bottom: 12px !important; } .mb-4 { margin-bottom: 16px !important; }
.p-0 { padding: 0 !important; } .p-3 { padding: 12px !important; } .p-4 { padding: 16px !important; }
.w-full { width: 100%; }
.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; }
@media (max-width: 719.98px) { .hide-mobile { display: none !important; } }
@media (min-width: 720px) { .hide-desktop { display: none !important; } }
@media (max-width: 1023.98px) { .hide-below-lg { display: none !important; } }
@media (min-width: 1024px) { .hide-lg { display: none !important; } }

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
  transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}
.reduce-motion .aurora i { animation: none !important; }
.reduce-motion .xp-float { animation: xpFade 1.1s linear forwards !important; animation-duration: 1.1s !important; }
@keyframes xpFade { 0%, 80% { opacity: 1; transform: translate(-50%, -120%); } 100% { opacity: 0; transform: translate(-50%, -120%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
  .aurora i { animation: none !important; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .bottomnav, .fab, .topbar, .aurora, .toasts { display: none !important; }
  .main-col { margin: 0 !important; }
  body { background: #fff; color: #000; }
}
