:root {
  --canvas: #f1eee5;
  --canvas-deep: #e8e3d8;
  --surface: #fbfaf5;
  --surface-raised: #fffefa;
  --surface-soft: #f6f3ea;
  --ink: #14211e;
  --ink-soft: #35433f;
  --muted: #68726e;
  --line: #dcd8cd;
  --line-strong: #c8c2b5;
  --petrol: #0e5d55;
  --petrol-dark: #123f3a;
  --petrol-soft: #dcebe5;
  --petrol-pale: #eef6f2;
  --blue: #456c87;
  --blue-soft: #e5edf2;
  --amber: #a86b25;
  --amber-soft: #f5ead8;
  --coral: #b75244;
  --coral-soft: #f7e4df;
  --violet: #695c89;
  --violet-soft: #ebe7f2;
  --offline: #717873;
  --shadow-sm: 0 1px 1px rgba(20, 33, 30, 0.03), 0 8px 24px rgba(20, 33, 30, 0.04);
  --shadow-lg: 0 24px 80px rgba(20, 33, 30, 0.14);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 236px;
  --topbar-height: 94px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 85% -20%, rgba(14, 93, 85, 0.07), transparent 34rem),
    var(--canvas);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  transform: translateY(-150%);
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  text-decoration: none;
}

.skip-link:focus {
  transform: none;
}

:focus-visible {
  outline: 3px solid rgba(14, 93, 85, 0.42);
  outline-offset: 3px;
}

.noscript-message {
  position: fixed;
  inset: 16px 16px auto;
  z-index: 999;
  border: 1px solid var(--coral);
  border-radius: 14px;
  background: var(--coral-soft);
  padding: 14px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  fill: none;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.brand-mark circle {
  fill: currentColor;
  stroke: none;
}

.brand-name,
.brand-product {
  display: block;
}

.brand-name {
  font-size: 22px;
  font-weight: 830;
  letter-spacing: -0.055em;
  line-height: 0.9;
}

.brand-product {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.button,
.icon-button,
.account-button,
.nav-item,
.mobile-nav button,
.segmented-control button {
  appearance: none;
  cursor: pointer;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.2;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button-primary {
  border-color: var(--petrol-dark);
  background: var(--petrol-dark);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: #0c332f;
}

.button-secondary {
  border-color: rgba(14, 93, 85, 0.24);
  background: var(--petrol-soft);
  color: var(--petrol-dark);
}

.button-quiet {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--ink-soft);
}

.button-light {
  border-color: #fff;
  background: #fff;
  color: var(--petrol-dark);
}

.button-ghost-light {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.button-danger-text {
  width: fit-content;
  border-color: rgba(183, 82, 68, 0.22);
  background: transparent;
  color: var(--coral);
}

.button-wide {
  width: 100%;
}

.button-wide svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.button-wide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-raised);
  place-items: center;
  position: relative;
}

.icon-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  width: fit-content;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 790;
  letter-spacing: 0.065em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-measured {
  border-color: rgba(14, 93, 85, 0.17);
  background: var(--petrol-soft);
  color: var(--petrol);
}

.badge-estimated {
  border-color: rgba(69, 108, 135, 0.18);
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-experimental {
  border-color: rgba(168, 107, 37, 0.19);
  background: var(--amber-soft);
  color: #895319;
}

.badge-calibrating {
  border-color: rgba(105, 92, 137, 0.18);
  background: var(--violet-soft);
  color: var(--violet);
}

.badge-offline {
  border-color: rgba(113, 120, 115, 0.2);
  background: #eceeea;
  color: var(--offline);
}

.badge-alert {
  border-color: rgba(183, 82, 68, 0.19);
  background: var(--coral-soft);
  color: var(--coral);
}

.toast-region {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 100;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-message {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--ink);
  box-shadow: var(--shadow-lg);
  color: #fff;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.45;
  animation: toast-in 180ms ease both;
}

.toast-message.is-error {
  background: #672e28;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Auth */
.auth-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  place-items: center;
}

.auth-screen::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(14, 93, 85, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 93, 85, 0.028) 1px, transparent 1px);
  background-size: 52px 52px;
  content: "";
  mask-image: radial-gradient(circle at center, #000, transparent 72%);
}

.auth-ambient {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(86vw, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.auth-ambient span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(14, 93, 85, 0.08);
  border-radius: 50%;
}

.auth-ambient span:nth-child(2) { inset: 16%; }
.auth-ambient span:nth-child(3) { inset: 32%; }

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  border: 1px solid rgba(200, 194, 181, 0.78);
  border-radius: var(--radius-xl);
  background: rgba(251, 250, 245, 0.93);
  box-shadow: var(--shadow-lg);
  padding: clamp(28px, 5vw, 46px);
  backdrop-filter: blur(18px);
}

.brand-auth {
  margin-bottom: 54px;
  color: var(--petrol-dark);
}

.auth-copy h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(38px, 7vw, 56px);
  font-weight: 790;
  letter-spacing: -0.06em;
  line-height: 0.94;
}

