/* The application shell: the grid that holds the banner, the top bar, the view and the
   assistant; the top bar; the sign-in page. */

.ds-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
}
.ds-app > .rw-banner { grid-row: 1; grid-column: 1 / -1; }
.ds-topbar { grid-row: 2; grid-column: 1 / -1; }
.ds-main { grid-row: 3; grid-column: 1; position: relative; min-width: 0; min-height: 0; overflow: hidden; }

/* At 80rem and wider the assistant pushes the page (guide 9b). */
.ds-app-pushed { grid-template-columns: minmax(0, 1fr) var(--ds-assistant-width, 25rem); }

/* ── The workspace ground ───────────────────────────────────────────────── */
/* Every page that is not a map sits on a soft wash: one corner of the ground a little lighter,
   with a trace of the brand blue, so the dark page has some depth. The shell puts it ahead of the
   page (shell.js, wash) wherever theme.js gives the page a ground; a map page keeps the map's own.
   It stays put while the page scrolls, and panels keep their own ground for reading. Not on a
   phone: there is no open ground beside the text there. The layer has no z-index, and the page
   after it is positioned without one, so the page paints over the layer in tree order and makes
   no stacking context: its menus and drawers rise as before. Each workspace lights its own corner
   on the right edge, the top unless it has its own. */
.ds-wash { display: none; --ds-wash-at: 0%; }
@media (min-width: 48rem) {
  .ds-wash {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      radial-gradient(ellipse 60% 75% at 100% var(--ds-wash-at), color-mix(in srgb, var(--rw-brand-110) var(--ds-wash-blue), transparent), transparent 70%),
      radial-gradient(ellipse 85% 100% at 100% var(--ds-wash-at), color-mix(in srgb, var(--rw-text-primary) var(--ds-wash-shade), transparent), transparent 80%);
    transform-origin: 100% var(--ds-wash-at);
    animation: ds-wash-in 900ms cubic-bezier(.2, .7, .2, 1) both;
  }
  .ds-wash + * { position: relative; }
}
/* The wash's strength. On the dark ground: the brand blue and a little of the text color, for
   depth. On the light ground, which has depth from its white panels already: half the blue and no
   shade, which there would read as a gray smudge. */
:root { --ds-wash-blue: 8%; --ds-wash-shade: 0%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ds-wash-blue: 16%; --ds-wash-shade: 5%; }
}
:root[data-theme="dark"], :root[data-theme="clinical"], .ds-chrome, .ds-dark { --ds-wash-blue: 16%; --ds-wash-shade: 5%; }
.ds-wash[data-ground="fleet"] { --ds-wash-at: 20%; }
.ds-wash[data-ground="proposals"] { --ds-wash-at: 35%; }
.ds-wash[data-ground="drones"] { --ds-wash-at: 50%; }
.ds-wash[data-ground="organization"] { --ds-wash-at: 65%; }
.ds-wash[data-ground="cases"] { --ds-wash-at: 85%; }
/* It fades up and settles, then holds still. The shell makes a new layer when the workspace
   changes (its key), and when a workspace comes back from a map page (Fleet's Map or Missions), so
   this one animation plays each time. */
@keyframes ds-wash-in { from { opacity: 0; transform: translateX(var(--rw-space-6x)) scale(1.03); } }
/* After the rule it undoes, which is as specific. */
@media (prefers-reduced-motion: reduce) {
  .ds-wash { animation: none; }
}

/* ── Top bar ────────────────────────────────────────────────────────────── */
.ds-topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--rw-space-4x);
  height: var(--rw-space-12x);
  padding: 0 var(--rw-space-3x) 0 var(--rw-space-4x);
  background: var(--rw-bg-content);
  border-bottom: 1px solid var(--rw-divider);
}
.ds-product { flex-shrink: 0; color: var(--rw-text-primary); font-size: var(--rw-body-md-size); font-weight: var(--rw-heading-weight); text-decoration: none; white-space: nowrap; }
.ds-site { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); font-weight: 600; white-space: nowrap; }

.ds-topnav { align-self: stretch; flex-shrink: 0; gap: var(--rw-space-6x); margin-inline-start: var(--rw-space-2x); border-bottom: 0; overflow: visible; }
.ds-topnav > .rw-tab { min-width: 0; min-height: 0; }
.ds-topnav-split { margin-inline-start: var(--rw-space-6x); }
.ds-topnav-split::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(-0.5 * (var(--rw-space-6x) + var(--rw-space-1x)));
  inset-block: var(--rw-space-3x);
  width: 1px;
  background: var(--rw-divider);
}

