/* ==========================================================================
   Brotech Operasyon Konsolu: the robot panel's BROTECH design system
   (src/brobot_web_api/static/app/css/app.css, D-296) for the fleet console.
   The same tokens, light and dark; no web fonts, no build step.
   Colour rules as on the robot: neutral when normal, amber = needs attention,
   red = stopped / needs a person, blue only for what you can tap. Every state
   also carries a word.
   ========================================================================== */

:root {
  color-scheme: light dark;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f6;
  --border: #dce2e9;
  --border-strong: #7f8d9f;
  --text: #0f1b2a;
  --text-2: #4a5a6c;
  --text-3: #5f6f82;
  --primary: #2458e6;
  --primary-hover: #1d47c4;
  --primary-soft: #eaf0ff;
  --on-primary: #ffffff;
  --focus: #2458e6;
  --danger: #c62828;
  --danger-hover: #a91f1f;
  --danger-text: #b42318;
  --danger-soft: #fdedec;
  --warning: #b45309;
  --warning-text: #9a4a00;
  --warning-soft: #fef4e4;
  --ok: #157a3a;
  --ok-soft: #e7f6ec;
  --info-soft: #eaf0ff;
  --stale: #5f6f82;
  --brand-ink: #0f1b2a;
  --brand-tech: #6b7c8f;
  --scrim: rgba(15, 27, 42, 0.45);
  --shadow-1: 0 1px 2px rgba(15, 27, 42, 0.06), 0 1px 1px rgba(15, 27, 42, 0.04);
  --shadow-2: 0 10px 32px rgba(15, 27, 42, 0.16), 0 2px 6px rgba(15, 27, 42, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-1: 12px; --fs-2: 14px; --fs-3: 16px; --fs-4: 18px; --fs-5: 20px;
  --fs-6: 24px; --fs-7: 32px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;
  --tap: 44px;
  --t-fast: 120ms; --t-med: 200ms; --t-slow: 280ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --header-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1118; --surface: #121a24; --surface-2: #17212d; --surface-3: #1e2a38;
    --border: #263241; --border-strong: #5a6b80;
    --text: #e6edf5; --text-2: #a9b6c6; --text-3: #8391a3;
    --primary: #7fa6ff; --primary-hover: #9bbaff; --primary-soft: #1a2a4d;
    --on-primary: #0b1118; --focus: #7fa6ff;
    --danger: #d32f2f; --danger-hover: #e04444; --danger-text: #ff7a70; --danger-soft: #3a1618;
    --warning: #f6b84b; --warning-text: #f6b84b; --warning-soft: #2e2410;
    --ok: #4cc38a; --ok-soft: #11291d; --info-soft: #1a2a4d; --stale: #8391a3;
    --brand-ink: #e6edf5; --brand-tech: #8fa0b3;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 12px 36px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1118; --surface: #121a24; --surface-2: #17212d; --surface-3: #1e2a38;
  --border: #263241; --border-strong: #5a6b80;
  --text: #e6edf5; --text-2: #a9b6c6; --text-3: #8391a3;
  --primary: #7fa6ff; --primary-hover: #9bbaff; --primary-soft: #1a2a4d;
  --on-primary: #0b1118; --focus: #7fa6ff;
  --danger: #d32f2f; --danger-hover: #e04444; --danger-text: #ff7a70; --danger-soft: #3a1618;
  --warning: #f6b84b; --warning-text: #f6b84b; --warning-soft: #2e2410;
  --ok: #4cc38a; --ok-soft: #11291d; --info-soft: #1a2a4d; --stale: #8391a3;
  --brand-ink: #e6edf5; --brand-tech: #8fa0b3;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 36px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-2)/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--fs-6); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: var(--fs-5); font-weight: 700; letter-spacing: -0.005em; line-height: 1.25; text-wrap: balance; }
h3 { font-size: var(--fs-3); font-weight: 650; line-height: 1.3; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden, [hidden] { display: none !important; }
.mt { margin-top: var(--sp-3); }
.warn-text { color: var(--warning-text); } .danger-text { color: var(--danger-text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
/* A container focused for screen readers after a route change shows no ring. */
[tabindex="-1"]:focus { outline: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.ic.sm { width: 16px; height: 16px; }
svg.ic.lg { width: 24px; height: 24px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important;
    animation-iteration-count: 1 !important; }
  .dot.live::after { display: none; }
}

/* --------------------------------------------------------------- the shell */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) calc(var(--sp-3) + var(--safe-r)) 0 calc(var(--sp-3) + var(--safe-l));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: var(--safe-t); z-index: 41;
  background: var(--surface); }
.brand { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; color: var(--brand-ink);
  text-decoration: none; }
.brand:hover { text-decoration: none; }
svg.brotech { display: block; height: 18px; width: auto; flex: none; }
.brand .product { font-weight: 650; font-size: var(--fs-2); color: var(--text-2); padding-left: var(--sp-2);
  border-left: 1px solid var(--border); white-space: nowrap; }
.spacer { flex: 1; min-width: 0; }
.topbar .user { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.topbar .user .who { color: var(--text-2); font-size: var(--fs-1); max-width: 220px; }
.content {
  flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; min-width: 0;
  padding: var(--sp-4) calc(var(--sp-4) + var(--safe-r)) calc(var(--sp-10) + var(--safe-b)) calc(var(--sp-4) + var(--safe-l));
}
@media (min-width: 720px) {
  .content { padding: var(--sp-6) calc(var(--sp-6) + var(--safe-r)) var(--sp-10) calc(var(--sp-6) + var(--safe-l)); }
}
@media (max-width: 599px) { .hide-sm { display: none !important; } }
@media (max-width: 420px) { .brand .product { display: none; } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  border-radius: var(--r-md); border: 0; background: none; color: var(--text-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------------------------------------------------------------- dots */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warning); }
.dot.danger { background: var(--danger); }
.dot.stale { background: var(--stale); }
/* The robot page watches the robot live: its dot breathes. */
.dot.live { position: relative; }
.dot.live::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid currentColor;
  color: var(--ok); opacity: 0; animation: ping 2.4s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(0.7); opacity: 0.55; } 70%, 100% { transform: scale(1.7); opacity: 0; } }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: var(--fs-2); font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  user-select: none; -webkit-user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.danger-ghost { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--surface); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-1); border-radius: var(--r-sm); }