.auth-copy > p:last-child {
  max-width: 34ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 15px;
  margin-top: 32px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 690;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-raised);
  padding: 10px 12px;
}

.field input:focus,
.field select:focus {
  border-color: rgba(14, 93, 85, 0.52);
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-status.is-error {
  color: var(--coral);
}

.privacy-note {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 28px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.privacy-note svg {
  width: 18px;
  fill: none;
  flex: 0 0 auto;
  stroke: var(--petrol);
  stroke-width: 1.6;
}

/* App shell */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid rgba(200, 194, 181, 0.72);
  background: rgba(251, 250, 245, 0.84);
  padding: 30px 22px 24px;
  backdrop-filter: blur(18px);
}

.sidebar .brand {
  min-height: 44px;
  color: var(--petrol-dark);
  padding: 0 8px;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 58px;
}

.nav-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease;
}

.nav-item:hover {
  background: rgba(14, 93, 85, 0.06);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--petrol-soft);
  color: var(--petrol-dark);
  font-weight: 730;
}

.nav-item svg {
  width: 21px;
  fill: none;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.sidebar-spacer {
  flex: 1 1 auto;
}

.sidebar-health {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 18px 8px 0;
}

.health-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--offline);
  box-shadow: 0 0 0 5px rgba(113, 120, 115, 0.09);
}

.health-good {
  background: var(--petrol);
  box-shadow: 0 0 0 5px rgba(14, 93, 85, 0.09);
}

.health-warning {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(168, 107, 37, 0.1);
}

.health-alert {
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(183, 82, 68, 0.1);
}

.sidebar-health strong,
.sidebar-health span {
  display: block;
}

.sidebar-health strong {
  font-size: 12px;
}

.sidebar-health span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.sidebar-privacy {
  margin: 18px 8px 0;
  color: var(--muted);
  font-size: 10px;
}

.workspace {
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(200, 194, 181, 0.68);
  background: rgba(241, 238, 229, 0.88);
  padding: max(18px, env(safe-area-inset-top)) clamp(24px, 4vw, 54px) 18px;
  backdrop-filter: blur(18px);
}

.page-title {
  margin: 0;
  font-size: 25px;
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-state {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(168, 107, 37, 0.09);
}

.sync-state.is-live .sync-dot {
  background: var(--petrol);
  box-shadow: 0 0 0 5px rgba(14, 93, 85, 0.09);
}

.sync-state.is-offline .sync-dot {
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(183, 82, 68, 0.09);
}

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  min-width: 19px;
  height: 19px;
  border: 2px solid var(--canvas);
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  place-items: center;
}

.account-button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  padding: 5px 12px 5px 5px;
}

.account-button > span:first-child {
  display: grid;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--petrol-dark);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  place-items: center;
}

