:root {
  --accent: #E4621A;
  --accent-hover: #CF5410;
  --accent-soft: #F19A68;
  --accent-tint: rgba(228, 98, 26, 0.11);
  --ink: #24364D;
  --paper: #F4EFE6;
  --line: #24364D;
  --bg: #F4EFE6;
  --surface: #FFFDF8;
  --surface-2: #ECE5D6;
  --sidebar: #24364D;
  --sidebar-card: #2E4560;
  --text: #24364D;
  --text-2: #6C7A8C;
  --border: #DDD3BE;
  --urgent: #C2410C;
  --urgent-tint: rgba(194, 65, 12, 0.12);
  --success: #16A34A;
  --success-tint: rgba(22, 163, 74, 0.12);
  --danger: #DC2626;
  --danger-tint: rgba(220, 38, 38, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-nav: 0 6px 0 rgba(36, 54, 77, 0.18);
  --shadow-hard: 4px 4px 0 var(--ink);
  --font: "Space Grotesk", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --surface: #1C1C1E;
  --surface-2: #27272A;
  --sidebar: #0B0B0D;
  --sidebar-card: #1C1C1E;
  --text: #F4EFE6;
  --text-2: #A3A3AB;
  --border: #34343A;
  --line: #3A3A42;
  --accent-tint: rgba(228, 98, 26, 0.22);
  --shadow-nav: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-hard: 4px 4px 0 #000000;
}

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

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: clip;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* Shell Layout */
.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.sidebar {
  display: none;
}

.main-wrap {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px calc(98px + env(safe-area-inset-bottom, 0px));
}

.main-wrap--onboarding {
  max-width: 480px;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(28px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
}

.onboarding-card {
  padding: 20px 18px;
  width: 100%;
}

.onboarding-title {
  font-size: clamp(1.35rem, 4.5vw, 1.55rem);
  margin: 0 0 6px;
}

.onboarding-lead {
  margin: 0 0 14px;
}

.onboarding-tabs {
  margin-bottom: 14px;
}

.google-auth-block {
  margin: 0 0 14px;
}

.google-btn-slot {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 44px;
}

.google-btn-slot > div {
  width: 100% !important;
  display: flex !important;
  justify-content: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
  color: var(--text-2);
  font-size: 12.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  flex-shrink: 0;
}

.onboarding-legal {
  text-align: center;
  margin-top: 16px;
}

.account-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-hero__avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1a2a3a));
  flex-shrink: 0;
}

.account-hero__meta {
  min-width: 0;
  flex: 1;
}

.bank-box {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
  display: grid;
  gap: 8px;
}

.bank-box__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.bank-box__row strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.pay-method-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.pay-method-tab {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.pay-method-tab.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.pay-method-tab strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.main-wrap--landing {
  max-width: 820px;
  padding: 20px 16px 40px;
  min-height: 100dvh;
}

.landing__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.landing__nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.landing__nav a:not(.btn) {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}

.landing__nav a:not(.btn):hover {
  color: var(--accent);
}

.landing__hero {
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--line);
  margin-bottom: 16px;
  background: var(--ink, #24364D);
}

.landing__banner {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
  object-position: center top;
}

.landing__intro-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.landing__footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
}

.landing__footer a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
}

.landing__footer a:hover {
  color: var(--accent);
}

/* Mobile Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.topbar__left {
  min-width: 0;
}

.topbar__greet {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 2px;
}

.page-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-2);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pill-alert {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #FFFFFF;
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.desktop-add-btn,
.btn.desktop-add-btn {
  display: none;
}

/* Bottom Mobile Nav */
.bottom-nav-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.bottom-nav {
  pointer-events: auto;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-nav);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 6px 10px;
  gap: 4px;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 16px;
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  border: 0;
  background: transparent;
}

.bottom-nav__item.is-active {
  color: var(--accent);
}

.bottom-nav__add {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.bottom-nav__add:hover {
  background: var(--accent-hover);
}

/* Logo */
.logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
}

.logo__dot {
  color: var(--accent);
}

.logo-img {
  display: inline-block;
  height: 28px;
  width: auto;
  vertical-align: middle;
}

