/* ==========================================================================
   D11 — Kairon Fleet OS
   App-style customer portal: side rail, sticky top bar, fleet KPIs,
   live throughput chart, alerts, tickets and robot tiles. Every value
   declares its data state (live / stale / offline / simulated) via
   .fleet-shell[data-ds].
   ========================================================================== */

/* Product UI runs at a denser base size than the marketing site */
.page-d11-fleet-os {
  font-size: 14px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Shell: rail + main column
   The rail is 220px wide until the shell is narrower than 860px, then it
   takes the full width (container-relative width trick, no media query).
   -------------------------------------------------------------------------- */
.fleet-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  min-height: 100vh;
}

.fleet-main {
  flex: 1 1 560px;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Side rail
   -------------------------------------------------------------------------- */
.fleet-rail {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: max(220px, min(100%, (860px - 100%) * 999));
  height: 100vh;
  padding: 16px 12px;
  overflow: auto;
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fleet-rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  white-space: nowrap;
}

.fleet-rail__mark {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text);
  border-radius: 50%;
}

.fleet-rail__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--text);
  border-radius: 50%;
}

.fleet-rail__word {
  font-size: 14px;
  font-stretch: 125%;
  letter-spacing: .1em;
}

.fleet-rail__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-1);
  white-space: nowrap;
}

.fleet-rail__link[aria-current="page"] {
  background: var(--surface-2);
  box-shadow: inset 2px 0 0 var(--action);
}

.fleet-rail__label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fleet-rail__label .icon {
  color: #EDEFF2;
}

.fleet-rail__badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.fleet-rail__badge--alert {
  color: var(--critical);
}

