:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --blue: #0071e3;
  --blue-soft: #eaf4ff;
  --green: #248a3d;
  --green-soft: #eaf7ed;
  --amber: #9a5700;
  --amber-soft: #fff5e6;
  --red: #c1121f;
  --red-soft: #fff0f1;
  --sidebar: #171719;
  --sidebar-muted: #9d9da3;
  --radius: 8px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.07);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.28);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-block-start: 0;
}

h1,
h2,
h3,
strong {
  letter-spacing: 0;
}

h1 {
  margin-block-end: 0.35rem;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.14;
}

h2 {
  margin-block-end: 0.3rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

p {
  margin-block-end: 0;
  color: var(--muted);
}

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.visually-hidden,
.skip-link:not(:focus) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--ink);
  color: #fff;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  z-index: 80;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid #29292d;
  padding: 1.15rem 0.8rem;
  background: var(--sidebar);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.4rem 1.4rem;
  color: #fff;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.brand span {
  display: grid;
  min-width: 0;
}

.brand strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: var(--sidebar-muted);
  font-size: 0.72rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.2rem;
}

.sidebar-nav a,
.sidebar-footer a,
.sidebar-footer button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-footer a:hover,
.sidebar-footer button:hover {
  background: #252528;
  color: #fff;
}

.sidebar-nav a[aria-current="page"] {
  background: #2c2c30;
  color: #fff;
}

.sidebar-nav a[aria-current="page"] .icon {
  color: #50a5ff;
}

.sidebar-footer {
  display: grid;
  gap: 0.2rem;
  margin-top: auto;
  border-top: 1px solid #303034;
  padding-top: 0.7rem;
}

.sidebar-footer form {
  margin: 0;
}

.sidebar-backdrop,
.mobile-menu {
  display: none;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 60;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.65rem clamp(1rem, 2.6vw, 2.4rem);
  background: rgba(250, 250, 252, 0.9);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}

.topbar-title {
  display: grid;
}

.topbar-title strong {
  font-size: 0.9rem;
}

.topbar-title span {
  color: var(--muted);
  font-size: 0.72rem;
}

.user-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 700;
}

.main-content {
  width: min(100%, 1440px);
  min-height: calc(100vh - 64px);
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 2.6rem);
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 0.25rem 1.6rem;
}

.page-heading p {
  max-width: 720px;
}

.button,
.icon-button,
.inline-copy,
.text-link {
  border: 0;
  text-decoration: none;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.65rem 0.95rem;
  font-weight: 700;
}

.button--primary {
  background: var(--blue);
  color: #fff;
}

.button--primary:hover {
  background: #0064c8;
}

.button--secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

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

.button--danger {
  border-color: #f3c4c8;
  background: #fff;
  color: var(--red);
}

.button--small {
  min-height: 34px;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
}

.button--wide {
  width: 100%;
}

.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

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

.text-link {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
}

.muted-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  background: #fff;
  font-size: 0.86rem;
}

.notice--success {
  border-color: #bddfc5;
  background: var(--green-soft);
  color: #17652b;
}

.notice--warning {
  border-color: #efd09e;
  background: var(--amber-soft);
  color: #744000;
}

.notice--error {
  border-color: #efbdc1;
  background: var(--red-soft);
  color: #9e0f1a;
}

.notice--info {
  border-color: #bdd8f5;
  background: var(--blue-soft);
  color: #0058ad;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.metric-grid--five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
  display: grid;
  min-width: 0;
  min-height: 130px;
  align-content: space-between;
  gap: 0.25rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 0.76rem;
}

.metric-card strong {
  overflow-wrap: anywhere;
  font-size: 1.75rem;
  line-height: 1;
}

.metric-card--blue {
  border-color: #a9cff6;
  background: var(--blue-soft);
}