.sidebar__logo .logo-img {
  height: 30px;
  filter: brightness(0) invert(1);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.mascot {
  width: 96px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.mascot--sm {
  width: 64px;
}

.onboarding-hero {
  margin: -6px -4px 16px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--ink, #24364D);
}

.onboarding-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: cover;
  object-position: center top;
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.onboarding-brand__copy {
  display: grid;
  gap: 2px;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
}

.card--flat {
  border: 0;
}

.card--accent {
  background: var(--accent);
  color: #FFFFFF;
  border-color: transparent;
}

.card--accent .muted,
.card--accent .card__eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.card__eyebrow {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}

.big-amount {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 6px 0 4px;
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: 12.5px;
}

.urgent-text {
  color: var(--urgent);
  font-weight: 600;
}

/* Progress Bar */
.progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 6px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.card--accent .progress-track {
  background: rgba(255, 255, 255, 0.25);
}

.card--accent .progress-fill {
  background: #FFFFFF;
}

/* Quick Actions Row (4 squares) */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}

.quick-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.quick-btn__icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

/* Section Headers */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.link-muted {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}

.link-accent {
  font-size: 13.5px;
  color: var(--accent);
  font-weight: 600;
}

/* Subscription / Item List */
.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.sub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

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

.sub-row:hover {
  background: var(--surface-2);
}

.sub-row__main {
  flex: 1;
  min-width: 0;
}

.sub-row__title {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-row__sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.sub-row__right {
  text-align: right;
  flex-shrink: 0;
}

.sub-row__amount {
  font-weight: 700;
  font-size: 14.5px;
}

.sub-row__cycle {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
}

/* Tiles */
.tile {
  border-radius: 12px;
  color: #FFFFFF;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

.tile--sm {
  width: 36px;
  height: 36px;
  font-size: 12px;
  border-radius: 10px;
}

.tile--md {
  width: 42px;
  height: 42px;
  font-size: 13px;
  border-radius: 12px;
}

.tile--lg {
  width: 68px;
  height: 68px;
  font-size: 20px;
  border-radius: 18px;
}

.tile--dense.tile--sm { font-size: 10px; }
.tile--dense.tile--md { font-size: 11px; }
.tile--dense.tile--lg { font-size: 16px; }

/* Buttons & Chips */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 700;
  font-size: 14.5px;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--white {
  background: #FFFFFF;
  color: #151515;
}

.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn--dark-muted {
  background: #2C2C30;
  color: #FFFFFF;
}

.btn--danger {
  background: var(--danger);
  color: #FFFFFF;
}

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

.btn--sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn--full {
  width: 100%;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.chip.is-active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge--accent {
  background: var(--accent-tint);
  color: var(--accent);
}

.badge--success {
  background: var(--success-tint);
  color: var(--success);
}

.badge--urgent {
  background: var(--urgent-tint);
  color: var(--urgent);
}

.badge--danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.badge--muted {
  background: var(--surface-2);
  color: var(--text-2);
}

/* Demo Banner */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--accent-tint);
  color: var(--text);
  border: 1px solid rgba(228, 98, 26, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* Calendar */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-nav {
  display: flex;
  gap: 6px;
}

.cal-nav__btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cal-weekdays, .cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  gap: 4px;
}

.cal-weekdays {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.cal-day {
  position: relative;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cal-day:hover:not(:disabled) {
  background: var(--surface-2);
}

.cal-day.is-today {
  background: var(--accent);
  color: #FFFFFF;
}

.cal-day.is-selected:not(.is-today) {
  background: var(--accent-tint);
  color: var(--accent);
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  margin-top: 2px;
}

.cal-day.is-today .cal-dot {
  background: #FFFFFF;
}

/* Detail view */
.detail-hero {
  text-align: center;
  padding: 8px 0 18px;
}

.detail-hero__tile {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.detail-hero__title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-hero__sub {
  margin: 4px 0 10px;
  color: var(--text-2);
  font-size: 14px;
}

.kv-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin-bottom: 14px;
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.kv-row__label {
  color: var(--text-2);
}

.kv-row__val {
  font-weight: 700;
}

.history-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 12px 0 8px;
}

.history-box {
  height: 28px;
  border-radius: 8px;
  background: var(--border);
}

.history-box.is-filled {
  background: var(--accent);
}

.stack-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.switch__slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.2s ease;
}

.switch input:checked + .switch__slider {
  background: var(--accent);
}

.switch input:checked + .switch__slider::before {
  transform: translateX(20px);
}

/* Forms */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.input, .select, .textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
}

.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Store Grid */
.store-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Variants side by side (ref 6 paywall style) */
.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.variant-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.variant-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.variant-pill {
  display: inline-block;
  align-self: flex-start;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.feature-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

/* Modals & Sheets */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 18, 0.58);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop--sheet {
  align-items: flex-end;
  padding: 0;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  color: var(--text);
  border-radius: 24px;
  padding: 24px 20px 20px;
  border: 1px solid var(--border);
}

.modal-card--success {
  text-align: center;
}

.success-badge {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-body {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-2);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-actions--row {
  flex-direction: row;
  justify-content: flex-end;
}

.sheet-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: 0 auto 14px;
}

.sheet-title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
}

.sheet-subtitle {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-2);
}

/* Toasts */
.toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 400px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #151515;
  color: #FFFFFF;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast__btn {
  background: var(--accent);
  color: #FFFFFF;
  border: 0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Utilities */
.desktop-only { display: none; }
.mobile-only { display: block; }
.avatar-btn.mobile-only { display: inline-flex; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-16 { display: flex; flex-direction: column; gap: 16px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Desktop Layout (>= 1024px) */
@media (min-width: 1024px) {
  .desktop-only { display: block; }
  .mobile-only,
  .avatar-btn.mobile-only { display: none; }

  .shell {
    flex-direction: row;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 230px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: #FFFFFF;
    padding: 24px 14px;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    align-self: flex-start;
  }

  .sidebar__logo {
    padding: 4px 10px 22px;
  }

  .sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }

  .sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #A0A0A8;
    transition: background 0.12s ease, color 0.12s ease;
  }

  .sidebar__link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
  }

  .sidebar__link.is-active {
    background: var(--accent);
    color: #FFFFFF;
  }

  .sidebar__summary {
    background: var(--sidebar-card);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 12.5px;
    color: #E4E4E7;
  }

  .sidebar__summary .progress-track {
    background: #323238;
    height: 6px;
    margin: 8px 0 0;
  }

  .sidebar__summary .progress-fill {
    background: var(--accent);
  }

  .main-wrap {
    max-width: 1140px;
    padding: 28px 36px 48px;
  }

  .bottom-nav-wrap {
    display: none;
  }

  .desktop-add-btn,
  .btn.desktop-add-btn {
    display: inline-flex;
  }

  .home-top-grid {
    display: grid;
    grid-template-columns: 1.55fr 0.95fr 0.95fr;
    gap: 16px;
    margin-bottom: 18px;
  }

  .home-main-grid {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 18px;
    align-items: start;
  }

  .cal-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 18px;
    align-items: start;
  }

  .store-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .modal-backdrop--sheet {
    align-items: center;
    padding: 18px;
  }

  .sheet-card {
    border-radius: 24px;
    padding: 20px 24px 24px;
  }
}

