/* Drone Sentinel Console: base rules.
 *
 * The design system is vendored unchanged in ../vendor/redwood/. This file and its siblings
 * arrange those tokens and component classes for this application. They add no colour, no
 * spacing step and no radius: every value is a --rw-* token, an alpha of one, or a structural
 * length (a 1px rule, a panel width). See web/DESIGN.md.
 */

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-oracle-sans);
  font-size: var(--rw-body-md-size);
  line-height: var(--rw-body-md-lh);
  color: var(--rw-text-primary);
  background: var(--rw-bg-app);
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

[hidden] { display: none !important; }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--rw-heading-weight); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
strong { font-weight: 600; }

/* Guide 8: a 2px ring in the focus colour, which inverts with the theme. */
:focus-visible { outline: 2px solid var(--rw-focus-ring); outline-offset: 2px; }
h2:focus-visible { outline-offset: 4px; }

/* Guide 3: figures align, identifiers go in mono. */
time, .ds-num { font-variant-numeric: tabular-nums; }
code, kbd, .ds-mono { font-family: var(--font-oracle-mono); font-size: .94em; }
.ds-nowrap { white-space: nowrap; }

.ds-sr-only, .ds-ico-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ds-contents { display: contents; }
.ds-secondary { color: var(--rw-text-secondary); }
.ds-stack { display: grid; gap: var(--rw-space-4x); }

/* Standalone links: brand, 600, underlined on hover (guide 6h). */
.ds-link { color: var(--rw-text-brand); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.ds-link:hover { text-decoration: underline; }
.ds-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--rw-text-brand);
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.ds-linkbtn:hover { text-decoration: underline; }

/* The product chrome and the sign-in page stay dark in every theme (guide 6g, "Application
   shell"). This is the mapping of redwood-dark.css, scoped to an element instead of the root;
   web/tests/tokens.test.mjs fails if the two ever differ. */
.ds-chrome {
  --rw-bg-app: var(--rw-neutral-190);
  --rw-bg-content: var(--rw-neutral-180);
  --rw-bg-subtle: var(--rw-neutral-170);
  --rw-bg-muted: var(--rw-neutral-160);
  --rw-bg-hover: rgba(251, 249, 248, .08);
  --rw-bg-active: rgba(251, 249, 248, .16);
  --rw-bg-selected: var(--rw-brand-160);
  --rw-text-primary: var(--rw-neutral-10);
  --rw-text-secondary: rgba(251, 249, 248, .70);
  --rw-text-disabled: rgba(251, 249, 248, .40);
  --rw-text-brand: var(--rw-brand-70);
  --rw-text-danger: var(--rw-danger-70);
  --rw-text-warning: var(--rw-warning-60);
  --rw-text-success: var(--rw-success-60);
  --rw-divider: rgba(251, 249, 248, .14);
  --rw-border-enabled: rgba(251, 249, 248, .45);
  --rw-border-selected: var(--rw-brand-80);
  --rw-focus-ring: var(--rw-neutral-0);
  --rw-field-border-focus: var(--rw-brand-80);
  color-scheme: dark;
  color: var(--rw-text-primary);
}

/* ── Icons ──────────────────────────────────────────────────────────────────
   The inline drawing shows until the Redwood icon font has loaded (icons.js). */
.ds-ico-svg {
  flex-shrink: 0;
  width: var(--rw-space-6x);
  height: var(--rw-space-6x);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ds-ico-font { display: none; }
:root[data-icons="font"] .ds-ico-font { display: inline-block; }
:root[data-icons="font"] .ds-ico-svg { display: none; }
.rw-field-message > .ds-ico-svg, .rw-banner-icon > .ds-ico-svg { width: var(--rw-space-4x); height: var(--rw-space-4x); }
.ds-banner-icon, .ds-toast-icon { display: inline-flex; }
.ds-toast-icon > .ds-ico-svg { width: var(--rw-space-6x); height: var(--rw-space-6x); }

/* ── Status in words, with a colour beside it ─────────────────────────────── */
.ds-text-danger { color: var(--rw-text-danger); }
.ds-text-warning { color: var(--rw-text-warning); }
.ds-text-success { color: var(--rw-text-success); }
.ds-text-quiet { color: var(--rw-text-secondary); }

.ds-tone-danger { color: var(--rw-text-danger); }
.ds-tone-warning { color: var(--rw-text-warning); }
.ds-tone-success { color: var(--rw-text-success); }
.ds-tone-quiet { color: var(--ds-traffic); }
/* Drones: always green (glyphPaint); their status is a ring in its own tone. */
.ds-tone-drone { color: var(--rw-text-success); }
/* Ordinary traffic's glyphs: steel blue on the dark surfaces (as on the map), a darker step on light ones. */
:root { --ds-traffic: var(--rw-brand-110); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ds-traffic: var(--rw-brand-60); }
}
:root[data-theme="dark"], :root[data-theme="clinical"] { --ds-traffic: var(--rw-brand-60); }
.ds-tone-plain { color: inherit; }

