/* MintWatch console stylesheet.
   Consolidated from the previous multi-pass file: each selector now carries the
   final computed values the layered passes produced, in one place. */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;
  --surface: #f7fafa;
  --panel: #ffffff;
  --panel-soft: #fafbfc;
  --border: #d9e0e4;
  --border-strong: #a9b7bf;
  --text: #172326;
  --muted: #52636b;
  --muted-soft: #829099;
  --teal-50: #eef8f8;
  --teal-100: #d4eeef;
  --teal-200: #b0d9dc;
  --teal-300: #7bbcc1;
  --teal-500: #007a87;
  --teal-600: #00656f;
  --teal-700: #00565f;
  --teal-800: #004349;
  --teal-900: #002f34;
  --mint-50: #edfbf4;
  --mint-100: #d4f5e4;
  --mint-200: #b2edd1;
  --mint-400: #4dcc87;
  --mint-500: #45b08c;
  --mint-700: #267356;
  --mint-800: #1e5c45;
  --red-50: #fff1f0;
  --red-100: #ffd9d4;
  --red-500: #d92d20;
  --red-600: #b42318;
  --amber-50: #fffbeb;
  --amber-100: #fde68a;
  --amber-600: #b7791f;
  --shadow-card: 0 1px 4px rgba(0, 86, 95, 0.08), 0 0 0 1px rgba(221, 230, 232, 0.8);
  --shadow-hover: 0 4px 16px rgba(0, 86, 95, 0.12), 0 0 0 1px rgba(221, 230, 232, 1);
  --radius: 14px;
}

/* ------------------------------------------------------------------ base */

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--surface);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--text);
  font-size: 26px;
  line-height: 1.15;
}

h2 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

h3 {
  font-size: 15px;
}

.hidden,
.is-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(122, 191, 197, 0.45);
  outline-offset: 2px;
}

/* --------------------------------------------------------- form controls */

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

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #ffffff;
  background: var(--mint-400);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: var(--mint-500);
}

button.secondary {
  border-color: var(--border);
  color: var(--text);
  background: #ffffff;
}

button.secondary:hover {
  border-color: var(--teal-200);
  background: var(--teal-50);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
}

input,
select {
  min-height: 38px;
  border-radius: 999px;
  background: #ffffff;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  box-sizing: border-box;
  accent-color: var(--teal-600);
  cursor: pointer;
}

input[type="radio"] {
  border-radius: 50%;
}

