/* FuelDash V383 — stable iOS viewport and isolated Tankbuch station picker. */

:root {
  --fd-tb-page: #000000;
  --fd-tb-card: #0c0c0c;
  --fd-tb-control: #080808;
  --fd-tb-border: #1e1e1e;
  --fd-tb-text: #f5f5f7;
  --fd-tb-muted: #a1a1a8;
  --fd-tb-accent: #ff3b30;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker,
html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker *,
.fd-tb-station-modal,
.fd-tb-station-modal * {
  box-sizing: border-box;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker {
  display: grid;
  grid-column: 1 / -1;
  gap: 7px;
  min-width: 0;
  width: 100%;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__label {
  color: var(--fd-r251-text, #f5f5f7);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 58px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--fd-tb-border);
  border-radius: 15px;
  background: var(--fd-tb-control);
  color: var(--fd-tb-text);
  font: inherit;
  text-align: left;
  touch-action: manipulation;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger:is(:hover, :focus-visible, .is-selected) {
  border-color: rgba(255, 59, 48, .68);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, .38);
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger :is(strong, small) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger strong {
  font-size: 14px;
  font-weight: 720;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger small {
  color: var(--fd-r251-help, #96969f);
  font-size: 11px;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__trigger i,
html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-location i,
html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-result i {
  color: rgba(255, 255, 255, .6);
  font-size: 23px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__clear {
  width: 46px;
  min-height: 58px;
  padding: 0;
  border: 1px solid var(--fd-tb-border);
  border-radius: 15px;
  background: var(--fd-tb-control);
  color: rgba(255, 255, 255, .72);
  font-size: 23px;
  line-height: 1;
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tb-station-picker__clear[hidden] {
  display: none;
}

html.fd-tb-station-modal-open,
html.fd-tb-station-modal-open body {
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

html.fd-tb-station-modal-open body {
  position: fixed !important;
  inset: 0 !important;
}

html.fd-tb-station-modal-open body :is(#app, .app-shell, .app-content) {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
}

html body .fd-feature-page.fd-tb-station-background-locked {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
}

html body .fd-tb-station-background-locked .fd-feature-content {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto !important;
  touch-action: none !important;
}

.fd-tb-station-modal {
  --fd-tb-viewport-top: 0px;
  --fd-tb-viewport-height: 100dvh;
  position: fixed;
  top: var(--fd-tb-viewport-top);
  right: 0;
  bottom: auto;
  left: 0;
  height: var(--fd-tb-viewport-height);
  z-index: 2147483400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding: max(calc(env(safe-area-inset-top, 0px) + 28px), 56px) 12px max(calc(env(safe-area-inset-bottom, 0px) + 12px), 16px);
  overscroll-behavior: none;
  touch-action: pan-y;
  isolation: isolate;
}

.fd-tb-station-modal[hidden] {
  display: none;
}

.fd-tb-station-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, .9);
}

.fd-tb-station-modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: min(calc(var(--fd-tb-viewport-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 88px), 720px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--fd-tb-border);
  border-radius: 22px;
  background: var(--fd-tb-page);
  box-shadow: none;
  color: var(--fd-tb-text);
}

.fd-tb-station-modal__panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--fd-tb-border);
  background: var(--fd-tb-page);
}

.fd-tb-station-modal__panel > header > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.fd-tb-station-modal__panel > header small {
  color: rgba(255, 255, 255, .46);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
}

.fd-tb-station-modal__panel > header h3 {
  margin: 0;
  color: var(--fd-tb-text);
  font-size: 19px;
  line-height: 1.2;
}

.fd-tb-station-modal__panel > header > button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--fd-tb-border);
  border-radius: 50%;
  background: var(--fd-tb-control);
  color: rgba(255, 255, 255, .75);
  font-size: 22px;
  line-height: 1;
}

.fd-tb-station-search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin: 12px 16px 0;
  padding: 0 12px;
  border: 1px solid var(--fd-tb-border);
  border-radius: 14px;
  background: var(--fd-tb-control);
}

.fd-tb-station-search-field:focus-within {
  border-color: var(--fd-tb-accent) !important;
  outline: 0 !important;
  box-shadow: inset 0 0 0 1px var(--fd-tb-accent) !important;
}

.fd-tb-station-search-field svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: rgba(255, 255, 255, .58);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.fd-tb-station-search-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fd-tb-text);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

html body .fd-tb-station-modal .fd-tb-station-search-field input,
.fd-tb-station-search-field input:is(:focus, :focus-visible) {
  border: 0 !important;
  outline: 0 !important;
  outline-offset: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

.fd-tb-station-search-field input::placeholder {
  color: rgba(255, 255, 255, .38);
}

.fd-tb-station-modal__body {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.fd-tb-station-location,
.fd-tb-station-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--fd-tb-border);
  border-radius: 15px;
  background: var(--fd-tb-control);
  color: var(--fd-tb-text);
  font: inherit;
  text-align: left;
}

.fd-tb-station-location:hover,
.fd-tb-station-location:focus-visible,
.fd-tb-station-result:hover,
.fd-tb-station-result:focus-visible,
.fd-tb-station-result.is-selected {
  border-color: rgba(255, 59, 48, .72);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, .34);
}

.fd-tb-station-location:disabled {
  opacity: .62;
}

.fd-tb-station-location svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #ff3b30;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.fd-tb-station-location > span,
.fd-tb-station-result > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.fd-tb-station-location :is(strong, small),
.fd-tb-station-result :is(strong, small, em) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-tb-station-location strong,
.fd-tb-station-result strong {
  font-size: 14px;
  font-weight: 720;
}

.fd-tb-station-location small,
.fd-tb-station-result small,
.fd-tb-station-result em {
  color: var(--fd-tb-muted);
  font-size: 11px;
  font-style: normal;
}

.fd-tb-station-result {
  grid-template-columns: minmax(0, 1fr) auto;
}

.fd-tb-station-result em {
  color: rgba(255, 59, 48, .78);
  font-size: 10px;
}

.fd-tb-station-section {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.fd-tb-station-section h4 {
  margin: 0;
  padding: 2px 2px 0;
  color: rgba(255, 255, 255, .46);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.fd-tb-station-section > div {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.fd-tb-station-status {
  min-height: 18px;
  margin: 0;
  padding: 2px;
  color: var(--fd-tb-muted);
  font-size: 11px;
  line-height: 1.4;
}

.fd-tb-station-status[data-type="searching"],
.fd-tb-station-status[data-type="locating"] {
  color: var(--fd-tb-text);
}

.fd-tb-station-status[data-type="error"] {
  color: #ff6961;
}

html[data-fd-theme] body #app .station-mini-map--location-status {
  display: grid;
  min-height: 144px;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 24px;
  border: 1px solid var(--fd-tb-border);
  border-radius: 18px;
  background: var(--fd-tb-card);
  color: var(--fd-tb-text);
  text-align: center;
}

html[data-fd-theme] body #app .station-mini-map--location-status small {
  max-width: 280px;
  color: #96969f;
  font-size: 12px;
  line-height: 1.4;
}

html[data-fd-theme] body #app .station-location-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: #ff3b30;
  border-radius: 50%;
  animation: fd-station-location-spin .8s linear infinite;
}

@keyframes fd-station-location-spin {
  to { transform: rotate(360deg); }
}

html[data-fd-theme] body .fd-feature-page[data-fd-feature-view="tankbook"] .fd-tank-history .fd-tank-list {
  max-height: clamp(260px, 52dvh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

@media (max-width: 520px) {
  .fd-tb-station-modal {
    align-items: flex-start;
    padding: max(calc(env(safe-area-inset-top, 0px) + 28px), 56px) 8px max(calc(env(safe-area-inset-bottom, 0px) + 8px), 12px);
  }

  .fd-tb-station-modal__panel {
    width: 100%;
    max-height: min(calc(var(--fd-tb-viewport-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 88px), 720px);
    border-radius: 22px;
  }
}