.metric-card--green {
  border-color: #b9ddc1;
  background: var(--green-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.content-grid--overview {
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
}

.panel,
.table-panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
}

.panel {
  padding: 1.15rem;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-heading p {
  font-size: 0.82rem;
}

.simple-list,
.status-list,
.health-list {
  display: grid;
}

.simple-list__row {
  display: grid;
  min-width: 0;
  grid-template-columns: 74px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 0.8rem;
  border-top: 1px solid var(--line-soft);
  padding: 0.8rem 0;
  color: var(--ink);
  text-decoration: none;
}

.simple-list__row:first-child {
  border-top: 0;
  padding-top: 0;
}

.simple-list__row:last-child {
  padding-bottom: 0;
}

.simple-list__row > span:nth-child(2),
.simple-list__row > span:last-child {
  display: grid;
  min-width: 0;
}

.simple-list__row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-list__row > span:last-child {
  text-align: right;
}

.link-type {
  display: inline-flex;
  width: fit-content;
  min-width: 60px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0.25rem 0.45rem;
  background: #ededf0;
  color: #55555b;
  font-size: 0.66rem;
  font-weight: 800;
}

.status-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  border-top: 1px solid var(--line-soft);
  padding: 0.85rem 0;
}

.status-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.status-list li:last-child {
  padding-bottom: 0;
}

.status-list p {
  font-size: 0.76rem;
}

.status-list a {
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #a8a8ad;
}

.status-dot--green {
  background: var(--green);
}

.status-dot--amber {
  background: #d97706;
}

.status-dot--neutral {
  background: #8e8e93;
}

.connection-band,
.empty-connection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border: 1px solid #cfd3d8;
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  background: #202124;
  color: #fff;
}

.connection-band h2,
.empty-connection h2 {
  margin-top: 0.7rem;
  font-size: 1.35rem;
}

.connection-band p,
.empty-connection p {
  max-width: 760px;
  color: #b8bac0;
}