.btn.lg { min-height: 52px; padding: 0 var(--sp-5); font-size: var(--fs-3); border-radius: var(--r-lg); }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* segmented control (language) */
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--r-md); background: var(--surface-3);
  border: 1px solid var(--border); }
.seg button { border: 0; background: none; min-height: 32px; padding: 0 var(--sp-2); border-radius: 7px;
  font-size: var(--fs-1); font-weight: 650; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: var(--sp-4); min-width: 0;
}
.card-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); min-height: 28px; }
.card-head h3 { flex: 1; min-width: 0; }
.card-head .meta { color: var(--text-3); font-size: var(--fs-1); }

.page-head { display: flex; align-items: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.page-head .titles { flex: 1 1 260px; min-width: 0; }
.page-head .titles p { color: var(--text-2); margin-top: 2px; }

.stack { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* ----------------------------------------------------------- pills/badges */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warning-soft); color: var(--warning-text); }
.pill.danger { background: var(--danger-soft); color: var(--danger-text); }
.pill.info { background: var(--primary-soft); color: var(--primary); }
.pill.stale { background: var(--surface-3); color: var(--stale); }

/* ---------------------------------------------------------------- forms */
.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 16px; /* 16px stops iOS zoom-on-focus */
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 40px; }

/* ------------------------------------------------------------- banners */
.banner { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.banner .ic { margin-top: 1px; }
.banner .body { flex: 1; min-width: 0; }
.banner .title { font-weight: 650; }
.banner .sub { color: var(--text-2); font-size: var(--fs-2); margin-top: 2px; overflow-wrap: anywhere; }
.banner .actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.banner.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.banner.info > .ic { color: var(--primary); }
.banner.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.banner.warn > .ic { color: var(--warning-text); }
.banner.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.banner.danger > .ic { color: var(--danger-text); }
.banners { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.banners:empty { display: none; }

/* ---------------------------------------------------------- empty state */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-2); }
.empty .ic-wrap { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto var(--sp-3); display: flex;
  align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-3); }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty p { max-width: 460px; margin: 0 auto; overflow-wrap: anywhere; }

