.calculator {
  margin-bottom: clamp(20px, 3vw, 42px);
  padding: clamp(16px, 3.2vw, 34px);
  border: 1px solid #dce7dc;
  border-radius: 20px;
  background: #f4f8ef;
}
.calc-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.calc-header h2 { font-size: clamp(22px, 2.4vw, 31px); }
.calc-header p {
  max-width: 64ch;
  margin-top: 6px;
  color: #42594e;
  font-size: 14px;
  line-height: 1.5;
}
.calc-icon {
  display: grid;
  flex: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 11px;
  color: #12553b;
  background: #dfeee0;
}
.calc-icon .icon { width: 25px; height: 25px; }
.calc-form {
  display: grid;
  grid-template-columns: 1.15fr 1fr .8fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 20px;
}
.calc-field { min-width: 0; }
.calc-field label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 720; }
.calc-field input, .calc-field select, .calc-city-trigger {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #a9bcb1;
  border-radius: 8px;
  background: #fff;
  color: #183a2d;
  font: inherit;
  font-size: 16px;
}
.calc-field select { padding-inline-end: 22px; }
.calc-city-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  cursor: pointer;
  text-align: left;
}
#calc-city-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-city-trigger .icon { width: 16px; height: 16px; }
.calc-city-trigger[aria-invalid="true"] { border-color: #a73120; }
.calc-error { margin-top: 5px; color: #a73120; font-size: 13px; }
.calc-amount { position: relative; }
.calc-amount input { padding-right: 30px; }
.calc-amount span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: #3b5a4c; }
.calc-submit, .calc-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}
.calc-submit { background: #14633f; color: #fff; cursor: pointer; }
.calc-submit:hover { background: #0d5132; }
.calc-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  padding: clamp(14px, 2.1vw, 22px);
  border: 1px solid #d2e2d4;
  border-radius: 12px;
  background: #fff;
}
.calc-result[hidden] { display: none; }
.calc-result-summary { min-width: 0; }
.calc-result-summary:focus { scroll-margin-block: 15px; }
.calc-result-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 750; }
#calc-rate { border-radius: 12px; padding: 2px 8px; background: #fce7d6; color: #854013; }
#calc-cashback { display: block; color: #135939; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.14; margin-top: 5px; white-space: nowrap; }
.calc-euros { font-size: clamp(32px, 4vw, 42px); letter-spacing: -.03em; }
.calc-cents { font-size: clamp(21px, 2.6vw, 28px); color: #356750; font-weight: 720; }
.calc-currency { font-size: clamp(23px, 2.7vw, 29px); font-weight: 750; }
#calc-selection { margin-top: 4px; color: #42594e; font-size: 13px; line-height: 1.35; }
.calc-result-note { margin-top: 4px; color: #42594e; font-size: 12px; line-height: 1.4; }
.calc-download { background: #e7f2e5; color: #12583a; border-color: #b9d0bd; }
.calc-download:hover { background: #d7ead6; }

.calc-city-dialog {
  width: min(480px, calc(100% - 24px));
  max-height: min(670px, calc(100% - 24px));
  padding: 0;
  overflow: hidden;
}
.calc-city-panel { display: flex; flex-direction: column; max-height: inherit; padding: 19px; }
.calc-city-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.calc-city-dialog .calc-city-close {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: none;
  place-items: center;
  background: #edf5e9;
  color: #175439;
}
.calc-city-search {
  display: flex;
  align-items: center;
  min-height: 48px;
  flex: none;
  gap: 8px;
  margin-top: 10px;
  padding-inline: 11px;
  border: 1px solid #8fae99;
  border-radius: 9px;
  background: #f9fcf7;
  color: #315847;
}
.calc-city-search:focus-within { outline: 2px solid #176744; outline-offset: 2px; }
.calc-city-search input { width: 100%; min-width: 0; padding: 9px 0; border: 0; background: transparent; color: #183a2d; font: inherit; font-size: 16px; outline: 0; }
.calc-city-dialog #calc-city-status { margin: 12px 0 4px; color: #435f50; font-size: 13px; }
#calc-city-results {
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#calc-city-results li + li { border-top: 1px solid #e6ede4; }
.calc-city-dialog .calc-city-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 49px;
  padding: 7px 10px;
  border-radius: 6px;
  color: #173c2d;
  background: transparent;
  text-align: left;
  overflow-wrap: anywhere;
}
.calc-city-dialog .calc-city-option:is(:hover, :focus-visible) { background: #edf5e9; }
.calc-city-dialog .calc-city-option:focus-visible { outline-offset: -3px; }
.calc-city-option-name { font-weight: 730; }
.calc-city-option-region { color: #4b6255; font-size: 12px; font-weight: 500; }
.calc-city-dialog .calc-city-source { margin: 10px 0 0; color: #4b6255; font-size: 11px; line-height: 1.35; }
.calc-city-source a { text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 900px) {
  .calc-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calc-submit { grid-column: 1 / -1; }
}
@media (max-width: 500px) {
  .calculator { border-radius: 14px; }
  .calc-header { gap: 10px; }
  .calc-header p { font-size: 13px; }
  .calc-icon { width: 34px; height: 34px; border-radius: 8px; }
  .calc-icon .icon { width: 21px; height: 21px; }
  .calc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
  .calc-field:nth-child(3) { grid-column: 1 / -1; }
  .calc-download { width: 100%; }
}
@media (max-width: 600px) {
  .calc-city-dialog { inset: auto 0 0; width: 100%; max-width: none; max-height: min(650px, 81dvh); margin: 0; border-radius: 18px 18px 0 0; }
  .calc-city-panel { padding: 15px 16px max(15px, env(safe-area-inset-bottom)); }
}
