/* Design tokens: the only file allowed to hold a color literal.
 *
 * Every color does one of four jobs and is assigned by that job, last:
 * categorical (identity), sequential (magnitude), diverging (polarity),
 * status (state). Values are the documented reference palette, validated
 * per mode with validate_palette.js; the reports are in docs/design-tokens.md.
 * Dark values are selected from the same ramps against the dark surface,
 * never an inversion of the light ones.
 *
 * The surfaces, the text and hairline inks and two radii first read the
 * variables a host passes in hostContext.styles.variables and fall back to
 * the kit's own value when it passes none. The data colors never do: the host
 * cannot know the palette was validated against these surfaces. The fonts need
 * no line here, since applying a host's --font-sans or --font-mono replaces
 * the kit's declaration of the same name.
 *
 * The dark block appears twice, under the OS preference and under the host's
 * explicit theme. A test keeps the two identical.
 */
:root {
  color-scheme: light;

  --surface-1: var(--color-background-primary, #fcfcfb);
  --surface-2: var(--color-background-secondary, #f9f9f7);
  --ink-1: var(--color-text-primary, #0b0b0b);
  --ink-2: var(--color-text-secondary, #52514e);
  --mark-muted: #898781;
  --hairline: var(--color-border-secondary, #e1e0d9);
  --axis: #c3c2b7;

  --action: #256abf;
  --accent: var(--series-1);

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  --seq-1: #86b6ef;
  --seq-2: #5598e7;
  --seq-3: #2a78d6;
  --seq-4: #1c5cab;
  --seq-5: #104281;

  --div-neg: #e34948;
  --div-mid: #f0efec;
  --div-pos: #2a78d6;

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --impact-blocking: var(--status-critical);
  --impact-degrading: var(--status-serious);
  --impact-informational: var(--mark-muted);

  --layer-services: #2a78d6;
  --layer-conteneurs: #149c6a;
  --layer-machines: #6250d6;
  --layer-hyperviseurs: #0f8fa8;
  --layer-reseau-ip: #7d8a14;
  --layer-reseau-local: #d8588f;
  --layer-kubernetes: #b04fbf;

  --home-ok: #0a8f3c;
  --home-warning: #d97a06;
  --home-critical: #d03b3b;
  --home-unknown: #c4c8cf;
  --home-info: #8a9099;

  --home-wall-bg: #0a1020;
  --home-wall-card: #111a2e;
  --home-wall-line: #22304a;
  --home-wall-ink: #eef0f4;
  --home-wall-muted: #a3abbd;
  --home-wall-ok: #34c26a;
  --home-wall-warning: #f5a142;
  --home-wall-critical: #ef6b6b;
  --home-wall-unknown: #3c4a66;
  --home-wall-info: #7c8496;

  --map-stage-edge: #eceef2;
  --map-grid: rgba(11, 18, 32, .04);
  --map-glass: rgba(255, 255, 255, .18);
  --map-glass-side: rgba(214, 220, 229, .55);
  --map-halo: rgba(255, 255, 255, .96);
  --map-shadow: #0b1220;
  --map-shadow-soft: rgba(11, 18, 32, .3);
  --map-route: #a9781a;
  --map-route-glow: rgba(169, 120, 26, .16);

  --observed-ink: var(--ink-1);
  --observed-width: 2px;
  --declared-ink: var(--mark-muted);
  --declared-width: 1.5px;
  --declared-dash: 6 5;
  --derived-dash: 2 3;

  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-base: 16px;
  --text-lg: 19px;
  --text-hero: 48px;
  --leading-tight: 1.25;
  --leading-body: 1.5;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --radius-1: var(--border-radius-sm, 4px);
  --radius-2: var(--border-radius-md, 8px);
  --radius-pill: 999px;
  --mark-line: 2px;
  --mark-gap: 2px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;

    --surface-1: var(--color-background-primary, #1a1a19);
    --surface-2: var(--color-background-secondary, #0d0d0d);
    --ink-1: var(--color-text-primary, #ffffff);
    --ink-2: var(--color-text-secondary, #c3c2b7);
    --mark-muted: #898781;
    --hairline: var(--color-border-secondary, #2c2c2a);
    --axis: #383835;

    --action: #6da7ec;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;

    --seq-1: #184f95;
    --seq-2: #256abf;
    --seq-3: #3987e5;
    --seq-4: #6da7ec;
    --seq-5: #9ec5f4;

    --div-neg: #e66767;
    --div-mid: #383835;
    --div-pos: #3987e5;

    --layer-services: #3987e5;
    --layer-conteneurs: #199e70;
    --layer-machines: #9085e9;
    --layer-hyperviseurs: #1b97b0;
    --layer-reseau-ip: #869222;
    --layer-reseau-local: #d55181;
    --layer-kubernetes: #c77dd4;

    --home-ok: #34c26a;
    --home-warning: #f5a142;
    --home-critical: #ef6b6b;
    --home-unknown: #3c4a66;
    --home-info: #7c8496;

    --map-stage-edge: #0b1222;
    --map-grid: rgba(238, 240, 244, .035);
    --map-glass: rgba(255, 255, 255, .035);
    --map-glass-side: rgba(255, 255, 255, .06);
    --map-halo: rgba(17, 26, 46, .96);
    --map-shadow: #000000;
    --map-shadow-soft: rgba(0, 0, 0, .5);
    --map-route: #fcbe36;
    --map-route-glow: rgba(252, 190, 54, .2);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --surface-1: var(--color-background-primary, #1a1a19);
  --surface-2: var(--color-background-secondary, #0d0d0d);
  --ink-1: var(--color-text-primary, #ffffff);
  --ink-2: var(--color-text-secondary, #c3c2b7);
  --mark-muted: #898781;
  --hairline: var(--color-border-secondary, #2c2c2a);
  --axis: #383835;

  --action: #6da7ec;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;

  --seq-1: #184f95;
  --seq-2: #256abf;
  --seq-3: #3987e5;
  --seq-4: #6da7ec;
  --seq-5: #9ec5f4;

  --div-neg: #e66767;
  --div-mid: #383835;
  --div-pos: #3987e5;

  --layer-services: #3987e5;
  --layer-conteneurs: #199e70;
  --layer-machines: #9085e9;
  --layer-hyperviseurs: #1b97b0;
  --layer-reseau-ip: #869222;
  --layer-reseau-local: #d55181;
  --layer-kubernetes: #c77dd4;

  --home-ok: #34c26a;
  --home-warning: #f5a142;
  --home-critical: #ef6b6b;
  --home-unknown: #3c4a66;
  --home-info: #7c8496;

  --map-stage-edge: #0b1222;
  --map-grid: rgba(238, 240, 244, .035);
  --map-glass: rgba(255, 255, 255, .035);
  --map-glass-side: rgba(255, 255, 255, .06);
  --map-halo: rgba(17, 26, 46, .96);
  --map-shadow: #000000;
  --map-shadow-soft: rgba(0, 0, 0, .5);
  --map-route: #fcbe36;
  --map-route-glow: rgba(252, 190, 54, .2);
}

/* SH Fleet's console. Colors, sizes and spaces come from the kit's tokens
 * only: this file holds no color literal, so a host's theme and the dark
 * mode reach the console as they reach the kit's views. Rules under
 * .sh-fleet-page apply to a page served by SH Fleet, never inside a host. */

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.45;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}

.sh-fleet-page body {
  margin: 0;
  background: var(--surface-2);
  min-height: 100vh;
}

.sh-fleet-page main {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-6);
  box-sizing: border-box;
}

/* Bar: the product, the views, who is there. */
.sh-fleet-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-5);
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
}

.sh-fleet-brand {
  font-weight: var(--weight-strong);
  font-size: var(--text-base);
  letter-spacing: 0.02em;
  color: var(--ink-1);
  text-decoration: none;
}

.sh-fleet-nav {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.sh-fleet-nav a {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  text-decoration: none;
}

.sh-fleet-nav a:hover {
  background: var(--surface-2);
  color: var(--ink-1);
}

.sh-fleet-nav a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--action);
  font-weight: var(--weight-medium);
}

.sh-fleet-who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--ink-2);
  font-size: var(--text-sm);
}

/* What a view answers, then its figures as cards. */
.sh-fleet-page #root > header {
  margin-bottom: var(--space-5);
}

.summary {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.35;
}

figure.visual {
  margin: 0 0 var(--space-5);
  padding: var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius-2) * 1.5);
}

.visual-title {
  margin-bottom: var(--space-3);
  font-size: var(--text-base);
  font-weight: var(--weight-strong);
}

.visual-note {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td,
table tr:hover td {
  background: var(--surface-2);
}

details {
  margin-top: var(--space-3);
  color: var(--ink-2);
  font-size: var(--text-sm);
}

summary {
  cursor: pointer;
}

/* Forms: proposals and gaps. */
.sh-fleet-card {
  margin: 0 0 var(--space-3);
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2);
}

.sh-fleet-card h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: var(--weight-strong);
}

.sh-fleet-card p {
  margin: 0 0 var(--space-1);
}

.sh-fleet-muted {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.sh-fleet-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-3);
}

input,
select {
  font: inherit;
  color: var(--ink-1);
  background: var(--surface-1);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-1);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 1px;
}

button {
  font: inherit;
  color: var(--ink-1);
  background: var(--surface-1);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-1);
  cursor: pointer;
}

button:hover {
  background: var(--surface-2);
}

button.sh-fleet-primary {
  color: var(--surface-1);
  background: var(--action);
  border-color: var(--action);
}

button.sh-fleet-primary:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.sh-fleet-result {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

a {
  color: var(--action);
}

/* Home. */
.sh-fleet-hero {
  margin: 0 0 var(--space-1);
  font-size: 32px;
  font-weight: var(--weight-regular);
  letter-spacing: -0.01em;
}

.sh-fleet-lead {
  margin: 0 0 var(--space-6);
  color: var(--ink-2);
  font-size: var(--text-base);
}

.sh-fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.sh-fleet-tile {
  display: block;
  padding: var(--space-4) var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius-2) * 1.5);
  color: var(--ink-1);
  text-decoration: none;
}