/* The end of the bar takes the room the start leaves, and its parts give way by that room
   (container queries below), whoever is signed in and however many tabs they have. */
.ds-topbar-end { display: flex; flex: 1 1 0; align-items: center; justify-content: safe flex-end; gap: var(--rw-space-1x); min-width: 0; container-type: inline-size; }
.ds-topbar-end > * { flex-shrink: 0; }
.ds-topbar-end > .rw-btn { flex-shrink: 0; }

/* The bar's tabs and buttons must read as things to click (Redwood's tabs only brighten their
   label on hover, which people missed): a rounded fill behind the label on hover and keyboard
   focus, a faint underline preview on hover, and Redwood's 3px underline on the selected tab.
   The fill is the stronger overlay, because the plain one barely shows on the dark bar. */
.ds-topnav { gap: var(--rw-space-1x); }
.ds-topnav > .rw-tab { padding-inline: var(--rw-space-3x); transition: color 120ms ease, border-color 120ms ease; }
.ds-topnav > .rw-tab::after {
  content: "";
  position: absolute;
  inset: var(--rw-space-2x) 0;
  border-radius: var(--rw-radius-md);
  background-color: transparent;
  outline: none;
  pointer-events: none;
  transition: background-color 120ms ease;
}
.ds-topnav > .rw-tab:hover::after,
.ds-topnav > .rw-tab:focus-visible::after,
.ds-topnav > .rw-tab:active::after { background-color: var(--rw-bg-active); }
.ds-topnav > .rw-tab:hover:not(.rw-selected) { border-bottom-color: var(--rw-text-secondary); }
.ds-topnav > .rw-tab:focus-visible::after { outline: 2px solid var(--rw-text-primary); outline-offset: 0; }
.ds-topbar .rw-btn-borderless:hover,
.ds-topbar .rw-btn-borderless:focus-visible { background-image: linear-gradient(var(--rw-bg-active), var(--rw-bg-active)); }
@media (prefers-reduced-motion: reduce) {
  .ds-topnav > .rw-tab, .ds-topnav > .rw-tab::after { transition: none; }
}

.ds-status { display: flex; align-items: center; gap: var(--rw-space-4x); min-width: 0; margin-inline-end: var(--rw-space-3x); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); white-space: nowrap; }
.ds-status > .ds-state { color: var(--rw-text-primary); font-weight: 600; }
.ds-status-age { color: var(--rw-text-secondary); font-weight: 400; }
.ds-status-item strong, .ds-status-item .ds-num { color: var(--rw-text-primary); }
.ds-status-clock { color: var(--rw-text-primary); }
.ds-status-sensors > .rw-btn { padding-inline: var(--rw-space-2x); font-weight: 400; color: var(--rw-text-secondary); }
.ds-status-sensors > .rw-btn .ds-num { color: var(--rw-text-primary); }
.ds-status-sensors > .rw-btn .ds-num.ds-text-warning { color: var(--rw-text-warning); }
.ds-status-sensors > .rw-btn .ds-num.ds-text-danger { color: var(--rw-text-danger); }

/* The bar's two menus are bordered buttons, so they read as controls: the account menu, the
   person's initials in a round avatar with the menu's arrow; and, when the tabs are folded, the
   Menu button at the start of the bar. The avatar is white on brand-110 (5.4:1) and stands out
   from the bar (3.1:1); the border is 4.3:1 against the bar. */
.ds-usermenu > .rw-btn { gap: var(--rw-space-1x); padding: 0 var(--rw-space-1x); }
.ds-usermenu .ds-menu-caret { margin-inline-start: 0; }
.ds-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rw-space-6x);
  height: var(--rw-space-6x);
  border-radius: 50%;
  background: var(--rw-brand-110);
  color: var(--rw-text-on-brand);
  font-size: var(--rw-body-xs-size);
  font-weight: 700;
  line-height: 1;
}
.ds-navmenu { flex-shrink: 0; }
.ds-navmenu > .rw-btn { padding: 0 var(--rw-space-3x) 0 var(--rw-space-2x); }
.ds-navmenu .ds-menu-caret { display: none; }
/* The bar's two menus open from the top of the window, so they may use its height below the bar,
   the part a phone's browser leaves visible where it says so: Menu holds every tab, Proposals, the
   weather and the sites, and the account menu an administrator's own pages, the theme, other
   organizations and Sign out. */