.account-button > span:nth-child(2) {
  max-width: 120px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-button svg {
  width: 14px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 180px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  padding: 7px;
}

.account-menu button {
  width: 100%;
  border-radius: 9px;
  background: transparent;
  padding: 10px 11px;
  color: var(--coral);
  text-align: left;
}

main {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 32px clamp(24px, 4vw, 54px) max(60px, env(safe-area-inset-bottom));
}

.page-view {
  animation: view-in 220ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.card {
  border: 1px solid rgba(200, 194, 181, 0.8);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-header h2,
.priority-card h2,
.snapshot-section h2,
.page-heading h2,
.privacy-card h2 {
  margin: 0;
  font-weight: 770;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.card-header h2,
.priority-card h2,
.snapshot-section h2 {
  font-size: 21px;
}

.card-header.compact {
  align-items: center;
}

.card-copy {
  max-width: 62ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Overview */
.truth-hero {
  position: relative;
  display: grid;
  min-height: 240px;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 32px;
  align-items: end;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--petrol-dark);
  box-shadow: 0 18px 52px rgba(18, 63, 58, 0.16);
  color: #fff;
  padding: clamp(28px, 4vw, 48px);
  transition: background-color 200ms ease;
}

.truth-hero.truth-alert {
  background: #713930;
}

.truth-hero.truth-warning {
  background: #66502f;
}

.truth-hero.truth-offline {
  background: #454d49;
}

.truth-content {
  position: relative;
  z-index: 2;
}

.truth-meta-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 650;
}

.truth-meta-line .badge-estimated {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.truth-meta-line .badge-measured,
.truth-meta-line .badge-experimental,
.truth-meta-line .badge-calibrating,
.truth-meta-line .badge-offline,
.truth-meta-line .badge-alert {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.live-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 10px;
  font-weight: 790;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8ad5b8;
  box-shadow: 0 0 0 5px rgba(138, 213, 184, 0.12);
}

.truth-content h2 {
  max-width: 13ch;
  margin: 24px 0 0;
  font-size: clamp(42px, 5.2vw, 76px);
  font-weight: 790;
  letter-spacing: -0.072em;
  line-height: 0.92;
}

.truth-content > p {
  max-width: 58ch;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.hero-confidence {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 140px;
  align-content: end;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  padding-left: 28px;
}

.hero-confidence span,
.hero-confidence small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-confidence strong {
  margin: 8px 0;
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1;
}

.hero-confidence small {
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

.truth-radar {
  position: absolute;
  top: 50%;
  right: -110px;
  width: 420px;
  height: 420px;
  transform: translateY(-50%);
  pointer-events: none;
}

.truth-radar span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.truth-radar span:nth-child(2) { inset: 18%; }
.truth-radar span:nth-child(3) { inset: 36%; }

.truth-radar::before,
.truth-radar::after {
  position: absolute;
  background: rgba(255, 255, 255, 0.06);
  content: "";
}

.truth-radar::before { top: 50%; right: 0; left: 0; height: 1px; }
.truth-radar::after { top: 0; bottom: 0; left: 50%; width: 1px; }

.truth-radar i {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9ce4c7;
  box-shadow: 0 0 0 9px rgba(156, 228, 199, 0.09), 0 0 34px rgba(156, 228, 199, 0.42);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.72fr);
  gap: 18px;
  margin-top: 18px;
}

.map-card {
  min-width: 0;
  padding: 24px;
}

.plan-shell {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f5f3ec;
}

.space-map,
.space-editor-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 430px;
  touch-action: none;
}

.space-grid-layer {
  color: rgba(20, 33, 30, 0.055);
}

.map-grid-line {
  stroke: currentColor;
  stroke-width: 1;
}

.map-room {
  fill: #fffefa;
  stroke: #bbb8ad;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.map-room.is-active {
  fill: #e7f2ed;
  stroke: var(--petrol);
}

.map-room.is-alert {
  fill: #f7e4df;
  stroke: var(--coral);
}

.map-room-label {
  fill: var(--ink-soft);
  font-size: 18px;
  font-weight: 730;
  letter-spacing: -0.02em;
  pointer-events: none;
}

.map-room-state {
  fill: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.map-wall {
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-width: 8;
  vector-effect: non-scaling-stroke;
}

.map-wall.is-inferred {
  stroke: var(--amber);
  stroke-dasharray: 10 8;
  stroke-width: 4;
}

.map-obstacle {
  fill: #d9d4c8;
  stroke: #b7b0a2;
  stroke-width: 1.5;
}

.map-obstacle.is-metal { fill: #c8d0cf; }
.map-obstacle.is-glass { fill: rgba(139, 176, 190, 0.18); stroke: #8bb0be; }

.map-obstacle-label {
  fill: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.map-sensor-group {
  cursor: pointer;
}

.map-sensor-ring {
  fill: rgba(255, 255, 255, 0.9);
  stroke: var(--petrol);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.map-sensor-dot {
  fill: var(--petrol);
}

.map-sensor-group.is-offline .map-sensor-ring { stroke: var(--offline); }
.map-sensor-group.is-offline .map-sensor-dot { fill: var(--offline); }
.map-sensor-group.is-calibrating .map-sensor-ring { stroke: var(--violet); }
.map-sensor-group.is-calibrating .map-sensor-dot { fill: var(--violet); }

.map-sensor-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 720;
  paint-order: stroke;
  pointer-events: none;
  stroke: #f5f3ec;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.map-halo {
  fill: url(#none);
  opacity: 0.22;
  pointer-events: none;
  stroke: var(--petrol);
  stroke-dasharray: 8 7;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
}

.map-halo.is-motion {
  fill: rgba(14, 93, 85, 0.17);
  stroke: var(--petrol);
}

.map-halo.is-alert {
  fill: rgba(183, 82, 68, 0.18);
  stroke: var(--coral);
}

.plan-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  border: 1px solid rgba(200, 194, 181, 0.85);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.9);
  padding: 8px 11px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 690;
  backdrop-filter: blur(10px);
}

.plan-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-motion { background: var(--petrol); box-shadow: 0 0 0 4px rgba(14, 93, 85, 0.12); }
.legend-sensor { border: 2px solid var(--petrol); background: #fff; }
.legend-line { display: inline-block; width: 14px; border-top: 2px solid var(--ink); }

.map-caveat {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.map-caveat svg {
  width: 16px;
  fill: none;
  flex: 0 0 auto;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.5;
}

.overview-rail {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
}

.zone-list-card,
.priority-card {
  padding: 21px;
}

.meta-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.zone-list,
.capability-list,
.sensor-list,
.event-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.zone-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.zone-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-raised);
  padding: 11px 12px;
}

.zone-item-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--offline);
}

.zone-item.is-active .zone-item-indicator { background: var(--petrol); box-shadow: 0 0 0 5px rgba(14, 93, 85, 0.09); }
.zone-item.is-alert .zone-item-indicator { background: var(--coral); box-shadow: 0 0 0 5px rgba(183, 82, 68, 0.09); }
.zone-item.is-calibrating .zone-item-indicator { background: var(--violet); }

.zone-item strong,
.zone-item small {
  display: block;
}

.zone-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.zone-item-state {
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  text-align: right;
}

.priority-card {
  display: grid;
  min-height: 248px;
  align-content: space-between;
  gap: 22px;
  background: var(--surface-soft);
}

.priority-card.priority-alert {
  border-color: rgba(183, 82, 68, 0.3);
  background: var(--coral-soft);
}

.priority-card.priority-warning {
  border-color: rgba(168, 107, 37, 0.28);
  background: var(--amber-soft);
}

.priority-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.priority-icon {
  display: grid;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--surface-raised);
  color: var(--petrol);
  place-items: center;
}

.priority-icon svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.priority-alert .priority-icon { color: var(--coral); }
.priority-warning .priority-icon { color: var(--amber); }

.priority-card .button {
  width: fit-content;
}

.snapshot-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  min-height: 112px;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(200, 194, 181, 0.76);
  border-radius: 18px;
  background: rgba(251, 250, 245, 0.76);
  padding: 18px;
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  place-items: center;
}

.metric-icon svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.metric-green { background: var(--petrol-soft); color: var(--petrol); }
.metric-blue { background: var(--blue-soft); color: var(--blue); }
.metric-amber { background: var(--amber-soft); color: var(--amber); }

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card > div > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  margin-top: 6px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1;
}

.metric-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

/* Activity */
.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin: 6px 0 28px;
}

.page-heading h2 {
  font-size: clamp(38px, 5vw, 62px);
}

.page-heading > div > p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.segmented-control {
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 250, 245, 0.72);
  padding: 4px;
}