textarea {
  min-height: 170px;
  border-radius: 6px;
  background: var(--panel);
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.form-error {
  min-height: 20px;
  color: var(--red-600);
}

.form-help {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* ------------------------------------------------------------- utilities */

.text-button {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
  font-weight: 500;
}

.text-button:hover {
  background: transparent;
  color: var(--mint-400);
}

.table-link {
  color: var(--text);
  font-size: inherit;
  font-weight: 700;
}

.table-link:hover {
  color: var(--teal-700);
}

.mono {
  color: #43535a;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 500;
}

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

.empty,
.empty-state {
  padding: 20px 0;
  color: var(--muted);
  text-align: center;
  font-size: 16px;
  font-weight: 500;
}

.empty-state {
  padding: 44px 12px;
}

.eyebrow {
  color: var(--teal-600);
  font-size: 12px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ login */

.boot-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.boot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.boot-card div {
  display: grid;
  gap: 2px;
}

.boot-card strong {
  color: var(--teal-700);
  font-size: 17px;
}

.boot-card span {
  color: var(--muted);
  font-size: 14px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0, 86, 95, 0.14);
}

.button-link {
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.mfa-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.mfa-qr-code {
  width: min(240px, 100%);
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.recovery-codes {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
  user-select: all;
}

/* -------------------------------------------------------- shell & sidebar */

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

.sidebar {
  display: flex;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #00565f 0%, #003c42 100%);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 86px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 20px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 9px;
  background: var(--mint-400);
}

.brand-mark svg {
  color: #003c42;
}

.brand div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand strong {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.brand span:last-child {
  color: var(--mint-100);
  font-size: 16px;
  font-weight: 500;
}

.sidebar nav {
  display: grid;
  gap: 4px;
  padding: 18px 10px;
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 18px 10px;
}

.nav-link,
.sidebar-collapse {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  padding: 0 16px;
  text-align: left;
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.sidebar-collapse:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.nav-link.active::after {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--mint-400);
  content: "";
}

.nav-icon {
  display: inline-flex;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
  color: rgba(176, 217, 220, 0.76);
}

.nav-link.active .nav-icon {
  color: var(--mint-400);
}

.sidebar-logout {
  margin-top: 6px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  font-size: 15px;
  font-weight: 600;
}

.sidebar-logout:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar-collapsed .brand {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .brand div,
.sidebar-collapsed .nav-link span:not(.nav-icon),
.sidebar-collapsed .sidebar-collapse span:not(.nav-icon),
.sidebar-collapsed .nav-link.active::after,
.sidebar-collapsed .sidebar-logout {
  display: none;
}

.sidebar-collapsed .nav-link,
.sidebar-collapsed .sidebar-collapse {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

/* -------------------------------------------------------- topbar & pages */

.workspace {
  display: grid;
  align-content: start;
  gap: 28px;
  padding: 42px 40px;
}

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

.topbar > div:first-child {
  display: flex;
  flex-direction: column;
}

.topbar h1 {
  order: 1;
  color: var(--teal-700);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
}

.topbar-subtitle {
  order: 2;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

#pageActionSlot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
  gap: 32px;
}

.view.active {
  display: grid;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
}

.page-head h1 {
  color: var(--teal-700);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
}

.page-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
}

.breadcrumb .text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.breadcrumb .text-button:hover {
  color: var(--teal-700);
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 700;
}

.breadcrumb-sep {
  display: inline-flex;
  color: rgba(82, 99, 107, 0.25);
}

/* --------------------------------------------------------------- buttons */

.action-button,
button.action-button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--mint-400);
  color: #ffffff;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 86, 95, 0.08);
}

.action-button:hover,
button.action-button:hover {
  background: var(--mint-500);
}

button[disabled],
.action-button[disabled],
button.action-button[disabled] {
  cursor: wait;
  opacity: 0.68;
}

.is-submitting {
  cursor: wait;
}

.is-submitting button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: button-spin 0.72s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.action-button.secondary,
button.action-button.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--teal-700);
  box-shadow: none;
}

.action-button.secondary:hover,
button.action-button.secondary:hover {
  border-color: var(--teal-200);
  background: var(--teal-50);
}

.small-button {
  min-height: 30px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 12px;
}

.icon-danger {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
}

.icon-danger:hover {
  border-color: var(--red-100);
  background: var(--red-50);
  color: var(--red-600);
}

.danger-button {
  border-color: var(--red-100) !important;
  color: var(--red-600) !important;
}

.danger-button:hover {
  background: var(--red-50) !important;
}

/* --------------------------------------------------------------- modals */

.modal-open {
  overflow: hidden;
}

.modal-shell {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 27, 31, 0.42);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(860px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(23, 35, 38, 0.24);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
}

.modal-head h2 {
  font-size: 20px;
}

.modal-body {
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 20px;
}

/* ------------------------------------------------------- panels & sections */

.panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.table-panel {
  overflow: hidden;
  padding: 0;
}

.table-panel .panel-title {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 17px 20px;
}

.section-title,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  align-items: flex-start;
}

.section-title h2,
.panel-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.panel-title h2 {
  font-size: 17px;
}

.heading-icon {
  display: inline-flex;
  color: var(--teal-700);
}

.heading-icon.danger {
  color: var(--red-500);
}

.section-title .text-button {
  color: var(--teal-700);
  font-size: 16px;
  font-weight: 600;
}

.panel-subtitle {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted-soft);
  font-size: 12px;
  font-weight: 500;
}

.setup-panel .panel-title {
  margin-bottom: 0;
}

.panel-body {
  margin-top: 14px;
}

.section-block {
  display: grid;
  gap: 16px;
}

.action-panel {
  width: 100%;
  max-width: none;
}

.action-panel .panel-title {
  margin-bottom: 14px;
}

.action-split {
  align-items: start;
}

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

/* ----------------------------------------------------------------- forms */

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.grid-form button {
  align-self: end;
}

.grid-form label.type-field-disabled,
.template-check-grid label.type-field-disabled {
  color: var(--muted-soft);
}

.grid-form label.type-field-disabled input,
.grid-form label.type-field-disabled select,
.grid-form label.type-field-disabled textarea,
.template-check-grid label.type-field-disabled input,
.template-check-grid label.type-field-disabled select,
.template-check-grid label.type-field-disabled textarea {
  border-color: var(--border);
  background: #f3f7f8;
  color: var(--muted-soft);
  cursor: not-allowed;
  opacity: 0.72;
}

.stack-form {
  display: grid;
  gap: 12px;
}

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

.settings-form {
  margin-top: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  border: 1px solid var(--red-100);
  border-radius: var(--radius);
  background: var(--red-50);
  padding: 12px;
}