/* The Redwood status dot is drawn in the -120 steps, which measure about 2.6:1 on the dark
   surfaces. This dot has the same anatomy and takes the status text tokens, which lift in
   dark. It always sits beside its label. */
.ds-state { display: inline-flex; align-items: center; gap: var(--rw-space-2x); min-width: 0; }
.ds-state::before {
  content: "";
  flex-shrink: 0;
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: var(--rw-text-secondary);
}
.ds-state-success::before { background: var(--rw-text-success); }
.ds-state-warning::before { background: var(--rw-text-warning); }
.ds-state-danger::before { background: var(--rw-text-danger); }

.ds-glyph { flex-shrink: 0; width: var(--rw-space-6x); height: var(--rw-space-6x); }

.rw-badge + .rw-badge { margin-inline-start: var(--rw-space-1x); }

/* ── Facts ──────────────────────────────────────────────────────────────── */
.ds-facts { display: grid; gap: var(--rw-space-2x); margin: 0; }
.ds-fact { display: grid; grid-template-columns: minmax(6.5rem, 36%) minmax(0, 1fr); column-gap: var(--rw-space-3x); align-items: baseline; }
.ds-fact dt { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-sm-lh); }
.ds-fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ds-facts-compact { font-size: var(--rw-body-sm-size); line-height: var(--rw-body-sm-lh); }

.ds-idval { display: inline-flex; align-items: center; gap: var(--rw-space-1x); min-width: 0; max-width: 100%; }
.ds-idval > .ds-mono { min-width: 0; overflow-wrap: anywhere; }
.ds-copybtn { --rw-btn-height: var(--rw-space-6x); --rw-btn-icon-size: var(--rw-space-4x); }

/* ── Feedback ───────────────────────────────────────────────────────────── */
.rw-banner { min-width: 0; }
.rw-banner-detail { overflow-wrap: anywhere; }
.ds-banner-actions { display: flex; align-items: center; gap: var(--rw-space-1x); }
/* A banner and a toast keep a light ground in every theme (guide 6d), so the controls inside
   them read the light values of the semantic tokens, exactly as redwood-tokens.css sets them. */
.rw-banner, .rw-toast {
  --rw-text-secondary: rgba(22, 21, 19, .70);
  --rw-text-disabled: rgba(22, 21, 19, .40);
  --rw-bg-hover: rgba(22, 21, 19, .08);
  --rw-bg-active: rgba(22, 21, 19, .16);
  --rw-border-enabled: rgba(22, 21, 19, .50);
  --rw-text-brand: var(--rw-brand-110);
}

.rw-toast { text-align: start; }
.ds-toast-actions { display: flex; align-items: center; gap: var(--rw-space-1x); }

.ds-skeleton { display: grid; gap: var(--rw-space-3x); padding: var(--rw-space-4x); }
.ds-skeleton-short { width: 60%; }

.ds-quiet { padding: var(--rw-space-3x) var(--rw-space-4x) var(--rw-space-4x); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); }
.ds-note { margin-bottom: var(--rw-space-3x); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); }
.ds-review { padding: var(--rw-space-3x); border-radius: var(--rw-radius-md); background: var(--rw-bg-muted); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); overflow-wrap: anywhere; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
/* A select draws its own face: a native one keeps the system's size in some browsers (Safari ignores
   height on it) and came out shorter than the fields beside it. The chevron is two gradients of the
   secondary text colour, so the sheets keep no literal colour and load no image. */