.segmented-control button {
  min-height: 36px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 7px 13px;
  font-size: 11px;
  font-weight: 710;
}

.segmented-control button.is-active {
  background: var(--petrol-dark);
  color: #fff;
}

.activity-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 124px;
  border: 1px solid rgba(200, 194, 181, 0.76);
  border-radius: 18px;
  background: rgba(251, 250, 245, 0.76);
  padding: 18px;
}

.stat-card span,
.stat-card strong,
.stat-card small {
  display: block;
}

.stat-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.stat-card strong {
  margin-top: 13px;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.05em;
  line-height: 1;
}

.stat-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(330px, 0.7fr);
  gap: 18px;
  margin-top: 18px;
}

.chart-card,
.timeline-card {
  padding: 22px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: var(--muted);
  font-size: 10px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--petrol);
}

.chart-legend .legend-gap {
  border: 1px solid var(--line-strong);
  background: repeating-linear-gradient(135deg, transparent 0 3px, rgba(104, 114, 110, 0.25) 3px 5px);
}

.history-chart {
  display: grid;
  min-height: 280px;
  grid-template-columns: repeat(var(--history-count, 24), minmax(8px, 1fr));
  gap: 7px;
  align-items: end;
  margin-top: 30px;
  border-bottom: 1px solid var(--line);
  padding: 0 3px 12px;
}