.danger-zone strong {
  color: var(--red-600);
  font-size: 13px;
}

.danger-zone p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.search-row {
  display: flex;
  align-items: center;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(400px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.search-wrap input {
  flex: 1;
  min-height: 43px;
  border-radius: 999px;
  padding-left: 46px;
  font-size: 15px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  display: inline-flex;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.agent-assign-field {
  display: grid;
  gap: 6px;
}

.agent-assign-field > .field-group-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.agent-assign-field .form-help {
  font-size: 12px;
}

.evaluation-policy-field {
  grid-column: 1 / -1;
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.agent-assign-list {
  display: grid;
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  padding: 10px 12px;
}

.agent-assign-list .checkbox-field {
  font-size: 14px;
  font-weight: 500;
}

.agent-assign-list .checkbox-field small {
  color: var(--muted);
  font-size: 12px;
}

.agent-assign-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* --------------------------------------------------------------- metrics */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 16px;
}

.metric-grid.compact {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.metric {
  display: flex;
  min-height: 132px;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.metric.mint {
  border-top-color: var(--mint-500);
}

.metric.danger {
  border-top-color: var(--red-500);
}

.metric.warning {
  border-top-color: var(--amber-600);
}

.metric.muted {
  border-top-color: var(--border-strong);
}

.metric-icon {
  display: inline-flex;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--teal-50);
  color: var(--teal-700);
}

.metric-icon.mint {
  background: var(--mint-50);
  color: var(--mint-700);
}

.metric-icon.danger {
  background: var(--red-50);
  color: var(--red-600);
}

.metric-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.metric .metric-copy strong {
  color: var(--text);
  font-size: 29px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric.mint .metric-copy strong {
  color: var(--mint-700);
}

.metric.danger .metric-copy strong {
  color: var(--red-600);
}

.metric .metric-copy > span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.metric .metric-copy small {
  margin-top: 2px;
  color: rgba(74, 100, 104, 0.75);
  font-size: 13px;
  font-weight: 400;
}

.metric-grid.compact .metric {
  min-height: 100px;
  align-items: flex-start;
  padding: 20px;
}

.metric-grid.compact .metric-icon {
  display: none;
}

.metric-grid.compact .metric .metric-copy strong {
  font-size: 28px;
}

.metric-grid.compact .metric .metric-copy > span {
  font-size: 14px;
}

.device-stats .metric {
  justify-content: center;
  text-align: center;
}

/* ---------------------------------------------------------- entity cards */

.card-grid,
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.card-grid {
  grid-template-columns: repeat(4, minmax(250px, 1fr));
}

.card-grid.three {
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 14px;
}

.card-grid.indented {
  padding-left: 20px;
}

.compact-agent-grid {
  display: flex;
  flex-wrap: wrap;
}

.entity-card {
  display: flex;
  flex-direction: column;
  min-height: 194px;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  padding: 20px;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.card-grid.three .entity-card {
  min-height: 132px;
}

.entity-card:hover {
  border-color: #c8d9dc;
  background: #fbfdfd;
  box-shadow: 0 12px 26px rgba(14, 57, 63, 0.1);
  transform: translateY(-1px);
}

.entity-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}

.entity-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-icon {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 10px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 0;
}

.card-grid.three .entity-icon {
  width: 39px;
  height: 39px;
}

.entity-card.has-issues .entity-icon {
  background: var(--red-50);
  color: var(--red-500);
}

.entity-subtitle,
.entity-meta {
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.card-grid.three .entity-subtitle,
.card-grid.three .entity-meta {
  font-size: 14px;
}

.cell-icon-text,
.entity-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.entity-meta {
  margin-left: auto;
  text-align: right;
}

.entity-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.entity-chevron {
  color: rgba(74, 100, 104, 0.3);
  font-size: 16px;
  font-weight: 600;
}

.entity-card:hover .entity-chevron {
  color: var(--teal-600);
}

.issue-dot {
  width: 8px;
  height: 8px;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--red-500);
}

/* ---------------------------------------------------------- group blocks */

.group-stack {
  display: grid;
  gap: 14px;
}

.group-block {
  display: grid;
  gap: 10px;
}

.group-block > summary {
  display: flex;
  align-items: center;
  min-height: 56px;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  padding: 0 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
}

.summary-chevron {
  display: inline-flex;
  color: var(--muted);
}

.summary-meta {
  margin-left: auto;
  color: var(--muted-soft);
  font-size: 14px;
  font-weight: 500;
}

.group-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 4px;
}

.group-settings-panel {
  margin: 0 4px;
}

/* ---------------------------------------------------------------- tables */

.table {
  overflow-x: auto;
}

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

.checks-table {
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid #e6ecef;
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

td {
  color: var(--text);
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(247, 250, 250, 0.72);
}

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

.click-row {
  cursor: pointer;
}

.table-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 700;
}

.table-primary span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.table-primary .check-title-stack {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  overflow: visible;
  white-space: normal;
  font-size: inherit;
}

.table-primary .check-title-stack > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.checks-table th,
.checks-table td {
  padding: 12px 10px;
}

.checks-table th:nth-child(1),
.checks-table td:nth-child(1) {
  width: 15%;
}

.checks-table th:nth-child(2),
.checks-table td:nth-child(2) {
  width: 8%;
}

.checks-table th:nth-child(3),
.checks-table td:nth-child(3) {
  width: 10%;
}

.checks-table th:nth-child(4),
.checks-table td:nth-child(4) {
  width: 8%;
}

.checks-table th:nth-child(5),
.checks-table td:nth-child(5) {
  width: 16%;
}

.checks-table th:nth-child(6),
.checks-table td:nth-child(6) {
  width: 9%;
}

.checks-table th:nth-child(7),
.checks-table td:nth-child(7) {
  width: 8%;
}

.checks-table th:nth-child(8),
.checks-table td:nth-child(8) {
  width: 8%;
}

.checks-table th:nth-child(9),
.checks-table td:nth-child(9) {
  width: 18%;
}

.checks-table td:nth-child(3),
.checks-table td:nth-child(5),
.checks-table td:nth-child(8) {
  overflow-wrap: anywhere;
}

.checks-table .row-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
}

.checks-table .row-actions .small-button,
.checks-table .row-actions .icon-danger {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.checks-table .row-actions .small-button:hover,
.checks-table .row-actions .icon-danger:hover {
  background: transparent;
  color: var(--teal-800);
}

.checks-table .row-actions .danger-button,
.checks-table .row-actions .icon-danger {
  color: var(--red-600) !important;
}

.maintenance-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--amber-100);
  border-radius: 999px;
  background: var(--amber-50);
  color: var(--amber-600);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.maintenance-pill.active {
  border-color: var(--teal-100);
  background: var(--teal-50);
  color: var(--teal-700);
}

.maintenance-pill.muted {
  border-color: var(--border);
  background: var(--panel-soft);
  color: var(--muted);
}

.chevron {
  color: rgba(82, 99, 107, 0.45);
  text-align: right;
}

.truncate-cell {
  max-width: 330px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.62;
  transition: opacity 0.15s ease;
}

tr:hover .row-actions,
tr:focus-within .row-actions {
  opacity: 1;
}

@media (hover: none) {
  .row-actions {
    opacity: 1;
  }
}

.agent-actions {
  opacity: 1;
}

.check-history-row td {
  background: var(--panel-soft);
  padding: 0;
}

.check-history-row:hover {
  background: transparent;
}

.check-history-panel {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(221, 230, 232, 0.72);
  padding: 14px 16px 16px 46px;
}

.check-history-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.check-history-title strong {
  color: var(--text);
  font-size: 14px;
}

.check-history-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-history-table table {
  min-width: 860px;
}

.compact-history-table th,
.compact-history-table td {
  padding: 10px 12px;
}

.ping-history-chart-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
}

.ping-history-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ping-history-chart-head div:first-child {
  display: grid;
  gap: 4px;
}

.ping-history-chart-head span,
.ping-history-chart-stats {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ping-history-chart-head strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.ping-history-chart-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
}

.ping-history-chart {
  width: 100%;
  height: 150px;
}

.ping-history-fail-point {
  fill: var(--red-500);
  stroke: #ffffff;
  stroke-width: 2;
}

.ping-history-hover-point {
  fill: transparent;
  stroke: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.result-output-row td {
  padding-top: 0;
  background: var(--panel-soft);
}

.result-output-panel {
  display: grid;
  gap: 8px;
  padding: 0 0 6px;
}

.result-output-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.result-output-panel pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px;
  white-space: pre;
}

/* --------------------------------------------------------- badges & pills */

.status-badge,
.mini-pill,
.count-pill,
.type-pill,
.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.status-badge {
  padding: 6px 12px;
}

.status-badge > span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
}

.mini-pill,
.count-pill,
.type-pill,
.scope-pill {
  padding: 6px 11px;
}

.type-pill,
.scope-pill {
  font-size: 14px;
}

.mini-pill {
  font-size: 15px;
}

.mini-pill b {
  font-weight: 700;
}

.status-ok,
.status-online {
  border-color: var(--mint-100);
  background: var(--mint-50);
  color: var(--mint-700);
}

.status-warning {
  border-color: var(--amber-100);
  background: var(--amber-50);
  color: var(--amber-600);
}

.status-critical,
.status-offline {
  border-color: var(--red-100);
  background: var(--red-50);
  color: var(--red-600);
}

.status-unknown {
  border-color: var(--border);
  background: #eef3f4;
  color: var(--muted);
}

.check-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mini-pill.ok,
.count-pill.mint {
  border-color: var(--mint-100);
  background: var(--mint-50);
  color: var(--mint-700);
}

.mini-pill.critical,
.count-pill.danger {
  border-color: var(--red-100);
  background: var(--red-50);
  color: var(--red-600);
}

.mini-pill.neutral,
.count-pill.teal,
.type-pill,
.scope-pill {
  border-color: #dbe5e9;
  background: #f3f6f7;
  color: #43535a;
}

.agent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.agent-pills span {
  border: 1px solid var(--teal-100);
  border-radius: 999px;
  background: #f3f6f7;
  color: #43535a;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 600;
}

.enabled-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--mint-500);
}

