    /* Core role: Main layout grid (top bar, tabs, sidebar, responsive zones). */
    /* TOP BAR */
    #topbar { display: flex; align-items: stretch; background: var(--surface-1); border-bottom: 1px solid var(--outline); height: 4.8rem; flex-shrink: 0; }
    .tb-logo { display: flex; align-items: center; gap: 0.8rem; padding: 0 2rem; border-right: 1px solid var(--outline); font-family: var(--font-label); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.12em; color: var(--color-primary); white-space: nowrap; }
    .tb-logo i { font-size: 1.8rem; }
    .tb-field { display: flex; flex-direction: column; justify-content: center; padding: 0 1.8rem; border-right: 1px solid var(--outline); }
    .tb-field .lbl { font-size: 1rem; font-family: var(--font-data); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-label); }
    .tb-field .val { font-family: var(--font-data); font-size: 1.3rem; color: var(--text-primary); margin-top: 1px; }
    .tb-field .val.teal  { color: var(--color-primary); }
    .tb-field .val.amber { color: var(--color-warning); }
    /* Scan-history picker — pushed to the far right of the bar. */
    .tb-field.tb-scan { margin-left: auto; }
    .scan-picker { position: relative; margin-top: 1px; }
    .scan-picker-btn { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--outline); border-radius: var(--radius-lg); font-family: var(--font-data); font-size: 1.2rem; padding: 0.3rem 0.8rem; cursor: pointer; display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
    .scan-picker-btn:hover { border-color: var(--color-primary); }
    .scan-picker-caret { font-size: 0.9rem; color: var(--text-secondary); margin-left: 1px; }
    .scan-picker-menu { position: absolute; top: calc(100% + 0.4rem); right: 0; background: var(--surface-1); border: 1px solid var(--outline); border-radius: var(--radius-lg); min-width: 30rem; box-shadow: 0 0.6rem 1.8rem rgba(0,0,0,0.5); z-index: 9999; overflow: hidden; }
    .scan-picker-row { display: flex; align-items: center; padding: 0.7rem 1rem; cursor: pointer; border-bottom: 1px solid var(--outline); gap: 1rem; }
    .scan-picker-row:last-child { border-bottom: none; }
    .scan-picker-row:hover { background: var(--surface-2); }
    .scan-picker-row.active { background: var(--color-primary-dim); }
    .scan-picker-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
    .scan-picker-num { font-family: var(--font-data); font-size: 1.2rem; color: var(--color-primary); }
    .scan-picker-detail { font-family: var(--font-data); font-size: 1.1rem; color: var(--text-secondary); }
    .scan-picker-del { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 0.3rem 0.5rem; border-radius: var(--radius-md); line-height: 1; flex-shrink: 0; }
    .scan-picker-del:hover { color: var(--color-negative); background: var(--color-negative-dim); }

    /* ── NAV (tabs now live inside #topbar) ── */
    .nav-tab { padding: 0 1.6rem; display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-label); font-weight: 500; font-size: 1.3rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); cursor: pointer; border-bottom: 0.2rem solid transparent; position: relative; top: 1px; transition: color var(--duration-short); user-select: none; }
    .nav-tab:hover { color: var(--text-primary); }
    .nav-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
    .nav-tab i { font-size: 1.6rem; }
    .nav-badge { font-size: 1rem; font-family: var(--font-data); background: var(--color-primary-dim); color: var(--color-primary); padding: 1px 0.5rem; border-radius: var(--radius-md); }
    .nav-badge.warn { background: var(--color-negative-dim); color: var(--color-negative); }

    /* ── NAV DROPDOWN (Universe → Map / Sectors) ──
       The parent .nav-tab is a non-clickable label; the menu opens on hover.
       Pure CSS :hover keeps a small invisible bridge so the cursor can travel
       from the label into the menu without the gap closing it. */
    .nav-dropdown { position: relative; }
    .nav-dd-caret { font-size: 1.2rem !important; opacity: 0.6; margin-left: -0.2rem; }
    .nav-dd-menu {
      position: absolute; top: 100%; left: 0; min-width: 15rem; z-index: 50;
      background: var(--surface-1); border: 1px solid var(--outline); border-top: none;
      box-shadow: 0 0.6rem 1.6rem rgba(0,0,0,0.4);
      display: none; flex-direction: column; padding: 0.4rem 0;
    }
    .nav-dropdown:hover .nav-dd-menu { display: flex; }
    .nav-dd-item {
      display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 1.4rem;
      font-family: var(--font-label); font-size: 1.2rem; letter-spacing: 0.06em;
      text-transform: uppercase; color: var(--text-secondary); cursor: pointer;
      white-space: nowrap; transition: background var(--duration-short), color var(--duration-short);
    }
    .nav-dd-item:hover { background: var(--surface-0); color: var(--color-primary); }
    .nav-dd-item i { font-size: 1.5rem; }

    /* ── MAIN AREA ── */
    #main { display: flex; flex: 1; overflow: hidden; }

    /* ── SIDEBAR ── */
    #sidebar { width: 19rem; background: var(--surface-1); border-right: 1px solid var(--outline); padding: 1rem 0; overflow-y: auto; flex-shrink: 0; }
    .sb-heading { font-size: 1rem; font-family: var(--font-data); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-label); padding: 0.8rem 1.4rem 0.3rem; }
    /* Back button — sits right-justified on the Views heading row, revealed only
       after a cross-tab jump (pilot/ship/station link). Sheared parallelogram +
       burnt-orange (matches the scrubber accent) with bright text, for a HUD feel. */
    .nav-back-btn { font-family: var(--font-label); font-weight: 700; font-size: 1rem;
                    letter-spacing: 0.12em; text-transform: uppercase; color: #ffe9d6;
                    background: #d4540a; border: none; padding: 0.3rem 1rem 0.3rem 1.1rem; cursor: pointer;
                    clip-path: polygon(0.7rem 0, 100% 0, calc(100% - 0.7rem) 100%, 0 100%);
                    transition: background var(--duration-short), color var(--duration-short); }
    .nav-back-btn:hover  { background: #ff6f1a; color: #fff; }
    .nav-back-btn:active { background: #b8470a; }
    .sb-item { display: flex; align-items: center; gap: 0.7rem; justify-content: space-between; padding: 0.6rem 1.4rem; font-size: 1.2rem; font-family: var(--font-label); letter-spacing: 0.03em; color: var(--text-secondary); cursor: pointer; border-left: 0.2rem solid transparent; transition: background 0.1s, color 0.1s; }
    .sb-item:hover { background: var(--surface-2); color: var(--text-primary); }
    .sb-item.active { background: var(--color-primary-dim); color: var(--color-primary); border-left-color: var(--color-primary); }
    .sb-item.warn { color: var(--color-negative); }
    .sb-item-label { display: flex; align-items: center; gap: 0.7rem; }
    .sb-item i { font-size: 1.5rem; flex-shrink: 0; }
    .sb-item .sb-count { font-family: var(--font-data); font-size: 1rem; color: var(--text-label); margin-left: auto; }
    .sb-item.warn .sb-count { color: rgba(248,81,73,0.5); }
    .sb-divider { border: none; border-top: 1px solid var(--outline); margin: 0.6rem 0; }

    /* ── RESOURCE LIBRARY FLYOUT ──
       Hover-driven, same convention as the topbar's nav-dropdown (the label
       itself isn't clickable; the menu opens/closes purely via :hover). The
       menu is position:fixed with its top/left set in JS (resource-library.js'
       positionReslibMenu(), called on mouseenter) rather than the usual
       absolute+left:100% trick, because #sidebar has overflow-y:auto -- an
       absolutely-positioned descendant overflowing the sidebar's box gets
       clipped by that overflow instead of floating over #content. Plain
       overflow:auto does NOT clip a position:fixed descendant, so this escapes
       it entirely. It stays flush against the sidebar item (left = its right
       edge, top = its top edge, zero gap) so the cursor can travel from the
       label straight into the menu without crossing a dead zone that would
       drop the :hover state early. */
    .reslib-wrap { position: relative; }
    /* Keeps the trigger lit (same teal-accent look as .sb-item.active) for as
       long as .reslib-wrap is hovered, not just while the cursor sits on the
       sb-item itself — without this, the trigger reverts to its plain look
       the instant the cursor moves onto the (fixed-position, visually
       separate) menu, making the menu read as an unrelated floating panel
       instead of this item's submenu. */
    .reslib-wrap:hover .sb-item { background: var(--color-primary-dim); color: var(--color-primary); border-left-color: var(--color-primary); }
    .reslib-menu {
      display: none; flex-direction: column; padding: 0.4rem 0;
      position: fixed; min-width: 16rem; z-index: 200;
      background: var(--surface-1); border: 1px solid var(--outline); border-left: 0.2rem solid var(--color-primary);
      box-shadow: 0 0.6rem 1.6rem rgba(0,0,0,0.4);
    }
    .reslib-wrap:hover .reslib-menu { display: flex; }
    .reslib-menu-item {
      display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 1.4rem;
      font-family: var(--font-label); font-size: 1.2rem; letter-spacing: 0.03em;
      color: var(--text-secondary); cursor: pointer; white-space: nowrap;
      transition: background var(--duration-short), color var(--duration-short);
    }
    .reslib-menu-item:hover { background: var(--surface-2); color: var(--color-primary); }
    .reslib-menu-item i { font-size: 1.5rem; flex-shrink: 0; }

    /* ── RESOURCE LIBRARY HEADER ──
       Hulls only: the "Hull Inspector" tab (.fleet-subtab, reused from
       fleet-designs.css) stays dim and unclickable until a hull's actually
       been opened — there's nothing to inspect yet. */
    .fleet-subtab.disabled { opacity: 0.35; cursor: default; pointer-events: none; }
    /* Faction/Size/Type filter row under the Hull List/Inspector tabs.
       Each select mirrors .bhull's look (fleet-designs.css) so it reads as
       the same control language as the rest of the app rather than a bare
       OS dropdown. */
    .reslib-filters { display: flex; gap: 0.8rem; margin: 0.8rem 0; flex-wrap: wrap; }
    .reslib-fbox { border: 1px solid var(--outline); border-radius: var(--radius-md); background: var(--surface-1); padding: 0.4rem 0.8rem; max-width: 30rem; width: 100%; }
    .reslib-fbox select { background: var(--surface-1); border: none; color: var(--text-primary); font-family: var(--font-label); font-size: 1.3rem; cursor: pointer; width: 100%; }
    .reslib-fbox select:focus { outline: none; }

    /* Hull Inspector — collapsed-by-default "N Size Slot Hardpoints" sub-card
       per mount size (.dsub-box base styling from fleet-designs.css; this is
       just the <details>/<summary> collapse behaviour on top of it, same
       hide-default-marker + rotating-chevron idiom as .dcard). Catalogued
       equipment for that size only renders once expanded — with a dozen+
       items per size on some hulls, showing them all inline by default made
       the page unreadable. */
    .reslib-hpcard > .dsub-hd { cursor: pointer; user-select: none; list-style: none; }
    .reslib-hpcard > .dsub-hd::-webkit-details-marker { display: none; }
    .reslib-hp-title { font-family: var(--font-label); font-size: 1.2rem; color: var(--text-primary); }
    .reslib-hp-chev { margin-left: auto; flex-shrink: 0; font-size: 1.3rem; color: var(--text-label); transition: transform var(--duration-short); transform: rotate(-90deg); }
    .reslib-hpcard[open] .reslib-hp-chev { transform: rotate(0deg); }
    .reslib-hpcard[open] > .dsub-hd { margin-bottom: 0.3rem; }
    .reslib-hp-body { padding-top: 0.2rem; }

    /* ── CONTENT ── */
    #content { flex: 1; overflow-y: auto; padding: 1.4rem; display: flex; flex-direction: column; gap: 1.2rem; }

    /* ── TABS ── */
    .tab-panel { display: none; flex-direction: column; gap: 1.2rem; }
    .tab-panel.active { display: flex; }

    /* ── SCAN STATUS CARD ── */
    /* Same look as the existing .card/.panel components - background, border,
       and radius reused from shared-ui.css rather than redeclared. */
    .scan-status-card { background: var(--surface-2); border: 1px solid var(--outline); border-radius: var(--radius-md); padding: 1.4rem 1.6rem; }
    .scan-status-idle { display: flex; align-items: center; gap: 1rem; font-family: var(--font-label); font-size: 1.4rem; color: var(--text-secondary); }
    .scan-status-idle i { font-size: 1.8rem; color: var(--color-primary); }

    /* ── SCAN PROGRESS ── */
    /* Four segments, one per pipeline stage. A segment is "done" (solid
       green) once its stage has passed, "active" (dim green track + a
       sweeping highlight) while its stage is running - there's no finer
       progress within a stage, so the sweep just signals "still working"
       rather than showing real percent-complete. */
    .scan-progress { display: flex; gap: 0.6rem; }
    .scan-progress-seg { flex: 1; display: flex; flex-direction: column; gap: 0.6rem; }
    .scan-progress-fill { height: 0.6rem; border-radius: var(--radius-md); background: rgba(255,255,255,0.06); overflow: hidden; position: relative; transition: background var(--duration-medium); }
    .scan-progress-seg.done .scan-progress-fill { background: var(--color-positive); }
    .scan-progress-seg.active .scan-progress-fill { background: var(--color-positive-dim); }
    .scan-progress-seg.active .scan-progress-fill::after {
      content: ""; position: absolute; inset: 0; width: 40%; border-radius: var(--radius-md);
      background: var(--color-positive); animation: scan-progress-sweep 1.1s ease-in-out infinite;
    }
    @keyframes scan-progress-sweep {
      0%   { transform: translateX(-100%); }
      100% { transform: translateX(350%); }
    }
    .scan-progress-label { font-family: var(--font-data); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); transition: color var(--duration-medium); }
    .scan-progress-seg.active .scan-progress-label,
    .scan-progress-seg.done .scan-progress-label { color: var(--color-positive); }

    /* ──────────────────────────────────────────────────────────────────────
       RESPONSIVE BREAKPOINTS

       The UI no longer zooms with window width (see js/init.js) — 1rem is a
       fixed 10px everywhere, so the design holds its intended density and the
       extra room on big monitors is handled by #shell's max-width cap
       (base.css). What's left is making the layout *reflow* on smaller windows
       (small laptops, half-screen splits, tablets). We keep this deliberately
       simple — one narrow breakpoint, all the overrides in one place — rather
       than scattering @media rules across every feature stylesheet.

       Note for later: a media query reacts to the whole viewport, so a rule
       here can't tell that #content is already ~190px narrower than the window
       because of the sidebar. Container queries (which react to #content's own
       width) would be the more precise tool for the content-grid reflows below
       and are worth adopting if these thresholds ever feel off — media queries
       are just the simpler first pass.

       Breakpoints are width-based:
         • > 1000px  → base / wide. Side-by-side master-detail, multi-column
                       grids. Wide screens get more columns for free from the
                       auto-fit grids (.cards-row in shared-ui.css, .sd-grid in
                       sectors.css) up to the #shell cap.
         • ≤ 1000px  → narrow. Stack master-detail panes, collapse the fixed
                       two-column grids to one column, trim the sidebar, and let
                       the (nowrap) topbar scroll instead of overflowing.
       ────────────────────────────────────────────────────────────────────── */
    @media (max-width: 1000px) {
      /* Topbar has many nowrap items (logo, fields, every nav tab); let it
         scroll sideways rather than spilling out of the shell. */
      #topbar { overflow-x: auto; }

      /* Reclaim a little width from the sidebar. We keep it visible (never
         display:none) because Ship Builder and the Resource Library are only
         reachable from it — hiding it would strand those views. */
      #sidebar { width: 16rem; }

      /* Crew master-detail: roster stacks above the dossier. Cap the roster so
         it can't push the file pane off-screen; both scroll internally. */
      .crew-layout { flex-direction: column; }
      .crew-roster { flex: 0 0 auto; max-height: 45vh; }
      .crew-file   { flex: 1 1 auto; min-height: 24rem; }

      /* Sectors master-detail: cluster list stacks above the sector card. */
      #tab-sectors  { flex-direction: column; }
      #sectors-left { width: auto; max-height: 38vh; border-right: none; border-bottom: 1px solid var(--outline); }

      /* Fixed two-column grids collapse to a single column so their content
         isn't crushed. Covers the blueprint builder's master-detail (.btwo),
         the generic .two-col helper, and the ship-design card's body/footer. */
      .btwo,
      .two-col,
      .dcard-body,
      .dcard-footer { grid-template-columns: 1fr; }
    }