.history-bar-wrap {
  display: grid;
  height: 240px;
  grid-template-rows: minmax(0, 1fr) 20px;
  gap: 6px;
  align-items: end;
}

.history-bar-track {
  position: relative;
  height: 100%;
  border-radius: 9px;
  background: rgba(20, 33, 30, 0.035);
  overflow: hidden;
}

.history-bar-track.is-unavailable {
  border: 1px solid rgba(200, 194, 181, 0.75);
  background: repeating-linear-gradient(135deg, rgba(104, 114, 110, 0.02) 0 6px, rgba(104, 114, 110, 0.12) 6px 8px);
}

.history-bar-wrap.is-unavailable .history-bar {
  display: none;
}

.history-bar-wrap.is-partial .history-bar-track {
  opacity: 0.68;
}

.history-bar {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  min-height: 3px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #4f9485, var(--petrol));
}

.history-bar.is-empty {
  background: var(--line);
}

.history-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table-details {
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
}

.data-table-details summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 700;
}

.table-scroll {
  overflow: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink-soft);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.event-timeline {
  display: grid;
  gap: 0;
  margin-top: 20px;
}

.event-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 20px;
}

.event-item:not(:last-child)::before {
  position: absolute;
  top: 14px;
  bottom: 0;
  left: 5px;
  width: 1px;
  background: var(--line);
  content: "";
}

.event-dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 3px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--petrol);
  box-shadow: 0 0 0 1px var(--petrol);
}

