/* ============================================================
   Theme tokens — every color/radius the app uses lives here as
   a CSS custom property so the in-app "Appearance" panel can
   rewrite them live (see assets/js/theme.js) without touching
   any other file.
   ============================================================ */
:root {
  --color-primary: #0F5C56;
  --color-primary-dark: #0A3F3B;
  --color-accent: #C9A227;
  --color-bg: #F5F6F4;
  --color-surface: #FFFFFF;
  --color-text: #14231F;
  --color-text-muted: #5B6B66;
  --color-border: #DCE1DB;
  --color-error: #B3261E;
  --color-success: #1B7A43;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --font-display: 'Source Serif 4', 'Georgia', serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --shell-max-width: 480px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- phone-like app shell, centered on wider viewports ---- */
.app-shell {
  max-width: var(--shell-max-width);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--color-surface);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--color-border);
}
@media (min-width: 560px) {
  body { background: linear-gradient(180deg, var(--color-primary-dark), var(--color-bg) 320px); }
  .app-shell { margin: 28px auto 40px; border-radius: var(--radius-lg); overflow: hidden; min-height: calc(100dvh - 68px); box-shadow: 0 24px 60px -20px rgba(10, 30, 26, .45); }
}

/* ---- top bar ---- */
.app-topbar {
  padding: 22px 20px 16px;
  background: var(--color-primary);
  color: #fff;
}
.brand-row { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; width:100% }
.brand-logo-box {
  background: #fff;
  border-radius: 10px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  margin: 0 auto;
}
.brand-logo-box img { display: block; height: 38px; width: auto; }
.app-topbar .brand {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: .2px;
  margin: 0 0 2px;
}
.app-topbar .brand-sub { font-size: 13px; color: rgba(255,255,255,.78); margin: 0; }

.step-progress { padding: 14px 20px 0; background: var(--color-primary); }
.step-progress .bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.25); overflow: hidden; }
.step-progress .fill { height: 100%; background: var(--color-accent); border-radius: 4px; transition: width .35s ease; }
.step-progress .meta { display: flex; justify-content: space-between; color: rgba(255,255,255,.85); font-size: 12.5px; padding: 8px 0 16px; }
.step-progress .meta .step-title { font-weight: 600; color: #fff; }

/* ---- content area ---- */
.app-content { flex: 1; padding: 22px 20px 110px; }
.step-heading { font-family: var(--font-display); font-size: 22px; margin: 0 0 6px; }
.step-desc { color: var(--color-text-muted); font-size: 14px; margin: 0 0 20px; line-height: 1.45; }

/* ---- form elements ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--color-text); }
.field .hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.field .error { font-size: 12.5px; color: var(--color-error); margin-top: 5px; display: none; }
.field.has-error .error { display: block; }
.field.has-error input, .field.has-error select { border-color: var(--color-error); }
.field.has-error .iban-group { border-color: var(--color-error); }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="date"], select {
  width: 100%;
  padding: 12px 13px;
  font-size: 15px;
  font-family: var(--font-body);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color .15s ease;
}
input:focus, select:focus { border-color: var(--color-primary); }
input:disabled, select:disabled { background: #F0F1EF; color: var(--color-text-muted); }

.radio-group, .segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented label {
  flex: 1; min-width: 120px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 11px 10px; font-size: 14px; font-weight: 500; color: var(--color-text);
  background: var(--color-surface); transition: all .15s ease;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + label,
.segmented label.checked {
  border-color: var(--color-primary); background: var(--color-primary); color: #fff;
}

.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--color-primary); }
.checkbox-row label { margin: 0; font-weight: 500; font-size: 14px; }

/* ---- composite IBAN field (Step 4): reads as one bordered field, wraps to 2 rows ---- */
.iban-group {
  display: flex; flex-wrap: nowrap; align-items: stretch;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); overflow: hidden; transition: border-color .15s ease;
}
.iban-group:focus-within { border-color: var(--color-primary); }
.iban-prefix {
  display: flex; align-items: center; padding: 0 10px; flex-shrink: 0;
  font-weight: 700; font-size: 15px; color: var(--color-text-muted);
  background: #F0F1EF; border-right: 1px solid var(--color-border);
}
.iban-group input, .iban-group select {
  border: none; outline: none; background: transparent; min-width: 0;
  padding: 12px 10px; font-size: 15px; font-family: var(--font-body); color: var(--color-text);
  border-right: 1px solid var(--color-border);
}
.iban-check { width: 52px !important; flex-shrink: 0; text-align: center; }
.iban-bank {
  flex-shrink: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  border-right: none; width: 100px !important;

}
.iban-account {
  flex: 1 1 100%; letter-spacing: .5px; border-right: none;
  border-top: 1px solid var(--color-border);
	border: 0 !important;
}

.toggle-question {
  background: #F0F4F1; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 18px;
}
.toggle-question p { margin: 0 0 10px; font-weight: 600; font-size: 14.5px; }

