/* FuelDash R103 — unified page, modal and control geometry. */
:root {
  --fd-r103-red: #ff3b30;
  --fd-r103-light-page: #f5f5f7;
  --fd-r103-light-surface: #ffffff;
  --fd-r103-light-control: #ececf0;
  --fd-r103-light-border: #d2d2d8;
  --fd-r103-light-text: #171719;
  --fd-r103-light-muted: #717178;
  --fd-r103-dark-page: #050505;
  --fd-r103-dark-surface: #141416;
  --fd-r103-dark-control: #242428;
  --fd-r103-dark-border: rgba(255,255,255,.11);
  --fd-r103-dark-text: #f7f7f8;
  --fd-r103-dark-muted: #99999f;
  --fd-r103-round-control: 40px;
  --fd-r103-control-height: 48px;
  --fd-r103-control-radius: 16px;
  --fd-r103-card-radius: 24px;
  --fd-r103-gap: 16px;
}

/* One uninterrupted page color, including overscroll and PWA edge areas. */
html[data-fd-theme="light"],
html[data-fd-theme="light"] body,
html[data-fd-theme="light"] #app,
html[data-fd-theme="light"] .fd-feature-page,
html[data-fd-theme="light"] .fd-feature-shell,
html[data-fd-theme="light"] .fd-feature-content,
html[data-fd-theme="light"] .fd-alert-modal,
html[data-fd-theme="light"] .fd-account-sheet {
  background-color: var(--fd-r103-light-page) !important;
  background-image: none !important;
}
html[data-fd-theme="dark"],
html[data-fd-theme="dark"] body,
html[data-fd-theme="dark"] #app,
html[data-fd-theme="dark"] .fd-feature-page,
html[data-fd-theme="dark"] .fd-feature-shell,
html[data-fd-theme="dark"] .fd-feature-content,
html[data-fd-theme="dark"] .fd-alert-modal,
html[data-fd-theme="dark"] .fd-account-sheet {
  background-color: var(--fd-r103-dark-page) !important;
  background-image: none !important;
}
html, body, #app { min-height: 100%; }
html[data-fd-theme] :where(body,#app,.fd-feature-page,.fd-feature-shell,.fd-feature-content,.fd-alert-modal,.fd-account-sheet)::before,
html[data-fd-theme] :where(body,#app,.fd-feature-page,.fd-feature-shell,.fd-feature-content,.fd-alert-modal,.fd-account-sheet)::after {
  content: none !important;
  display: none !important;
  background: none !important;
}

/* Feature pages: the heading is normal page content, never a clipped overlay. */
body.fd-feature-open { overflow: hidden !important; }
.fd-feature-page {
  position: fixed !important;
  inset: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
}
.fd-feature-shell {
  display: block !important;
  width: min(100%, 480px) !important;
  min-height: 100dvh !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 auto !important;
  padding: 0 0 calc(36px + env(safe-area-inset-bottom)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
.fd-feature-header {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  display: grid !important;
  grid-template-columns: minmax(0,1fr) var(--fd-r103-round-control) !important;
  align-items: start !important;
  gap: 14px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: calc(18px + env(safe-area-inset-top)) 20px 14px !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  transform: none !important;
}
.fd-feature-heading {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
}
.fd-feature-heading h1 { margin: 0 !important; }
.fd-feature-heading p { max-width: 360px; }
.fd-feature-back {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  display: grid !important;
  place-items: center !important;
  width: var(--fd-r103-round-control) !important;
  min-width: var(--fd-r103-round-control) !important;
  height: var(--fd-r103-round-control) !important;
  min-height: var(--fd-r103-round-control) !important;
  margin: 0 !important;
  padding: 10px !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  transform: none !important;
}
.fd-feature-back svg {
  display: block !important;
  width: 19px !important;
  height: 19px !important;
  margin: 0 !important;
  transform: none !important;
}
.fd-feature-content {
  display: flex !important;
  flex-direction: column !important;
  gap: var(--fd-r103-gap) !important;
  width: 100% !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  padding: 10px 20px 0 !important;
}
.fd-feature-content > section { margin: 0 !important; }

/* Compact round controls match the original Details geometry. */
:is(.fd-feature-back,.fd-alert-close,.fd-account-sheet__panel > header > button) {
  width: var(--fd-r103-round-control) !important;
  min-width: var(--fd-r103-round-control) !important;
  height: var(--fd-r103-round-control) !important;
  min-height: var(--fd-r103-round-control) !important;
  padding: 0 !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  box-shadow: inset 0 1px rgba(255,255,255,.06) !important;
  -webkit-tap-highlight-color: transparent !important;
}
html[data-fd-theme="light"] :is(.fd-feature-back,.fd-alert-close,.fd-account-sheet__panel > header > button) {
  border: 1px solid var(--fd-r103-light-border) !important;
  background: var(--fd-r103-light-control) !important;
  color: #55555c !important;
}
html[data-fd-theme="dark"] :is(.fd-feature-back,.fd-alert-close,.fd-account-sheet__panel > header > button) {
  border: 1px solid var(--fd-r103-dark-border) !important;
  background: var(--fd-r103-dark-control) !important;
  color: #f7f7f8 !important;
}
:is(.fd-feature-back,.fd-alert-close,.fd-account-sheet__panel > header > button):focus,
:is(.fd-feature-back,.fd-alert-close,.fd-account-sheet__panel > header > button):focus-visible {
  outline: none !important;
  box-shadow: inset 0 1px rgba(255,255,255,.06) !important;
}

/* Price alarms use the same ordinary-page header and card rhythm. */
.fd-alert-modal {
  position: fixed !important;
  inset: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom)) !important;
  overscroll-behavior-y: contain !important;
}
.fd-alert-sheet {
  width: min(100%, 480px) !important;
  margin: 0 auto !important;
  padding: 0 !important;
  overflow: visible !important;
}
.fd-alert-head {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  width: 100% !important;
  height: auto !important;
  box-sizing: border-box !important;
  padding: calc(18px + env(safe-area-inset-top)) 0 16px !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.fd-alert-close {
  display: grid !important;
  place-items: center !important;
  font-size: 0 !important;
  line-height: 0 !important;
  position: relative !important;
}
.fd-alert-close::before,
.fd-alert-close::after,
.fd-account-sheet__panel > header > button::before,
.fd-account-sheet__panel > header > button::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 18px !important;
  height: 2px !important;
  border-radius: 2px !important;
  background: currentColor !important;
  transform-origin: center !important;
}
.fd-alert-close::before,
.fd-account-sheet__panel > header > button::before { transform: translate(-50%,-50%) rotate(45deg) !important; }
.fd-alert-close::after,
.fd-account-sheet__panel > header > button::after { transform: translate(-50%,-50%) rotate(-45deg) !important; }
.fd-alert-grid { gap: 10px !important; }
.fd-alert-row,
.fd-alert-station,
.fd-alert-empty {
  min-width: 0 !important;
  border-radius: 18px !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.fd-alert-row :is(select,input[type="time"],input[type="number"]) {
  width: 112px !important;
  max-width: 112px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 12px !important;
  border-radius: 14px !important;
  box-sizing: border-box !important;
  text-align: center !important;
}
html[data-fd-theme="light"] .fd-alert-row,
html[data-fd-theme="light"] .fd-alert-station,
html[data-fd-theme="light"] .fd-alert-empty {
  border: 1px solid var(--fd-r103-light-border) !important;
  background: var(--fd-r103-light-surface) !important;
  color: var(--fd-r103-light-text) !important;
}
html[data-fd-theme="light"] .fd-alert-row :is(select,input[type="time"],input[type="number"]) {
  border: 1px solid var(--fd-r103-light-border) !important;
  background: var(--fd-r103-light-control) !important;
  color: var(--fd-r103-light-text) !important;
}
html[data-fd-theme="dark"] .fd-alert-row,
html[data-fd-theme="dark"] .fd-alert-station,
html[data-fd-theme="dark"] .fd-alert-empty {
  border: 1px solid var(--fd-r103-dark-border) !important;
  background: var(--fd-r103-dark-surface) !important;
  color: var(--fd-r103-dark-text) !important;
}
html[data-fd-theme="dark"] .fd-alert-row :is(select,input[type="time"],input[type="number"]) {
  border: 1px solid var(--fd-r103-dark-border) !important;
  background: var(--fd-r103-dark-control) !important;
  color: var(--fd-r103-dark-text) !important;
}
.fd-alert-actions { margin-bottom: 0 !important; padding-bottom: 0 !important; }
.fd-alert-note { padding-bottom: 4px !important; }

/* Account and recovery views are regular full-page overlays, not bottom sheets. */
body.fd-account-open { overflow: hidden !important; }
.fd-account-sheet {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483400 !important;
  display: block !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)) !important;
  box-sizing: border-box !important;
  opacity: 1 !important;
  transform: none !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
}
.fd-account-sheet__backdrop { display: none !important; }
.fd-account-sheet__panel {
  position: relative !important;
  inset: auto !important;
  width: min(100%, 448px) !important;
  max-width: 448px !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 auto !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  border-radius: var(--fd-r103-card-radius) !important;
  transform: none !important;
  box-shadow: none !important;
}
html[data-fd-theme="light"] .fd-account-sheet__panel {
  border: 1px solid var(--fd-r103-light-border) !important;
  background: var(--fd-r103-light-surface) !important;
  color: var(--fd-r103-light-text) !important;
}
html[data-fd-theme="dark"] .fd-account-sheet__panel {
  border: 1px solid var(--fd-r103-dark-border) !important;
  background: var(--fd-r103-dark-surface) !important;
  color: var(--fd-r103-dark-text) !important;
}
.fd-account-sheet__panel > header {
  position: static !important;
  top: auto !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
  margin: 0 0 18px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.fd-account-sheet__panel > header h2 {
  margin: 5px 0 0 !important;
  font-size: 24px !important;
  line-height: 1.1 !important;
  letter-spacing: -.45px !important;
}
.fd-account-sheet__panel > header > button {
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  flex: 0 0 var(--fd-r103-round-control) !important;
  font-size: 0 !important;
  line-height: 0 !important;
}
.fd-auth-switch {
  display: grid !important;
  grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  gap: 4px !important;
  height: 48px !important;
  padding: 4px !important;
  margin: 0 0 18px !important;
  border-radius: 16px !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
}
.fd-auth-switch button {
  min-width: 0 !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-weight: 650 !important;
  line-height: 1.1 !important;
  box-shadow: none !important;
}
html[data-fd-theme="light"] .fd-auth-switch { background: var(--fd-r103-light-control) !important; }
html[data-fd-theme="dark"] .fd-auth-switch { background: var(--fd-r103-dark-control) !important; }
.fd-auth-switch button.is-active { background: var(--fd-r103-red) !important; color: #fff !important; }
.fd-auth-form {
  display: grid !important;
  gap: 14px !important;
  width: 100% !important;
}
.fd-auth-form > label { display: grid !important; gap: 7px !important; margin: 0 !important; }
.fd-auth-form > label > span { font-size: 13px !important; font-weight: 650 !important; line-height: 1.2 !important; }
.fd-auth-form > label > small,
.fd-auth-explanation { margin: 0 !important; font-size: 12px !important; line-height: 1.45 !important; }
.fd-auth-form input {
  width: 100% !important;
  height: var(--fd-r103-control-height) !important;
  min-height: var(--fd-r103-control-height) !important;
  padding: 0 14px !important;
  border-radius: var(--fd-r103-control-radius) !important;
  box-sizing: border-box !important;
  font-size: 16px !important;
  box-shadow: none !important;
}
html[data-fd-theme="light"] .fd-auth-form input {
  border: 1px solid var(--fd-r103-light-border) !important;
  background: var(--fd-r103-light-control) !important;
  color: var(--fd-r103-light-text) !important;
}
html[data-fd-theme="dark"] .fd-auth-form input {
  border: 1px solid var(--fd-r103-dark-border) !important;
  background: var(--fd-r103-dark-control) !important;
  color: var(--fd-r103-dark-text) !important;
}
.fd-account-sheet :is(.fd-auth-primary,.fd-auth-secondary) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: var(--fd-r103-control-height) !important;
  min-height: var(--fd-r103-control-height) !important;
  padding: 0 16px !important;
  border-radius: var(--fd-r103-control-radius) !important;
  box-sizing: border-box !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  box-shadow: none !important;
}
.fd-account-sheet .fd-auth-primary {
  border: 1px solid var(--fd-r103-red) !important;
  background: var(--fd-r103-red) !important;
  color: #fff !important;
}
html[data-fd-theme="light"] .fd-account-sheet .fd-auth-secondary {
  border: 1px solid var(--fd-r103-light-border) !important;
  background: var(--fd-r103-light-control) !important;
  color: var(--fd-r103-light-text) !important;
}
html[data-fd-theme="dark"] .fd-account-sheet .fd-auth-secondary {
  border: 1px solid var(--fd-r103-dark-border) !important;
  background: var(--fd-r103-dark-control) !important;
  color: var(--fd-r103-dark-text) !important;
}
.fd-account-signed-in { display: grid !important; gap: 10px !important; }
.fd-account-signed-in h3 { margin: 0 !important; }
.fd-account-signed-in p { margin: 0 0 8px !important; font-size: 14px !important; line-height: 1.5 !important; }
.fd-account-avatar { width: 32px !important; height: 32px !important; display: grid !important; place-items: center !important; }
.fd-account-sheet .fd-auth-link {
  justify-self: start !important;
  min-height: 36px !important;
  padding: 4px 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--fd-r103-red) !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  box-shadow: none !important;
}
.fd-recovery-code { overflow-wrap: anywhere !important; word-break: break-word !important; }
.fd-recovery-confirm { align-items: flex-start !important; }