.event-item.is-alert .event-dot { background: var(--coral); box-shadow: 0 0 0 1px var(--coral); }
.event-item.is-warning .event-dot { background: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.event-item.is-offline .event-dot { background: var(--offline); box-shadow: 0 0 0 1px var(--offline); }

.event-content {
  min-width: 0;
}

.event-content button {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: transparent;
  padding: 0;
  text-align: left;
}

.event-content strong {
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.event-content p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 9px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 22px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Configuration */
.configuration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.config-plan-card,
.capability-card,
.sensor-card,
.privacy-card {
  padding: 24px;
}

.config-plan-card,
.privacy-card {
  grid-column: 1 / -1;
}

.space-inventory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.inventory-stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 13px;
}

.inventory-stat span,
.inventory-stat strong {
  display: block;
}

.inventory-stat span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inventory-stat strong {
  margin-top: 7px;
  font-size: 20px;
  font-weight: 760;
}

.capability-list,
.sensor-list {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.capability-item,
.sensor-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 3px 0 14px;
}

.capability-item:last-child,
.sensor-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.capability-item strong,
.sensor-item strong,
.capability-item small,
.sensor-item small {
  display: block;
}

.capability-item strong,
.sensor-item strong {
  font-size: 12px;
}

.capability-item small,
.sensor-item small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.sensor-state {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.sensor-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--offline);
}

.sensor-state.is-online i { background: var(--petrol); }
.sensor-state.is-calibrating i { background: var(--violet); }

.privacy-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  background: var(--petrol-dark);
  color: #fff;
}

.privacy-visual {
  display: grid;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.07);
  place-items: center;
}