.enabled-dot.disabled {
  background: #c7d2d6;
}

.latency {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.latency.warning {
  color: var(--amber-600);
}

.latency.critical {
  color: var(--red-600);
}

.update-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.update-pill.ok {
  border-color: var(--mint-200);
  background: var(--mint-50);
  color: var(--mint-800);
}

.update-pill.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.update-pill.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--red-700);
}

.update-pill.muted {
  color: var(--muted-soft);
}

.version-stack {
  display: inline-grid;
  gap: 5px;
}

/* ----------------------------------------------------------- agent cards */

.agent-card {
  display: grid;
  gap: 8px;
  min-width: 330px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.agent-card div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.agent-card span {
  color: var(--muted);
  font-size: 12px;
}

.agent-card strong {
  font-size: 18px;
  font-weight: 700;
}

.agent-card .mono {
  font-size: 15px;
}

.agent-radio-icon {
  display: inline-flex;
  flex: 0 0 18px;
  color: #c7d2d6;
}

.agent-radio-icon.online {
  color: var(--mint-500);
}

.scope-pill svg,
.agent-detail-chips svg {
  flex: 0 0 auto;
}

/* ------------------------------------------------------------ agent detail */

.agent-detail-head {
  align-items: center;
}

.agent-detail-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
}

.agent-health-grid,
.trend-grid {
  display: grid;
  gap: 14px;
}