/* Order Mini-Chat */
.order-chat {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-chat__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
}

.chat-bubble {
  max-width: 86%;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.38;
  word-break: break-word;
}

.chat-bubble--mine {
  align-self: flex-end;
  background: var(--accent);
  color: #FFFFFF;
}

.chat-bubble--other {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.chat-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  opacity: 0.82;
  margin-bottom: 3px;
}

.order-chat__form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.order-chat__form .input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
}

/* Mobile Responsive Polish (<= 640px) */
@media (max-width: 640px) {
  .main-wrap {
    padding: 12px 12px calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .main-wrap--onboarding {
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(20px, env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
  }

  .onboarding-card {
    padding: 16px 14px;
  }

  .onboarding-hero {
    margin: -2px -2px 12px;
  }

  .onboarding-hero img {
    max-height: 110px;
  }

  .onboarding-brand .mascot--sm {
    width: 48px;
    height: 48px;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  .topbar__left {
    flex: 1 1 160px;
  }

  .page-title {
    font-size: 22px;
  }

  .topbar__actions {
    gap: 6px;
  }

  .pill-alert {
    padding: 6px 10px;
    font-size: 12px;
  }

  .form-row-2 {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .input,
  .select,
  .textarea {
    font-size: 16px;
    max-width: 100%;
    min-width: 0;
  }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 6px;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .quick-grid {
    gap: 6px;
    margin: 12px 0 14px;
  }

  .quick-btn {
    padding: 10px 4px;
    font-size: 11px;
    border-radius: 12px;
  }

  .sub-row {
    padding: 11px 12px;
    gap: 10px;
  }

  .store-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .code-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .code-box > div {
    justify-content: flex-end;
  }

  .bottom-nav-wrap {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav {
    padding: 6px 4px;
    gap: 2px;
  }

  .bottom-nav__item {
    padding: 6px 2px;
    font-size: 10px;
    gap: 3px;
    min-width: 0;
  }

  .bottom-nav__item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .demo-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .kv-row {
    gap: 8px;
    flex-wrap: wrap;
  }

  .history-boxes {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =====================================================================
   Estilo "Retro más legible" (paleta 2): papel #F4EFE6 · tinta #24364D ·
   naranja #E4621A · modo oscuro #121212. Bordes marcados, botones píldora
   y sombras duras. Aplica a toda la app (móvil, escritorio y páginas legales).
   ===================================================================== */
body {
  letter-spacing: -0.005em;
}

.page-title,
.section-title,
.modal-title,
.detail-hero__title,
.big-amount {
  letter-spacing: -0.035em;
}

/* Logo: tinta con punto naranja */
.logo {
  color: var(--text);
}
.sidebar .logo,
.sidebar__logo .logo {
  color: var(--paper);
}
.logo__dot {
  color: var(--accent);
}

/* Superficies con borde marcado */
.card,
.product-card,
.list-card,
.kv-list,
.variant-card,
.quick-btn,
.cal-nav__btn,
.avatar-btn {
  border: 2px solid var(--line);
}

.card--flat {
  border: 0;
}

.product-card {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.product-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hard);
}

/* Tarjeta destacada en tinta (como "Gasto del mes") */
.card--accent {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.card--accent .muted,
.card--accent .card__eyebrow {
  color: rgba(244, 239, 230, 0.78);
}
.card--accent .progress-track {
  background: rgba(244, 239, 230, 0.22);
}
.card--accent .progress-fill {
  background: var(--accent);
}
.card--accent .badge {
  background: rgba(244, 239, 230, 0.16) !important;
  color: var(--paper) !important;
}

/* Botones píldora */
.btn {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.btn--primary {
  background: var(--accent);
  color: #FFFFFF;
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn--primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
[data-theme="dark"] .btn--primary {
  border-color: transparent;
  box-shadow: none;
}
.btn--secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--line);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn--ghost {
  background: transparent;
  color: var(--text-2);
}
.btn--danger {
  border: 2px solid var(--ink);
}
.btn--sm {
  padding: 7px 14px;
}

/* Chips: tinta, activo en naranja */
.chip {
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  font-weight: 700;
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--ink);
  color: #FFFFFF;
}
[data-theme="dark"] .chip {
  border-color: #34475F;
  background: #24364D;
}
[data-theme="dark"] .chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
}

/* Insignias */
.badge {
  border: 1.5px solid currentColor;
  font-weight: 700;
}
.badge--muted {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.badge--accent {
  background: var(--accent-tint);
  color: var(--accent);
}

.pill-alert {
  background: var(--accent);
  border: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
[data-theme="dark"] .pill-alert {
  border-color: transparent;
  box-shadow: none;
}

/* Campos: contorno marcado */
.input,
.select,
.textarea {
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: 3px solid rgba(228, 98, 26, 0.35);
  outline-offset: 0;
  border-color: var(--accent);
}
.field label,
.field > label {
  font-weight: 700;
}

.form-error {
  border: 2px solid var(--danger);
}

/* Barra lateral y navegación inferior: tinta */
.bottom-nav {
  background: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-nav);
}
.bottom-nav__item {
  color: rgba(244, 239, 230, 0.62);
}
.bottom-nav__item.is-active {
  color: var(--accent);
}
.bottom-nav__add {
  background: var(--accent);
  color: #FFFFFF;
  border: 2px solid var(--paper);
}
[data-theme="dark"] .bottom-nav {
  background: #1C1C1E;
  border-color: #34343A;
}
.sidebar {
  background: var(--sidebar);
}
.sidebar__link.is-active {
  background: var(--accent);
  border-radius: 12px;
}

/* Modales y hojas: ventana con sombra dura */
.modal-card,
.sheet-card {
  border: 2px solid var(--line);
  box-shadow: var(--shadow-hard);
}
.modal-backdrop {
  background: rgba(36, 54, 77, 0.62);
}
.success-badge {
  background: var(--accent);
  border: 2px solid var(--ink);
}

/* Listas y detalle */
.sub-row {
  border-bottom: 1.5px dashed var(--border);
}
.kv-row {
  border-bottom: 1.5px dashed var(--border);
}
.cal-day.is-today {
  background: var(--accent);
  border: 2px solid var(--ink);
}
.cal-day.is-selected:not(.is-today) {
  border: 2px solid var(--accent);
}
.history-box {
  border: 2px solid var(--line);
}

/* Caja de clave / licencia */
.code-box {
  border: 2px dashed var(--line);
  background: var(--surface);
}

/* Mini chat del pedido */
.chat-bubble--mine {
  background: var(--ink);
  color: var(--paper);
}
[data-theme="dark"] .chat-bubble--mine {
  background: var(--accent);
  color: #FFFFFF;
}
.chat-bubble--other {
  border: 2px solid var(--line);
}

/* Avisos */
.demo-banner {
  border: 2px solid var(--accent);
  background: var(--accent-tint);
}

/* Interruptor */
.switch input:checked + .switch__slider {
  background: var(--accent);
}

/* Toast */
.toast {
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--paper);
}

/* Tiles de marca: borde tinta para que respiren sobre papel */
.tile {
  border: 2px solid var(--ink);
}
[data-theme="dark"] .tile {
  border-color: transparent;
}
