/*
 * Volt for the web. Every value here is transcribed from showup/src/v2/theme.ts — the same
 * ground, the same amber, the same type scale — so a page under showuphabits.com reads as the
 * same product as the app. Pages use these tokens and primitives and carry no palette of their
 * own; the only per-page CSS is layout.
 *
 * Primitives (prefix v-): brand, btn, card, input, chip, alert, table, stat, progress, empty,
 * spinner. Utilities: type-scale classes, tones, spacing, .hidden.
 */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0c0f15;
  --bg-raised: #141922;
  --bg-elevated: #1b2130;
  --bg-sunken: #07090d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --glass: rgba(255, 255, 255, 0.06);
  --scrim: rgba(3, 4, 6, 0.72);

  /* Text */
  --text: #f3f1ea;
  --text-muted: rgba(243, 241, 234, 0.62);
  --text-faint: rgba(243, 241, 234, 0.38);
  --text-on-accent: #14110a;

  /* Brand accent — amber. For the one thing on the page that matters. */
  --accent: #ffc53d;
  --accent-dim: rgba(255, 197, 61, 0.16);
  --accent-line: rgba(255, 197, 61, 0.45);

  /* Money at risk — raspberry. Stakes, failures, destructive actions. */
  --risk: #ff4d6d;
  --risk-dim: rgba(255, 77, 109, 0.16);

  /* Secondary semantic. Warning is orange, not amber, so it never reads as the brand. */
  --success: #3ddc97;
  --success-dim: rgba(61, 220, 151, 0.16);
  --warning: #ff8a3d;
  --warning-dim: rgba(255, 138, 61, 0.16);
  --info: #7aa2ff;
  --info-dim: rgba(122, 162, 255, 0.16);

  /* Space and radii */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 48px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --font:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, system-ui, 'Helvetica Neue',
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-card: 0 8px 16px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 18px rgba(255, 197, 61, 0.45);
  --tap: 44px;
}

/* ---- Base --------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/22px var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  max-width: 100%;
  display: block;
}

hr,
.v-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-lg) 0;
}

code,
.v-mono {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* ---- Type scale (theme.ts `type`) --------------------------------------------------------- */

.v-display {
  font-size: 34px;
  line-height: 38px;
  font-weight: 800;
  letter-spacing: -1px;
}
.v-title {
  font-size: 26px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
}
.v-heading {
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.v-body {
  font-size: 16px;
  line-height: 22px;
  font-weight: 400;
}
.v-body-strong {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}
.v-small {
  font-size: 14px;
  line-height: 19px;
}
.v-caption {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.v-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: 34px;
  line-height: 38px;
  font-weight: 800;
  letter-spacing: -1px;
}
h2 {
  font-size: 26px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
}
h3 {
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
h4 {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}
p + p {
  margin-top: var(--space-md);
}

/* Tones */
.v-muted {
  color: var(--text-muted);
}
.v-faint {
  color: var(--text-faint);
}
.v-accent {
  color: var(--accent);
}
.v-risk {
  color: var(--risk);
}
.v-success {
  color: var(--success);
}
.v-warning {
  color: var(--warning);
}
.v-info {
  color: var(--info);
}
.v-center {
  text-align: center;
}

/* ---- Layout ------------------------------------------------------------------------------- */

.v-page {
  min-height: 100vh;
  padding: var(--space-xl) var(--space-lg) var(--space-xxxl);
}

.v-container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.v-container-wide {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.v-stack > * + * {
  margin-top: var(--space-lg);
}

.v-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.v-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.v-section {
  margin-top: var(--space-xxl);
}

.v-section-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* ---- Brand -------------------------------------------------------------------------------- */

.v-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.v-brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
}

.v-brand-name {
  font-size: 20px;
  line-height: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.v-brand-tag {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

/* ---- Buttons ------------------------------------------------------------------------------ */

.v-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--tap);
  padding: 0 var(--space-xl);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  font: 600 16px/22px var(--font);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    opacity 120ms ease;
}

.v-btn:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.v-btn:active {
  transform: scale(0.97);
}

.v-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.v-btn:disabled,
.v-btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.v-btn-block {
  display: flex;
  width: 100%;
}

.v-btn-sm {
  min-height: 36px;
  padding: 0 var(--space-lg);
  font-size: 14px;
}

.v-btn-secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-line);
}

