:root {
  --brand-green: #0E6B4F;
  --beer-green: #3FBE6E;
  --beer-green-dark: #2F9E58;
  --beer-purple: #8E5FD6;
  --beer-purple-dark: #7847BE;
  --gold: #F2B705;
  --ink: #1E2328;
  --ink-soft: #6B7280;
  --line: #E7E9EC;
  --card-bg: #FFFFFF;
  --page-bg: #F2F3F5;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-full: 999px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  overflow-x: hidden;
}

body {
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--page-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

/* ---------- Header / brand ---------- */

.screen {
  flex: 1;
  padding: 32px 16px 110px;
}

.brand {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--brand-green);
  margin: 8px 0 28px;
}

.brand-flourish {
  font-family: "Yellowtail", cursive;
  font-weight: 400;
  font-size: 1.35em;
  letter-spacing: 0;
  vertical-align: -0.08em;
  margin: 0 -0.03em;
  display: inline-block;
}

.round-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: -6px 0 16px;
}

.round-total-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.round-total-value {
  font-size: 42px;
  font-weight: 800;
  color: var(--brand-green);
  line-height: 1;
}

.brand-actions {
  display: flex;
  justify-content: center;
  margin: 0 0 22px;
}

.close-day-btn {
  border: none;
  background: var(--card-bg);
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(20, 20, 30, 0.08);
  cursor: pointer;
}

/* ---------- People list ---------- */

.people-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.person-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 40px 114px;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 2px 10px rgba(20, 20, 30, 0.06);
  overflow: hidden;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar svg {
  width: 22px;
  height: 22px;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar--editable {
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}

.avatar-camera-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 20, 30, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}

.person-info {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.person-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-soft);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.history-link svg {
  flex: 0 0 auto;
}

.total-box {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px 2px;
  overflow: hidden;
}

.total-label {
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 500;
}

.total-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.beer-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.beer-btn {
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 34px;
  height: 48px;
  border-radius: var(--radius-full);
  color: #fff;
  padding: 0;
  overflow: hidden;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.beer-btn:active {
  transform: scale(0.92);
}

.beer-btn--undo {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #EAEBEE;
  color: #A14B43;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

.beer-btn--cerveza {
  background: linear-gradient(180deg, var(--beer-green), var(--beer-green-dark));
}

.beer-btn--brindis {
  background: linear-gradient(180deg, var(--beer-purple), var(--beer-purple-dark));
}

.beer-icon {
  font-size: 16px;
  line-height: 1;
}

.beer-label {
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.beer-btn.just-added {
  animation: pop 0.28s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  font-family: inherit;
}

.nav-item[disabled] {
  cursor: default;
}

.nav-text {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.nav-icon--plus {
  font-weight: 700;
  font-size: 31px;
}

.nav-icon--gear {
  font-size: 27px;
}

.nav-icon--crown {
  font-size: 28px;
}

.nav-icon--home {
  font-size: 28px;
}

.nav-icon--profile {
  font-size: 26px;
}

.nav-icon--receipt {
  font-size: 25px;
}

.nav-icon--logout {
  font-size: 26px;
}

.nav-item--active .nav-text {
  color: var(--ink);
}

/* ---------- Modal (add person) ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 25, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 320px;
}

.modal h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}

.modal input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.modal input:focus {
  border-color: var(--brand-green);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-btn {
  flex: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 11px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.modal-btn--cancel {
  background: var(--page-bg);
  color: var(--ink-soft);
}

.modal-btn--confirm {
  background: var(--brand-green);
  color: #fff;
}

.modal-btn--danger {
  background: #FBEAEA;
  color: #C0392B;
}

.modal--photo {
  max-width: 300px;
}

.photo-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-pick-btn {
  border: none;
  background: var(--brand-green);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.photo-pick-btn--secondary {
  background: var(--page-bg);
  color: var(--ink);
}

.photo-crop-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
}

.photo-crop-viewport {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--page-bg);
  touch-action: none;
  cursor: grab;
  box-shadow: 0 0 0 3px var(--line);
}

.photo-crop-viewport:active {
  cursor: grabbing;
}

#photo-crop-img {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-zoom-slider {
  display: block;
  width: 220px;
  margin: 14px auto 0;
}

/* ---------- Placeholder screens ---------- */

.screen--placeholder {
  display: flex;
  flex-direction: column;
}

.back-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 600;
}

.placeholder-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.placeholder-icon {
  font-size: 46px;
}

.placeholder-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  color: var(--brand-green);
  margin: 0;
}

.placeholder-text {
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Sub pages (historial / rankings / configuracion) ---------- */

.screen--sub {
  padding-top: 24px;
}

.sub-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.sub-header--simple {
  gap: 12px;
}

.sub-header-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar--sm {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.avatar--sm svg {
  width: 20px;
  height: 20px;
}

.sub-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 22px;
  margin: 0;
  color: var(--ink);
}

.sub-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ---------- Deuda (historial) ---------- */

.debt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(20, 20, 30, 0.06);
}

.debt-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.debt-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--brand-green);
  line-height: 1.2;
}