/* --------------------------------------------------------- loading bits */
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite; border-radius: var(--r-lg); }
.skeleton.tile { min-height: 168px; }
.skeleton.line { display: block; height: 12px; width: 70%; border-radius: var(--r-sm); }
.skeleton.line + .skeleton.line { margin-top: 10px; }
.skeleton.line.sm { width: 38%; }
.skeleton.line.lg { height: 22px; width: 82%; }
.skel-card { min-height: 190px; }
.skel-card .skeleton.line.sm { height: 16px; margin-bottom: 18px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------- sign-in screens */
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--sp-6) + var(--safe-t)) var(--sp-4) calc(var(--sp-6) + var(--safe-b));
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 60%), var(--bg); }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-2); padding: var(--sp-8) var(--sp-6) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-card .brand-big { display: flex; justify-content: center; color: var(--brand-ink); }
.auth-card .brand-big svg { height: 30px; width: auto; }
.auth-card h1 { text-align: center; font-size: var(--fs-5); }
.auth-card > .sub { text-align: center; color: var(--text-2); }
.auth-card > .foot { color: var(--text-3); font-size: var(--fs-1); text-align: center; }
.auth-card .lang { display: flex; justify-content: center; }
.auth-card .auth-busy { display: flex; justify-content: center; color: var(--brand-ink); }

/* ---------------------------------------------------------- fleet page */
.fleet-tools { display: flex; gap: var(--sp-2) var(--sp-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.fleet-tools .count { color: var(--text-3); font-size: var(--fs-1); }
.filters { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--sp-3);
  font-size: 13px; white-space: nowrap; }
.filters .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: inline-flex;
  align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.filters button.on .n { background: var(--primary-soft); color: var(--primary); }
.stale-note:empty { display: none; }
/* A phone: the search on its own line, the four filters share the next one. */
@media (max-width: 599px) {
  .fleet-tools .search { flex-basis: 100%; max-width: none; }
  .filters { width: 100%; }
  .filters button { flex: 1 1 auto; justify-content: center; gap: 4px; padding: 0 6px; font-size: 12.5px; }
  .filters .n, .filters button.on .n { min-width: 0; padding: 0; background: none; }
  .filters button.on .n { color: var(--primary); }
}
.fleet { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.fleet > .empty { grid-column: 1 / -1; }
.robot-card { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); color: inherit;
  text-decoration: none; border-left-width: 4px; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.robot-card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.robot-card.tone-ok { border-left-color: var(--ok); }
.robot-card.tone-warn { border-left-color: var(--warning); }
.robot-card.tone-danger { border-left-color: var(--danger); }
.robot-card.tone-stale { border-left-color: var(--stale); }
/* Offline: the facts are the last state the robot sent. */
.robot-card.is-offline .fact .v { color: var(--text-2); font-weight: 550; }
.robot-card .top { display: flex; align-items: flex-start; gap: var(--sp-2); }
.robot-card .names { flex: 1; min-width: 0; }
.robot-card .name { font-size: var(--fs-3); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.robot-card .rid { color: var(--text-3); font-size: var(--fs-1); font-family: var(--mono); }
.robot-card .summary { font-weight: 600; overflow-wrap: anywhere; }
.robot-card .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--sp-3); }
.fact { display: flex; flex-direction: column; min-width: 0; }
.fact .k { color: var(--text-3); font-size: 11px; font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase; }
.fact .v { font-weight: 600; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; }
.robot-card .foot { display: flex; gap: 2px var(--sp-3); flex-wrap: wrap; justify-content: space-between; margin-top: auto;
  color: var(--text-3); font-size: var(--fs-1); }

/* ---------------------------------------------------------- robot page */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; margin-bottom: var(--sp-3); }
.hero { display: flex; gap: var(--sp-4); align-items: center; }
.hero .hero-ic { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2); flex: none; }
.hero .hero-ic .ic { width: 28px; height: 28px; }
.hero .hero-body { flex: 1; min-width: 0; }
.hero .hero-title { font-size: var(--fs-5); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.hero .hero-sub { color: var(--text-2); margin-top: 3px; overflow-wrap: anywhere; }
.hero.ok .hero-ic { background: var(--ok-soft); color: var(--ok); }
.hero.warn { border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: color-mix(in srgb, var(--warning-soft) 55%, var(--surface)); }
.hero.warn .hero-ic { background: var(--warning-soft); color: var(--warning-text); }
.hero.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface)); }
.hero.danger .hero-ic { background: var(--danger-soft); color: var(--danger-text); }
.id-line { margin-top: 4px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
@media (min-width: 720px) { .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-3);
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric .label { color: var(--text-2); font-size: var(--fs-1); font-weight: 600; }
.metric .value { font-size: var(--fs-5); font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.metric .note { color: var(--text-3); font-size: var(--fs-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; margin: 4px 0 2px;
  border: 0; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ok); overflow: hidden; }
progress.bar::-webkit-progress-bar { background: var(--surface-3); border-radius: var(--r-pill); }
progress.bar::-webkit-progress-value { background: var(--ok); border-radius: var(--r-pill); transition: width var(--t-slow) var(--ease); }
progress.bar::-moz-progress-bar { background: var(--ok); border-radius: var(--r-pill); }
progress.bar.warn::-webkit-progress-value { background: var(--warning); }
progress.bar.warn::-moz-progress-bar { background: var(--warning); }
progress.bar.danger::-webkit-progress-value { background: var(--danger); }
progress.bar.danger::-moz-progress-bar { background: var(--danger); }
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px var(--sp-4); align-items: baseline; margin: 0; }
.kv dt { color: var(--text-2); font-size: var(--fs-1); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.locks, .chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.cmd-note { margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-1);
  color: var(--warning-text); background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border)); }
