:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-soft: #f5f7fa;
  --text: #27313f;
  --muted: #6b7280;
  --line: #dfe4ea;
  --line-soft: #edf0f3;
  --brand: #006fff;
  --brand-dark: #0057c2;
  --critical: #c0342b;
  --warning: #b76e00;
  --healthy: #0a7a45;
  --unknown: #5b6470;
  --shadow: 0 1px 2px rgba(31, 41, 51, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  word-break: break-all;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 50px;
  padding: 0 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
}

.topbar > div {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  flex: 0 0 auto;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  display: block;
  width: 86px;
  height: auto;
}

.brand span {
  white-space: nowrap;
}

.nav {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 1rem;
  padding: 0.16rem;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.nav a {
  padding: 0.38rem 0.62rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.nav a:hover {
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.nav a.active,
.nav a[aria-current="page"] {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: var(--shadow);
}

.container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0.75rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-head h1,
.panel h1,
.status-card h2 {
  margin: 0;
}

.page-head h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.customer-metrics {
  grid-template-columns: repeat(5, minmax(145px, 1fr));
}

.split {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-top: 0.75rem;
}

.panel,
.metric,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 0.75rem;
}

.metric {
  min-height: 84px;
  padding: 0.75rem;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric strong {
  display: block;
  margin-top: 0.55rem;
  font-size: 1.55rem;
  line-height: 1;
}

.metric-critical strong {
  color: var(--critical);
}

.metric-warning strong {
  color: var(--warning);
}

.narrow {
  max-width: 430px;
  margin: 5rem auto 0;
}

.stack {
  display: grid;
  gap: 0.65rem;
}

label span,
dt {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

dd {
  margin: 0 0 1rem;
}

input,
select,
textarea,
button {
  font: inherit;
  border-radius: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0.5rem 0.62rem;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(0, 111, 255, 0.18);
  border-color: var(--brand);
}

button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 32px;
  border-radius: 8px;
  padding: 0.42rem 0.72rem;
  cursor: pointer;
}

button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
}

button:hover {
  background: var(--brand-dark);
}

.danger-button {
  border-color: #ffd0ca;
  background: #fff4f2;
  color: var(--critical);
}

.danger-button:hover {
  border-color: var(--critical);
  background: #ffe6e1;
}

.stack button,
.narrow button {
  width: 100%;
}

.secondary-button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: var(--panel-soft);
  text-decoration: none;
}

.panel-header,
.status-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filters select {
  width: auto;
  min-width: 150px;
}

.muted {
  color: var(--muted);
}

.flash {
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.75rem;
  border: 1px solid transparent;
}

.flash-success {
  background: #eefaf3;
  color: var(--healthy);
  border-color: #bde8ce;
}

.flash-error {
  background: #fff4f2;
  color: var(--critical);
  border-color: #ffd0ca;
}

.notice-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.78rem;
}

.notice-banner strong {
  white-space: nowrap;
}

.notice-banner span {
  min-width: 0;
  color: var(--muted);
}

.notice-warning {
  border-color: #f3d58d;
  background: #fffaf0;
}

.notice-warning strong {
  color: var(--warning);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 22px;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: lowercase;
  white-space: nowrap;
}

.pill-critical {
  background: #fff4f2;
  color: var(--critical);
}

.pill-warning {
  background: #fff8ea;
  color: var(--warning);
}

.pill-healthy,
.pill-info,
.pill-ok {
  background: #eefaf3;
  color: var(--healthy);
}