.v-btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.v-btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.v-btn-danger {
  background: var(--risk);
  color: #ffffff;
}

.v-btn-danger-outline {
  background: var(--risk-dim);
  color: var(--risk);
  border-color: rgba(255, 77, 109, 0.45);
}

/* ---- Cards -------------------------------------------------------------------------------- */

.v-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.v-card-elevated {
  background: var(--bg-elevated);
}

.v-card-accent {
  background: var(--accent-dim);
  border-color: var(--accent-line);
}

.v-card-risk {
  background: var(--risk-dim);
  border-color: rgba(255, 77, 109, 0.45);
}

.v-card-flush {
  padding: 0;
}

.v-card-title {
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: var(--space-sm);
}

.v-list-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 60px;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--line);
}

.v-list-row:last-child {
  border-bottom: 0;
}

.v-list-row-text {
  flex: 1;
  min-width: 0;
}

/* ---- Forms -------------------------------------------------------------------------------- */

.v-field {
  display: block;
  margin-bottom: var(--space-lg);
}

.v-field-label {
  display: block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.v-input,
input.v-input,
select.v-input,
textarea.v-input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--space-lg);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font: 400 16px/22px var(--font);
  outline: none;
  transition: border-color 120ms ease;
}

textarea.v-input {
  min-height: 120px;
  padding: var(--space-md) var(--space-lg);
  resize: vertical;
}

.v-input::placeholder {
  color: var(--text-faint);
}

.v-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.v-input[aria-invalid='true'],
.v-input.is-invalid {
  border-color: var(--risk);
}

.v-help {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-faint);
  margin-top: var(--space-xs);
}

.v-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  min-height: var(--tap);
  cursor: pointer;
}

.v-checkbox input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  flex: none;
}

/* Stripe Elements host: the frame Stripe draws inside takes our surface. */
.v-stripe-element {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
}

/* ---- Chips, alerts, stats ----------------------------------------------------------------- */

.v-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--glass);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.v-chip-accent {
  background: var(--accent-dim);
  border-color: var(--accent-line);
  color: var(--accent);
}
.v-chip-success {
  background: var(--success-dim);
  border-color: rgba(61, 220, 151, 0.45);
  color: var(--success);
}
.v-chip-warning {
  background: var(--warning-dim);
  border-color: rgba(255, 138, 61, 0.45);
  color: var(--warning);
}
.v-chip-risk {
  background: var(--risk-dim);
  border-color: rgba(255, 77, 109, 0.45);
  color: var(--risk);
}
.v-chip-info {
  background: var(--info-dim);
  border-color: rgba(122, 162, 255, 0.45);
  color: var(--info);
}

.v-alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--glass);
  color: var(--text);
  font-size: 14px;
  line-height: 19px;
}

.v-alert-success {
  background: var(--success-dim);
  border-color: rgba(61, 220, 151, 0.45);
  color: var(--success);
}
.v-alert-risk,
.v-alert-error {
  background: var(--risk-dim);
  border-color: rgba(255, 77, 109, 0.45);
  color: var(--risk);
}
.v-alert-warning {
  background: var(--warning-dim);
  border-color: rgba(255, 138, 61, 0.45);
  color: var(--warning);
}
.v-alert-info {
  background: var(--info-dim);
  border-color: rgba(122, 162, 255, 0.45);
  color: var(--info);
}

.v-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.v-stat-value {
  font-size: 26px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.v-stat-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

.v-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-lg);
}

.v-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--glass);
  overflow: hidden;
}
.v-progress > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

/* ---- Tables ------------------------------------------------------------------------------- */

.v-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}

.v-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 19px;
}

.v-table th {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.v-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.v-table tr:last-child td {
  border-bottom: 0;
}

.v-table .v-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---- States ------------------------------------------------------------------------------- */

.v-empty {
  text-align: center;
  padding: var(--space-xxl) var(--space-lg);
  color: var(--text-muted);
}

.v-empty-title {
  color: var(--text);
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.v-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--accent-dim);
  border-top-color: var(--accent);
  animation: v-spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.v-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xxl) 0;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

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

/* ---- Footer ------------------------------------------------------------------------------- */

.v-footer {
  margin-top: var(--space-xxxl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-lg);
}

@media (min-width: 720px) {
  .v-page {
    padding: var(--space-xxxl) var(--space-xl);
  }
}