.agent-health-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.trend-grid {
  grid-template-columns: repeat(3, minmax(230px, 1fr));
}

.agent-collapsible-title {
  align-items: center;
}

.agent-collapsible-title > div {
  min-width: 0;
}

.agent-collapsible-body {
  margin-top: 14px;
}

.table-panel .agent-collapsible-body {
  margin-top: 0;
}

.table-panel .agent-collapsible-body > .empty {
  padding: 20px;
}

.agent-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 18px 0 14px;
  border-bottom: 1px solid var(--border);
}

.agent-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 2px 10px;
  font-size: 14px;
  font-weight: 650;
  box-shadow: none;
}

.agent-tab:hover {
  background: transparent;
  color: var(--teal-700);
}

.agent-tab.active {
  color: var(--teal-700);
  border-bottom-color: var(--teal-300);
}

.agent-tab.has-issue:not(.active) {
  color: var(--amber-600);
}

.agent-tab small {
  min-width: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 7px;
}

.agent-tab-panel {
  display: grid;
  gap: 16px;
}

.agent-tab-panel .agent-update-panel,
.agent-tab-panel .telemetry-panel,
.agent-tab-panel .agent-network-panel,
.agent-tab-panel .agent-install-health-panel {
  margin-top: 0;
}

.agent-tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.agent-detail-panel-body {
  margin-top: 14px;
}

.table-panel .agent-detail-panel-body {
  margin-top: 0;
}

.table-panel .agent-detail-panel-body > .empty {
  padding: 20px;
}

.health-card,
.trend-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.health-card {
  min-height: 118px;
}

.health-card-head,
.trend-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.health-card-head span,
.trend-card-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.health-card-head strong,
.trend-card-head strong {
  color: var(--text);
  font-size: 25px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.health-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.health-card-track {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef0;
}

.health-card-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mint-500);
}

.health-card.warning .health-card-track span {
  background: #d97706;
}

