/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:              #0A0A0F;
  --card-dark:       #1C1C1E;
  --card-input:      #2C2C2E;
  --text:            #FFFFFF;
  --text-secondary:  rgba(235,235,245,0.65);
  --text-tertiary:   rgba(235,235,245,0.55);
  --text-quaternary: rgba(235,235,245,0.5);
  --accent:          #0A84FF;
  --accent-light:    #64D2FF;
  --accent-deep:     #5E5CE6;
  --success:         #30D158;
  --success-bg:      rgba(48,209,88,0.22);
  --cancel-bg:       rgba(118,118,128,0.36);
  --separator:       rgba(120,120,128,0.32);

  --font:         -apple-system, "SF Pro Display", "SF Pro", system-ui, sans-serif;
  --font-rounded: -apple-system, "SF Pro Rounded", "SF Pro", system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── App shell ─────────────────────────────────────────────── */
.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* ── Background orbs ───────────────────────────────────────── */
.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.orb-blue {
  top: -60px; left: -40px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, #0A84FF 0%, rgba(10,132,255,0) 70%);
  filter: blur(20px);
  opacity: 0.85;
}
.orb-purple {
  top: 240px; right: -80px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, #BF5AF2 0%, rgba(191,90,242,0) 70%);
  filter: blur(20px);
  opacity: 0.55;
}
.orb-green {
  bottom: -40px; left: 40px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, #30D158 0%, rgba(48,209,88,0) 70%);
  filter: blur(20px);
  opacity: 0.4;
}
.orb-red {
  bottom: 220px; right: 20px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, #FF375F 0%, rgba(255,55,95,0) 70%);
  filter: blur(20px);
  opacity: 0.35;
}

/* ── Scrollable content column ─────────────────────────────── */
.content {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  /* leave room below for the CTA (54px height + 50px bottom + safe-area) */
  padding-bottom: calc(54px + 50px + 16px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  padding: calc(52px + env(safe-area-inset-top)) 16px 12px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.debtor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64D2FF, #0A84FF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-rounded);
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(10,132,255,0.5), inset 0 1px 0 rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.debtor-name {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

/* ── Card wrappers ─────────────────────────────────────────── */
.card-wrap {
  padding: 4px 16px 0;
}
.card-wrap + .card-wrap {
  padding-top: 12px;
}

/* ── Glass surface ─────────────────────────────────────────── */
.glass {
  position: relative;
  overflow: hidden;
}
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  background: rgba(120,120,128,0.22);
}
.glass::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 1.5px 1.5px 1px rgba(255,255,255,0.18),
    inset -1px   -1px 1px rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.18);
  pointer-events: none;
}
.glass > * { position: relative; z-index: 1; }

/* ── Gauge card ────────────────────────────────────────────── */
.gauge-card {
  border-radius: 28px;
  padding: 22px 20px 18px;
}

.gauge-sublabel {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: -0.2px;
}

.gauge-wrap {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.gauge-svg {
  width: min(240px, 70vw);
  overflow: visible;
}

.gauge-glow {
  opacity: 0.45;
  filter: blur(8px);
  stroke-dasharray: 0 339.292;
  transition: stroke-dasharray 0.6s cubic-bezier(.22, 1, .36, 1);
}

.gauge-fill {
  stroke-dasharray: 0 339.292;
  transition: stroke-dasharray 0.6s cubic-bezier(.22, 1, .36, 1);
}

.gauge-bottom {
  text-align: center;
  margin-top: -8px;
}

.amount-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.amount-big {
  font-family: var(--font-rounded);
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1.2px;
  line-height: 1;
  text-shadow: 0 0 30px rgba(100,210,255,0.3);
}

.amount-denom {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-quaternary);
}

.pct-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--success-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  letter-spacing: -0.1px;
}

/* ── History card ──────────────────────────────────────────── */
.history-card {
  border-radius: 22px;
  padding: 6px 0;
}

.history-header {
  padding: 10px 18px 6px;
  letter-spacing: 0.2px;
}

.history-row {
  display: flex;
  align-items: center;
  padding: 10px 18px;
}
.history-row.has-border {
  border-bottom: 0.5px solid var(--separator);
}

.history-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(10,132,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.history-info { flex: 1; }

.history-label {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.3px;
}

.history-date {
  font-size: 12px;
  color: var(--text-quaternary);
  margin-top: 1px;
}

.history-amount {
  font-family: var(--font-rounded);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

/* ── CTA button ────────────────────────────────────────────── */
.cta-btn {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(50px + env(safe-area-inset-bottom));
  z-index: 3;
  height: 54px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.4px;
  box-shadow:
    0 8px 22px rgba(10,132,255,0.4),
    0 2px 6px  rgba(10,132,255,0.25),
    inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.12s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.cta-btn:active {
  transform: scale(0.98);
  box-shadow:
    0 2px 6px rgba(10,132,255,0.33),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ── Modal overlay (= scrim) ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.28s;
  pointer-events: none;
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Modal sheet ───────────────────────────────────────────── */
.modal-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--card-dark);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,0.18);
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(.22,1,.36,1);
}
.modal-overlay.visible .modal-sheet {
  transform: translateY(0);
}

.grabber {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: rgba(235,235,245,0.3);
  margin: 8px auto 0;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  letter-spacing: -0.4px;
  margin-top: 16px;
}

.modal-subtitle {
  font-size: 14px;
  color: rgba(235,235,245,0.6);
  text-align: center;
  margin-top: 4px;
}

/* ── Amount input ──────────────────────────────────────────── */
.amount-input-card {
  display: flex;
  align-items: center;
  background: var(--card-input);
  border-radius: 14px;
  padding: 18px 16px;
  margin: 18px 16px 0;
}

.amount-input-card input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-rounded);
  font-size: 34px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.8px;
  caret-color: var(--accent);
  min-width: 0;
}
.amount-input-card input::placeholder {
  color: rgba(235,235,245,0.6);
}

.euro-glyph {
  font-size: 28px;
  font-weight: 500;
  color: rgba(235,235,245,0.6);
  margin-left: 8px;
}

/* ── Quick-pick chips ──────────────────────────────────────── */
.chips-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
}

.chip {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  background: var(--cancel-bg);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.1s;
}
.chip:active { opacity: 0.7; }

/* ── Modal action buttons ──────────────────────────────────── */
.modal-actions {
  display: flex;
  gap: 10px;
  padding: 18px 16px 0;
}

.btn-cancel,
.btn-confirm {
  flex: 1;
  height: 50px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.btn-cancel {
  background: var(--cancel-bg);
  transition: opacity 0.1s;
}
.btn-cancel:active { opacity: 0.7; }

.btn-confirm {
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(10,132,255,0.33);
  transition: background 0.15s, box-shadow 0.15s, opacity 0.1s;
}
.btn-confirm:disabled {
  background: rgba(10,132,255,0.35);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-confirm:not(:disabled):active { opacity: 0.85; }

/* ── Auth gate ─────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  border-radius: 28px;
  padding: 32px 24px 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  margin-top: 14px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-input-wrap {
  width: 100%;
  margin-top: 22px;
}

.auth-input-wrap input {
  font-size: 20px;
  letter-spacing: 0.1em;
}

.auth-error {
  font-size: 13px;
  color: #FF375F;
  margin-top: 8px;
  min-height: 18px;
  display: none;
}

.auth-btn {
  width: 100%;
  margin-top: 16px;
}
