/* Local screen-fit repair: keep rules scoped to the reported car viewports.
   The AI renderer inserts its shared styles after page stylesheets; the
   overview ID keeps these viewport rules authoritative without changing data. */
@media (min-width:700px) and (max-width:900px) and (min-height:500px) and (max-height:820px) {
  /* Notifications retain their original fixed overlay sizing and behavior. */
  html body.rdg-tesla-ui #rdgAiOverview .rdg-region-ranking,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-flight-board,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-marine-board,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-board {
    flex:1 1 0!important;min-height:0!important;height:auto!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-marine-board {
    overflow-y:auto!important;position:relative!important;isolation:isolate;contain:paint;
  }

  /* Calendar: date/impact above a full-width, wrapping description. */
  html body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-event-pagehead {
    flex:0 0 auto!important;min-height:54px!important;height:auto!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-calendar-filters {
    flex:0 0 auto!important;min-height:44px!important;box-sizing:border-box!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-all-list {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-auto-rows:max-content!important;align-content:start!important;
    min-height:0!important;overflow-y:auto!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row {
    grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important;
    height:auto!important;min-height:0!important;align-content:start!important;padding:12px!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row>time {grid-column:1;grid-row:1;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row>small {grid-column:1/-1;grid-row:3;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row>em {grid-column:2;grid-row:1;align-self:start!important;font-size:13px!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row>div {grid-column:1/-1;grid-row:2;min-width:0!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row strong,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row span,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row small {
    white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
    overflow-wrap:anywhere!important;max-height:none!important;-webkit-line-clamp:unset!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row>div strong {font-size:17px!important;line-height:1.3!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row>div span,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-event-row small {font-size:12px!important;line-height:1.4!important;}

  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-status {
    grid-template-columns:48px minmax(0,1fr) 28px!important;min-height:60px!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-status-copy {min-width:0!important;padding:8px!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-status-copy b,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-status-copy span,
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-placeholder strong {
    white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-status-copy b {font-size:18px!important;line-height:1.3!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-status-copy span {font-size:10px!important;line-height:1.3!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-placeholders {
    left:14%!important;right:8%!important;gap:8px!important;height:44px!important;min-height:44px!important;
  }
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-placeholder {height:44px!important;min-width:0!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-placeholder-icon {width:25px!important;height:25px!important;flex-basis:25px!important;margin-left:6px!important;font-size:10px!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-placeholder strong {font-size:12px!important;line-height:1.2!important;}
  html body.rdg-tesla-ui #rdgAiOverview .rdg-local-offer-placeholder-arrow {width:18px!important;flex-basis:18px!important;margin-right:4px!important;font-size:16px!important;}
}

@media (min-width:700px) and (max-width:900px) and (min-height:500px) and (max-height:820px) {
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-hero {
    flex:0 0 auto!important;min-height:204px!important;height:auto!important;padding:8px 10px!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-hero>header {
    grid-template-columns:minmax(0,1fr) auto minmax(150px,.65fr)!important;min-height:34px!important;gap:8px!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-hero-types {
    flex:0 0 auto!important;min-height:54px!important;overflow:visible!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-region-type-labels {
    flex-wrap:wrap!important;max-height:none!important;overflow:visible!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-list>header,
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-list article {
    grid-template-columns:26px minmax(130px,1.35fr) 48px 56px 62px 30px minmax(140px,1fr)!important;
    column-gap:5px!important;padding:0 8px!important;min-width:0!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-list article {
    flex:0 0 auto!important;min-height:46px!important;padding-top:6px!important;padding-bottom:6px!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-row-name {
    font-size:14px!important;white-space:normal!important;overflow-wrap:anywhere!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-table-type {min-width:0!important;overflow:hidden!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-table-type>span {flex-wrap:wrap!important;white-space:normal!important;overflow:visible!important;}
}

/* Match the existing compact header typography on the 804px normal-density pane. */
@media (min-width:700px) and (max-width:900px) and (min-height:500px) and (max-height:820px) {
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead {flex:0 0 43px!important;min-height:0!important;padding:0 4px!important;gap:12px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead>div {gap:8px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead>div>strong {font-size:20px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead>div>span {font-size:9px!important;padding:4px 8px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead>b {font-size:14px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead>div>i {width:25px!important;height:25px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-tesla-region-pagehead .rdg-flow-tab-icon {width:15px!important;height:15px!important;}
}

/* 804px: match the accepted compact notification proportions, while keeping
   the original fixed overlay and leaving the 773px compact profile untouched. */
@media (min-width:700px) and (max-width:900px) and (min-height:500px) and (max-height:820px) {
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded {
    box-sizing:border-box!important;width:min(548px,calc(100vw - 80px))!important;
    min-height:0!important;border-width:2px!important;border-radius:12px!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-event-alert-copy {
    column-gap:12px!important;row-gap:5px!important;padding:8px 13px 51px!important;
  }
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-event-alert-copy>b {gap:6px!important;font-size:12px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-event-alert-copy>b>i {width:18px!important;height:18px!important;border-radius:5px!important;font-size:12px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-event-alert-copy>strong {font-size:26px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-event-alert-name {font-size:12px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded>a {right:12px!important;bottom:9px!important;min-width:93px!important;height:31px!important;min-height:31px!important;padding:0 10px!important;border-radius:7px!important;font-size:10px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-flight-alert-metric {gap:8px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-flight-alert-metric>strong {font-size:22px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-flight-alert-metric>span {font-size:14px!important;}
  html:not([data-rdg-tesla-density="compact"]) body.rdg-tesla-ui #rdgAiOverview .rdg-event-urgent-alert.is-expanded .rdg-flight-alert-companion {font-size:14px!important;}
}