select.rw-input {
  appearance: none; -webkit-appearance: none;
  padding-inline-end: var(--rw-space-8x);
  background-image: linear-gradient(45deg, transparent 50%, var(--rw-text-secondary) 50%), linear-gradient(135deg, var(--rw-text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.rw-input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); }
.ds-choices { min-width: 0; margin: 0; padding: 0; border: 0; }
.ds-choices > legend { padding: 0; margin-bottom: var(--rw-space-2x); }
.ds-choices > .rw-help { margin-bottom: var(--rw-space-2x); }
.ds-choices-list { display: grid; gap: var(--rw-space-3x); }
.ds-choice { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--rw-space-2x); align-items: start; }
.ds-choice > input { width: var(--rw-space-4x); height: var(--rw-space-4x); margin: calc((var(--rw-body-md-size) * var(--rw-body-md-lh) - var(--rw-space-4x)) / 2) 0 0; accent-color: var(--rw-brand-110); }
.ds-choice > label { cursor: pointer; }
.ds-choice > .rw-help { grid-column: 2; margin-top: var(--rw-space-1x); }
.ds-copyfield { display: flex; gap: var(--rw-space-2x); align-items: stretch; }
.ds-copyfield > .rw-input { flex: 1; min-width: 0; text-overflow: ellipsis; }

/* ── Dialog and drawer ──────────────────────────────────────────────────── */
/* The backdrop is neutral-190 at .4 (guide 6f); no token holds that alpha. */
dialog::backdrop { background: color-mix(in srgb, var(--rw-neutral-190) 40%, transparent); }
dialog.ds-dialog { margin: auto; padding: 0; }
.ds-dialog > .rw-dialog-head { position: relative; }
.ds-dialog > .rw-dialog-head > .rw-btn { position: absolute; inset-block-start: var(--rw-space-3x); inset-inline-end: var(--rw-space-3x); }
.ds-dialog h2 { overflow-wrap: anywhere; }
.rw-dialog-body > .rw-banner { margin-bottom: var(--rw-space-4x); }

.ds-drawer { width: 22rem; overflow: hidden; }
dialog.ds-drawer-modal { inset-inline-start: auto; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; }
.ds-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--rw-space-2x); padding: var(--rw-space-4x) var(--rw-space-3x) var(--rw-space-2x) var(--rw-space-4x); }
.ds-drawer-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rw-space-2x); min-width: 0; padding-top: var(--rw-space-1x); }
.ds-drawer-title > h2 { min-width: 0; font-size: var(--rw-heading-xs-size); line-height: var(--rw-heading-xs-lh); overflow-wrap: anywhere; }
.ds-drawer-title > h2:focus { outline: none; }
.ds-drawer-title > h2:focus-visible { outline: 2px solid var(--rw-focus-ring); outline-offset: 4px; }
.ds-drawer-context { display: flex; align-items: center; gap: var(--rw-space-2x); padding: 0 var(--rw-space-4x) var(--rw-space-3x); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); }
.ds-drawer-context > span { min-width: 0; overflow-wrap: anywhere; }
.ds-drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 var(--rw-space-4x) var(--rw-space-4x); border-top: 1px solid var(--rw-divider); }
.ds-drawer-body > .rw-banner { margin-top: var(--rw-space-4x); }
.ds-drawer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--rw-space-2x); padding: var(--rw-space-3x) var(--rw-space-4x); border-top: 1px solid var(--rw-divider); }
.ds-foot-note { flex: 1 1 100%; color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); }

.ds-sec { padding-block: var(--rw-space-4x); }
.ds-sec + .ds-sec { border-top: 1px solid var(--rw-divider); }
.ds-sec > h3, .ds-sec > h4 { margin-bottom: var(--rw-space-3x); font-size: var(--rw-body-md-size); line-height: var(--rw-body-md-lh); }
.ds-sec > p + p { margin-top: var(--rw-space-2x); }
.ds-sec > p + .rw-btn { margin-top: var(--rw-space-3x); }
.ds-sec > .rw-banner { margin-top: var(--rw-space-3x); }
.ds-sec-count { color: var(--rw-text-secondary); font-weight: 400; }
.ds-sec-link { margin-top: var(--rw-space-3x); }
.ds-sub { margin: var(--rw-space-4x) 0 var(--rw-space-2x); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-sm-lh); color: var(--rw-text-secondary); font-weight: 600; }

