/* onboarding.css — first-time "get connected" flow (Phase 0, design review).
   Uses the same design tokens as app.css (--bg/--panel/--accent/--font-display
   etc.) so it matches the Treehouse theme once merged in. Kept as its own file
   during design review; fold into app.css once the look is approved. */

/* Onboarding now carries the SAME blue/white identity as the Landing screen
   in front of it (2026-07-27, Barat: "why here still green... theme change
   overall same theme") — overrides the shared app.css tokens only while body
   has .onboard-mode, so the dashboard's own Light/Warm/Dark/Ocean theme
   picker (a separate, later concern for AFTER login) is untouched. */
body.onboard-mode {
  --bg: #f4f5f7;
  --bg-2: #eceef1;
  --panel: #ffffff;
  --txt: #12181f;
  --txt-soft: #5b6673;
  --muted: #8a94a1;
  --line: rgba(18, 24, 31, 0.12);
  --accent: #2f6fed;
  --accent-strong: #2559c9;
  --accent-contrast: #ffffff;
  --moss-bg: #e8f0ff;
  --rust: #d64545;
}
body.onboard-mode::before, body.onboard-mode::after { display: none; }

/* Native shells use the same account flow, but not the website's marketing chrome. */
body.native-app-mode {
  --bg: #eef4ff;
  --bg-2: #e5edff;
  --panel: #ffffff;
  --txt: #101a2b;
  --txt-soft: #5d6b80;
  --muted: #8793a5;
  --line: rgba(16, 26, 43, 0.12);
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-contrast: #ffffff;
  min-height: 100dvh;
  background:
    radial-gradient(620px 360px at 8% -8%, rgba(37, 99, 235, 0.18), transparent 70%),
    linear-gradient(160deg, #f8fbff 0%, #eef4ff 52%, #e5edff 100%);
}
body.native-app-mode .app-header,
body.native-app-mode .app-footer { display: none; }
body.native-app-mode .app-main { max-width: none; padding: 0; }
body.native-app-mode .onboard-root {
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}
body.native-app-mode .login-gate {
  max-width: 420px;
  margin: 0;
  padding: 34px 28px 28px;
  border-radius: 28px;
  border-color: rgba(37, 99, 235, 0.1);
  box-shadow: 0 24px 70px rgba(36, 72, 140, 0.18);
}
.native-login-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 8px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}
.native-login-subtitle {
  margin: -2px 0 10px;
  color: var(--txt-soft);
  font-size: 14px;
  text-align: center;
}
.native-login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* Native dashboard shell: the data views remain shared with web, but the app
   gets its own compact header, touch targets, and bottom navigation. */