.debt-hint {
  font-size: 12px;
  color: var(--ink-soft);
}

.past-rounds {
  margin-bottom: 24px;
}

.debt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.debt-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(20, 20, 30, 0.05);
}

.debt-row-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.payment-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.round-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-green);
  background: #E4F5EC;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  vertical-align: middle;
}

.debt-row-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.debt-row-date {
  font-weight: 600;
  font-size: 14px;
}

.debt-row-count {
  font-size: 12px;
  color: var(--ink-soft);
}

.debt-row-value {
  font-weight: 800;
  font-size: 16px;
  color: var(--beer-purple-dark);
}

.paid-toggle {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  background: #FBEAEA;
  color: #C0392B;
  margin-top: 4px;
}

.paid-toggle--sm {
  font-size: 11.5px;
  padding: 6px 14px;
  margin-top: 0;
}

.paid-toggle--paid {
  background: #E4F5EC;
  color: #1F8A55;
}

.paid-toggle--readonly {
  display: inline-block;
  cursor: default;
}

/* ---------- Notas (historial) ---------- */

.notes-section {
  margin-bottom: 24px;
}

.notes-textarea {
  width: 100%;
  min-height: 90px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--brand-green);
}

.notes-status {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
  height: 14px;
}

/* ---------- Timeline (historial) ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(20, 20, 30, 0.05);
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.timeline-dot--cerveza {
  background: var(--beer-green);
}

.timeline-dot--brindis {
  background: var(--beer-purple);
}

.timeline-icon {
  font-size: 16px;
}

.timeline-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.timeline-kind {
  font-weight: 600;
  font-size: 14px;
}

.timeline-time {
  font-size: 11.5px;
  color: var(--ink-soft);
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state--small {
  padding: 24px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
}

.empty-icon {
  font-size: 34px;
}

/* ---------- Rankings ---------- */

.range-switch {
  display: flex;
  gap: 4px;
  background: var(--line);
  border-radius: var(--radius-full);
  padding: 4px;
  margin: 4px 0 22px;
}

.range-switch button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
}

.range-switch button.is-active {
  background: var(--card-bg);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(20, 20, 30, 0.1);
}

.ranking-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}

.section-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.ranking-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(20, 20, 30, 0.05);
}

.ranking-pos {
  width: 18px;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.ranking-name {
  flex: 1;
  font-weight: 600;
  font-size: 14.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  font-weight: 800;
  font-size: 16px;
  color: var(--beer-green-dark);
}

.ranking-value--purple {
  color: var(--beer-purple-dark);
}

.ranking-crown {
  font-size: 13px;
}

.ranking-list--extra {
  display: none;
  margin-top: -6px;
}

.ranking-list--extra.is-open {
  display: flex;
}

.ranking-toggle {
  width: 100%;
  border: none;
  background: none;
  color: var(--brand-green);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px;
  margin-bottom: 14px;
  cursor: pointer;
}

.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  box-shadow: 0 2px 10px rgba(20, 20, 30, 0.06);
}

/* ---------- Configuracion ---------- */

.config-section {
  margin-bottom: 28px;
}

.config-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.config-section-header .section-title {
  margin: 0;
}