:is(.ds-navmenu, .ds-usermenu) .ds-menu-popup {
  max-height: calc(100vh - var(--rw-space-12x) - var(--rw-space-4x));
  max-height: calc(100dvh - var(--rw-space-12x) - var(--rw-space-4x));
}
.ds-navmenu .rw-badge { margin-inline-start: var(--rw-space-1x); }
/* On a phone the menu sign stands alone; the word stays the button's name. */
@media (max-width: 29.99rem) {
  .ds-navmenu > .rw-btn { padding: 0 var(--rw-space-2x); }
  .ds-navmenu-word { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
}
/* At 360px and narrower (and at 320, the width a page must reflow to): less air in the bar, the
   account button without its arrow (the round avatar in its border is the control), and the
   product name may shorten rather than push the account button off the screen. */
@media (max-width: 22.5rem) {
  .ds-topbar { gap: var(--rw-space-2x); padding-inline: var(--rw-space-2x); }
  .ds-usermenu .ds-menu-caret { display: none; }
  .ds-product { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* The folded bar's end holds only the live count, Assistant and the account button, none of
     which the size container hides: it takes their width, so the product name gives way. */
  .ds-topbar-end { flex: 1 0 auto; container-type: normal; }
  .ds-status { margin-inline-end: var(--rw-space-1x); }
}
/* The bar's text buttons (Proposals, Assistant) keep 12px each side, which leaves
   the account button its room beside the tabs at 1440 wide. */
.ds-topbar-end > .rw-btn-borderless:not(.ds-weather, .rw-btn-icon) { padding-inline: var(--rw-space-3x); }
.ds-topbar :is(.ds-usermenu, .ds-navmenu) > .rw-btn:hover,
.ds-topbar :is(.ds-usermenu, .ds-navmenu) > .rw-btn[aria-expanded="true"] {
  border-color: var(--rw-text-primary);
  background-image: linear-gradient(var(--rw-bg-active), var(--rw-bg-active));
}

/* ── Sign-in and start-up ───────────────────────────────────────────────────
   One frame for both (plate.js). The text sits on the start edge at a fixed top, which
   signin.js decides with the plate, so the name does not move when the sign-in replaces the
   start-up page. Behind it, the plate: the airspace around one site, still, in the base map's
   neutrals and the ink of ordinary traffic at reduced strength (about 1.3:1 for rings, 2:1
   for tracks), so the text keeps its full contrast. The page stays in the dark chrome in every
   theme, like the top bar. */
.ds-splash {
  position: relative;
  display: grid;
  grid-template-rows: var(--ds-splash-top, 30vh) auto minmax(0, 1fr);
  height: 100%;
  overflow: hidden auto;
  background: var(--rw-bg-app);
}
/* The plate fades out under the text: across from the start edge on a wide screen, up from
   the text on a narrow one. */
.ds-splash::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--rw-bg-app) calc(var(--ds-splash-left, 0px) + 20rem), transparent calc(var(--ds-splash-left, 0px) + 42rem));
}
.ds-splash-narrow::after {
  background: linear-gradient(180deg, transparent calc(var(--ds-splash-top, 30vh) - 9rem), var(--rw-bg-app) calc(var(--ds-splash-top, 30vh) - 1rem));
}
.ds-splash-box {
  position: relative;
  z-index: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(28rem, 100% - 2 * var(--ds-splash-left, var(--rw-space-6x)));
  margin-inline-start: var(--ds-splash-left, var(--rw-space-6x));
  padding-block-end: var(--rw-space-8x);
}
.ds-splash-title { display: flex; align-items: center; gap: var(--rw-space-4x); }
.ds-splash-mark { flex-shrink: 0; width: var(--rw-space-12x); height: var(--rw-space-12x); }
.ds-splash-mark-tile { fill: var(--rw-bg-content); stroke: var(--rw-divider); }
.ds-splash-mark-glyph { fill: var(--rw-text-primary); stroke: var(--rw-text-primary); }
.ds-splash-name { font-size: var(--rw-heading-2xl-size); line-height: var(--rw-heading-2xl-lh); }
@media (max-width: 30rem) { .ds-splash-name { font-size: var(--rw-heading-lg-size); line-height: var(--rw-heading-lg-lh); } }
.ds-splash-lead { max-width: 22em; text-wrap: balance; margin-block-start: var(--rw-space-5x); color: var(--rw-text-secondary); font-size: var(--rw-body-xl-size); line-height: var(--rw-body-xl-lh); }
.ds-splash-box > .ds-skeleton { width: min(22rem, 100%); margin-block-start: var(--rw-space-6x); padding: 0; }
.ds-splash-box > .rw-banner { width: 100%; margin-block-start: var(--rw-space-6x); }
.ds-splash-box > .rw-banner + .ds-link { margin-block-start: var(--rw-space-4x); }
.ds-splash-why { margin-block-start: var(--rw-space-6x); padding: var(--rw-space-3x) var(--rw-space-4x); border-radius: var(--rw-radius-md); background: var(--rw-bg-muted); line-height: var(--rw-body-lg-lh); }
.ds-splash-note { margin-block-start: var(--rw-space-6x); color: var(--rw-text-secondary); }
.ds-splash-action { min-width: 12rem; margin-block-start: var(--rw-space-8x); }
.ds-splash-why + .ds-splash-action, .ds-splash-note + .ds-splash-action { margin-block-start: var(--rw-space-4x); }