body.native-app-mode .app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  max-width: none;
  padding: max(14px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(248, 251, 255, 0.92);
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
  box-shadow: 0 6px 24px rgba(36, 72, 140, 0.08);
  backdrop-filter: blur(18px);
}
body.native-app-mode .app-header-top {
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}
body.native-app-mode .brand { gap: 10px; min-width: 0; }
body.native-app-mode .emblem {
  width: 38px;
  height: 38px;
  border-radius: 13px 13px 13px 5px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
}
body.native-app-mode .emblem svg { width: 23px; height: 23px; }
body.native-app-mode .brand-title {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
body.native-app-mode .brand-sub {
  margin-top: 1px;
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
body.native-app-mode .header-actions {
  margin-left: auto;
  gap: 5px;
  flex-wrap: nowrap;
}
body.native-app-mode .header-actions .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: transparent;
  border-color: transparent;
}
body.native-app-mode .header-actions .icon-btn:hover { transform: none; background: rgba(37, 99, 235, 0.08); }
body.native-app-mode .session-chip { display: none; }
body.native-app-mode .nav,
body.native-app-mode .nav--native {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 40;
  display: block;
  width: auto;
  padding: 6px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 36px rgba(36, 72, 140, 0.2);
  backdrop-filter: blur(18px);
}
body.native-app-mode .nav-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
}
body.native-app-mode .nav-link,
body.native-app-mode .nav-link--native {
  position: relative;
  min-width: 0;
  min-height: 52px;
  padding: 22px 2px 5px;
  border-radius: 18px;
  color: #8290a4;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}
body.native-app-mode .nav-link::before {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  color: currentColor;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}
body.native-app-mode .nav-link[data-view="overview"]::before { content: '⌂'; }
body.native-app-mode .nav-link[data-view="activity"]::before { content: '≡'; }
body.native-app-mode .nav-link[data-view="upload"]::before { content: '+'; font-size: 22px; }
body.native-app-mode .nav-link[data-view="manage"]::before { content: '▦'; }
body.native-app-mode .nav-link[data-view="settings"]::before { content: '⚙'; font-size: 15px; }
body.native-app-mode .nav-link.is-active {
  color: #1d4ed8;
  background: #eaf1ff;
  border-color: transparent;
}
body.native-app-mode .app-main {
  max-width: none;
  padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
}
body.native-app-mode .view {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body.native-app-mode .view-title-row {
  margin: 4px 2px 14px;
  padding: 0;
}
body.native-app-mode .view-title {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
body.native-app-mode .ov-kpi,
body.native-app-mode .ov-linechart,
body.native-app-mode .ov-donut-wrap,
body.native-app-mode .act-card,
body.native-app-mode .up-zone,
body.native-app-mode .rp-toolbar,
body.native-app-mode .tp-file-zone,
body.native-app-mode .set-section,
body.native-app-mode .manage-shell,
body.native-app-mode .team-root,
body.native-app-mode .payments {
  border-color: rgba(16, 26, 43, 0.08);
  box-shadow: 0 8px 24px rgba(36, 72, 140, 0.08);
}
body.native-app-mode button,
body.native-app-mode input,
body.native-app-mode select,
body.native-app-mode textarea { min-height: 44px; }
body.native-app-mode .sora-chat { bottom: calc(90px + env(safe-area-inset-bottom)); }

@media (max-width: 420px) {
  body.native-app-mode .header-actions .icon-btn:nth-child(1),
  body.native-app-mode .header-actions .icon-btn:nth-child(2) { display: none; }
  body.native-app-mode .app-main { padding-left: 12px; padding-right: 12px; }
}

.onboard-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.onboard-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow, var(--panel-shadow));
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.onboard-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.onboard-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--line); }
.onboard-dot.is-active { background: var(--accent); width: 18px; border-radius: 999px; transition: width .2s ease; }