.commands { display: grid; gap: var(--sp-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.commands .btn { width: 100%; }
.goto-form { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-3); }
.goto-form > label { font-size: var(--fs-1); font-weight: 650; color: var(--text-2); }
.goto-form .hint { font-size: var(--fs-1); color: var(--text-3); }
.goto-row { display: flex; gap: var(--sp-2); }
.goto-row .input { flex: 1 1 auto; min-width: 0; }
.goto-row .btn { flex: none; }

.robot-grid { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "commands" "details" "events" "identity"; }
.robot-grid > .commands-card { grid-area: commands; }
.robot-grid > .details { grid-area: details; }
.robot-grid > .events-card { grid-area: events; }
.robot-grid > .identity-card { grid-area: identity; }
@media (min-width: 900px) {
  .robot-grid { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); grid-template-rows: auto auto 1fr;
    grid-template-areas: "details commands" "details events" "details identity"; align-items: start; }
}
.cmd-status { margin-top: var(--sp-3); display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3);
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.cmd-status:empty { display: none; }
.cmd-status .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cmd-status.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.cmd-status.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.cmd-status.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.events li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px var(--sp-3); padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border); }
.events li:last-child { border-bottom: 0; }
.events .when { color: var(--text-3); font-size: var(--fs-1); white-space: nowrap; font-variant-numeric: tabular-nums; }
.events .what { font-weight: 600; overflow-wrap: anywhere; }
.events .type { color: var(--text-3); font-size: var(--fs-1); font-family: var(--mono); overflow-wrap: anywhere; }
.events .sev { grid-row: span 2; align-self: start; }
.events li.skel { display: block; }

/* --------------------------------------------------- confirmation dialog */
.dialog-root { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.dialog-root .scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade-in var(--t-med) var(--ease); }
.dialog { position: relative; width: 100%; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-5) calc(var(--sp-4) + var(--safe-r)) calc(var(--sp-4) + var(--safe-b)) calc(var(--sp-4) + var(--safe-l));
  animation: sheet-in var(--t-slow) var(--ease); }
.dialog h2 { font-size: var(--fs-4); }
.dialog .btn-row .btn { flex: 1 1 140px; }
@media (min-width: 720px) {
  .dialog-root { align-items: center; }
  .dialog { width: min(480px, calc(100vw - 48px)); border-radius: var(--r-xl); padding: var(--sp-6);
    animation: dialog-in var(--t-med) var(--ease); }
  .dialog .btn-row { justify-content: flex-end; }
  .dialog .btn-row .btn { flex: 0 0 auto; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes dialog-in { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