.ds-plate { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ds-plate-water { fill: rgba(0, 0, 0, .42); }
.ds-plate-shore { fill: none; stroke: var(--rw-neutral-170); stroke-width: 1.5; }
.ds-plate-road { fill: none; stroke: var(--rw-neutral-180); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ds-plate-road-major { stroke: var(--rw-neutral-170); stroke-width: 4; }
.ds-plate-ring { fill: none; stroke: rgba(251, 249, 248, .09); stroke-width: 1; }
.ds-plate-site { fill: rgba(251, 249, 248, .03); stroke: rgba(251, 249, 248, .22); stroke-width: 1; stroke-dasharray: 4 4; }
.ds-plate-notice { fill: none; stroke: rgba(251, 249, 248, .14); stroke-width: 1; }
.ds-plate-notice-band { fill: none; stroke: rgba(251, 249, 248, .035); stroke-width: 9; }
.ds-plate-wedge { fill: rgba(251, 249, 248, .03); }
.ds-plate-trail { stroke: rgba(251, 249, 248, .2); stroke-width: 1.5; stroke-linecap: round; }
.ds-plate-leader { stroke: rgba(251, 249, 248, .24); stroke-width: 1; }
.ds-plate-tie { stroke: rgba(251, 249, 248, .16); stroke-width: 1; stroke-dasharray: 3 3; }
.ds-plate-keyline { fill: none; stroke: var(--rw-bg-app); stroke-linejoin: round; }
.ds-plate-mark { fill: rgba(251, 249, 248, .26); }
.ds-plate-mark-line { fill: none; stroke: rgba(251, 249, 248, .26); stroke-linecap: round; stroke-linejoin: round; }
.ds-plate-scale { fill: none; stroke: rgba(251, 249, 248, .24); stroke-width: 1; }
.ds-plate-label { fill: rgba(251, 249, 248, .3); font-size: var(--rw-body-xs-size); font-variant-numeric: tabular-nums; }

/* ── Pages that are not the map ─────────────────────────────────────────── */
.ds-page { height: 100%; overflow-y: auto; padding: var(--rw-space-6x); }
.ds-page-narrow { display: grid; place-items: center; }

/* ── Weather in the top bar ─────────────────────────────────────────────── */
.ds-weather { gap: var(--rw-space-2x); padding-inline: var(--rw-space-2x); font-weight: 400; color: var(--rw-text-primary); }
.ds-weather > .ds-state { font-weight: 600; }
.ds-weather-age { font-size: var(--rw-body-xs-size); }
/* The bar gives way in this order as its end runs out of room: temperature, the track count,
   the wind (it stays in the tooltip and the drawer), the clock, then the sensor count (it stays
   in Organization and in the detail of each sensor). Below that the navigation folds into Menu
   at the start of the bar (shell.js). The steps are the measured widths of what is shown, with some air. */
@container (max-width: 64rem) { .ds-weather-temp { display: none; } }
@container (max-width: 61rem) { .ds-status-tracks { display: none; } }
@container (max-width: 54.5rem) { .ds-weather-wind { display: none; } }
@container (max-width: 47.75rem) { .ds-status-clock { display: none; } }
@container (max-width: 41.25rem) { .ds-status-sensors { display: none; } }