.onboard-step { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
/* BUG (2026-07-27, found while testing resetpassword.js's request/done toggle): same class
   of bug already fixed once in app.css's .up-file-section/.up-manual-section (2026-07-14) —
   .onboard-step's own `display: flex` has the SAME specificity as the browser's default
   `[hidden] { display: none }` UA rule, and this stylesheet loads after the UA sheet, so a
   plain `el.hidden = true` on an .onboard-step silently lost every time (both the request
   form and the "Check your email" confirmation showed at once). Same fix: a compound
   selector (class + [hidden]) always wins regardless of declaration order. */
.onboard-step[hidden] { display: none; }

.onboard-badge { font-size: 40px; line-height: 1; margin-bottom: 4px; }

/* Email-verify confirmation states (#26) */
@keyframes ev-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 0 0 10px transparent; }
}
.onboard-badge--confirming {
  display: inline-block;
  border-radius: 50%;
  padding: 4px;
  animation: ev-badge-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .onboard-badge--confirming { animation: none; }
}
.onboard-card--success { border-left: 4px solid var(--moss, #22c55e); }
.onboard-card--error   { border-left: 4px solid var(--rust, #ef4444); }

/* Verification banner success flash (#26) */
.guest-banner.is-verified {
  background: color-mix(in srgb, var(--moss, #22c55e) 15%, var(--panel, #fff));
  transition: background 0.4s ease;
}

.onboard-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--txt);
}
.onboard-title--sm { font-size: 20px; }

.onboard-sub { margin: 0 0 6px; color: var(--txt-soft); font-size: 14px; line-height: 1.5; max-width: 320px; }

.onboard-steps-list {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.onboard-steps-item { display: flex; align-items: center; gap: 12px; }
.onboard-steps-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--moss-bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.onboard-steps-label { font-size: 14px; color: var(--txt); }

.onboard-btn {
  font: inherit;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  text-decoration: none;
  display: inline-block;
}
.onboard-btn--primary { background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.onboard-btn--primary:hover { background: var(--accent-strong); }

.onboard-telegram-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }

.onboard-btn--google {
  background: #fff;
  color: #3c4043;
  border: 1px solid var(--line);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.onboard-btn--google:hover { background: #f8f8f8; }
.onboard-google-icon { display: inline-flex; line-height: 0; }

/* Guest Mode (2026-07-28) — a small, lower-emphasis box directly under Google, distinct in
   both size and weight from the full-width primary/Google buttons above it. */
.onboard-btn--guest {
  width: auto;
  margin: 8px auto 0;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.onboard-btn--guest:hover { color: var(--txt); border-color: var(--accent); }

.onboard-btn--secondary {
  background: transparent;
  color: var(--txt);
  border: 1px solid var(--line);
  font-weight: 700;
}
.onboard-btn--secondary:hover { border-color: var(--muted); }

/* Guest Mode explainer popup — a small overlay (this app has no shared modal host; every
   component that needs one builds its own, same as grid.js's Export-PDF paywall). */
.onboard-guest-explainer-host {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 27, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.onboard-guest-explainer-card {
  background: var(--panel);
  border-radius: var(--radius, 14px);
  padding: 28px 26px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 60px -20px rgba(15, 20, 27, 0.45);
  text-align: center;
}
.onboard-guest-explainer-badge { font-size: 32px; line-height: 1; margin-bottom: 6px; }
.onboard-guest-explainer-title { margin: 0 0 14px; font-size: 20px; font-weight: 800; color: var(--txt); }
.onboard-guest-explainer-list {
  text-align: left;
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--txt);
  font-size: 13.5px;
  line-height: 1.55;
}
.onboard-guest-explainer-list li { margin-bottom: 8px; }
.onboard-guest-explainer-list li:last-child { margin-bottom: 0; }
.onboard-guest-explainer-actions { display: flex; gap: 10px; }
.onboard-guest-explainer-actions .onboard-btn { width: auto; flex: 1; }

.onboard-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 10px 0 2px;
  color: var(--muted);
  font-size: 12px;
}
.onboard-divider::before, .onboard-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.onboard-bot-chip {
  font-family: monospace;
  font-size: 13px;
  color: var(--txt-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  margin-top: 14px;
}

.onboard-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 13px;
  color: var(--txt-soft);
}
.onboard-status-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--honey);
  animation: onboard-pulse 1.2s ease-in-out infinite;
}
.onboard-status.is-done { background: var(--moss-bg); color: var(--accent); }
.onboard-status-dot.is-success { animation: none; background: var(--accent); }
@keyframes onboard-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(0.7); }
}

.onboard-result {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
.onboard-result-merchant { font-weight: 700; color: var(--txt); }
.onboard-result-amount { font-family: var(--font-display); font-size: 20px; color: var(--accent); }

.onboard-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  margin-top: 4px;
}
.onboard-label { font-size: 12px; font-weight: 700; color: var(--txt-soft); margin-top: 6px; }
.onboard-input {
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--txt);
  width: 100%;
  box-sizing: border-box;
}
.onboard-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.onboard-tc-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; cursor: pointer; font-size: 13px; color: var(--lp-ink, #101826); line-height: 1.4; }
.onboard-tc-check { margin-top: 2px; flex-shrink: 0; accent-color: var(--lp-blue, #2563eb); }
.onboard-tc-link { color: var(--lp-blue, #2563eb); text-decoration: underline; cursor: pointer; }
.onboard-tc-link:hover { text-decoration: none; }
.onboard-error { color: var(--rust, #9c4f3a); font-size: 13px; margin: 2px 0; }
.onboard-form .onboard-btn { margin-top: 10px; }

.onboard-skip {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 4px;
}
.onboard-skip:hover { color: var(--txt); }

.onboard-tabs-list { width: 100%; display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; text-align: left; }
.onboard-tabs-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.onboard-tabs-name { font-weight: 700; color: var(--txt); font-size: 13px; white-space: nowrap; }
.onboard-tabs-desc { color: var(--muted); font-size: 12px; text-align: right; }