.health-card.danger {
  border-color: var(--red-100);
  background: linear-gradient(180deg, #ffffff 0%, var(--red-50) 100%);
}

.health-card.danger .health-card-track span {
  background: var(--red-500);
}

.health-card.unknown .health-card-track span,
.health-card.info .health-card-track span {
  background: var(--muted-soft);
}

.trend-card {
  min-height: 220px;
}

.trend-chart {
  width: 100%;
  height: 130px;
}

.trend-gridline {
  fill: none;
  stroke: rgba(82, 99, 107, 0.16);
  stroke-width: 1;
}

.trend-line {
  fill: none;
  stroke: var(--teal-600);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.trend-point {
  fill: var(--mint-500);
  stroke: #ffffff;
  stroke-width: 2;
}

.trend-foot {
  display: flex;
  justify-content: space-between;
  color: var(--muted-soft);
  font-size: 12px;
  font-weight: 600;
}

.trend-empty {
  display: grid;
  min-height: 130px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.health-stack {
  display: grid;
  min-width: 210px;
  max-width: 280px;
  gap: 6px;
}

.health-meter {
  display: grid;
  grid-template-columns: 36px minmax(72px, 1fr) 48px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.health-meter-track {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef0;
}

.health-meter-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mint-500);
}

.health-meter.warning .health-meter-track span {
  background: #d97706;
}

.health-meter.danger .health-meter-track span {
  background: var(--red-500);
}

.health-meter.unknown .health-meter-track span {
  background: var(--muted-soft);
}

.health-meter-value {
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.health-detail,
.health-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.agent-update-panel,
.telemetry-panel,
.agent-network-panel {
  margin-top: 18px;
}

.agent-update-panel.update-available {
  border-color: #fed7aa;
}

.agent-update-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.agent-update-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.agent-update-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.agent-update-diagnostics.has-error {
  color: var(--red-700);
}

.agent-update-diagnostics strong {
  font-weight: 700;
}

.update-command {
  max-height: 220px;
  overflow: auto;
  margin: 14px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--teal-50);
  color: var(--teal-900);
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  white-space: pre;
}

.agent-address-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.agent-address-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 13px;
  min-width: 0;
}

.agent-address-card strong {
  color: var(--text);
  font-size: 13px;
}

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

.agent-address-list .mono {
  overflow-wrap: anywhere;
}

/* -------------------------------------------------------------- telemetry */

.telemetry-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.telemetry-kv-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.telemetry-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.telemetry-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.telemetry-item strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.telemetry-subsection {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.telemetry-subsection > strong {
  color: var(--text);
  font-size: 13px;
}

.latency-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.latency-chip-row span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 9px;
}

/* ------------------------------------------------------- service inventory */

.service-inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
}

.service-search-wrap {
  width: min(460px, 100%);
}

.service-inventory-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.service-inventory-summary span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 9px;
}

.service-inventory-result-meta,
.service-inventory-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
}

.service-inventory-result-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.service-inventory-footer {
  border-top: 1px solid var(--border);
}

.service-inventory-table table {
  min-width: 980px;
  font-size: 14px;
}

.service-inventory-table th,
.service-inventory-table td {
  padding: 11px 14px;
}

.service-inventory-table td {
  vertical-align: top;
}

.service-name-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.service-monitor-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.service-monitor-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--mint-500);
}

.service-monitor-field:has(input:disabled) {
  color: var(--muted-soft);
  cursor: not-allowed;
}

/* -------------------------------------------------- enrollment & installs */

.token-output {
  min-height: 56px;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--teal-800);
  padding: 12px;
  white-space: normal;
}

.stack-form + .token-output:not(.is-hidden) {
  margin-top: 16px;
}

.agent-install-guide {
  display: grid;
  gap: 14px;
}

.install-summary {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.download-row a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  text-decoration: none;
}

.download-row a:hover {
  border-color: var(--border-strong);
  background: var(--teal-50);
}

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

.install-step {
  min-width: 0;
}

.install-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.install-step-header h3 {
  margin: 0;
  color: var(--teal-800);
  font-size: 13px;
  line-height: 1.2;
}

.install-step-header .small-button {
  min-height: 28px;
}

.install-step pre {
  min-height: 132px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--teal-50);
  color: var(--teal-900);
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  white-space: pre;
}

.agent-artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.agent-artifact-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.agent-artifact-card strong {
  color: var(--text);
  font-size: 13px;
}

.agent-artifact-card span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.install-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.install-health-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.install-health-item strong {
  font-size: 14px;
}

.install-health-item span {
  color: var(--danger);
  font-weight: 700;
}

