.page--auth {
  min-height: 100dvh;
}

.auth-layout {
  display: grid;
  min-height: 100dvh;
  padding: 24px 18px;
  place-items: center;
}

.auth-card {
  width: min(100%, 420px);
  padding: 36px 32px 29px;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.auth-card .wordmark {
  color: var(--color-primary);
}

.auth-copy {
  margin: 54px 0 34px;
}

.auth-copy h1 {
  font-size: clamp(31px, 8vw, 38px);
  font-weight: 680;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.auth-copy p {
  margin-top: 18px;
  color: var(--color-text-secondary);
  font-size: 15px;
}

.google-button {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}

.google-button:hover {
  border-color: #d2d6e0;
  background: var(--color-surface-secondary);
}

.google-letter {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: #4285f4;
  font-weight: 750;
}

.access-note {
  margin-top: 19px;
  color: var(--color-text-subtle);
  font-size: 12px;
  text-align: center;
}

.page--app {
  height: 100dvh;
  overflow: hidden;
}

.app-frame {
  height: 100dvh;
}

.app-shell {
  position: relative;
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  grid-template-rows: minmax(0, 1fr) auto;
  margin: auto;
  overflow: hidden;
  background: var(--color-bg);
}

.views,
.view {
  min-height: 0;
  height: 100%;
}

.view {
  animation: view-in var(--motion-default);
}

.view-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

.home-scroll {
  padding-bottom: var(--space-4);
}

.home-content {
  display: grid;
  gap: 10px;
  padding: 0 12px;
}

.view--chat {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--color-bg);
  --chat-composer-gap: 14px;
  --chat-body-height: auto;
  --chat-viewport-offset-top: 0px;
  --chat-safe-bottom: env(safe-area-inset-bottom);
}

.topbar--chat {
  position: relative;
  z-index: 2;
  min-height: calc(82px + var(--chat-viewport-offset-top));
  padding: calc(13px + var(--chat-viewport-offset-top)) 13px 10px;
  background: var(--color-bg);
}

.topbar--chat .icon-button {
  width: 41px;
  height: 41px;
}

.icon-button--back {
  flex: 0 0 auto;
}

.chat-heading {
  flex: 1;
  min-width: 0;
}

.chat-heading h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.chat-heading p {
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.chat-body {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
  height: var(--chat-body-height, auto);
  overflow: hidden;
  padding-bottom: var(--chat-safe-bottom);
}

.chat-thread {
  min-height: 0;
  padding: 15px 14px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}

.chat-item {
  display: flex;
  width: 100%;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 15px;
  animation: message-in var(--motion-default);
}

.chat-item--user {
  justify-content: flex-end;
}

.lumi-signature {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(91, 115, 232, 0.12);
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 4px 14px rgba(46, 58, 110, 0.08);
}

.message-bubble {
  max-width: 78%;
  padding: 12px 14px 9px;
  border: 1px solid var(--color-border);
  border-radius: 18px 18px 18px 5px;
  background: var(--color-surface);
  box-shadow: 0 7px 20px rgba(22, 28, 45, 0.04);
}

.chat-item--user .message-bubble {
  border-color: var(--color-primary);
  border-radius: 18px 18px 5px 18px;
  background: var(--color-primary);
  color: white;
  box-shadow: 0 8px 20px rgba(91, 115, 232, 0.18);
}

.message-bubble p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-meta {
  display: block;
  margin-top: 5px;
  color: var(--color-text-subtle);
  font-size: 10px;
}

.chat-item--user .message-meta {
  color: rgba(255, 255, 255, 0.78);
  text-align: right;
}

.confirmation-card {
  width: min(88%, 390px);
  margin-left: 38px;
  padding: 15px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  animation: message-in var(--motion-default);
}

.confirmation-intro {
  margin-bottom: 12px;
  font-size: 14px;
}

.financial-preview {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.financial-preview__header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.financial-preview__title {
  font-size: 16px;
  font-weight: 680;
}

.financial-preview__description {
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.financial-preview__amount {
  margin-top: 3px;
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.preview-field {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.preview-field:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.preview-field__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
}

.preview-field__copy {
  display: grid;
}

.preview-field__copy small {
  color: var(--color-text-secondary);
  font-size: 10px;
}

.preview-field__copy strong {
  font-size: 13px;
  font-weight: 580;
  overflow-wrap: anywhere;
}

.confirmation-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.confirmation-action {
  min-height: 45px;
  border-radius: 14px;
  font-weight: 650;
}

.confirmation-action--cancel {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
}

.confirmation-action--confirm {
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.execution-card {
  max-width: 78%;
  margin-left: 38px;
  padding: 13px 14px;
  border: 1px solid rgba(33, 161, 121, 0.2);
  border-radius: 18px;
  background: #f4fbf8;
}

.execution-card strong {
  color: var(--color-success);
  font-size: 12px;
}

.execution-card p {
  margin-top: 4px;
}

.execution-card__meta {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.chat-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 18px 8px 52px;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: typing 1s infinite alternate;
}

.typing-dots i:nth-child(2) { animation-delay: 160ms; }
.typing-dots i:nth-child(3) { animation-delay: 320ms; }

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 45px;
  gap: 8px;
  align-items: end;
  margin: 0 12px var(--chat-composer-gap);
  padding: 6px 6px 6px 15px;
  border: 1px solid var(--color-border);
  border-radius: 19px;
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgba(32, 39, 66, 0.08);
  transition: margin-bottom var(--motion-fast);
}

.chat-composer textarea {
  width: 100%;
  max-height: 120px;
  min-height: 38px;
  padding: 9px 0 7px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  line-height: 1.4;
}

.chat-composer textarea::placeholder {
  color: var(--color-text-subtle);
}

.send-button {
  display: grid;
  width: 45px;
  height: 45px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  transition: transform var(--motion-fast), background var(--motion-fast);
}

.send-button:active {
  transform: scale(0.95);
  background: var(--color-primary-pressed);
}

.send-button:disabled {
  opacity: 0.6;
}

.send-button svg {
  width: 22px;
  height: 22px;
}

@keyframes view-in {
  from { opacity: 0; }
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(5px); }
}

@keyframes typing {
  to { opacity: 0.3; transform: translateY(-2px); }
}

@media (max-width: 430px) {
  .topbar--home {
    min-height: 102px;
    padding: 20px 12px 16px;
  }

  .home-content {
    gap: 8px;
    padding-inline: 10px;
  }

  .balance-card {
    min-height: 176px;
    padding: 16px;
  }

  .balance-card__main > p:first-child {
    font-size: 13px;
  }

  .balance-card__amount {
    margin-top: 6px;
    font-size: clamp(1.9rem, 7.8vw, 2.4rem);
  }

  .balance-card__actions {
    gap: 6px;
  }

  .balance-card__status {
    min-height: 28px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .empty-hint {
    margin-top: 3px;
    font-size: 11px;
  }

  .balance-summary {
    gap: 6px;
    margin-top: 12px;
  }

  .balance-chip {
    min-height: 48px;
    gap: 8px;
    padding: 7px 8px;
  }

  .balance-chip__arrow {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
    font-size: 17px;
  }

  .balance-chip small {
    font-size: 10px;
  }

  .balance-chip strong {
    font-size: clamp(0.76rem, 3.2vw, 0.88rem);
  }


  .credit-card-preview__metric:nth-of-type(3) {
    display: none;
  }

  .credit-card-preview {
    grid-template-columns: 47px minmax(72px, 1fr) minmax(75px, 0.9fr) 16px;
  }
}

.app-shell[data-chat-keyboard-open="true"] [data-bottom-nav] {
  display: none;
}

@media (min-width: 600px) {
  .app-frame {
    display: grid;
    padding: 18px;
    place-items: center;
  }

  .app-shell {
    width: min(100%, 520px);
    height: calc(100dvh - 36px);
    min-height: 620px;
    border: 1px solid rgba(231, 233, 239, 0.8);
    border-radius: 28px;
    box-shadow: 0 18px 55px rgba(28, 35, 61, 0.09);
  }

  .bottom-nav {
    border-radius: 0 0 28px 28px;
  }

  .home-content {
    padding-inline: 16px;
  }

  .view--chat {
    width: min(100%, 500px);
    margin: auto;
  }

  .more-sheet {
    bottom: 18px;
    border-bottom: 1px solid var(--color-border);
    border-radius: 24px;
  }
}

@media (max-height: 680px) and (min-width: 600px) {
  .app-frame {
    padding-block: 0;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
  }
}

.home-scroll {
  overscroll-behavior-y: contain;
}
