:root {
  --kb-safe: 0px;
  --panelTop: 38vh;
  --brand: #d21f32;
  --brand-mid: #a9182a;
  --brand-700: #7a1422;
  --brand-900: #4b0b16;
  --gold-dark: #8a5b12;
  --gold: #d9a436;
  --gold-light: #fff0a6;
  --bg: #f7f0ea;
  --surface: #fffaf4;
  --text: #211f24;
  --muted: #746c69;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--brand);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  position: relative;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  touch-action: manipulation;
}

#page-main {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -12%, rgba(210, 31, 50, .18), transparent 36%),
    linear-gradient(180deg, #fff7ef 0%, var(--bg) 42%, #eaded6 100%);
}

.header-img {
  position: relative;
  width: 100%;
  height: var(--panelTop);
  min-height: 220px;
  overflow: visible;
  z-index: 1;
  isolation: isolate;
  background: var(--brand);
}

.header-img::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, var(--brand) 0, var(--brand) 18px, rgba(210, 31, 50, .94) 28%, rgba(169, 24, 42, .86) 54%, rgba(95, 15, 27, .90) 100%),
    radial-gradient(circle at 18% 12%, rgba(255, 240, 166, .22), transparent 34%);
}

.header-img::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  z-index: 2;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold), var(--gold-dark));
}

.header-img img.bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.02) contrast(1.02);
}

#btn-clear {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
}

#btn-clear i {
  font-size: 24px;
}

.avatar {
  position: absolute;
  top: calc(var(--panelTop) - 73px);
  left: 50%;
  z-index: 10;
  width: 110px;
  height: 110px;
  border: 3px solid var(--surface);
  border-radius: 28px;
  background: #fff;
  object-fit: cover;
  cursor: pointer;
  transform: translateX(-50%);
  box-shadow:
    0 0 0 2px rgba(217, 164, 54, .72),
    0 12px 28px rgba(75, 11, 22, .24);
  transition: transform .18s ease;
}

.avatar:active {
  transform: translateX(-50%) scale(.96);
}

.photo-popover {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.photo-popover.show {
  opacity: 1;
  pointer-events: auto;
}

.photo-popover img {
  width: min(68vw, 260px);
  height: min(68vw, 260px);
  object-fit: cover;
  border: 4px solid #fff;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 22px 56px rgba(0, 0, 0, .38);
  transform: scale(.72);
  transition: transform .22s cubic-bezier(.2, .85, .25, 1.18);
}

.photo-popover.show img {
  transform: scale(1);
}

.content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--panelTop) + 28px);
  margin-top: -28px;
  padding: 76px 18px 0;
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 240, 166, .12) 0%, rgba(255, 250, 244, 0) 18%),
    var(--surface);
  box-shadow: 0 -10px 34px rgba(75, 11, 22, .16);
}

.content .container-sm {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 430px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 4px calc(24px + var(--kb-safe));
  scroll-padding: 28px 0 120px;
}

.kbd-open .container-sm {
  scroll-padding-bottom: calc(110px + var(--kb-safe));
}

.greeting {
  margin-bottom: 4px;
  color: var(--brand-900);
  font-size: 1.34rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.login-copy {
  max-width: 320px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.35;
  text-align: center;
}

.form-shell {
  position: relative;
  width: min(100%, 390px);
  margin: 0 auto;
  padding: 20px 18px 18px;
  overflow: hidden;
  border: 1px solid rgba(122, 20, 34, .18);
  border-radius: 18px;
  background: #fff;
}

.form-shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #c72f42 0%, #b42332 38%, var(--gold) 72%, var(--gold-dark) 100%);
}

.section-label {
  display: block;
  margin-bottom: 12px;
  color: var(--brand-700);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.form-control,
.input-group .btn {
  height: 52px;
  font-size: 16px;
}

.form-control {
  border-color: rgba(122, 20, 34, .18);
  border-radius: 12px !important;
  background: #fff;
  box-shadow: none !important;
}

.form-control::placeholder {
  color: #8d838b;
}

.form-control:focus {
  border-color: rgba(180, 35, 50, .55);
  box-shadow: 0 0 0 4px rgba(180, 35, 50, .12) !important;
}

.input-group.single .form-control {
  border-radius: 12px !important;
}

.input-group.rounded-group .form-control {
  border-right: 0;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.input-group.rounded-group .btn.ojo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border: 1px solid rgba(122, 20, 34, .18);
  border-left: 0;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
  background: #fff;
  color: var(--brand-700);
}

#togglePass i {
  font-size: 1.1rem;
}

.btn-red {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--brand-900);
  border-radius: 12px;
  background: var(--brand-700);
  color: #fff;
  font-weight: 800;
  box-shadow: none;
}

.btn-red:hover,
.btn-red:focus {
  background: var(--brand-900);
  color: #fff;
}

.alert-danger {
  max-width: 390px;
  margin: 10px auto;
}

.first-access {
  display: none;
  margin-top: 8px;
  color: #666;
  font-size: .95rem;
  text-align: center;
}

.inner-footer {
  display: block;
  margin-top: auto;
  padding: 11px 10px calc(11px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(180, 35, 50, .18);
  background: rgba(255, 255, 255, .64);
  color: #666;
  text-align: center;
}

.inner-footer img {
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
}

.inner-footer span {
  font-size: 13px;
}

.webmobile-lock-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.webmobile-lock-footer .content {
  flex: 1 0 auto;
}

@media (max-width: 768px) {
  :root {
    --panelTop: 34vh;
  }

  .content {
    padding-right: 14px;
    padding-left: 14px;
    border-radius: 26px 26px 0 0;
  }

  .form-shell {
    padding: 20px 16px 18px;
  }
}

@media (max-width: 480px) {
  :root {
    --panelTop: 31vh;
  }

  .avatar {
    top: calc(var(--panelTop) - 70px);
    width: 101px;
    height: 101px;
    border-radius: 26px;
  }

  .content {
    padding-top: 70px;
  }

  .greeting {
    font-size: 1.22rem;
  }

  .login-copy {
    margin-bottom: 16px;
    font-size: .9rem;
  }

  .content .container-sm {
    padding-bottom: 18px;
  }
}