/* Backup controls keep their icons readable. */
.fd-backup-actions button {
  min-height: 72px !important;
  border-radius: var(--fd-r103-control-radius) !important;
  box-shadow: none !important;
}
.fd-backup-actions button span {
  display: block !important;
  font-size: 17px !important;
  line-height: 1 !important;
  font-weight: 780 !important;
}
.fd-backup-actions button:nth-child(3) span { font-size: 21px !important; }
.fd-backup-actions button strong { font-size: 12px !important; line-height: 1.15 !important; }

@media (max-width: 360px) {
  .fd-feature-header,
  .fd-feature-content { padding-left: 16px !important; padding-right: 16px !important; }
  .fd-account-sheet { padding-left: 12px !important; padding-right: 12px !important; }
  .fd-account-sheet__panel { padding: 16px !important; }
  .fd-alert-modal { padding-left: 12px !important; padding-right: 12px !important; }
}

/* Final specificity guards for controls previously sized by legacy repair layers. */
.fd-alert-head .fd-alert-close,
.fd-account-sheet__panel > header > button {
  width: var(--fd-r103-round-control) !important;
  min-width: var(--fd-r103-round-control) !important;
  max-width: var(--fd-r103-round-control) !important;
  height: var(--fd-r103-round-control) !important;
  min-height: var(--fd-r103-round-control) !important;
  max-height: var(--fd-r103-round-control) !important;
}