.privacy-visual svg {
  width: 50px;
  fill: none;
  stroke: #a9dec9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.privacy-card .eyebrow,
.privacy-card p {
  color: rgba(255, 255, 255, 0.65);
}

.privacy-card h2 {
  font-size: 28px;
}

.privacy-card p {
  max-width: 66ch;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

.privacy-points {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.privacy-points span {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 700;
}

/* Dialogs */
.dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  padding: 0;
}

.dialog::backdrop {
  background: rgba(14, 24, 21, 0.48);
  backdrop-filter: blur(5px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 22px 24px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 780;
  letter-spacing: -0.05em;
}

.dialog-header p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 600px;
}

.editor-canvas-wrap {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 20px;
}

.space-editor-svg {
  min-height: 530px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f6ef;
}

.editor-help {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 10px;
}

.editor-selectable {
  cursor: grab;
}

.editor-selectable:active {
  cursor: grabbing;
}

.editor-selected {
  filter: drop-shadow(0 0 5px rgba(14, 93, 85, 0.35));
}

.editor-selected > :first-child,
.editor-selected:first-child {
  stroke: var(--petrol) !important;
  stroke-width: 4 !important;
}

.editor-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.editor-actions .button {
  min-height: 37px;
  padding: 7px 11px;
  font-size: 11px;
}

.editor-empty {
  display: grid;
  min-height: 180px;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 20px;
  text-align: center;
}

.editor-empty-icon {
  color: var(--petrol);
  font-size: 32px;
}

.editor-empty strong {
  margin-top: 8px;
  font-size: 12px;
}

.editor-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.editor-fields {
  display: grid;
  min-width: 0;
  gap: 12px;
  border: 0;
  margin: 0;
  padding: 0;
}

.editor-fields legend {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 760;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.editor-truth-note {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.editor-truth-note p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.editor-polygon-notice {
  margin-top: 0;
  border: 1px solid rgba(168, 107, 37, 0.24);
  border-radius: 14px;
  background: var(--amber-soft);
  padding: 13px;
}

.dialog-footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding: 15px 24px;
}

.dialog-footer > div {
  display: flex;
  gap: 8px;
}

.event-dialog {
  width: min(560px, calc(100vw - 32px));
}

.event-dialog-body {
  padding: 24px;
}

.event-dialog-body > p {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.event-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 20px 0 0;
}

.event-facts div {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  padding: 11px;
}

.event-facts dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.event-facts dd {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.dialog-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.event-dialog-body .event-caveat {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 10px;
}

.mobile-nav {
  display: none;
}

/* Responsive */
@media (max-width: 1180px) {
  :root { --sidebar-width: 206px; }

  .overview-grid,
  .activity-grid {
    grid-template-columns: 1fr;
  }

  .overview-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  .priority-card {
    min-height: 100%;
  }

  .plan-shell {
    min-height: 390px;
  }

  .space-map {
    min-height: 390px;
  }
}

@media (max-width: 900px) {
  :root { --topbar-height: 78px; }

  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .sidebar {
    display: none;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    min-height: var(--topbar-height);
    padding: max(13px, env(safe-area-inset-top)) 18px 13px;
  }

  .topbar .eyebrow,
  .sync-state,
  .account-button > span:nth-child(2),
  .account-button > svg {
    display: none;
  }

  .account-button {
    width: 42px;
    padding: 5px;
  }

  .account-button > span:first-child {
    width: 30px;
    height: 30px;
  }

  main {
    padding: 22px 18px 28px;
  }

  .mobile-nav {
    position: fixed;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid rgba(200, 194, 181, 0.9);
    border-radius: 21px;
    background: rgba(251, 250, 245, 0.94);
    box-shadow: 0 12px 46px rgba(20, 33, 30, 0.14);
    padding: 6px;
    backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    display: grid;
    min-height: 51px;
    gap: 2px;
    border-radius: 15px;
    background: transparent;
    color: var(--muted);
    padding: 6px;
    place-items: center;
  }

  .mobile-nav button.is-active {
    background: var(--petrol-soft);
    color: var(--petrol-dark);
  }

  .mobile-nav svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }

  .mobile-nav span {
    font-size: 9px;
    font-weight: 740;
  }

  .truth-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-confidence {
    min-height: auto;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-left: 0;
    padding-top: 18px;
    padding-left: 0;
  }

  .hero-confidence strong {
    font-size: 30px;
  }

  .snapshot-grid,
  .activity-metrics {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .metric-card,
  .stat-card {
    scroll-snap-align: start;
  }

  .configuration-grid {
    grid-template-columns: 1fr;
  }

  .config-plan-card,
  .privacy-card {
    grid-column: auto;
  }

  .space-inventory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-canvas-wrap {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .space-editor-svg {
    min-height: 380px;
  }

  .editor-panel {
    min-height: 420px;
  }
}

@media (max-width: 680px) {
  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions > .badge {
    display: none;
  }

  .page-title {
    font-size: 22px;
  }

  .truth-hero {
    min-height: 330px;
    padding: 26px 22px;
  }

  .truth-content h2 {
    margin-top: 20px;
    font-size: clamp(40px, 13vw, 58px);
  }

  .truth-radar {
    top: 0;
    right: -170px;
    transform: none;
  }

  .hero-confidence {
    grid-template-columns: auto auto;
  }

  .hero-confidence small {
    grid-column: 1 / -1;
  }

  .overview-rail {
    grid-template-columns: 1fr;
  }

  .map-card,
  .zone-list-card,
  .priority-card,
  .chart-card,
  .timeline-card,
  .config-plan-card,
  .capability-card,
  .sensor-card,
  .privacy-card {
    padding: 18px;
  }

  .card-header {
    flex-direction: column;
  }

  .card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .plan-shell,
  .space-map {
    min-height: 300px;
  }

  .plan-legend {
    right: 8px;
    bottom: 8px;
    left: 8px;
    justify-content: center;
    border-radius: 13px;
  }

  .metric-card {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 100px;
    gap: 10px;
    padding: 14px;
  }

  .metric-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .history-chart {
    gap: 4px;
    overflow-x: auto;
  }

  .history-bar-wrap {
    min-width: 15px;
  }

  .privacy-card {
    grid-template-columns: 1fr;
  }

  .privacy-visual {
    width: 74px;
    height: 74px;
    border-radius: 22px;
  }

  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
  }

  .dialog-header,
  .dialog-footer {
    padding: 17px;
  }

  .dialog-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-footer > div {
    justify-content: flex-end;
  }

  .editor-canvas-wrap,
  .editor-panel,
  .event-dialog-body {
    padding: 16px;
  }

  .space-editor-svg {
    min-height: 300px;
  }

  .event-facts {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
