/* =========================================================================
   Flomax.ai — shared design tokens, boot, brand and overlays.
   Load this before any page stylesheet.
   ========================================================================= */

:root {
  --bg: #0d0d10;
  --bg-elevated: #141418;
  --surface: #18181d;
  --surface-2: #202027;
  --surface-3: #2a2a33;
  --ink: #f2f2f4;
  --ink-2: #a9a9b4;
  --ink-3: #777783;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  /* Logo palette: violet #6813fd -> blue #0248fc -> cyan #01d8fc.
     --blue is that blue lifted for contrast on the dark theme. */
  --blue: #4f8cff;
  --blue-soft: rgba(79, 140, 255, .14);
  /* The one accent that is not in the logo. Kept to dots, focus rings and
     status pips only, so it stays a spark rather than a theme colour. */
  --yellow: #ffd60a;
  --yellow-soft: rgba(255, 214, 10, .16);
  --danger: #f28b82;
  --danger-soft: rgba(242, 139, 130, .13);
  --success: #81c995;
  --gold: #f2c26b;
  --gold-soft: rgba(242, 181, 68, .13);
  --primary: #f1f1f3;
  --primary-ink: #101014;
  --grad: linear-gradient(120deg, #6813fd 0%, #0248fc 48%, #01d8fc 100%);
  --font: "Google Sans", "Google Sans Text", "Product Sans", "Inter", "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .42);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, .55);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --topbar-h: 66px;
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }

/* Author `display` rules would otherwise beat the UA [hidden] rule. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 620px at 12% -8%, rgba(2, 72, 252, .10), transparent 62%),
    radial-gradient(900px 700px at 98% 4%, rgba(104, 19, 253, .09), transparent 62%),
    radial-gradient(820px 640px at 48% 108%, rgba(1, 216, 252, .06), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

::selection { background: rgba(79, 140, 255, .28); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

a { color: inherit; }

h1, h2, h3, p { margin: 0; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg { display: block; }

.ic,
button svg,
a.btn svg,
.sidebar svg,
.topbar svg,
.menu svg,
.search svg,
.select-wrap svg,
.empty svg {
  width: 20px;
  height: 20px;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}

/* ===================================================================== boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  gap: 22px;
  background: var(--bg);
  transition: opacity .45s var(--ease), visibility .45s;
}

.boot.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  animation: boot-pulse 1.8s var(--ease) infinite;
}

/* The boot screen is empty otherwise, so the lockup may run larger there. */
.boot-logo .brand-logo {
  height: clamp(30px, 5vw, 56px);
  max-width: min(280px, 74vw);
}

.boot-bar {
  width: 132px;
  height: 3px;
  margin: 0 auto;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}

.boot-bar span {
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  animation: boot-slide 1.2s var(--ease) infinite;
}

@keyframes boot-pulse {
  0%, 100% { opacity: .75; }
  50% { opacity: 1; }
}

@keyframes boot-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(330%); }
}

/* ===================================================================== brand */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}

/* The lockup is a fixed 5:1 PNG, so height alone drives its width. Height
   scales with the viewport and is capped so it cannot crowd a phone header
   or look lost on a 2K display; max-width is the backstop if the artwork's
   aspect ratio ever changes. */
.brand-logo {
  display: block;
  height: clamp(18px, 2.3vw, 32px);
  width: auto;
  max-width: min(160px, 44vw);
}

.brand-tag {
  margin-left: 2px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ============================================================ language switch */

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
}

.lang-switch button {
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: background .15s, color .15s;
}

.lang-switch button:hover { color: var(--ink); }
.lang-switch button.is-active { background: var(--surface-3); color: var(--ink); }

.lang-switch--auth {
  position: absolute;
  top: 28px;
  right: clamp(24px, 5vw, 72px);
  z-index: 3;
}


/* ================================================================== shared */

.primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background .18s, transform .18s var(--ease), opacity .18s;
}

.primary:hover { background: #dcdce2; }
.primary:active { transform: scale(.985); }
.primary:disabled { opacity: .6; }

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, .20);
  border-top-color: var(--primary-ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================================================================== modals */

.modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 16, 20, .48);
  backdrop-filter: blur(8px);
  animation: fade-in .2s var(--ease);
}

.modal-card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 26px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modal-in .25s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  transition: background .15s, color .15s;
}

.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-close:disabled { opacity: .3; }
.modal-close svg { width: 18px; height: 18px; }

.modal-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--ink-2);
}

.modal-icon svg { width: 22px; height: 22px; }
.modal-icon--grad {
  background: linear-gradient(135deg, rgba(2, 72, 252, .22), rgba(104, 19, 253, .22) 55%, rgba(1, 216, 252, .18));
  color: #a978ff;
}

.modal-card h2 {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.03em;
}

.modal-lede {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.56;
}

.modal-action { width: 100%; height: 46px; margin-top: 18px; }

.progress {
  height: 6px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width .25s var(--ease);
}

.wm-status {
  margin-top: 9px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.wm-status.is-error { color: var(--danger); }

.credit-balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    radial-gradient(160px 110px at 100% 0%, rgba(242, 166, 0, .14), transparent 60%),
    radial-gradient(160px 110px at 0% 100%, rgba(2, 72, 252, .14), transparent 60%),
    var(--surface);
}

.credit-balance-label {
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.credit-balance-value {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.04em;
}

.credit-balance-value span:last-child {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.credit-balance-spark { width: 28px; height: 28px; color: var(--gold); opacity: .65; }

.credit-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 16px 0;
}

.credit-steps p {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.45;
}

.credit-steps p span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 700;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.help-steps li { display: flex; gap: 11px; }

.help-steps li > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}

.help-steps strong { display: block; font-size: 12.5px; font-weight: 600; }
.help-steps p { margin-top: 2px; color: var(--ink-3); font-size: 11px; line-height: 1.5; }

.shortcuts {
  margin-top: 22px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.shortcuts-title {
  margin-bottom: 9px;
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.shortcuts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  color: var(--ink-2);
  font-size: 11.5px;
}

.shortcuts > div span:last-child { display: inline-flex; gap: 2px; }

/* ==================================================================== toasts */

.toasts {
  position: fixed;
  right: 18px;
  top: calc(var(--topbar-h) + 12px);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(24, 24, 30, .96);
  box-shadow: var(--shadow-md);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: toast-in .28s var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
}

.toast.is-out { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }

.toast-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
}

.toast-icon svg { width: 14px; height: 14px; }
.toast.is-success .toast-icon { background: rgba(129, 201, 149, .16); color: var(--success); }
.toast.is-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-text { flex: 1; padding-top: 3px; }
.toast-text strong { display: block; margin-bottom: 1px; color: var(--ink); font-size: 12px; font-weight: 600; }
.toast-action {
  flex: none;
  align-self: center;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}

.toast-action:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.toast-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  margin-top: 1px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
}

.toast-close:hover { background: var(--surface-2); color: var(--ink); }
.toast-close svg { width: 13px; height: 13px; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 14px;
  text-align: center;
}

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