.status-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.status-pill--waiting {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill--live {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill--off {
  background: #eeeeF0;
  color: #646469;
}

.toolbar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border-block: 1px solid var(--line);
  padding-block: 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
  background: #fff;
  color: var(--muted);
}

.segmented button:first-child {
  border-left: 0;
}

.segmented button.is-active {
  background: #e6e6e9;
  color: var(--ink);
}

.empty-connection {
  justify-content: flex-start;
  margin-bottom: 1rem;
  background: #fff;
  color: var(--ink);
}

.empty-connection__icon {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #ededf0;
  color: #6e6e73;
}

.empty-connection__icon .icon {
  width: 26px;
  height: 26px;
}

.empty-connection p {
  color: var(--muted);
}

.empty-connection .button {
  margin-left: auto;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 1rem;
}

.placeholder-grid > section {
  min-height: 260px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: #fff;
}

.chart-placeholder {
  display: flex;
  height: 175px;
  align-items: end;
  gap: 8%;
  border-bottom: 1px solid var(--line);
  padding: 1rem 8%;
}

.chart-placeholder span {
  width: 12%;
  border-radius: 4px 4px 0 0;
  background: #e5e5e8;
}

.chart-placeholder span:nth-child(1) { height: 34%; }
.chart-placeholder span:nth-child(2) { height: 62%; }
.chart-placeholder span:nth-child(3) { height: 48%; }
.chart-placeholder span:nth-child(4) { height: 76%; }
.chart-placeholder span:nth-child(5) { height: 58%; }

.row-placeholder {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.row-placeholder span {
  height: 34px;
  border-radius: 4px;
  background: #ececef;
}

.event-map {
  margin-top: 1rem;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.event-grid span {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 0.65rem;
  background: var(--surface-2);
  color: #55555b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-editor,
.settings-section {
  display: grid;
  grid-template-columns: minmax(240px, 0.34fr) minmax(0, 0.66fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  border-block: 1px solid var(--line);
  padding-block: clamp(1.3rem, 3vw, 2.2rem);
}

.section-copy h2 {
  margin-top: 0.75rem;
  font-size: 1.45rem;
}

.section-copy p {
  max-width: 420px;
}

.link-form,
.settings-form,
.form-stack {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.3fr) minmax(0, 0.7fr);
  gap: 1rem;
}

.field {
  display: grid;
  min-width: 0;
  gap: 0.4rem;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 750;
}

.field small {
  color: var(--muted);
  font-size: 0.72rem;
}

.field--full {
  grid-column: 1 / -1;
}

.field input,
.field select,
.search-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.68rem 0.8rem;
  background: #fff;
  color: var(--ink);
}

.field input[readonly],
.field select:disabled {
  background: #ededf0;
  color: #65656b;
  opacity: 1;
}

.copy-field {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.copy-field .icon-button {
  height: 46px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.inventory-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem 1rem;
}

.inventory-heading p {
  font-size: 0.82rem;
}

.search-field {
  width: min(100%, 340px);
}

.search-field input {
  min-height: 42px;
}

.quarantine-note {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  border: 1px solid #e5d3b1;
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  background: #fffbf3;
  color: #664a1d;
  font-size: 0.78rem;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
}

.data-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 0.8rem 0.75rem;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.link-cell {
  display: flex;
  min-width: 250px;
  align-items: center;
  gap: 0.7rem;
}

.link-cell > div {
  display: grid;
  min-width: 0;
}

.inline-copy {
  display: inline-flex;
  max-width: 290px;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-copy .icon,
.destination-link .icon {
  width: 14px;
  height: 14px;
}

.destination-link {
  display: inline-flex;
  max-width: 220px;
  align-items: center;
  gap: 0.25rem;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warning-text {
  display: block;
  margin-top: 0.2rem;
  color: var(--amber);
  font-size: 0.7rem;
}

.row-actions {
  display: flex;
  min-width: max-content;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.row-actions form {
  margin: 0;
}

.row-actions .icon-button {
  width: 34px;
  height: 34px;
}

.empty-table,
.empty-row {
  padding: 2rem !important;
  text-align: center;
}

.health-list > div {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line-soft);
  padding-block: 0.7rem;
}

.health-list > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.health-list > div:last-child {
  padding-bottom: 0;
}

.health-list span {
  display: grid;
}

.health-list small {
  color: var(--muted);
}

.health-list--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
}

.audit-source {
  display: grid;
  grid-template-columns: 0.8fr 1.6fr 0.6fr;
  gap: 1rem;
  border-block: 1px solid var(--line);
  padding-block: 1.15rem;
}

.audit-source div {
  display: grid;
}

.audit-source span {
  color: var(--muted);
  font-size: 0.72rem;
}

.audit-source strong {
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}

.settings-layout {
  display: grid;
  gap: 1rem;
}

.settings-section:first-child {
  border-top: 1px solid var(--line);
}

.credential-state {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border-block: 1px solid var(--line-soft);
  padding-block: 0.75rem;
}

.credential-state p {
  font-size: 0.75rem;
}

.settings-form .button {
  width: fit-content;
  justify-self: end;
}

.security-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.security-strip > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.8rem;
  background: #fff;
}

.security-strip .icon {
  color: var(--green);
}

.security-strip span {
  display: grid;
  min-width: 0;
}

.security-strip small {
  color: var(--muted);
  font-size: 0.68rem;
}

.empty-panel {
  display: grid;
  min-height: 320px;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  border-block: 1px solid var(--line);
  text-align: center;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.25rem;
  background: #ececef;
}

.login-shell {
  width: min(100%, 430px);
}

.login-panel {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 6vw, 2.5rem);
  background: #fff;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.login-heading {
  padding-block: 1.25rem 1.4rem;
}

.login-heading h1 {
  font-size: 2rem;
}

.eyebrow {
  margin-bottom: 0.45rem;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-note {
  margin-top: 1rem;
  font-size: 0.7rem;
  text-align: center;
}

@media (max-width: 1120px) {
  .metric-grid--five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    width: min(82vw, 284px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.36);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

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

  .topbar {
    justify-content: flex-start;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-title strong,
  .topbar-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-chip {
    margin-left: auto;
  }

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

  .content-grid,
  .placeholder-grid {
    grid-template-columns: 1fr;
  }

  .link-editor,
  .settings-section {
    grid-template-columns: 1fr;
    gap: 1.3rem;
  }

  .section-copy p {
    max-width: 640px;
  }

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

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .topbar-title span {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .page-heading,
  .inventory-heading,
  .connection-band,
  .empty-connection {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading {
    display: grid;
    gap: 1rem;
  }

  .page-heading .button {
    width: 100%;
  }

  .metric-grid,
  .metric-grid--five {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card {
    min-height: 116px;
    padding: 0.85rem;
  }

  .metric-card strong {
    font-size: 1.45rem;
  }

  .connection-band,
  .empty-connection {
    display: grid;
    gap: 1rem;
  }

  .empty-connection .button {
    width: 100%;
    margin-left: 0;
  }

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

  .field--full,
  .field--wide {
    grid-column: auto;
  }

  .inventory-heading {
    display: grid;
  }

  .search-field {
    width: 100%;
  }

  .table-panel {
    border: 0;
    background: transparent;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-bottom: 0.75rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 0.65rem;
    background: #fff;
  }

  .data-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 0.7rem;
    border: 0;
    padding: 0.5rem;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 750;
    text-transform: uppercase;
  }

  .link-cell {
    min-width: 0;
  }

  .inline-copy {
    max-width: 190px;
  }

  .row-actions {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .health-list--compact,
  .audit-source,
  .security-strip {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 420px) {
  .metric-grid,
  .metric-grid--five {
    grid-template-columns: 1fr;
  }

  .topbar-title strong {
    max-width: 150px;
  }

  .user-chip {
    display: none;
  }
}

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