:root {
        color-scheme: dark;
        --bg: #0c0f14;
        --card: #151a22;
        --card2: #10151d;
        --text: #f4f6f8;
        --muted: #a8b0bc;
        --line: #293241;
        --good: #55d187;
        --bad: #ff6b6b;
        --warn: #ffc857;
        --accent: #72a7ff;
      }
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        background: var(--bg);
        color: var(--text);
        font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      }
      a {
        color: var(--accent);
      }
      header {
        position: sticky;
        top: 0;
        z-index: 10;
        border-bottom: 1px solid var(--line);
        background: rgba(12, 15, 20, 0.94);
        backdrop-filter: blur(10px);
      }
      .dash-header {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        justify-content: space-between;
        gap: 12px 20px;
      }
      .dash-header > div:first-child {
        min-width: 0;
      }
      .dash-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 10px;
        align-items: center;
      }
      .dash-nav a {
        color: var(--muted);
        text-decoration: none;
        font-size: 14px;
        font-weight: 650;
        padding: 8px 12px;
        border-radius: 10px;
        border: 1px solid transparent;
      }
      .dash-nav a:hover {
        color: var(--text);
        border-color: var(--line);
        background: var(--card2);
      }
      .dash-nav a.dash-nav-active {
        color: var(--text);
        border-color: var(--accent);
        background: rgba(114, 167, 255, 0.12);
      }
      .wrap {
        max-width: 1180px;
        margin: 0 auto;
        padding: 18px;
      }
      h1,
      h2,
      h3 {
        margin: 0;
      }
      h1 {
        font-size: 22px;
      }
      h2 {
        font-size: 18px;
        margin-bottom: 12px;
      }
      h3 {
        font-size: 16px;
      }
      .sub {
        color: var(--muted);
        font-size: 13px;
        margin-top: 4px;
      }
      .grid {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        gap: 14px;
      }
      .card {
        grid-column: span 12;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 16px;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
      }
      .half {
        grid-column: span 6;
      }
      .third {
        grid-column: span 4;
      }
      .row {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      }
      .row:last-child {
        border-bottom: 0;
      }
      .label {
        color: var(--muted);
      }
      .value {
        text-align: right;
        font-weight: 650;
      }
      .ok {
        color: var(--good);
      }
      .bad {
        color: var(--bad);
      }
      .warn {
        color: var(--warn);
      }
      .tesla-removed {
        border-color: rgba(255, 200, 87, 0.55);
      }
      .toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 12px;
      }
      .filters {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
        margin-bottom: 12px;
      }
      input,
      select,
      button {
        color: var(--text);
        background: var(--card2);
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 9px 10px;
        font: inherit;
      }
      input {
        width: min(100%, 360px);
      }
      button {
        cursor: pointer;
      }
      button:hover {
        border-color: var(--accent);
      }
      .cards {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 12px;
        margin-top: 8px;
      }
      .ios-group .cards {
        padding: 0 14px 14px;
      }
      /* Tile grid: stack photo above listing details (Auto Trader cards) */
      .cards > .vehicle {
        min-width: 0;
        overflow: hidden;
      }
      .cards > .vehicle .at-entry {
        grid-template-columns: minmax(0, 1fr);
      }
      .cards > .vehicle .at-entry-photo {
        width: 100%;
      }
      .cards > .empty {
        grid-column: 1 / -1;
      }
      .vehicle,
      .activity {
        background: var(--card2);
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 13px;
      }
      .vehicle-title {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        align-items: flex-start;
      }
      .price {
        font-size: 20px;
        font-weight: 800;
      }
      .meta {
        color: var(--muted);
        font-size: 13px;
        line-height: 1.45;
        margin-top: 6px;
      }
      .pill {
        display: inline-flex;
        gap: 4px;
        align-items: center;
        color: var(--muted);
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 999px;
        padding: 3px 8px;
        font-size: 12px;
        white-space: nowrap;
      }
      .status-pill {
        flex-shrink: 1;
        justify-content: center;
        max-width: 150px;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
      }
      .pill.ok {
        color: var(--good);
        border-color: rgba(85, 209, 135, 0.45);
      }
      .pill.bad {
        color: var(--bad);
        border-color: rgba(255, 107, 107, 0.5);
      }
      .actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin-top: 10px;
      }
      .btn-favorite {
        border: 1px solid rgba(255, 120, 160, 0.45);
        background: rgba(255, 80, 120, 0.12);
        color: #ffb8cc;
        border-radius: 8px;
        padding: 6px 12px;
        font-size: 0.9rem;
        cursor: pointer;
      }
      .btn-favorite:hover:not(:disabled) {
        background: rgba(255, 80, 120, 0.22);
      }
      .btn-favorite.is-favorite {
        border-color: rgba(85, 209, 135, 0.55);
        background: rgba(85, 209, 135, 0.18);
        color: #9ef0b8;
      }
      .btn-favorite:disabled {
        opacity: 0.65;
        cursor: wait;
      }
      .vehicle.at-card {
        min-width: 0;
        overflow: hidden;
      }
      .at-entry {
        display: grid;
        grid-template-columns: 118px minmax(0, 1fr);
        gap: 14px;
        align-items: start;
        width: 100%;
        min-width: 0;
      }
      .at-entry--no-photo {
        grid-template-columns: minmax(0, 1fr);
      }
      .at-entry-photo {
        width: 118px;
        aspect-ratio: 4 / 3;
        border-radius: 10px;
        overflow: hidden;
        background: rgba(0, 0, 0, 0.28);
        border: 1px solid var(--line);
      }
      .at-entry-photo-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
      }
      .at-entry-body {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
      }
      .at-entry-row-price {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        min-width: 0;
      }
      .at-entry-price,
      .at-entry-price-btn {
        margin: 0;
        padding: 0;
        font-size: 1.375rem;
        font-weight: 800;
        line-height: 1.2;
        color: var(--text);
        font-variant-numeric: tabular-nums;
        min-width: 0;
        word-break: break-word;
      }
      .at-entry-price-btn {
        background: none;
        border: none;
        cursor: pointer;
        text-align: left;
        text-decoration: underline;
        text-decoration-color: rgba(255, 255, 255, 0.25);
        text-underline-offset: 3px;
      }
      .at-entry-price-btn:hover {
        color: var(--accent);
      }
      .at-entry-pills {
        flex-shrink: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
        max-width: min(200px, 48%);
      }
      .at-entry-title {
        margin: 10px 0 0 0;
        padding: 0;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.35;
        color: var(--text);
        word-break: break-word;
      }
      .at-entry-sub {
        margin: 4px 0 0 0;
        padding: 0;
        font-size: 12px;
        color: var(--muted);
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        word-break: break-all;
      }
      .at-entry-meta {
        margin: 8px 0 0 0;
        padding: 0;
        font-size: 13px;
        line-height: 1.45;
        color: var(--muted);
        word-break: break-word;
      }
      p.at-entry-meta.warn {
        color: var(--warn);
      }
      .at-entry-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
      }
      @media (max-width: 520px) {
        .at-entry {
          grid-template-columns: 1fr;
        }
        .at-entry-photo {
          width: 100%;
          max-width: 220px;
        }
      }
      .empty {
        color: var(--muted);
        padding: 14px 0;
      }
      dialog {
        width: min(920px, calc(100vw - 24px));
        max-height: calc(100vh - 40px);
        overflow: auto;
        background: var(--card);
        color: var(--text);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 0;
      }
      dialog::backdrop {
        background: rgba(0, 0, 0, 0.7);
      }
      .modal-head {
        position: sticky;
        top: 0;
        background: var(--card);
        border-bottom: 1px solid var(--line);
        padding: 14px 16px;
        display: flex;
        justify-content: space-between;
        gap: 12px;
      }
      .modal-body {
        padding: 16px;
      }
      table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
      }
      th,
      td {
        text-align: left;
        padding: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        vertical-align: top;
      }
      th {
        color: var(--muted);
        font-weight: 650;
      }
      @media (max-width: 760px) {
        .half,
        .third {
          grid-column: span 12;
        }
        .toolbar {
          display: block;
        }
        .toolbar > * {
          margin-top: 8px;
        }
      }

      /* —— App shell: fixed top menu + page content —— */
      body.dash-app {
        padding-top: 0;
        padding-bottom: 24px;
      }
      body.dash-app header:not(.dash-top) {
        display: none;
      }
      .dash-top {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 30;
        border-bottom: 1px solid var(--line);
        background: rgba(12, 15, 20, 0.96);
        backdrop-filter: blur(12px);
        padding: 0;
      }
      .dash-top .wrap {
        padding-top: 12px;
        padding-bottom: 12px;
      }
      .dash-top-inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px 16px;
      }
      .dash-title {
        margin: 0;
        font-size: 22px;
        font-weight: 700;
        letter-spacing: -0.02em;
        flex-shrink: 0;
      }
      .dash-sub {
        margin: 4px 0 0;
        width: 100%;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.4;
      }
      .dash-top-inner .dash-sub {
        order: 3;
        flex-basis: 100%;
      }
      body.dash-app .dash-main {
        padding-top: calc(108px + env(safe-area-inset-top, 0px));
        padding-bottom: 24px;
      }
      body.dash-app.dash-has-subtitle .dash-main {
        padding-top: calc(132px + env(safe-area-inset-top, 0px));
      }
      @media (min-width: 760px) {
        .dash-title {
          font-size: 26px;
        }
        body.dash-app .dash-main {
          padding-top: calc(88px + env(safe-area-inset-top, 0px));
        }
        body.dash-app.dash-has-subtitle .dash-main {
          padding-top: calc(108px + env(safe-area-inset-top, 0px));
        }
      }
      .dash-footnote {
        margin: 12px 0 0;
        font-size: 13px;
        color: var(--muted);
        text-align: center;
      }
      .dash-top .dash-nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: 6px 8px;
        flex: 1;
        min-width: 0;
      }
      .dash-nav-link {
        color: var(--muted);
        text-decoration: none;
        font-size: 14px;
        font-weight: 650;
        padding: 8px 12px;
        border-radius: 10px;
        border: 1px solid transparent;
        white-space: nowrap;
      }
      .dash-nav-link:hover {
        color: var(--text);
        border-color: var(--line);
        background: var(--card2);
      }
      .dash-nav-link.dash-nav-active {
        color: var(--text);
        border-color: var(--accent);
        background: rgba(114, 167, 255, 0.12);
      }
      @media (max-width: 520px) {
        .dash-top-inner {
          flex-direction: column;
          align-items: stretch;
        }
        .dash-top .dash-nav {
          justify-content: flex-start;
          overflow-x: auto;
          flex-wrap: nowrap;
          padding-bottom: 2px;
          -webkit-overflow-scrolling: touch;
        }
      }

      /* iOS-style grouped sections */
      .ios-group {
        margin-bottom: 18px;
      }
      .ios-group-head {
        margin: 0 0 8px 4px;
        font-size: 13px;
        font-weight: 650;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
      }
      .ios-group-head-split {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
        text-transform: none;
        letter-spacing: 0;
        font-size: 15px;
        color: var(--text);
      }
      .ios-group-meta {
        font-size: 13px;
        font-weight: 500;
        color: var(--muted);
      }
      .ios-group-body {
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 14px;
        overflow: hidden;
      }
      .ios-group-body .row:last-child {
        border-bottom: 0;
      }
      .ios-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 11px 14px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        font-size: 14px;
      }
      .ios-row:last-child {
        border-bottom: 0;
      }
      .ios-row-label {
        color: var(--muted);
        flex-shrink: 0;
      }
      .ios-row-value {
        text-align: right;
        font-weight: 600;
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
      }
      .status-dot {
        font-size: 10px;
        line-height: 1;
      }
      .status-dot.ok {
        color: var(--good);
      }
      .status-dot.bad {
        color: var(--bad);
      }
      .readiness-banner {
        display: flex;
        gap: 12px;
        align-items: flex-start;
        padding: 14px;
      }
      .readiness-icon {
        font-size: 26px;
        line-height: 1;
      }
      .readiness-icon.ok {
        color: var(--good);
      }
      .readiness-icon.warn {
        color: var(--warn);
      }
      .readiness-icon.bad {
        color: var(--bad);
      }
      .readiness-title {
        font-size: 17px;
        font-weight: 700;
        margin: 0 0 4px;
      }
      .readiness-detail {
        margin: 0;
        font-size: 13px;
        color: var(--muted);
        line-height: 1.4;
      }
      .ios-group-body .btn-block,
      .ios-group-body .btn-primary,
      .ios-group-body .btn-danger {
        display: block;
        width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        text-align: center;
        font-weight: 650;
      }
      .ios-group-body .btn-block + .btn-block,
      .ios-group-body .btn-primary + .btn-danger {
        border-top: 1px solid var(--line);
      }
      .btn-primary {
        background: rgba(114, 167, 255, 0.15);
        border-color: rgba(114, 167, 255, 0.35);
        color: var(--accent);
      }
      .btn-danger {
        background: rgba(255, 107, 107, 0.1);
        border-color: rgba(255, 107, 107, 0.35);
        color: var(--bad);
      }
      .btn-block {
        background: var(--card2);
      }
      .job-heading {
        padding: 12px 14px 4px;
        font-size: 16px;
        font-weight: 700;
      }
      .job-note {
        padding: 0 14px 10px;
        font-size: 12px;
        color: var(--muted);
        line-height: 1.4;
      }
      .job-note.warn {
        color: var(--warn);
      }
      .filters-inset {
        padding: 12px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 8px;
        border: none;
        background: transparent;
      }
      .filters-inset input,
      .filters-inset select {
        width: 100%;
      }
      .filter-check {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 10px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--card2);
        font-size: 14px;
        grid-column: 1 / -1;
      }
      .filter-check input {
        width: auto;
      }
      .segmented {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        grid-column: 1 / -1;
      }
      .segmented-btn {
        flex: 1;
        min-width: 0;
        padding: 8px 10px;
        font-size: 12px;
        font-weight: 650;
        border-radius: 8px;
        background: var(--card2);
        border: 1px solid var(--line);
        color: var(--muted);
      }
      .segmented-btn.is-active {
        color: var(--text);
        border-color: var(--accent);
        background: rgba(114, 167, 255, 0.14);
      }
      .fav-note-block {
        margin-top: 10px;
        display: grid;
        gap: 6px;
      }
      .fav-note-label {
        font-size: 12px;
        font-weight: 600;
        color: var(--muted);
      }
      .fav-note-input {
        width: 100%;
        min-height: 56px;
        resize: vertical;
        padding: 8px 10px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--card2);
        color: var(--text);
        font: inherit;
        line-height: 1.35;
      }
      .fav-note-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
      }
      .fav-note-status {
        font-size: 12px;
        color: var(--muted);
      }
      .fav-note-status.ok {
        color: var(--ok, #3dd68c);
      }
      .fav-note-status.err {
        color: var(--warn);
      }
      .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
      }

      /* Single-column feeds (list style like iOS) */
      .ios-feed {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 8px;
      }
      .ios-feed .vehicle,
      .ios-feed .activity-row {
        margin: 0;
      }
      .ios-feed-activity {
        margin-top: 0;
        padding: 0 0 8px;
      }
      .activity-row {
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 12px 14px;
      }
      .activity-row-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 6px;
      }
      .activity-row-head h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 700;
        line-height: 1.3;
      }
      .activity-row-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
        flex-shrink: 0;
      }
      .activity-price-move {
        font-size: 15px;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
        margin: 4px 0;
      }
      .source-pill-ev {
        color: #72a7ff;
        border-color: rgba(114, 167, 255, 0.4);
      }
      .source-pill-tesla {
        color: #ff7b7b;
        border-color: rgba(255, 123, 123, 0.4);
      }
      .source-pill-at {
        color: #ffb347;
        border-color: rgba(255, 179, 71, 0.45);
      }
      #stackLog {
        margin: 0;
        padding: 10px 14px;
        font-size: 11px;
        line-height: 1.45;
        color: var(--muted);
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        white-space: pre-wrap;
        word-break: break-word;
        max-height: 120px;
        overflow: auto;
      }