.pill-unknown,
.pill-never {
  background: #eef1f4;
  color: var(--unknown);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.console-table {
  min-width: 1760px;
}

.device-table {
  min-width: 1880px;
}

.service-device-table {
  min-width: 1280px;
}

.dense-table {
  font-size: 0.74rem;
  line-height: 1.25;
}

.dense-table th,
.dense-table td {
  height: 28px;
  padding: 0.32rem 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}

.dense-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.dense-table th[data-sort] {
  user-select: none;
}

.sort-button {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  max-width: 100%;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.sort-button:hover,
.sort-button:focus-visible {
  color: var(--brand);
}

.sort-button:focus-visible {
  outline: 2px solid rgba(0, 111, 255, 0.32);
  outline-offset: 2px;
  border-radius: 4px;
}

.sort-indicator {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  opacity: 0.35;
}

th[aria-sort="ascending"] .sort-indicator {
  border-bottom: 5px solid currentColor;
  opacity: 0.95;
}

th[aria-sort="descending"] .sort-indicator {
  border-top: 5px solid currentColor;
  opacity: 0.95;
}

.dense-table strong {
  font-weight: 600;
}

.package-table {
  min-width: 0;
}

.package-table-wrap {
  margin-top: 1rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.52rem 0.5rem;
  border-bottom: 1px solid var(--line-soft);
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.unmanaged-row {
  background: #fcfdff;
}

.package-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 0.5rem;
  min-width: 240px;
}

.package-controls input,
.package-controls select {
  min-height: 38px;
  padding: 0.55rem 0.65rem;
}

.inventory-head {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(240px, 360px) auto auto;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.inventory-head h1 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.inventory-search input {
  min-height: 30px;
  padding-left: 1.8rem;
  background:
    linear-gradient(transparent, transparent),
    #fff;
}

.inventory-summary {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.inventory-summary span {
  display: inline-flex;
  gap: 0.22rem;
  align-items: center;
  min-height: 26px;
  padding: 0 0.5rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.inventory-summary strong {
  color: var(--text);
}

.inventory-layout {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
}

.inventory-sidebar {
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 72px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar-block {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line-soft);
}

.sidebar-block:last-child {
  border-bottom: 0;
}

.sidebar-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.25rem 0.35rem;
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
}

.sidebar-title a {
  color: var(--brand);
  font-weight: 700;
}

.filter-link {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  min-height: 25px;
  padding: 0 0.25rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.73rem;
}

.filter-link:hover,
.filter-link.active {
  background: #eef5ff;
  color: var(--brand-dark);
  text-decoration: none;
}

.filter-link span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-link em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.68rem;
}

.radio-dot,
.checkbox-dot {
  width: 13px;
  height: 13px;
  border: 1px solid #c7d0dc;
  background: #fff;
}

.radio-dot {
  border-radius: 999px;
}

.checkbox-dot {
  border-radius: 3px;
}

.filter-link.active .radio-dot,
.filter-link.active .checkbox-dot {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 3px #fff;
  background: var(--brand);
}

.inventory-main {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.inventory-tablebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  min-height: 38px;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfcfd;
}

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

.inventory-tablebar strong {
  font-size: 0.82rem;
}

.inventory-tablebar span {
  color: var(--muted);
  font-size: 0.7rem;
}

.inventory-table-wrap {
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.dashboard-head {
  grid-template-columns: minmax(230px, 1fr) auto auto;
}

.action-head,
.report-head,
.report-detail-head {
  grid-template-columns: minmax(230px, 1fr) auto auto;
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-table {
  min-width: 1580px;
}

.firmware-table {
  min-width: 1500px;
}

.firmware-events-panel {
  margin-top: 0.75rem;
}

.firmware-events-table {
  min-width: 980px;
}

.firmware-detail-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.firmware-facts dl {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 0.34rem 0.55rem;
  margin: 0.75rem 0;
}

.firmware-facts dt,
.firmware-facts dd {
  margin: 0;
  min-width: 0;
}

.firmware-facts dd {
  overflow-wrap: anywhere;
}

.firmware-device-events {
  min-width: 0;
}

.static-filter {
  cursor: default;
}

.filter-link.static-filter:hover {
  background: transparent;
  color: var(--text);
}

.filter-link .state-dot {
  justify-self: center;
}

.dashboard-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.dashboard-mini-table {
  max-height: 360px;
  overflow: auto;
}

.dashboard-mini-table table {
  min-width: 640px;
}

.action-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.action-strip article {
  min-width: 0;
  padding: 0.68rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.action-strip strong,
.action-strip span {
  display: block;
}

.action-strip strong {
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.action-strip span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.action-table {
  min-width: 1180px;
}

.action-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.action-controls form {
  margin: 0;
}

.bulk-actionbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto auto auto;
  gap: 0.45rem;
  align-items: center;
  min-width: min(860px, 100%);
}

.bulk-actionbar textarea,
.bulk-actionbar select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 0.74rem;
}

.bulk-actionbar textarea {
  resize: vertical;
  padding: 0.45rem 0.55rem;
}

.bulk-actionbar select {
  padding: 0.35rem 0.55rem;
}

.action-select-cell {
  width: 54px;
  text-align: center;
}

.report-pill,
.note-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.report-included {
  border-color: #bde8ce;
  background: #eefaf3;
  color: var(--healthy);
}

.report-internal {
  border-color: #d9e2ec;
  background: #f6f8fb;
  color: var(--muted);
}

.note-pill {
  min-width: 28px;
  background: #fbfcfd;
  color: var(--text);
}

.action-detail-row td {
  border-top: 0;
  background: #fbfcfd;
  padding-top: 0.35rem;
  padding-bottom: 0.45rem;
}

.action-note-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 0.45rem;
  align-items: center;
}

.action-note-form textarea {
  width: 100%;
  min-height: 30px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.42rem 0.55rem;
  background: #fff;
  color: var(--text);
  font-size: 0.74rem;
}

.report-table {
  min-width: 1220px;
}

.report-site-table {
  min-width: 1080px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 800;
}

.score-healthy {
  border-color: #bde8ce;
  background: #eefaf3;
  color: var(--healthy);
}

.score-warning {
  border-color: #f3d58d;
  background: #fffaf0;
  color: var(--warning);
}

.score-critical {
  border-color: #ffd0ca;
  background: #fff4f2;
  color: var(--critical);
}

.report-hero {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 0.75rem;
}

.report-hero > *,
.report-history-grid > *,
.service-health-grid > *,
.dashboard-lower-grid > * {
  min-width: 0;
}

.score-card {
  display: grid;
  place-items: center;
  min-height: 128px;
  border: 1px solid currentColor;
  border-radius: 8px;
  text-align: center;
}

.score-card span,
.score-card em {
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.score-card strong {
  font-size: 2.35rem;
  line-height: 1;
}

.report-copy {
  align-self: center;
  min-width: 0;
}

.report-copy h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.report-copy p {
  margin: 0.2rem 0;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.45;
}

.report-copy .muted {
  color: var(--muted);
}

.report-kpis,
.report-actions {
  display: grid;
  gap: 0.5rem;
  align-content: center;
}

.report-kpis {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  min-width: 390px;
}

.report-actions {
  min-width: 120px;
}

.inline-tablebar {
  margin: -0.75rem -0.75rem 0.75rem;
  border-radius: 8px 8px 0 0;
}

.recommendation-list {
  display: grid;
  gap: 0.45rem;
}

.recommendation-list a {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  min-height: 30px;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: var(--text);
}

.recommendation-list a:hover {
  border-color: #c9d8ea;
  background: #fbfcfd;
  text-decoration: none;
}

.recommendation-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
}

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

.event-title-cell {
  min-width: 260px;
}

.event-title-cell strong,
.event-title-cell span {
  display: block;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-cell {
  min-width: 210px;
}

.site-cell .state-dot {
  display: inline-block;
  margin-right: 0.45rem;
  vertical-align: middle;
}

.site-cell > div {
  display: inline-grid;
  max-width: 180px;
  vertical-align: middle;
}

.site-cell a,
.site-cell strong,
.cell-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-cell span,
.cell-sub {
  color: var(--muted);
  font-size: 0.68rem;
}

.cell-sub {
  display: block;
}

.cell-warning {
  display: block;
  color: var(--warning);
  font-size: 0.68rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-mail-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.42fr) minmax(520px, 0.58fr);
  gap: 0.75rem;
  align-items: start;
}

.report-mail-editor,
.report-mail-preview-panel {
  min-width: 0;
}

.report-mail-editor form {
  display: grid;
  gap: 0.65rem;
}

.report-mail-editor label {
  display: grid;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.report-mail-editor input,
.report-mail-editor textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.55rem 0.65rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.report-mail-editor textarea {
  resize: vertical;
  line-height: 1.45;
}

.report-mail-actions,
.report-mail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.report-mail-meta {
  color: var(--muted);
  font-size: 0.68rem;
}

.email-preview-frame {
  display: block;
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.device-name-cell {
  min-width: 220px;
}

.device-name-cell strong,
.device-name-cell span {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-name-cell span {
  color: var(--muted);
  font-size: 0.68rem;
}

.device-type {
  display: inline-block;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.customer-device-wrap {
  max-height: calc(100vh - 150px);
}

.service-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.service-health-panel h2 {
  margin: 0;
  font-size: 0.92rem;
}

.health-metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.mini-metric {
  min-width: 0;
  padding: 0.5rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfd;
}

.mini-metric span,
.chart-head span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.mini-metric strong {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.94rem;
}

.mini-metric.unavailable strong {
  color: var(--muted);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.mini-chart {
  min-width: 0;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.chart-head strong {
  font-size: 0.72rem;
  white-space: nowrap;
}

.chart-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
}

.chart-plot {
  position: relative;
}

.mini-chart svg {
  display: block;
  width: 100%;
  height: 58px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(to bottom, transparent 0, transparent 48%, var(--line-soft) 49%, transparent 50%),
    #fbfcfd;
}

.chart-bound {
  position: absolute;
  left: 0.45rem;
  z-index: 1;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  background: rgba(251, 252, 253, 0.86);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
}

.chart-bound-top {
  top: 0.28rem;
}

.chart-bound-bottom {
  bottom: 0.28rem;
}

.mini-chart polyline {
  fill: none;
  stroke: var(--brand);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.state-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--unknown);
}

.state-healthy {
  background: #31c45d;
}

.state-warning {
  background: var(--warning);
}

.state-critical {
  background: var(--critical);
}

.table-select {
  width: 210px;
  min-height: 25px;
  padding: 0.18rem 1.7rem 0.18rem 0.45rem;
  border-color: var(--line-soft);
  font-size: 0.72rem;
}

.compact-button {
  min-height: 26px;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
}

.health-bar {
  display: block;
  width: 145px;
  height: 7px;
  overflow: hidden;
  background: #ecf1f5;
  border-radius: 999px;
}

.health-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.health-healthy span {
  background: #31c45d;
}

.health-warning span {
  background: #e8b100;
}

.health-critical span {
  background: var(--critical);
}

.status-text {
  font-weight: 600;
  text-transform: lowercase;
}

.status-healthy,
.healthy-text {
  color: #0bbf42;
}

.status-warning {
  color: var(--warning);
}

.status-critical {
  color: var(--critical);
}

.status-unknown {
  color: var(--unknown);
}

.empty-row {
  height: 56px;
  color: var(--muted);
  text-align: center;
}

.customer-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.detail-admin-grid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(340px, 1.2fr) minmax(260px, 0.8fr);
}

.compact-panel h1 {
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
}

.compact-panel-header {
  margin-bottom: 0.45rem;
}

.compact-panel-header h1 {
  margin-bottom: 0.25rem;
}

.compact-panel-header p {
  margin: 0;
  font-size: 0.76rem;
}

.panel-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.compact-form-grid textarea {
  resize: vertical;
}

.danger-zone {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line-soft);
}

.danger-zone h2 {
  margin: 0 0 0.25rem;
  color: var(--critical);
  font-size: 0.86rem;
}

.danger-zone p {
  margin: 0 0 0.65rem;
  font-size: 0.74rem;
  line-height: 1.4;
}

.compact-site-card dl {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.28rem 0.5rem;
  margin: 0;
}

.compact-site-card dt,
.compact-site-card dd {
  margin: 0;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 0.7rem;
}

.compact-form {
  display: inline-flex;
  justify-content: flex-start;
}

.customer-applications-panel {
  margin-top: 0.75rem;
}

.network-api-panel {
  margin-top: 0.75rem;
}

.network-api-list {
  display: grid;
}

.network-api-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.5fr) minmax(220px, 0.8fr) auto;
  align-items: end;
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line-soft);
}

.network-api-row:first-child {
  border-top: 0;
}

.network-api-meta {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
  font-size: 0.75rem;
}

.network-api-meta strong,
.network-api-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-api-meta span {
  color: var(--muted);
}

.network-api-meta .secret-status {
  color: var(--text);
  font-weight: 600;
}

.network-api-meta .network-api-error {
  color: var(--warning);
}

.network-api-meta .network-api-ok {
  color: var(--healthy);
  font-weight: 700;
}

.network-api-meta .network-api-missing {
  color: var(--warning);
  font-weight: 700;
}

.network-api-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.1fr) auto auto auto;
  align-items: end;
  gap: 0.5rem;
}

.ping-check-form {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: end;
  gap: 0.5rem;
}

.network-api-form input {
  min-height: 30px;
  padding: 0.38rem 0.5rem;
  font-size: 0.74rem;
}

.compact-checkbox {
  justify-content: center;
  min-height: 30px;
  margin-bottom: 0;
  white-space: nowrap;
}

.compact-checkbox span {
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.72rem;
}

.network-api-delete {
  display: flex;
  align-items: end;
}

.update-action-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.update-action-cell form {
  margin: 0;
}

.inline-check-form {
  margin: 0;
}

.table-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.table-checkbox input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.site-card,
.contact-card {
  border-top: 1px solid var(--line-soft);
  padding-top: 0.9rem;
  margin-top: 0.9rem;
}

.status-card h2 {
  font-size: 1rem;
}

.status-card .muted {
  margin: 0.28rem 0 0;
}

.checkbox {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.checkbox input {
  width: auto;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 190px;
  padding: 0.72rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sync-state strong,
.sync-state span {
  display: block;
}

.sync-state span {
  color: var(--muted);
  font-size: 0.82rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--warning);
}

.sync-ok .dot {
  background: var(--healthy);
}

.sync-error .dot {
  background: var(--critical);
}

.inline-alert {
  display: inline-flex;
  margin-left: 0.4rem;
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 700;
}

.notification-panel {
  margin-top: 0.75rem;
}

.notification-intro {
  max-width: 760px;
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.notification-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.notification-info-grid article {
  min-width: 0;
  padding: 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfd;
}

.notification-info-grid strong,
.notification-info-grid span {
  display: block;
}

.notification-info-grid strong {
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.notification-info-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.notification-table {
  min-width: 1180px;
}

.customer-notification-table {
  min-width: 1360px;
}

.notification-rule-cell {
  min-width: 320px;
}

.notification-rule-cell strong,
.notification-rule-cell span,
.notification-rule-cell em {
  display: block;
  max-width: 520px;
  white-space: normal;
}

.notification-rule-cell strong {
  font-size: 0.78rem;
}

.notification-rule-cell span {
  margin-top: 0.16rem;
  color: var(--muted);
  line-height: 1.35;
}

.notification-rule-cell em {
  margin-top: 0.18rem;
  color: var(--text);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
}

.source-pill {
  display: inline-flex;
  max-width: 230px;
  min-height: 22px;
  align-items: center;
  padding: 0 0.42rem;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-number {
  display: inline-grid;
  grid-template-columns: 76px auto;
  align-items: center;
  gap: 0.28rem;
}

.inline-number input {
  min-height: 27px;
  padding: 0.24rem 0.38rem;
  font-size: 0.72rem;
}

.inline-number span {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.notification-select {
  width: 118px;
  min-height: 27px;
  padding: 0.22rem 1.6rem 0.22rem 0.42rem;
  font-size: 0.72rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.contact-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.critical {
  color: var(--critical);
}

.warning {
  color: var(--warning);
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .customer-metrics {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .inventory-head {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-head {
    grid-template-columns: 1fr;
  }

  .inventory-layout,
  .firmware-detail-grid,
  .dashboard-lower-grid,
  .bulk-actionbar,
  .report-history-grid,
  .report-mail-layout,
  .network-api-row,
  .network-api-form,
  .ping-check-form,
  .service-health-grid,
  .action-strip,
  .report-hero,
  .health-metric-row,
  .chart-grid,
  .report-kpis,
  .notification-info-grid,
  .customer-admin-grid,
  .detail-admin-grid {
    grid-template-columns: 1fr;
  }

  .report-kpis {
    min-width: 0;
  }

  .score-card {
    min-width: 0;
    max-width: 100%;
  }

  .inventory-sidebar {
    position: static;
    max-height: none;
  }

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

@media (max-width: 760px) {
  .topbar,
  .page-head,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    position: static;
    padding: 1rem;
  }

  .topbar > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    margin-left: 0;
    margin-top: 0.8rem;
    flex-wrap: wrap;
  }

  .container {
    padding: 0.65rem;
  }

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

  .sync-state {
    width: 100%;
  }

  .package-controls {
    grid-template-columns: 1fr;
    min-width: 240px;
  }

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

  .inventory-head {
    grid-template-columns: 1fr;
  }

  .notice-banner {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    grid-template-columns: 1fr;
  }

  .inventory-summary {
    justify-content: flex-start;
  }

  .inventory-table-wrap {
    max-height: none;
  }

  .topbar form {
    width: 100%;
  }
}

@media print {
  .topbar,
  .flash,
  .nav,
  .secondary-button,
  button {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .container {
    padding: 0;
  }

  .panel,
  .inventory-main,
  .action-strip article {
    box-shadow: none;
  }

  .table-wrap,
  .inventory-table-wrap,
  .dashboard-mini-table {
    max-height: none;
    overflow: visible;
  }
}