.sh-fleet-tile:hover {
  border-color: var(--action);
}

.sh-fleet-tile strong {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-base);
}

.sh-fleet-tile span {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.sh-fleet-section {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.sh-fleet-panel {
  margin-bottom: var(--space-5);
  padding: var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius-2) * 1.5);
}

.sh-fleet-panel form {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 var(--space-3);
}

.sh-fleet-panel form:last-child {
  margin-bottom: 0;
}

.sh-fleet-links a {
  margin-right: var(--space-3);
}

.sh-fleet-notice {
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--action);
  border-radius: var(--radius-2);
}

/* The kit's figures: graph, legend, provenance. The kit ships no style of
 * its own; these rules follow Quart's, so the same figure reads the same in
 * both products. */
svg { display: block; max-width: 100%; }
svg.graph, svg.bars, svg.lines { height: auto; }
.axis { stroke: var(--axis); stroke-width: 1; }
.tick-label { fill: var(--ink-2); font-size: var(--text-xs); }
.bar { fill: var(--series-1); }
.bar-label { fill: var(--ink-1); font-size: var(--text-md); }
.bar-value { fill: var(--ink-1); font-size: var(--text-sm); }
.series-line { fill: none; stroke-width: var(--mark-line); }
.series-dot { stroke: var(--surface-2); stroke-width: 1.5; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.unread { stroke: none; }
.hatch-line { stroke: var(--mark-muted); stroke-width: 1.5; }
.node rect { fill: var(--surface-1); stroke: var(--observed-ink); stroke-width: var(--observed-width); }
.node.role-seed rect { stroke: var(--accent); stroke-width: 3; }
.node.standing-declared rect { fill: var(--surface-1); stroke: var(--declared-ink); stroke-width: var(--declared-width);
  stroke-dasharray: var(--declared-dash); }
.node-label { fill: var(--ink-1); font-size: var(--text-md); }
.node-tag { fill: var(--ink-2); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; }
.edge { fill: none; }
.edge-observed { stroke: var(--observed-ink); stroke-width: var(--observed-width); }
.edge-declared { stroke: var(--declared-ink); stroke-width: var(--declared-width); stroke-dasharray: var(--declared-dash); }
.edge-derived { stroke: var(--observed-ink); stroke-width: var(--declared-width); stroke-dasharray: var(--derived-dash); }
.arrow-observed, .arrow-derived { fill: var(--observed-ink); }
.arrow-declared { fill: var(--declared-ink); }
.edge-label { fill: var(--ink-2); font-size: var(--text-xs); paint-order: stroke;
  stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }
.declared-frame { fill: none; stroke: var(--declared-ink); stroke-width: var(--declared-width); stroke-dasharray: var(--declared-dash); }
.declared-label { fill: var(--ink-2); font-size: var(--text-xs); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin-top: var(--space-2);
  color: var(--ink-2); font-size: var(--text-xs); }
.legend > span { display: inline-flex; align-items: center; gap: var(--space-2); }
.legend-key { flex: none; }
.twin, .prov { margin-top: var(--space-2); }
.src { border-top: 1px solid var(--hairline); padding-top: var(--space-2); margin-top: 10px; }
.src:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.src-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.src-label { font-weight: var(--weight-strong); font-size: var(--text-md); }
.src-meta { color: var(--ink-2); font-size: var(--text-sm); }
.badge { font-weight: var(--weight-strong); font-size: var(--text-sm); padding: 3px var(--space-3);
  border-radius: var(--radius-pill); border: 1px solid var(--mark-muted); color: var(--ink-1); }
[hidden] { display: none !important; }
