:root {
  --bg: #0B132B; --surface: #131D3B; --surface-2: #1A2650; --border: #24335F;
  --text: #EEF2FF; --muted: #94A3C4; --blue: #2563EB; --gold: #FDE047; --amber: #F59E0B;
  --green: #10B981; --red: #EF4444; --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent; padding-bottom: var(--safe-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
.hidden { display: none !important; }
.text-emerald { color: var(--green); }
.text-muted { color: var(--muted); }
.rate-zero { color: var(--gold); }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 50; padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-container { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-identity { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-weight: 800; font-size: 17px; }
.badge-247 { background: var(--amber); color: #111; font-size: 11px; padding: 1px 6px; border-radius: 6px; vertical-align: middle; }
.brand-sub { font-size: 11px; color: var(--muted); }
.btn-pwa-header { display: inline-flex; align-items: center; gap: 6px; background: var(--blue); padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }

/* Ticker */
.market-ticker-bar { overflow: hidden; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.ticker-inner { display: flex; gap: 14px; white-space: nowrap; padding: 8px 0; width: max-content; animation: ticker 28s linear infinite; }
.ticker-separator { opacity: .5; }
.dot-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 4px; box-shadow: 0 0 6px var(--green); }
@keyframes ticker { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker-inner { animation: none; padding-left: 16px; } }

.main-content { max-width: 760px; margin: 0 auto; padding: 16px; display: grid; gap: 20px; }
.section-title { font-size: 19px; font-weight: 800; }

/* Calculator */
.calculator-hero-card { background: linear-gradient(160deg, #1D4ED8 0%, var(--surface) 55%); border: 1px solid var(--border); border-radius: 20px; padding: 18px; display: grid; gap: 18px; }
.promo-pill { display: inline-flex; gap: 6px; align-items: center; background: rgba(253,224,71,.14); border: 1px solid rgba(253,224,71,.5); color: var(--gold); border-radius: 999px; padding: 6px 12px; font-size: 13px; margin-bottom: 10px; }
.hero-heading { font-size: 23px; line-height: 1.2; font-weight: 800; margin-bottom: 6px; }
.hero-desc { color: #C7D2FE; font-size: 14px; }
.calc-group { display: grid; gap: 8px; }
.calc-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.calc-label { color: var(--muted); font-size: 14px; }
.calc-value-display { font-size: 22px; font-weight: 800; }
.range-slider { width: 100%; height: 28px; accent-color: var(--gold); cursor: pointer; }
.slider-range-limits { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.amount-chip, .days-chip { background: var(--surface-2); border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.amount-chip.active, .days-chip.active { background: var(--gold); color: #111; border-color: var(--gold); font-weight: 700; }
.calc-result-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: rgba(0,0,0,.25); border-radius: 14px; padding: 12px; }
.result-metric { display: flex; flex-direction: column; gap: 2px; }
.res-label { font-size: 11px; color: var(--muted); }
.res-val { font-size: 16px; font-weight: 800; }

/* Multi-apply */
.multi-apply-banner { background: var(--surface); border: 1px dashed var(--amber); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.multi-apply-content { display: flex; gap: 10px; font-size: 13px; }
.multi-text { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.multi-text strong { color: var(--text); }
.multi-icon { font-size: 22px; }
.btn-multi-apply { display: flex; justify-content: center; align-items: center; gap: 6px; background: var(--amber); color: #111; font-weight: 700; padding: 12px; border-radius: 12px; }

/* Filters */
.offers-filter-section { display: grid; gap: 10px; }
.filter-header-row { display: flex; justify-content: space-between; align-items: center; }
.offers-count { font-size: 12px; color: var(--muted); background: var(--surface); padding: 4px 10px; border-radius: 999px; }
.filter-tabs-scrollable { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filter-tabs-scrollable::-webkit-scrollbar { display: none; }
.filter-tab { flex: 0 0 auto; background: var(--surface); border: 1px solid var(--border); padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.filter-tab.active { background: var(--blue); border-color: var(--blue); font-weight: 700; }

/* Offer cards */
.offers-list { display: grid; gap: 14px; }
.offer-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.offer-card.top-card { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(253,224,71,.25), 0 10px 30px -12px rgba(253,224,71,.35); }
.offer-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.offer-brand { display: flex; gap: 10px; align-items: center; }
.brand-avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-color); display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; }
.brand-title-wrap { display: flex; align-items: center; gap: 4px; }
.brand-name { font-size: 17px; font-weight: 800; }
.verified-icon { color: #60A5FA; display: inline-flex; }
.brand-rating { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.stars { color: var(--amber); letter-spacing: 1px; }
.rating-val { color: var(--text); font-weight: 700; }
.offer-tag { font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-align: center; max-width: 120px; }
.offer-tag.top { background: var(--gold); color: #111; }
.offer-tag.promo { background: rgba(236,72,153,.18); color: #F9A8D4; }
.offer-tag.success { background: rgba(16,185,129,.18); color: #6EE7B7; }
.offer-tag.fire { background: rgba(239,68,68,.18); color: #FCA5A5; }
.offer-tag.fast { background: rgba(37,99,235,.2); color: #93C5FD; }
.offer-metrics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.metric-item { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.metric-item.highlight { background: rgba(253,224,71,.1); border: 1px solid rgba(253,224,71,.4); }
.metric-label { font-size: 11px; color: var(--muted); }
.metric-value { font-size: 17px; font-weight: 800; }
.metric-sub { font-size: 10px; color: var(--muted); }
.trust-pills-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.pill-bankid { color: #93C5FD; }
.pill-diia { color: #fff; }
.diia-badge-sm { background: #000; color: #fff; border-radius: 4px; padding: 0 4px; font-weight: 800; }
.pill-success { color: #6EE7B7; }
.offer-calc-preview { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); background: rgba(0,0,0,.2); padding: 8px 10px; border-radius: 10px; }
.offer-calc-preview strong { color: var(--text); }
.badge-saving { flex: 0 0 auto; color: var(--green); font-weight: 700; font-size: 11px; }
.btn-cta {
  position: relative; display: grid; justify-items: center; text-decoration: none; padding: 12px 40px;
  border-radius: 14px; background: linear-gradient(180deg, #22C55E, #059669); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(16,185,129,.7); transition: transform .1s;
}
.btn-cta:active { transform: scale(.98); }
.btn-cta:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-text { font-size: 17px; font-weight: 800; }
.btn-subtext { font-size: 11px; opacity: .9; }
.btn-arrow { position: absolute; right: 16px; top: 50%; translate: 0 -50%; }

/* Accordions */
.legal-accordion, .faq-item { background: var(--surface-2); border-radius: 12px; }
.legal-summary, .faq-summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; font-size: 12px; color: var(--muted); }
.faq-summary { font-size: 14px; color: var(--text); font-weight: 600; padding: 14px; }
.legal-summary::-webkit-details-marker, .faq-summary::-webkit-details-marker { display: none; }
details[open] .acc-chevron, details[open] .faq-chevron { rotate: 180deg; }
.legal-accordion-content, .faq-content { padding: 0 12px 12px; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.faq-content { font-size: 14px; padding: 0 14px 14px; }
.faq-section { display: grid; gap: 8px; }

/* BankID / Steps */
.bankid-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.bankid-logos { display: flex; gap: 6px; margin-bottom: 8px; }
.logo-diia-pill { background: #000; border: 1px solid #fff; padding: 3px 10px; border-radius: 8px; font-weight: 800; }
.logo-bankid-pill { background: var(--blue); padding: 3px 10px; border-radius: 8px; font-weight: 800; }
.bankid-box h3 { font-size: 16px; }
.bankid-desc { font-size: 13px; color: var(--muted); }
.bankid-benefits-list { list-style: none; display: grid; gap: 8px; font-size: 13px; }
.bankid-benefits-list li { display: flex; gap: 8px; }
.check-icon { color: var(--green); font-weight: 800; }
.how-it-works-section { display: grid; gap: 12px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.step-number { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: #111; font-weight: 800; display: grid; place-items: center; margin-bottom: 8px; }
.step-card h4 { margin-bottom: 4px; }
.step-card p { font-size: 13px; color: var(--muted); }

/* Legal footer */
.app-legal-footer { border-top: 1px solid var(--border); background: #070D1F; margin-top: 24px; padding-bottom: 90px; }
.footer-container { max-width: 760px; margin: 0 auto; padding: 20px 16px; }
.legal-disclaimer-box { display: grid; gap: 12px; font-size: 12px; color: var(--muted); }
.legal-heading { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; }
.legal-text { display: grid; gap: 10px; }
.legal-consequences-list { padding-left: 18px; display: grid; gap: 6px; }
.legal-rates-block, .calculation-example-box, .aggregator-status-notice { background: var(--surface); border-radius: 10px; padding: 10px; display: grid; gap: 6px; }
.legal-rates-block { border-left: 3px solid var(--amber); }
.aggregator-status-notice { border-left: 3px solid var(--red); }
.legal-text strong { color: var(--text); }
.footer-bottom-copy { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.bank-logos-row { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-mini { border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px; font-size: 10px; }

/* Install banner */
.pwa-install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); z-index: 60;
  max-width: 560px; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); translate: 0 160%; transition: translate .3s ease;
}
.pwa-install-banner.visible { translate: 0 0; }
.install-banner-content { display: flex; gap: 10px; align-items: center; }
.install-app-icon { border-radius: 12px; }
.install-banner-text { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.install-banner-text strong { color: var(--text); font-size: 14px; }
.install-banner-actions { display: flex; gap: 4px; align-items: center; }
.btn-install-primary { background: var(--blue); padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; }
.btn-install-dismiss { padding: 8px; color: var(--muted); }

/* iOS modal */
.ios-modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.6); display: none; align-items: flex-end; justify-content: center; }
.ios-modal-backdrop.open { display: flex; }
.ios-modal-card { width: 100%; max-width: 480px; background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-bottom)); display: grid; gap: 14px; }
.ios-modal-header { display: flex; justify-content: space-between; align-items: center; }
.ios-modal-body { display: grid; gap: 12px; }
.ios-step { display: flex; gap: 12px; align-items: center; }
.ios-step-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: #60A5FA; flex: 0 0 auto; }
.ios-step-desc { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.ios-step-desc strong { color: var(--text); }
.btn-ios-close { padding: 6px; color: var(--muted); }
.btn-ios-done { background: var(--blue); padding: 12px; border-radius: 12px; font-weight: 700; }

/* Debug drawer */
.debug-floating-btn { position: fixed; right: 12px; bottom: calc(90px + var(--safe-bottom)); z-index: 55; background: #000; border: 1px solid var(--amber); color: var(--amber); padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.tracking-debug-drawer { position: fixed; inset: auto 0 0 0; z-index: 80; max-height: 70dvh; overflow: auto; background: #050A18; border-top: 2px solid var(--amber); padding: 16px 16px calc(16px + var(--safe-bottom)); translate: 0 100%; transition: translate .3s; font-size: 12px; }
.tracking-debug-drawer.open { translate: 0 0; }
.debug-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.btn-debug-close { padding: 6px; }
.debug-note { color: var(--muted); margin-bottom: 10px; }
.debug-params-list { display: grid; gap: 4px; font-family: ui-monospace, Menlo, monospace; }
.debug-param-row { display: flex; gap: 8px; }
.debug-param-key { color: var(--amber); }
.debug-param-val { word-break: break-all; }
.debug-preview-section { margin-top: 12px; display: grid; gap: 6px; }
.debug-link-code { font-family: ui-monospace, Menlo, monospace; background: var(--surface); padding: 8px; border-radius: 8px; word-break: break-all; color: #6EE7B7; }

/* Toast */
.app-toast { position: fixed; left: 50%; top: calc(70px + var(--safe-top)); translate: -50% -20px; opacity: 0; z-index: 90; background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; font-size: 13px; pointer-events: none; transition: opacity .25s, translate .25s; max-width: 90vw; text-align: center; }
.app-toast.visible { opacity: 1; translate: -50% 0; }

@media (min-width: 640px) {
  .offer-metrics-grid { grid-template-columns: repeat(4, 1fr); }
  .multi-apply-banner { grid-template-columns: 1fr auto; align-items: center; }
}