/* < 860px: the rail becomes a horizontal, scrollable bar */
@media (max-width: 859.98px) {
  .fleet-rail {
    flex-direction: row;
    height: auto;
  }
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.fleet-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 12px clamp(16px, 2.5vw, 32px);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.fleet-bar__site {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fleet-bar__caption {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.fleet-bar__select {
  height: 40px;
  padding: 0 10px;
  background: var(--surface-1);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  font: 500 14px var(--font-sans);
}

.fleet-bar__demo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.fleet-bar__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Segmented radio control (demo state, range) */
.fleet-toggle {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
}

.fleet-toggle__btn {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 1px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
}

.fleet-toggle__btn[aria-checked="true"] {
  background: var(--text);
  color: var(--canvas);
}

.fleet-toggle--range .fleet-toggle__btn {
  padding: 0 12px;
  white-space: nowrap;
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Data state: badge, dimming, chart dashes, banners
   -------------------------------------------------------------------------- */
.fleet-shell {
  --ds-color: var(--success);   /* badge / banner border */
  --ds-fill: var(--success);    /* badge dot fill */
  --ds-radius: 50%;             /* badge dot shape */
  --ds-opacity: 1;              /* dimming of live values */
  --ds-dash: 0;                 /* chart line dash pattern */
}

.fleet-shell[data-ds="stale"] {
  --ds-color: var(--warning);
  --ds-fill: transparent;
  --ds-radius: 0;
  --ds-opacity: .6;
}

.fleet-shell[data-ds="offline"] {
  --ds-color: var(--critical);
  --ds-fill: var(--critical);
  --ds-radius: 0;
  --ds-opacity: .35;
  --ds-dash: 4 4;
}

.fleet-shell[data-ds="sim"] {
  --ds-color: var(--info);
  --ds-fill: transparent;
  --ds-dash: 6 3;
}

.data-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--ds-color);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.data-state__dot {
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--ds-color);
  border-radius: var(--ds-radius);
  background: var(--ds-fill);
}

.fleet-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 24px;
  border: 1px solid var(--ds-color);
}

.fleet-banner--stale {
  background: repeating-linear-gradient(-45deg, var(--warning) 0 6px, transparent 6px 12px) left / 10px 100% no-repeat, var(--surface-1);
}

.fleet-banner--offline {
  background: linear-gradient(var(--critical), var(--critical)) left / 4px 100% no-repeat, var(--surface-1);
}

.fleet-banner--sim {
  background: linear-gradient(var(--info), var(--info)) left / 4px 100% no-repeat, var(--surface-1);
}

.fleet-banner--stale .icon { color: #FFD60A; }
.fleet-banner--offline .icon { color: #FF6B5E; }
.fleet-banner--sim .icon { color: #7FDBFF; }

/* --------------------------------------------------------------------------
   Dashboard body
   -------------------------------------------------------------------------- */
.fleet-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(16px, 2.5vw, 32px);
}

.fleet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.fleet-head__caption {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.fleet-head__title {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 650;
  font-stretch: 118%;
  letter-spacing: -.02em;
}

.fleet-body__note {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

/* KPIs */
.fleet-kpis {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  font-variant-numeric: tabular-nums;
}

.fleet-kpis > .fleet-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--surface-1);
  opacity: var(--ds-opacity);
}

.fleet-kpi__label,
.fleet-kpi__trend {
  font-family: var(--font-mono);
  font-size: 10px;
}

.fleet-kpi__label {
  color: var(--text-3);
}

.fleet-kpi__value {
  font-size: 30px;
  line-height: 1;
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: -.02em;
}

.fleet-kpi__unit {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
}

/* Two-up panel rows */
.fleet-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
}

.fleet-panel {
  border: 1px solid var(--line);
  background: var(--surface-1);
}

.fleet-panel--scroll {
  overflow-x: auto;
}

.fleet-panel__head {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.fleet-panel__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.fleet-panel__action,
.fleet-panel__action:hover {
  font-size: 13px;
  color: var(--action-text);
}

.fleet-panel__foot {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Throughput chart
   -------------------------------------------------------------------------- */
.throughput__chart {
  display: block;
  opacity: var(--ds-opacity);
}

.throughput__grid {
  stroke: var(--line);
}

.throughput__tick {
  fill: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
}

.throughput__band {
  fill: var(--viz-1);
  opacity: .12;
}

.throughput__line {
  fill: none;
  stroke: var(--viz-1);
  stroke-width: 1.5;
  stroke-dasharray: var(--ds-dash);
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.alert-row.is-acked {
  opacity: .45;
}

.alert-row__sev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.alert-row__sev--critical { color: var(--critical); }
.alert-row__sev--warning { color: var(--warning); }
.alert-row__sev--info { color: var(--info); }

.alert-row__sev--critical .icon { color: #FF6B5E; }
.alert-row__sev--warning .icon { color: #FFD60A; }
.alert-row__sev--info .icon { color: #7FDBFF; }

.alert-row__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.alert-row__ack {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: transparent;
  color: var(--text);
  font: 500 12px var(--font-sans);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Maintenance tickets
   -------------------------------------------------------------------------- */
.ticket-table {
  min-width: 420px;
}

.ticket-table__row {
  display: grid;
  grid-template-columns: 80px 1fr 90px 110px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.ticket-table__id,
.ticket-table__sla {
  font-family: var(--font-mono);
  font-size: 11px;
}

.ticket-table__sub,
.ticket-table__state {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.ticket-table__state {
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Robot tiles
   -------------------------------------------------------------------------- */
.robot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1px;
  background: var(--line);
}

.robot-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--surface-1);
  opacity: var(--ds-opacity);
}

.robot-card__id {
  font-family: var(--font-mono);
  font-size: 11px;
}

.robot-card__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

/* Battery bar: width from --bat */
.robot-card__bar {
  height: 3px;
  background: var(--line);
}

.robot-card__bar::after {
  content: "";
  display: block;
  width: var(--bat, 0%);
  height: 3px;
  background: var(--text-2);
}

.robot-card__bat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

/* Robot state dot: shape + fill, never color alone */
.robot-dot {
  width: 8px;
  height: 8px;
  border: 1.5px solid;
  border-radius: 50%;
}

.robot-dot--live { border-color: var(--success); background: var(--success); }
.robot-dot--charging { border-color: var(--info); background: transparent; }
.robot-dot--estop { border-color: var(--critical); background: var(--critical); border-radius: 0; }
.robot-dot--idle { border-color: var(--text-3); background: transparent; }

/* --------------------------------------------------------------------------
   Annotation + FLUX pill
   -------------------------------------------------------------------------- */
/* Annotation box (base: components/annotation.css), pinned to the viewport */
.anno {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 30;
}

.page-d11-fleet-os .flux-pill {
  box-shadow: none;
}

/* Plain link hover here (no pill background) */
.page-d11-fleet-os .flux-pill__link:hover {
  background: transparent;
  color: var(--action-text);
}
