/* UI POLISH V1: component geometry only; financial and Geo data are immutable. */
:root { --ui-header-height:132px; --ui-safe-top:env(safe-area-inset-top,0px); }
html { scroll-padding-top:calc(var(--ui-header-height) + 12px); }
header[data-native-header-root] { padding-top:var(--ui-safe-top); background:#fff!important; isolation:isolate; }
.dark header[data-native-header-root] { background:#020617!important; }
header[data-native-header-root] + div[aria-hidden="true"] { height:var(--ui-header-height)!important; }
main, main > *, .hr-home, .hr-home > *, [data-native-explorer-root] { min-width:0; }

#ui-mfo-grid { display:grid!important; grid-template-columns:minmax(0,1fr)!important; gap:20px!important; align-items:stretch; }
#ui-mfo-grid > article { min-width:0!important; }
#ui-mfo-grid .ca-mfo-card { min-width:0; height:100%; }
#ui-mfo-grid .ca-mfo-card__bank,
#ui-mfo-grid .ca-mfo-card__title { white-space:normal!important; overflow:visible!important; text-overflow:clip!important; overflow-wrap:anywhere; max-height:none!important; -webkit-line-clamp:unset!important; }
@media(min-width:768px) { #ui-mfo-grid { grid-template-columns:repeat(2,minmax(0,1fr))!important; } }
@media(min-width:1200px) { #ui-mfo-grid { grid-template-columns:repeat(3,minmax(0,1fr))!important; } }
/* A short landscape viewport remains a readable single phone column. */
@media(orientation:landscape) and (max-height:500px) and (max-width:1199px) { #ui-mfo-grid { grid-template-columns:minmax(0,1fr)!important; } }

.hr-calculator-main,.hr-calculator-market { min-width:0!important; }
/* All calculator breakpoints, field grids and result positions remain original. */

/* Existing currency grid, tile padding and typography remain original. */
.hr-home .hr-rate-change { font-size:11px!important; font-weight:700; line-height:1.4; white-space:nowrap; }
.hr-home .hr-rate-change--up { color:#08783c!important; }
.hr-home .hr-rate-change--down { color:#ba2636!important; }
.hr-home .hr-rate-change--flat { color:#536079!important; }
.dark .hr-home .hr-rate-change--up { color:#72e8a5!important; }
.dark .hr-home .hr-rate-change--down { color:#ff96a2!important; }
.dark .hr-home .hr-rate-change--flat { color:#b9c9e2!important; }
.hr-home .hr-rate-date,.hr-home .hr-rate-status { margin:8px 0 0; font-size:12px; line-height:1.5; color:var(--hr-muted,#59667e); }
.hr-home .hr-rate-status:empty { display:none; }

.ca-geo-dialog { max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); }
[data-native-details-overlay] { padding-bottom:max(12px,env(safe-area-inset-bottom,0px)); }
@media(min-width:1280px) { :root { --ui-header-height:64px; } }
@media(prefers-reduced-motion:reduce) { html { scroll-behavior:auto!important; } .vh-hero *, .hr-home *, [data-native-details-overlay] * { transition-duration:.01ms!important; animation-duration:.01ms!important; } }

/* Keep the approved grid and controls; align each row's inputs when captions wrap. */
.hr-home #main-calculator label:has(input[type="number"]) {
  align-self:stretch!important;
  grid-template-rows:minmax(min-content,1fr) auto!important;
}

/* V8_TELEGRAM_MOBILE_DETAILS_P0_FIX. Geometry only; Native data is unchanged. */
@media (max-width:767px), (max-width:1023px) and (max-height:500px) and (pointer:coarse) {
  html body header[data-native-header-root] { position:relative!important; inset:auto!important; }
  html body header[data-native-header-root] + div[aria-hidden="true"] { display:none!important; height:0!important; }
  html { scroll-padding-top:16px; }
  html body :is(#popular-offers,#home-calculator,#calculators) { scroll-margin-top:16px; }
}
html[data-native-details-open] { overflow:hidden!important; overscroll-behavior:none; }
html body [data-native-details-overlay][role="dialog"] {
  --native-modal-viewport-height:100vh;
  position:fixed!important; inset:0!important; top:var(--native-modal-top,0px)!important; bottom:auto!important;
  width:100%; height:var(--native-modal-height,var(--native-modal-viewport-height))!important;
  max-height:none!important; margin:0!important; padding:0!important;
  z-index:2147483647!important; isolation:isolate;
  display:flex!important; flex-direction:column!important; overflow:hidden!important;
  background:rgba(2,6,23,.64)!important;
  -webkit-backdrop-filter:blur(8px)!important; backdrop-filter:blur(8px)!important;
  overscroll-behavior:none;
}
@supports(height:100dvh) {
  html body [data-native-details-overlay][role="dialog"] { --native-modal-viewport-height:100dvh; }
}
html body [data-native-details-overlay][role="dialog"] > button {
  position:absolute!important; inset:0!important; width:100%; height:100%;
  background:transparent!important; border:0; z-index:0;
}
html body [data-native-details-overlay][role="dialog"] > [data-native-details-panel] {
  display:flex!important; flex-direction:column!important; flex:1 1 auto!important;
  position:relative; z-index:1; min-height:0!important; height:100%!important; max-height:100%!important;
  margin-top:0!important; margin-bottom:0!important; overflow:hidden!important;
  overscroll-behavior:none; scroll-padding-top:0; border-radius:0!important;
}
html body [data-native-details-overlay][role="dialog"] > [data-native-details-panel] > [data-native-details-header] {
  position:relative!important; top:auto!important; flex:0 0 auto!important;
  padding-top:max(16px,env(safe-area-inset-top,0px));
  padding-right:max(16px,env(safe-area-inset-right,0px));
  padding-left:max(16px,env(safe-area-inset-left,0px));
  border-top-left-radius:inherit; border-top-right-radius:inherit;
}
html body [data-native-details-overlay][role="dialog"] .native-details-close {
  width:44px!important; height:44px!important; min-width:44px; min-height:44px;
  display:grid; place-items:center; flex-shrink:0; touch-action:manipulation;
}
html body [data-native-details-overlay][role="dialog"] > [data-native-details-panel] > [data-native-details-body] {
  flex:1 1 auto!important; min-height:0!important; min-width:0;
  overflow-y:auto!important; overflow-x:hidden!important;
  overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  padding-bottom:max(12px,env(safe-area-inset-bottom,0px));
  scroll-padding-bottom:env(safe-area-inset-bottom,0px);
}
@media(min-width:768px) {
  html body [data-native-details-overlay][role="dialog"] { padding:20px!important; padding-top:max(20px,env(safe-area-inset-top,0px))!important; padding-bottom:max(20px,env(safe-area-inset-bottom,0px))!important; }
  html body [data-native-details-overlay][role="dialog"] > [data-native-details-panel] { border-radius:2rem!important; }
}

/* V8_MOBILE_DETAILS_COMPACT_V1 — mobile dialog composition only.
   The fullscreen backdrop, portal, visualViewport, scroll lock and desktop
   geometry remain the accepted P0 implementation. */
@media (max-width:767px) {
  html body [data-native-details-overlay][role="dialog"] {
    justify-content:center!important; align-items:center!important;
    padding:16px 12px!important;
    padding-top:max(16px,env(safe-area-inset-top,0px))!important;
    padding-bottom:max(16px,env(safe-area-inset-bottom,0px))!important;
    padding-left:max(12px,env(safe-area-inset-left,0px))!important;
    padding-right:max(12px,env(safe-area-inset-right,0px))!important;
  }
  html body [data-native-details-overlay][role="dialog"] > [data-native-details-panel] {
    flex:0 1 auto!important; width:100%!important; height:auto!important;
    max-height:90%!important; border-radius:24px!important;
  }
  html body [data-native-details-overlay][role="dialog"] > [data-native-details-panel] > [data-native-details-header] {
    gap:8px!important; padding:12px!important;
  }
  html body [data-native-details-overlay][role="dialog"] .native-details-heading { gap:10px!important; }
  html body [data-native-details-overlay][role="dialog"] .native-details-logo { width:40px!important; height:40px!important; flex:0 0 40px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-bank-name] { font-size:12px!important; line-height:16px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-title] { margin-top:2px!important; font-size:18px!important; line-height:22px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-secondary] { margin-top:3px!important; font-size:11px!important; line-height:15px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] { padding:10px!important; gap:12px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > * + * { margin-top:12px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child { padding:10px!important; border-radius:20px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid { gap:8px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl { padding:10px!important; border-radius:16px!important; min-height:0!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex { gap:8px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex > .grid { width:32px!important; height:32px!important; border-radius:12px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex > .min-w-0 > :first-child { font-size:12px!important; line-height:16px!important; letter-spacing:0!important; text-transform:none!important; text-wrap:balance!important; hyphens:auto!important; overflow-wrap:anywhere!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex > .min-w-0 > :nth-child(2) { margin-top:3px!important; font-size:18px!important; line-height:23px!important; text-wrap:balance!important; overflow-wrap:anywhere!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:not(:first-child) > button { padding:12px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:not(:first-child) > button > span:first-child { font-size:18px!important; line-height:24px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-body="mfo"] { padding:10px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="mfo"] { gap:12px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="mfo"] > main > section:first-child { padding:12px!important; }
}
@media (min-width:390px) and (max-width:767px) {
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex { display:grid!important; grid-template-columns:32px minmax(0,1fr)!important; gap:8px!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex > .min-w-0 { display:contents!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex > .min-w-0 > :first-child { grid-column:2!important; grid-row:1!important; align-self:center!important; }
  html body [data-native-details-overlay][role="dialog"] [data-native-details-grid="standard"] > div:first-child > section:first-child > .grid > .rounded-3xl > .flex > .min-w-0 > :nth-child(2) { grid-column:1 / -1!important; grid-row:2!important; margin-top:0!important; }
}
