@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --bg: #f6efe4;
  --forest: #6b2a38;
  --forest-soft: #8a3d4c;
  --gold: #c9a24a;
  --text: #231714;
  --muted: #6d5c54;
  --err: #c04545;
  --surface: #fffdf8;
  --line: rgba(35, 23, 20, 0.12);
  --font: "Outfit", "Segoe UI", sans-serif;
}

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

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body.app-body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 162, 74, 0.18), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

.app-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 239, 228, 0.88);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.app-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-top .link {
  margin-left: auto;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.app-main, .app-card {
  padding: 1.5rem 1.25rem 3rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 3rem;
}

.app-logo {
  border-radius: 14px;
  align-self: center;
}

h1 { margin: 0.25rem 0; font-size: 1.75rem; color: var(--forest); }

.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.85rem; }
.err { color: var(--err); }
.ok { color: var(--forest-soft); }
.dev { background: var(--surface); border: 1px solid var(--line); padding: 0.75rem; border-radius: 8px; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

input,
button,
select,
textarea {
  max-width: 100%;
}

input {
  padding: 0.85rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

.btn-primary, .btn-ghost {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.9rem 1rem;
  margin: 0.35rem 0;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--forest);
  color: #fbf6ed;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(107, 42, 56, 0.3);
  color: var(--forest);
}

.balance {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.balance .label { color: var(--muted); font-size: 0.85rem; }
.balance .value { font-size: 2rem; letter-spacing: 0.02em; color: var(--forest); }
.balance .sub { color: var(--muted); }

.actions { display: flex; flex-direction: column; gap: 0.25rem; }

/* Perfil / biometria */
input[readonly] {
  background: #f3ebe3;
  color: var(--muted);
}

.bio-panel {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.bio-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: var(--forest);
}

.bio-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.bio-toggle__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.bio-toggle__meta strong {
  color: var(--text);
  font-size: 0.95rem;
}

.bio-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

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

.bio-switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #c5d0ca;
  border-radius: 999px;
  transition: background .2s ease;
}

.bio-switch__slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

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

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

.bio-switch input:disabled + .bio-switch__slider {
  opacity: .5;
  cursor: not-allowed;
}

/* PWA install */
.pwa-install-banner {
  display: none;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(201, 168, 76, 0.18), rgba(107, 42, 56, 0.06));
}
.pwa-install-banner.is-visible,
.pwa-install-banner:not([hidden]) { display: block; }
.pwa-install-banner[hidden] { display: none !important; }
.pwa-install-banner__inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
}
.pwa-install-banner__text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pwa-install-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}
.pwa-install-banner__btn {
  border: 0;
  border-radius: 0.35rem;
  padding: 0.55rem 0.75rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--forest);
  color: #fbf6ed;
  flex: 1;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}
.pwa-install-banner__link {
  border: 0;
  background: transparent;
  color: var(--forest);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.35rem;
  flex-shrink: 0;
}
.pwa-install-banner__dismiss {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  flex-shrink: 0;
}
.pwa-install-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  padding: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.pwa-install-sheet.is-open {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.pwa-install-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 23, 20, 0.55);
}
.pwa-install-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  max-height: min(85dvh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.pwa-install-sheet__block[hidden] {
  display: none !important;
}
.pwa-install-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  width: 100%;
  min-width: 0;
}
.pwa-install-sheet__header h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--forest);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pwa-install-sheet__close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0.15rem 0.35rem;
}
.pwa-install-sheet__block { margin-bottom: 0.9rem; min-width: 0; }
.pwa-install-sheet__block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pwa-install-sheet__block p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pwa-install-sheet__block strong { color: var(--text); }
.pwa-install-sheet__note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (min-width: 480px) {
  .pwa-install-sheet.is-open {
    align-items: center;
    padding: 0.75rem;
  }
  .pwa-install-sheet__panel {
    width: min(420px, 100%);
    border-radius: 14px;
    padding: 1.1rem 1.1rem 1.25rem;
  }
}