/* ---- file upload ---- */
.file-field { border: 1.5px dashed var(--color-border); border-radius: var(--radius-md); padding: 16px; text-align: center; cursor: pointer; background: #FAFBFA; }
.file-field.has-file { border-style: solid; border-color: var(--color-primary); background: #F0F7F5; }
.file-field input[type="file"] { display: none; }
.file-field .file-label { font-size: 13.5px; color: var(--color-text-muted); }
.file-field .file-name { font-size: 13.5px; font-weight: 600; color: var(--color-primary); word-break: break-all; }
.file-field .file-icon { font-size: 22px; margin-bottom: 4px; display: block; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  border: none; cursor: pointer; font-family: var(--font-body); transition: transform .06s ease, opacity .15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--color-primary); border: 1.5px solid var(--color-border); }
.btn-block { width: 100%; }
.btn-accent { background: var(--color-accent); color: #2A2000; }
.btn-link { background: none; border: none; color: var(--color-primary); font-weight: 600; cursor: pointer; padding: 0; font-size: 14px; }

/* ---- bottom action bar (wizard) ---- */
.app-bottombar {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
}
.app-bottombar .btn { flex: 1; }

/* ---- auth screens ---- */
.auth-wrap { padding: 34px 22px 30px; }
.auth-tabs { display: flex; background: #EEF1EE; border-radius: 999px; padding: 4px; margin-bottom: 26px; }
.auth-tabs button {
  flex: 1; border: none; background: none; padding: 10px 0; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; color: var(--color-text-muted); cursor: pointer; font-family: var(--font-body);
}
.auth-tabs button.active { background: var(--color-primary); color: #fff; }
.auth-title { font-family: var(--font-display); font-size: 24px; margin: 0 0 6px; }
.auth-sub { color: var(--color-text-muted); font-size: 14px; margin: 0 0 26px; }
.auth-panel { display: none; }
.auth-panel.active { display: block; }

.otp-inputs { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.otp-inputs input {
  width: 44px; height: 52px; text-align: center; font-size: 20px; font-weight: 700;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); padding: 0;
}

.status-banner {
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13.5px; margin-bottom: 16px; display: none;
}
.status-banner.show { display: block; }
.status-banner.info { background: #EAF3F1; color: var(--color-primary-dark); }
.status-banner.error { background: #FBEAE9; color: var(--color-error); }
.status-banner.success { background: #E9F6ED; color: var(--color-success); }

/* ---- confirmation screen ---- */
.confirm-wrap { padding: 60px 26px; text-align: center; }
.confirm-icon {
  width: 76px; height: 76px; border-radius: 50%; background: var(--color-success);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 34px; margin: 0 auto 22px;
}
.confirm-title { font-family: var(--font-display); font-size: 24px; margin: 0 0 10px; }
.confirm-sub { color: var(--color-text-muted); font-size: 14.5px; line-height: 1.5; margin: 0 0 30px; }
.confirm-ref { background: #F0F4F1; border-radius: var(--radius-sm); padding: 12px; font-size: 13.5px; margin-bottom: 30px; }

/* ---- T&C box ---- */
.tc-box {
  border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px;
  max-height: 180px; overflow-y: auto; font-size: 12.5px; line-height: 1.55; color: var(--color-text-muted);
  background: #FAFBFA; margin-bottom: 12px;
}
.tc-box h4 { font-size: 13px; color: var(--color-text); margin: 12px 0 4px; }
.tc-box h4:first-child { margin-top: 0; }

/* ---- appearance (theme) panel ---- */
.theme-fab {
  position: fixed; right: 18px; bottom: 92px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-accent); color: #2A2000; border: none; box-shadow: 0 8px 20px rgba(0,0,0,.25);
  font-size: 20px; cursor: pointer; z-index: 40;
}
@media (min-width: 560px) { .theme-fab { right: calc(50% - (var(--shell-max-width) / 2) + 18px); } }
.theme-sheet {
  position: fixed; inset: 0; background: rgba(10,20,17,.45); z-index: 50; display: none; align-items: flex-end; justify-content: center;
}
.theme-sheet.open { display: flex; }
.theme-sheet .panel {
  background: var(--color-surface); width: 100%; max-width: var(--shell-max-width);
  border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto;
}
.theme-sheet h3 { font-family: var(--font-display); margin: 0 0 4px; font-size: 19px; }
.theme-sheet .sub { color: var(--color-text-muted); font-size: 13px; margin: 0 0 18px; }
.swatch-row { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.swatch-btn {
  border: 2px solid transparent; border-radius: 12px; padding: 8px 10px; cursor: pointer;
  background: #F0F1EF; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--color-text);
}
.swatch-btn .dots { display: flex; gap: 3px; }
.swatch-btn .dots span { width: 12px; height: 12px; border-radius: 50%; display: block; }
.swatch-btn.active { border-color: var(--color-primary); }
.color-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--color-border); }
.color-row:first-of-type { border-top: none; }
.color-row span { font-size: 14px; font-weight: 500; }
.color-row input[type="color"] { width: 40px; height: 32px; border: none; border-radius: 8px; padding: 0; background: none; cursor: pointer; }
.theme-sheet .actions { display: flex; gap: 10px; margin-top: 18px; }

.step-nav-hidden { display: none !important; }

/* ---- small helpers ---- */
.link-row { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--color-text-muted); }
.link-row .btn-link { margin-left: 4px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--color-text-muted); }