.install-health-item.ok span {
  color: var(--ok);
}

.install-health-item small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* --------------------------------------------------- settings & templates */

.settings-page {
  display: grid;
  gap: 24px;
}

.settings-page .panel {
  padding: 22px;
}

.settings-page .integration-settings-panel,
.settings-page .setup-panel,
.settings-page .template-management-panel,
.settings-page > .split > .panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.settings-page .panel-title {
  min-width: 0;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.settings-page .panel-title h2 {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.settings-page .panel-title > div {
  display: grid;
  gap: 3px;
}

.settings-page .panel-title > div .panel-subtitle {
  margin-top: 0;
}

.settings-page .panel-subtitle {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
}

.settings-page label {
  gap: 7px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

.settings-page input:not([type="checkbox"]):not([type="radio"]),
.settings-page select,
.settings-page textarea {
  font-size: 14px;
}

.settings-page input:not([type="checkbox"]):not([type="radio"]),
.settings-page select {
  min-height: 40px;
}

.settings-page .stack-form {
  gap: 16px;
}

.settings-page .stack-form > button[type="submit"] {
  min-width: 180px;
  justify-self: start;
}

.settings-page .backup-history {
  gap: 12px;
}

.settings-page .backup-history h3 {
  font-size: 15px;
  line-height: 1.35;
}

.settings-page .form-help {
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
}

.settings-page .login-ip-rules {
  min-height: 124px;
  border-radius: 10px;
  background: #ffffff;
  line-height: 1.6;
}

.login-ip-current {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 9px 11px;
}

.login-ip-current span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.login-ip-current code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.settings-toggle-row,
.notification-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-page .settings-toggle-row .checkbox-field,
.settings-page .notification-toggle-row .checkbox-field,
.settings-page .stack-form > .checkbox-field {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 8px 11px;
}

.user-access-selector {
  display: grid;
  gap: 8px;
}

.user-access-selector > strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.user-access-selector > .form-help {
  margin-top: -5px;
}

.agent-checkbox {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
}

.threshold-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  align-items: start;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.backup-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.backup-status-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.backup-status-card span,
.backup-status-card small {
  color: var(--muted);
  font-size: 12px;
}

.backup-status-card strong {
  color: var(--text);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.backup-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.backup-history {
  display: grid;
  gap: 10px;
}

.backup-history h3 {
  margin: 0;
  font-size: 16px;
}

.threshold-pair {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.threshold-pair strong {
  color: var(--text);
  font-size: 14px;
}

.notification-form {
  display: grid;
  gap: 12px;
}

.maintenance-window-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.maintenance-window-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.maintenance-window-head strong {
  display: block;
  margin-bottom: 2px;
}

.maintenance-window-list {
  display: grid;
  gap: 10px;
}

.maintenance-window-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) minmax(170px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.maintenance-enabled {
  align-self: center;
  margin-bottom: 8px;
}

.notification-channel-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.notification-channel-settings {
  display: grid;
  gap: 8px;
}

.integration-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.integration-status,
.notification-channel-note {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.integration-status.configured,
.notification-channel-note.configured {
  border-color: var(--mint-100);
  background: var(--mint-50);
  color: var(--mint-700);
}

.integration-status.missing,
.notification-channel-note.missing {
  border-color: var(--red-100);
  background: var(--red-50);
  color: var(--red-600);
}

.integration-status.pending {
  border-color: var(--amber-100);
  background: var(--amber-50);
  color: var(--amber-600);
}

.template-management-panel {
  display: grid;
  gap: 16px;
}

.template-management-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
  gap: 16px;
  align-items: start;
}

.template-editor-form {
  min-width: 0;
}

.template-list {
  display: grid;
  gap: 12px;
}

.template-editor-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  box-shadow: var(--shadow-card);
}

.template-editor-card summary {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 1.2fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
}

.template-editor-card summary > span:first-child {
  display: grid;
  gap: 3px;
}

.template-editor-card summary strong {
  color: var(--text);
  font-size: 15px;
}

.template-editor-card summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.template-editor-card form {
  border-top: 1px solid var(--border);
  padding: 14px;
}

.template-items-editor {
  display: grid;
  gap: 12px;
}

.template-items-head,
.template-check-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.template-items-head h3 {
  color: var(--text);
  font-size: 15px;
}

.template-items-list {
  display: grid;
  gap: 12px;
}

.template-check-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
}

.template-check-item-head strong {
  color: var(--text);
  font-size: 14px;
}

.template-check-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.template-apply-form {
  margin-bottom: 16px;
}

.template-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.template-preview-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.template-preview-card > div:first-child {
  display: grid;
  gap: 4px;
}

.template-preview-card strong {
  color: var(--text);
  font-size: 15px;
}

.template-preview-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.template-item-list {
  display: grid;
  gap: 8px;
}

.template-item-list > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.template-item-list b {
  color: var(--text);
  font-size: 13px;
}

.template-item-list small {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

/* -------------------------------------------------------- device visuals */

.device-title-row,
.client-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.device-target {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  padding: 7px 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  font-weight: 500;
}

.device-visual-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(260px, 1fr);
  gap: 14px;
}

.device-colour-field {
  display: grid;
  gap: 8px;
}

.colour-swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.colour-swatch-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  padding: 6px 9px 6px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.colour-swatch-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.colour-swatch-option:has(input:checked) {
  border-color: var(--teal-300);
  color: var(--text);
  box-shadow: 0 0 0 2px rgba(0, 122, 135, 0.12);
}

.colour-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(23, 35, 38, 0.14);
}

.entity-icon.device-visual-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 0;
}

.entity-icon.device-title-icon {
  width: 48px;
  height: 48px;
}

.client-logo {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 10px;
  color: #00656f;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.client-logo.large {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  font-size: 17px;
}

.client-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.client-logo-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.client-logo-preview {
  padding-top: 26px;
}

.client-logo-fields {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.client-logo-clear {
  font-size: 13px;
}

.device-visual-icon.tone-teal,
.client-logo.tone-teal,
.colour-swatch.tone-teal {
  background: #e7f7f7;
  color: #00656f;
}

.device-visual-icon.tone-mint,
.client-logo.tone-mint,
.colour-swatch.tone-mint {
  background: #e5f9ef;
  color: #267356;
}

.device-visual-icon.tone-blue,
.client-logo.tone-blue,
.colour-swatch.tone-blue {
  background: #eaf3ff;
  color: #2563a6;
}

.device-visual-icon.tone-amber,
.client-logo.tone-amber,
.colour-swatch.tone-amber {
  background: #fff4d8;
  color: #9a5b00;
}

.device-visual-icon.tone-red,
.client-logo.tone-red,
.colour-swatch.tone-red {
  background: #fff1f0;
  color: #b42318;
}

.device-visual-icon.tone-purple,
.client-logo.tone-purple,
.colour-swatch.tone-purple {
  background: #f2ecff;
  color: #6b46a3;
}

.device-visual-icon.tone-slate,
.client-logo.tone-slate,
.colour-swatch.tone-slate {
  background: #edf2f4;
  color: #40515a;
}

/* ------------------------------------------------------------ flash toast */

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.flash {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 56px));
  border: 1px solid var(--mint-100);
  border-radius: 999px;
  background: var(--mint-50);
  color: var(--mint-700);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 86, 95, 0.18);
  animation: flash-in 0.18s ease;
}