/* ── Menu (popup: content surface, divider border, radius sm, dropdown shadow) ─ */
.ds-menu { position: relative; display: inline-flex; }
.ds-menu-caret { display: inline-flex; margin-inline-start: calc(-1 * var(--rw-space-1x)); }
.ds-menu-caret > .ds-ico-svg, .ds-menu-caret > .rw-ico { width: var(--rw-space-4x); height: var(--rw-space-4x); font-size: var(--rw-space-4x); }
.ds-menu-popup {
  position: absolute;
  inset-block-start: calc(100% + var(--rw-space-1x));
  z-index: 1200;
  min-width: 12rem;
  max-width: min(22rem, calc(100vw - var(--rw-space-4x)));
  max-height: min(32rem, calc(100vh - var(--rw-space-12x) - var(--rw-space-4x)));
  overflow-y: auto;
  padding: var(--rw-space-1x) 0;
  border: 1px solid var(--rw-divider);
  border-radius: var(--rw-radius-sm);
  background: var(--rw-bg-content);
  box-shadow: var(--rw-shadow-sm);
  color: var(--rw-text-primary);
  font-size: var(--rw-body-md-size);
  white-space: normal;
}
/* A menu with details is as wide as its items need, within 22rem and the screen (under a button it
   would otherwise take the button's width and squeeze them). The menus with details open where
   there is room: the account menu and New mission. */
.ds-menu-popup:has(.ds-menu-detail) { width: max-content; }
.ds-menu-end { inset-inline-end: 0; }
.ds-menu-start { inset-inline-start: 0; }
.ds-menu-wide { min-width: 16rem; }
/* A menu whose details are sentences (New mission's kinds): each detail under its label. */
.ds-menu-stacked .ds-menu-item { flex-direction: column; align-items: flex-start; gap: var(--rw-space-1x); }
.ds-menu-stacked .ds-menu-label { flex: none; }
.ds-menu-stacked .ds-menu-detail { max-width: none; text-align: start; }
.ds-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--rw-space-3x);
  width: 100%;
  min-height: var(--rw-space-9x);
  padding: var(--rw-space-2x) var(--rw-space-4x);
  border: 0;
  background: none;
  color: var(--rw-text-primary);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.ds-menu-item:hover { background-image: linear-gradient(var(--rw-bg-hover), var(--rw-bg-hover)); }
.ds-menu-item:focus-visible { outline: dotted 1px var(--rw-focus-ring); outline-offset: -2px; background-image: linear-gradient(var(--rw-bg-hover), var(--rw-bg-hover)); }
/* A label keeps its own width and breaks only between words; the detail beside it wraps instead. */
.ds-menu-label { flex: 1 1 auto; overflow-wrap: break-word; }
/* A long detail (the weather sentence on a phone) wraps beside its label instead of crushing it. */
.ds-menu-detail { max-width: 65%; color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); text-align: end; }
.ds-menu-check { display: inline-flex; }
.ds-menu-check > * { width: var(--rw-space-4x); height: var(--rw-space-4x); font-size: var(--rw-space-4x); }
.ds-menu-danger { color: var(--rw-text-danger); }
.ds-menu-sep { height: 1px; margin: var(--rw-space-1x) 0; background: var(--rw-divider); }
.ds-menu-heading { display: grid; gap: var(--rw-space-1x); padding: var(--rw-space-2x) var(--rw-space-4x) var(--rw-space-1x); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); }
.ds-menu-who { color: var(--rw-text-primary); font-size: var(--rw-body-md-size); font-weight: 600; overflow-wrap: anywhere; }
.ds-menu-sub { overflow-wrap: anywhere; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.ds-table-wrap { border: 1px solid var(--rw-divider); border-radius: var(--rw-radius-lg); background: var(--rw-bg-content); overflow: hidden; }
.ds-table-wrap .rw-table td { overflow-wrap: anywhere; }
.ds-table-wrap .rw-table tr:last-child > td { border-bottom: 0; }
.ds-table-wrap .rw-table th { white-space: normal; }
.ds-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--rw-space-2x); padding: var(--rw-space-2x) var(--rw-space-3x); border-top: 1px solid var(--rw-divider); font-size: var(--rw-body-sm-size); color: var(--rw-text-secondary); }
.ds-pager-count { padding: var(--rw-space-3x) var(--rw-space-4x); border-top: 1px solid var(--rw-divider); font-size: var(--rw-body-sm-size); color: var(--rw-text-secondary); }
@media (max-width: 79.99rem) { .ds-hide-lg { display: none; } }
@media (max-width: 63.99rem) { .ds-hide-md { display: none; } }
@media (max-width: 47.99rem) { .ds-hide-sm { display: none; } }
/* What a hidden column said, shown in the first column on a phone. */
@media (min-width: 48rem) { .ds-show-sm { display: none; } }
@media (max-width: 47.99rem) { .ds-stack-sm { flex-direction: column; align-items: flex-end; } }

.ds-noscript { padding: var(--rw-space-6x); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}