.add-friend-btn {
  border: none;
  background: var(--brand-green);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.config-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.config-person {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(20, 20, 30, 0.05);
  flex-wrap: wrap;
}

.config-name-input {
  flex: 1 1 90px;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  padding: 6px 4px;
  border-radius: 8px;
}

.config-name-input:focus {
  outline: none;
  background: var(--page-bg);
}

.color-swatches {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.color-swatch--active {
  border-color: var(--ink);
}

.icon-btn {
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.icon-btn--danger:hover {
  color: #D9605A;
}

.danger-btn {
  width: 100%;
  border: none;
  background: #FBEAEA;
  color: #C0392B;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.danger-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---------- Login ---------- */

.screen--login {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 32px;
  overflow: hidden;
}

.floating-emojis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.floating-emoji {
  position: absolute;
  font-size: 180px;
  line-height: 1;
  opacity: 0;
  animation-name: emoji-float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes emoji-float {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.75) rotate(-8deg);
  }
  15% {
    opacity: 0.35;
    transform: translateY(0) scale(1) rotate(0deg);
  }
  80% {
    opacity: 0.35;
    transform: translateY(-14px) scale(1) rotate(4deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-34px) scale(0.75) rotate(8deg);
  }
}

.title-clink {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: -1;
}

.title-mug-wrap {
  position: absolute;
  display: block;
  width: 58px;
  height: 76px;
  top: -38px;
}

.title-mug-wrap--left {
  left: -90px;
}

.title-mug-wrap--right {
  left: 34px;
  transform: scaleX(-1);
}

.title-mug {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 82% 92%;
  animation: title-cascada 3.4s ease-in-out infinite;
  filter: drop-shadow(0 6px 8px rgba(20, 20, 20, 0.16));
}

@keyframes title-cascada {
  0%, 10% { transform: translateX(-30px) rotate(0deg); }
  32% { transform: translateX(-2px) rotate(20deg); }
  60% { transform: translateX(-2px) rotate(20deg); }
  82%, 100% { transform: translateX(-30px) rotate(0deg); }
}

.clink-liquid {
  animation: title-spill-liquid 3.4s ease-in-out infinite;
}

@keyframes title-spill-liquid {
  0%, 28% { transform: translateY(0); }
  45% { transform: translateY(7px); }
  65% { transform: translateY(7px); }
  85%, 100% { transform: translateY(0); }
}

.title-drop {
  position: absolute;
  left: 0;
  top: -2px;
  width: var(--size, 4px);
  height: var(--size, 4px);
  border-radius: 50%;
  background: #E8A33D;
  opacity: 0;
  animation: title-drop-fall 3.4s ease-in infinite;
  animation-delay: calc(1.1s + var(--d, 0s));
}

@keyframes title-drop-fall {
  0% { opacity: 0; transform: translate(0,-4px) scale(0.7); }
  5% { opacity: 0.95; }
  55% { opacity: 0.3; transform: translate(var(--dx), var(--dy)) scale(0.8); }
  62% { opacity: 0; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .title-mug, .clink-liquid, .title-drop {
    animation: none !important;
  }
}

.brand,
.screen--login > .login-card {
  position: relative;
  z-index: 1;
}

.brand--type::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.8em;
  margin-left: 2px;
  background: var(--brand-green);
  vertical-align: -0.05em;
  opacity: 0;
}

.brand--type.is-typing::after {
  opacity: 1;
  animation: caret-blink 0.8s step-end infinite;
}

@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: 0 2px 10px rgba(20, 20, 30, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.login-error {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #C0392B;
  background: #FBEAEA;
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.login-card--minimal input {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 14px;
}

.login-card--minimal input:focus {
  outline: none;
  border-color: var(--brand-green);
}

.login-submit {
  border: none;
  background: var(--brand-green);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 4px;
}

.logout-link {
  display: block;
  text-align: center;
  color: #C0392B;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  padding: 12px;
}

/* ---------- iPhone frame (desktop preview only) ---------- */

@media (min-width: 560px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #DADCE1;
    padding: 16px 20px;
    box-sizing: border-box;
  }

  .device-frame {
    position: relative;
    width: min(430px, 90vw);
    height: min(860px, 78vh);
    background: linear-gradient(155deg, #3a3d44, #131417);
    border-radius: 62px;
    padding: 14px;
    box-shadow:
      0 40px 80px rgba(0, 0, 0, 0.35),
      inset 0 0 0 2px rgba(255, 255, 255, 0.06);
    /* establishes a containing block so fixed children (bottom nav, modal)
       anchor to the phone frame instead of the browser viewport */
    transform: translateZ(0);
  }

  .device-frame::before {
    content: "";
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    width: 126px;
    height: 32px;
    background: #0a0a0c;
    border-radius: 20px;
    z-index: 5;
  }

  .device-frame::after {
    content: "";
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    z-index: 5;
  }

  .app-shell {
    width: 100%;
    height: 100%;
    max-width: none;
    min-height: 0;
    border-radius: 48px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: none;
    scrollbar-width: none;
  }

  .app-shell::-webkit-scrollbar {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    transform: none;
    max-width: none;
    border-bottom-left-radius: 48px;
    border-bottom-right-radius: 48px;
    padding-bottom: 10px;
  }

  .modal-backdrop {
    left: 14px;
    right: 14px;
    top: 14px;
    bottom: 14px;
    border-radius: 48px;
  }

  .screen--sub {
    padding-top: 46px;
  }
}
