.app-shell {
  --ink: #17212f;
  --muted: #697486;
  --line: #d9e2ea;
  --panel: #ffffff;
  --soft: #fbfcf8;
  --blue: #2f7dd1;
  --green: #1d9a74;
  --amber: #d9822b;
  --rose: #d94f62;
  --cyan: #20a7b8;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  font-size: 14px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(47, 125, 209, 0.1), transparent 28%),
    linear-gradient(315deg, rgba(245, 172, 87, 0.14), transparent 30%),
    #f0f5f4;
  color: var(--ink);
}

.svg-icon {
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  background: #101925;
  color: #eef5f7;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand,
.child-card,
.panel-title,
.bus-card,
.topbar,
.top-actions,
.map-tools,
.child-name-row,
.parent-card,
.threshold-box > div,
.range-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #30a6b6;
  color: white;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand span {
  color: #9fb1c3;
  font-size: 11px;
  margin-top: 3px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-list button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 14px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  color: #b9c8d6;
  background: transparent;
  text-align: left;
}

.nav-list button.active,
.nav-list button:hover {
  background: #1d2b3b;
  color: #ffffff;
}

.sidebar-panel {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.panel-title {
  gap: 8px;
  color: #dbe7ef;
  font-weight: 700;
  font-size: 13px;
}

.signal-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  color: #b7c6d3;
}

.meter,
.range-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.meter {
  margin: 10px 0;
}

.meter span,
.range-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.meter span {
  background: #3fd0b5;
}

.sidebar-panel small {
  color: #8fa3b6;
}

.main {
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}

.page-title span,
.section-head p,
.parent-card p,
.bus-card p,
.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.page-title h1,
.section-head h2,
.child-card h2,
.bus-card h2 {
  margin: 4px 0 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.page-title h1 {
  font-size: 21px;
}

.top-actions {
  gap: 7px;
}

.scope-switch {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.86);
}

.scope-switch button {
  min-width: 46px;
  height: 28px;
  border: 0;
  border-radius: 14px;
  padding: 0 10px;
  background: transparent;
  color: #637386;
  font-size: 12px;
  font-weight: 900;
}

.scope-switch button.active {
  background: #236ca7;
  color: white;
  box-shadow: 0 5px 13px rgba(35, 108, 167, 0.2);
}

.search-box {
  min-width: 230px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.ghost-button,
.primary-button,
.icon-button,
.tool {
  min-height: 36px;
  border-radius: 16px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 700;
  line-height: 1;
}

.primary-button {
  border-color: #1f7fcd;
  background: #1f7fcd;
  color: white;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.mobile-menu {
  display: none;
}

.stats-grid,
.lower-grid,
.bus-parent-band {
  display: grid;
  gap: 8px;
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.stat-card,
.map-section,
.detail-panel,
.event-panel,
.roster-panel,
.settings-panel,
.bus-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(203, 216, 226, 0.9);
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(31, 51, 73, 0.08);
}

.stat-card {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 11px;
  text-align: left;
}

.stat-card > div:last-child {
  min-width: 0;
  flex: 1;
}

.stat-card strong {
  display: block;
  margin-top: 3px;
  color: var(--stat-color, var(--ink));
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--stat-color, var(--blue)) 13%, white);
  color: var(--stat-color, var(--blue));
}

.stat-icon .svg-icon {
  width: 19px;
  height: 19px;
}

.stat-card.blue {
  --stat-color: #236ca7;
}

.stat-card.green {
  --stat-color: var(--green);
}

.stat-card.amber {
  --stat-color: #b86819;
}

.stat-card.rose {
  --stat-color: #dc2626;
}

.stat-card.cyan {
  --stat-color: #147c89;
}

.stat-card.gray {
  --stat-color: #64748b;
}

.zone-chip.blue {
  background: #e7f1fb;
  color: var(--blue);
}

.zone-chip.green {
  background: #e6f7f1;
  color: var(--green);
}

.zone-chip.amber {
  background: #fff2df;
  color: var(--amber);
}

.zone-chip.pink {
  background: #fdecef;
  color: var(--rose);
}

.stat-card.rose.emphasis {
  background: #fff1f2;
  border-color: #f43f5e;
  box-shadow: 0 14px 34px rgba(220, 38, 38, 0.16);
}

.stat-card.rose.emphasis strong {
  color: #b91c1c;
  font-size: 24px;
}

.stat-card.rose.emphasis .stat-icon {
  background: #dc2626;
  color: white;
}

.zone-chip.slate {
  background: #ecf0f4;
  color: #566578;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 8px;
  align-items: stretch;
  min-height: 0;
}

.map-section,
.detail-panel,
.event-panel,
.roster-panel,
.settings-panel {
  padding: 9px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 7px;
}

.section-head h2 {
  font-size: 16px;
}

.map-tools {
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.floor-switch {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.86);
}

.floor-switch button {
  min-width: 42px;
  height: 24px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #637386;
  font-size: 12px;
  font-weight: 900;
}

.floor-switch button.active {
  background: #101925;
  color: white;
}

.tool {
  min-height: 32px;
  font-size: 12px;
}

.tool.active {
  background: #e8f4f7;
  border-color: #95c9d2;
  color: #0d7382;
}

.floor-map {
  --map-pan-x: 0px;
  --map-pan-y: 0px;
  position: relative;
  height: min(590px, calc(100vh - 340px));
  min-height: 0;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid #cbd8e2;
  background:
    linear-gradient(90deg, rgba(23, 33, 47, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(23, 33, 47, 0.05) 1px, transparent 1px),
    #fbfcf8;
  background-size: 28px 28px;
  background-position:
    var(--map-pan-x) var(--map-pan-y),
    var(--map-pan-x) var(--map-pan-y),
    0 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.floor-map.dragging {
  cursor: grabbing;
}

.floor-map.returning .room,
.floor-map.returning .yard,
.floor-map.returning .gate,
.floor-map.returning .danger-zone,
.floor-map.returning .history-layer,
.floor-map.returning .map-marker {
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.floor-map.returning {
  transition: background-position 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.floor-map.dragging .room,
.floor-map.dragging .yard,
.floor-map.dragging .gate,
.floor-map.dragging .danger-zone,
.floor-map.dragging .history-layer,
.floor-map.dragging .map-marker {
  transition: none;
}

.room,
.yard,
.gate,
.danger-zone {
  position: absolute;
  border-radius: 18px;
  border: 2px solid #b6c7d5;
  display: grid;
  place-items: center;
  color: #405064;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.78);
  transform: translate(var(--map-pan-x), var(--map-pan-y));
}

.room-a {
  left: 6%;
  top: 10%;
  width: 30%;
  height: 28%;
}

.room-b {
  left: 6%;
  top: 42%;
  width: 25%;
  height: 26%;
}

.room-c {
  left: 39%;
  top: 10%;
  width: 18%;
  height: 24%;
}

.room-d {
  left: 35%;
  top: 68%;
  width: 26%;
  height: 20%;
}

.room-e {
  left: 55%;
  top: 51%;
  width: 14%;
  height: 21%;
}

.yard {
  left: 61%;
  top: 14%;
  width: 31%;
  height: 48%;
  border-style: dashed;
  border-color: #93c7a7;
  background: rgba(232, 248, 236, 0.72);
  color: #2c7d4c;
}

.gate {
  left: 7%;
  top: 79%;
  width: 14%;
  height: 10%;
  border-color: #98a8b7;
}

.danger-zone {
  border-color: #e07179;
  color: #ba2636;
  background: repeating-linear-gradient(
    45deg,
    rgba(217, 79, 98, 0.14),
    rgba(217, 79, 98, 0.14) 10px,
    rgba(255, 255, 255, 0.82) 10px,
    rgba(255, 255, 255, 0.82) 20px
  );
}

.danger-one {
  left: 80%;
  top: 23%;
  width: 13%;
  height: 17%;
}

.danger-two {
  left: 84%;
  top: 62%;
  width: 10%;
  height: 11%;
}

.floor-map.age-1 .room-a,
.floor-map.age-2 .room-b,
.floor-map.age-3 .yard,
.floor-map.age-3 .room-e,
.floor-map.age-4 .yard,
.floor-map.age-5 .yard,
.floor-map.age-5 .room-d {
  border-color: #2f9fc0;
  box-shadow: inset 0 0 0 3px rgba(47, 159, 192, 0.15), 0 0 0 4px rgba(47, 159, 192, 0.08);
}

.floor-map:not(.all).age-1 .room:not(.room-a),
.floor-map:not(.all).age-2 .room:not(.room-b),
.floor-map:not(.all).age-3 .room:not(.room-e),
.floor-map:not(.all).age-4 .room,
.floor-map:not(.all).age-5 .room:not(.room-d) {
  opacity: 0.62;
}

.history-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translate(var(--map-pan-x), var(--map-pan-y));
}

.history-path {
  fill: none;
  stroke: var(--history-color, #2a6f98);
  stroke-width: 0.18;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.18;
}

.history-path.selected {
  stroke: var(--history-color, #1f7fcd);
  stroke-width: 0.38;
  opacity: 0.78;
  filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--history-color, #1f7fcd) 45%, transparent));
}

.history-current-dot {
  fill: #1f7fcd;
  stroke: #1f7fcd;
  stroke-width: 0.5;
  opacity: 0.95;
}

.map-marker {
  position: absolute;
  z-index: 2;
  width: 30px;
  height: 30px;
  transform: translate(calc(-50% + var(--map-pan-x)), calc(-50% + var(--map-pan-y)));
  border-radius: 999px;
  border: 3px solid white;
  display: grid;
  place-items: center;
  box-shadow: 0 7px 20px rgba(19, 35, 52, 0.22);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.map-marker.safe {
  background: var(--green);
}

.map-marker.watch {
  background: var(--amber);
}

.map-marker.alert,
.map-marker.missing {
  background: var(--rose);
}

.map-marker.alert::after,
.map-marker.missing::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 2px solid rgba(217, 79, 98, 0.42);
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}

.map-marker.selected {
  outline: 3px solid rgba(31, 127, 205, 0.35);
  outline-offset: 3px;
}

@keyframes pulse {
  70% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.zone-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.bus-monitor {
  min-height: 44px;
  margin-top: 6px;
  border: 1px solid #cbd8e2;
  border-radius: 18px;
  background: #eef7ff;
  display: grid;
  grid-template-columns: auto repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  padding: 6px;
}

.bus-monitor-title {
  height: 100%;
  min-width: 92px;
  border-radius: 14px;
  background: #dff0ff;
  color: #236ca7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}

.bus-mini-card {
  min-width: 0;
  min-height: 34px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  grid-template-columns: minmax(70px, 0.55fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
}

.bus-mini-card strong,
.bus-mini-card > div:first-child span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bus-mini-card strong {
  display: block;
  font-size: 12px;
}

.bus-mini-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.bus-child-list {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.bus-child-marker {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 3px solid white;
  display: grid;
  place-items: center;
  box-shadow: 0 7px 20px rgba(19, 35, 52, 0.22);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.bus-child-marker span {
  color: white;
}

.bus-child-marker.safe {
  background: var(--green);
}

.bus-child-marker.watch {
  background: var(--amber);
}

.bus-child-marker.alert,
.bus-child-marker.missing {
  background: var(--rose);
}

.bus-child-marker.selected {
  outline: 3px solid rgba(31, 127, 205, 0.26);
  outline-offset: 2px;
}

.zone-chip {
  min-height: 34px;
  border-radius: 16px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
}

.zone-chip strong {
  font-size: 16px;
}

.detail-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1.15fr) minmax(0, 0.85fr) auto;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.detail-panel.overview-mode {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.overview-card,
.priority-list,
.overview-summary,
.empty-guide {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.overview-card {
  padding: 13px;
}

.overview-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.overview-card h2 {
  margin: 3px 0;
  font-size: 19px;
}

.overview-card p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.priority-list {
  padding: 8px;
  display: grid;
  gap: 6px;
}

.priority-item {
  width: 100%;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  background: #f7fafc;
  text-align: left;
}

.priority-item.critical {
  background: #fff1f2;
  border-color: #fecdd3;
}

.priority-item.warning {
  background: #fff8eb;
  border-color: #f5d8a8;
}

.priority-item.signal {
  background: #f1f5f9;
  border-color: #d8e0e8;
}

.priority-marker {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 3px solid white;
  display: grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 7px 20px rgba(19, 35, 52, 0.18);
  flex: 0 0 auto;
}

.priority-marker.alert,
.priority-marker.missing {
  background: var(--rose);
}

.priority-marker.watch {
  background: var(--amber);
}

.priority-item span:nth-child(2) {
  min-width: 0;
}

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

.priority-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.overview-summary div {
  min-height: 48px;
  padding: 8px;
  background: #ffffff;
}

.overview-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.overview-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.overview-events {
  overflow-y: auto;
}

.empty-guide {
  min-height: 40px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fbfcf8;
}

.child-card {
  gap: 9px;
}

.safe-confirm-button {
  width: 100%;
  min-height: 34px;
  border: 1px solid #9ccfbd;
  border-radius: 16px;
  background: #e8f8f1;
  color: #14745a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
}

.safe-confirm-button:hover {
  background: #dff4ec;
  border-color: #6fb79f;
}

.avatar,
.mini-avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: #246d91;
}

.avatar {
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.child-name-row {
  gap: 6px;
  flex-wrap: wrap;
}

.child-card h2 {
  font-size: 17px;
}

.child-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.status-pill {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.status-pill.safe {
  background: #e6f7f1;
  color: var(--green);
}

.status-pill.watch {
  background: #fff2df;
  color: var(--amber);
}

.status-pill.alert,
.status-pill.missing {
  background: #fdecef;
  color: var(--rose);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.detail-summary,
.timeline-card,
.parent-card,
.response-card,
.threshold-box {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.detail-summary {
  padding: 8px;
  background: #ffffff;
}

.detail-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.detail-summary-head span {
  color: #405064;
  font-size: 12px;
  font-weight: 900;
}

.detail-grid div {
  min-height: 34px;
  padding: 3px 2px;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
}

.detail-grid strong {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.2;
  color: #17212f;
}

.watch-list {
  min-height: 0;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 8px;
}

.watch-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border-top: 1px solid var(--line);
  padding: 6px 0;
}

.watch-item:first-of-type {
  margin-top: 6px;
}

.watch-item svg {
  flex: 0 0 auto;
  color: var(--blue);
}

.watch-item.warning svg {
  color: var(--amber);
}

.watch-item.critical svg {
  color: var(--rose);
}

.watch-item div {
  min-width: 0;
}

.watch-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.watch-item strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.timeline-card {
  padding: 8px;
  min-height: 0;
  overflow-y: auto;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 14px;
}

.panel-heading button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.timeline {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
}

.timeline li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  position: absolute;
  left: 55px;
}

.timeline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline strong {
  padding-left: 18px;
  font-size: 12px;
}

.parent-card {
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
}

.parent-card strong {
  display: block;
  margin-top: 3px;
}

.response-card {
  padding: 8px;
  background: #ffffff;
  min-height: 0;
}

.response-timeline {
  list-style: none;
  margin: 8px 0 8px;
  padding: 0;
  display: grid;
  gap: 5px;
}

.response-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 20px;
}

.response-timeline li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8da0b3;
  position: absolute;
  left: 51px;
}

.response-timeline li:last-child::before {
  background: var(--green);
}

.response-timeline span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.response-timeline strong {
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.2;
}

.response-action {
  width: 100%;
}

.compact {
  min-height: 32px;
  font-size: 12px;
}

.lower-grid {
  grid-template-columns: minmax(360px, 1.15fr) minmax(360px, 1fr) minmax(300px, 0.9fr);
  display: none;
}

.compact-head {
  align-items: center;
}

.event-list,
.roster-table,
.rule-list {
  display: grid;
  gap: 9px;
}

.event-item,
.roster-row,
.rule-item {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.event-icon {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #e9f2fa;
  color: var(--blue);
  flex: 0 0 auto;
}

.event-item.warning .event-icon {
  background: #fff2df;
  color: var(--amber);
}

.event-item.critical .event-icon {
  background: #fdecef;
  color: var(--rose);
}

.event-item div:nth-child(2),
.roster-row span:nth-child(2),
.rule-item div {
  min-width: 0;
  flex: 1;
}

.event-item span,
.rule-item span,
.roster-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-item strong,
.rule-item strong,
.roster-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.roster-row {
  width: 100%;
  text-align: left;
}

.roster-row.selected {
  border-color: #8fbfe6;
  background: #edf7ff;
}

.mini-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  font-size: 14px;
}

.roster-row code {
  border-radius: 12px;
  background: #e9eef4;
  padding: 5px 7px;
  color: #4b5a6d;
  font-size: 12px;
}

.rule-item {
  justify-content: space-between;
}

.toggle {
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #cbd6df;
  padding: 3px;
}

.toggle span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
}

.toggle.active {
  background: var(--green);
}

.toggle.active span {
  transform: translateX(20px);
}

.threshold-box {
  margin-top: 12px;
  padding: 14px;
}

.threshold-box > div:first-child {
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.threshold-box > strong {
  display: block;
  margin: 9px 0;
  font-size: 24px;
}

.range-track {
  background: #dfe7ee;
}

.range-track span {
  width: 62%;
  background: var(--amber);
}

.range-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.range-actions button {
  width: 34px;
  height: 34px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  display: grid;
  place-items: center;
}

.bus-parent-band {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  display: none;
}

.bus-card {
  min-height: 96px;
  gap: 14px;
  padding: 18px;
}

.bus-card > svg:first-child {
  flex: 0 0 auto;
  color: var(--blue);
}

.bus-card.parent > svg:first-child {
  color: var(--green);
}

.bus-card.toilet > svg:first-child {
  color: var(--amber);
}

.bus-card div {
  flex: 1;
}

.bus-card h2 {
  font-size: 17px;
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .brand div:last-child,
  .nav-list button {
    font-size: 0;
  }

  .nav-list button {
    justify-content: center;
    padding: 0;
  }

  .sidebar-panel {
    display: none;
  }

  .lower-grid,
  .workspace,
  .bus-parent-band {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) and (min-width: 821px) {
  .floor-map {
    height: min(590px, calc(100vh - 358px));
  }
}

@media (max-height: 690px) and (min-width: 821px) {
  .floor-map {
    height: min(590px, calc(100vh - 374px));
  }

  .zone-chip {
    min-height: 30px;
    padding-block: 4px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 16px;
    height: auto;
    overflow: visible;
    display: block;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar,
  .top-actions,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .map-tools {
    width: 100%;
  }

  .scope-switch {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .search-box,
  .ghost-button,
  .primary-button,
  .tool {
    width: 100%;
  }

  .floor-switch {
    width: 100%;
    justify-content: center;
  }

  .floor-switch button {
    flex: 1;
  }

  .stats-grid,
  .zone-strip {
    grid-template-columns: 1fr 1fr;
  }

  .bus-monitor {
    grid-template-columns: 1fr;
  }

  .bus-monitor-title {
    min-height: 34px;
  }

  .floor-map {
    height: 520px;
  }

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

  .roster-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .stats-grid,
  .zone-strip {
    grid-template-columns: 1fr;
  }

  .page-title h1 {
    font-size: 24px;
  }

  .stat-card strong {
    font-size: 26px;
  }
}