.flash.danger {
  border-color: var(--red-100);
  background: var(--red-50);
  color: var(--red-600);
}

.flash:empty {
  display: none;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1320px) {
  .metric-grid,
  .card-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .agent-health-grid,
  .agent-address-grid,
  .trend-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .card-grid.three {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

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

  .checks-table {
    min-width: 880px;
    table-layout: auto;
  }

  .checks-table th,
  .checks-table td {
    width: auto !important;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar nav,
  .sidebar-footer {
    padding: 10px;
  }

  .workspace {
    padding: 24px;
  }

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

  .topbar-actions {
    justify-content: space-between;
  }

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

  .metric-grid,
  .metric-grid.compact,
  .metric-grid.compact.device-stats,
  .agent-health-grid,
  .agent-address-grid,
  .agent-tab-grid,
  .trend-grid,
  .device-visual-grid,
  .threshold-grid,
  .card-grid,
  .card-grid.three,
  .split,
  .grid-form,
  .compact-form,
  .template-management-grid,
  .notification-channel-card,
  .template-check-grid,
  .template-editor-card summary {
    grid-template-columns: 1fr;
  }

  .card-grid.indented {
    padding-left: 0;
  }

  .settings-page {
    gap: 18px;
  }

  .settings-page .panel {
    padding: 16px;
  }

  .settings-page .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-page .panel-title > button,
  .settings-page .stack-form > button[type="submit"] {
    width: 100%;
    justify-self: stretch;
  }

  .settings-page .settings-toggle-row,
  .settings-page .notification-toggle-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-ip-current {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  table {
    font-size: 15px;
  }

  th,
  td {
    padding: 14px;
  }
}
