:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfd;
  --border: #e5eaf1;
  --text: #122033;
  --muted: #66768b;
  --operational: #10c985;
  --degraded: #f2a100;
  --partial_outage: #f06a00;
  --major_outage: #ff4268;
  --maintenance: #3d6be0;
  --shadow: 0 18px 50px rgba(18, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, #ffffff 0%, #f5f7fb 55%, #eef3f8 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.admin-body {
  background: linear-gradient(180deg, #f4f7fb 0%, #edf3f9 100%);
}

.admin-shell {
  max-width: 1180px;
}

.site-header,
.site-footer,
.hero-card,
.group-card,
.incident-card,
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  margin-bottom: 24px;
}

.admin-site-header {
  display: grid;
  gap: 14px;
  padding: 18px 22px;
  margin-bottom: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dce6f2;
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(18, 32, 51, 0.07);
}

.admin-site-headline {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-site-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.admin-site-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.admin-site-inline-actions a,
.admin-inline-logout {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #dbe5f1;
  background: #fff;
  color: #46586f;
  font-size: 0.9rem;
}

.admin-inline-logout {
  cursor: pointer;
  font: inherit;
}

.admin-site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #dbe5f1;
  background: #fff;
  color: #46586f;
  font-size: 0.92rem;
}

.admin-site-nav a.active {
  background: #122033;
  border-color: #122033;
  color: #fff;
}

.brand {
  font-size: 1.05rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
}

.content {
  display: grid;
  gap: 24px;
}

.hero-card,
.group-card,
.incident-card,
.detail-card {
  padding: 22px;
}

.hero-card {
  display: grid;
  gap: 20px;
}

.hero-status {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.hero-status .dot,
.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
  background: currentColor;
}

.hero-status-operational { color: var(--operational); }
.hero-status-degraded { color: var(--degraded); }
.hero-status-partial_outage { color: var(--partial_outage); }
.hero-status-major_outage { color: var(--major_outage); }
.hero-status-maintenance { color: var(--maintenance); }

.hero-status h1,
.section-head h1,
.detail-head h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
  line-height: 1.2;
}

.hero-status p,
.section-copy,
.muted,
.component-main p,
.timeline-content p,
.incident-row p,
.detail-head p {
  margin: 0;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 16px;
}

.section-head h2,
.group-head h3,
.component-main h4,
.incident-row h3,
.timeline h2 {
  margin: 0 0 8px;
}

.group-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.component-list {
  display: grid;
}

.component-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.component-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.component-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.badge,
.meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.badge {
  color: #fff;
  font-weight: 600;
}

.badge-operational { background: var(--operational); }
.badge-degraded { background: var(--degraded); }
.badge-partial_outage { background: var(--partial_outage); }
.badge-major_outage { background: var(--major_outage); }
.badge-maintenance { background: var(--maintenance); }

.meta-pill {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
}

.status-meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d7e2ee;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  color: #36516f;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.admin-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d7e2ee;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  color: #36516f;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.monitor-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.compact-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-stat {
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f7fb 100%);
  border: 1px solid var(--border);
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 6px;
  min-height: 78px;
  text-align: left;
}

.summary-label {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.15;
}

.summary-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.monitor-hero {
  gap: 10px;
  padding: 16px 18px;
}

.monitor-hero-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.monitor-hero h1 {
  margin: 0 0 4px;
  font-size: 1.34rem;
  line-height: 1.12;
}

.monitor-hero p {
  margin: 0;
  line-height: 1.34;
  font-size: 0.9rem;
}

.refresh-pill {
  min-width: 128px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f7fb 100%);
  text-align: right;
}

.refresh-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.refresh-pill strong {
  font-size: 0.9rem;
}

.monitor-row-list {
  display: grid;
  gap: 18px;
  margin-top: -72px;
}

.monitor-group-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  overflow: visible;
}

.monitor-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  list-style: none;
}

.monitor-group-head::-webkit-details-marker {
  display: none;
}

.monitor-group-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid #8a98aa;
  border-bottom: 2px solid #8a98aa;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.monitor-group-head h2 {
  margin: 0;
  font-size: 1rem;
}

.monitor-group-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-right: 6px;
}

.monitor-group-meta span:first-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.monitor-group-shell[open] .monitor-group-caret {
  transform: rotate(225deg);
}

.monitor-group-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.monitor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.monitor-panel-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.monitor-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 0;
}

.monitor-panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.monitor-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.monitor-panel-scroll {
  max-height: 960px;
  overflow-y: auto;
  padding-top: 88px;
  padding-right: 4px;
}

.monitor-panel-scroll::-webkit-scrollbar {
  width: 10px;
}

.monitor-panel-scroll::-webkit-scrollbar-thumb {
  background: #d9e2ee;
  border-radius: 999px;
  border: 2px solid #f7faff;
}

.monitor-panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.monitor-sidebar {
  display: grid;
  gap: 16px;
  position: static;
}

.monitor-toolbar {
  display: grid;
  gap: 10px;
}

.monitor-row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.monitor-row-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.monitor-title-wrap h3 {
  margin: 0;
  font-size: 1rem;
}

.monitor-title-wrap p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.monitor-model-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.group-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.group-chip {
  background: #f4f6fa;
  color: var(--muted);
  border-color: var(--border);
}

.status-chip-operational {
  color: var(--operational);
  background: rgba(15, 159, 110, 0.12);
  border-color: rgba(15, 159, 110, 0.22);
}

.status-chip-degraded,
.status-chip-maintenance {
  color: var(--degraded);
  background: rgba(208, 138, 0, 0.12);
  border-color: rgba(208, 138, 0, 0.22);
}

.status-chip-partial_outage,
.status-chip-major_outage {
  color: var(--major_outage);
  background: rgba(207, 47, 69, 0.12);
  border-color: rgba(207, 47, 69, 0.2);
}

.monitor-summary-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}

.monitor-summary-metrics strong {
  color: var(--text);
  font-size: 0.96rem;
}

.dot-sep {
  margin: 0 4px;
}

.monitor-timeline {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
}

.timeline-block-wrap {
  position: relative;
}

.timeline-block {
  height: 22px;
  border-radius: 4px;
}

.timeline-block-good {
  background: #10c985;
}

.timeline-block-warn {
  background: #f2a100;
}

.timeline-block-bad {
  background: #ff4268;
}

.timeline-block-empty {
  background: #e8edf4;
}

.timeline-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  min-width: 176px;
  padding: 14px 16px 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  box-shadow: 0 22px 48px rgba(18, 32, 51, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 10;
}

.timeline-block-wrap:hover .timeline-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.timeline-block-wrap:nth-child(-n + 2) .timeline-tooltip {
  left: 0;
  transform: translateX(0) translateY(6px);
}

.timeline-block-wrap:nth-child(-n + 2):hover .timeline-tooltip {
  transform: translateX(0) translateY(0);
}

.timeline-block-wrap:nth-last-child(-n + 2) .timeline-tooltip {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(6px);
}

.timeline-block-wrap:nth-last-child(-n + 2):hover .timeline-tooltip {
  transform: translateX(0) translateY(0);
}

.timeline-block-wrap:hover .timeline-block {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(33, 73, 182, 0.25);
}

.timeline-tooltip-time {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.2;
}

.timeline-tooltip-metric {
  display: grid;
  gap: 6px;
}

.timeline-tooltip-label {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.2;
}

.tooltip-rate {
  color: var(--operational);
  font-size: 1.02rem;
  line-height: 1;
}

.timeline-axis {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #8a98aa;
  font-size: 0.8rem;
}

.monitor-data-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.monitor-filter-toolbar,
.monitor-maintenance-bar {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow);
}

.monitor-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(160px, 0.9fr) minmax(160px, 0.9fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
}

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

.toolbar-field span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.toolbar-field input,
.toolbar-field select {
  width: 100%;
  border: 1px solid #d7e2ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.toolbar-field input:focus,
.toolbar-field select:focus {
  outline: none;
  border-color: #b8cae0;
  box-shadow: 0 0 0 3px rgba(33, 73, 182, 0.08);
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d7e2ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 10px;
  padding: 10px 40px 10px 12px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  text-align: left;
  position: relative;
  cursor: pointer;
}

.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #72839a;
  border-bottom: 2px solid #72839a;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 140ms ease;
}

.custom-select.open .custom-select-trigger {
  border-color: #b8cae0;
  box-shadow: 0 0 0 3px rgba(33, 73, 182, 0.08);
}

.custom-select.open .custom-select-trigger::after {
  transform: translateY(-35%) rotate(225deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  padding: 8px;
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(18, 32, 51, 0.12);
  backdrop-filter: blur(8px);
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 4px;
}

.custom-select-option {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  color: #43556d;
  cursor: pointer;
}

.custom-select-option:hover {
  background: #f3f7ff;
  color: var(--text);
}

.custom-select-option.selected {
  background: #eaf1ff;
  color: #2149b6;
  font-weight: 600;
}

.toolbar-search {
  min-width: 0;
}

.toolbar-search-input {
  position: relative;
}

.toolbar-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7a90;
  font-size: 0.76rem;
  text-decoration: none;
  background: rgba(248, 251, 255, 0.96);
  padding: 3px 7px;
  border-radius: 999px;
}

.toolbar-actions {
  display: flex;
  align-items: end;
}

.monitor-maintenance-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.monitor-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  padding: 14px 4px 2px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex: 0 0 auto;
}

.legend-swatch-good {
  background: #10c985;
}

.legend-swatch-warn {
  background: #f2a100;
}

.legend-swatch-bad {
  background: #ff4268;
}

.legend-swatch-empty {
  background: #e8edf4;
  border: 1px solid #d6dde8;
}

.maintenance-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--muted);
}

.custom-data-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.data-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f3f7ff;
  border: 1px solid #dbe6fb;
  color: #2149b6;
  font-size: 0.82rem;
}

.admin-rule-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
  padding-top: 8px;
}

.admin-rule-summary .data-pill {
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 16px;
  align-items: flex-start;
  line-height: 1.35;
}

.incident-row,
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.incident-meta-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.history-page-head {
  padding-left: 22px;
}

.history-scroll-wrap {
  display: grid;
  gap: 16px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.history-incident-main {
  display: grid;
  gap: 8px;
}

.history-incident-meta {
  display: grid;
  gap: 6px;
}

.history-detail-link {
  display: inline-flex;
  align-items: center;
  color: #2149b6;
  font-weight: 600;
}

.history-detail-link::after {
  content: "->";
  font-size: 0.86rem;
  margin-left: 6px;
}

.history-incident-times {
  margin: 0;
  line-height: 1.45;
}

.history-detail-line {
  margin: 0;
}

.history-update-text {
  margin-left: 10px;
}

.history-latest-update {
  margin: 8px 0 0;
  line-height: 1.45;
}

.history-latest-update-message {
  margin: 4px 0 0;
  color: var(--text);
  line-height: 1.5;
}

.detail-back {
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
}

.timeline {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}

.detail-timeline-scroll {
  max-height: 720px;
  overflow: auto;
  padding-right: 4px;
}

.timeline-item {
  display: flex;
  gap: 14px;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.site-footer {
  margin-top: 24px;
  padding: 18px 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-toolbar,
.admin-grid,
.admin-actions-grid {
  display: grid;
  gap: 16px;
}

.admin-toolbar {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.admin-actions-grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

.admin-hero {
  border: 1px solid #dce6f2;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  box-shadow: 0 16px 42px rgba(18, 32, 51, 0.07);
  padding: 22px 24px;
}

.admin-hero h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
}

.admin-toolbar h1 {
  margin: 0;
  font-size: 1.24rem;
}

.admin-toolbar > div {
  display: grid;
  gap: 8px;
}

.admin-toolbar .section-copy {
  margin: 0;
}

.admin-section {
  gap: 14px;
}

.admin-section .section-head {
  padding: 0 4px;
}

.admin-section .section-head h2 {
  margin-bottom: 4px;
  font-size: 1.08rem;
}

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

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

.admin-page-head .button-anchor {
  flex-shrink: 0;
}

.admin-action-card {
  background: var(--surface);
  border: 1px solid #dce6f2;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(18, 32, 51, 0.06);
  overflow: hidden;
}

.admin-action-head {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.admin-action-head::-webkit-details-marker {
  display: none;
}

.admin-action-head h3 {
  margin: 0 0 4px;
  font-size: 1.04rem;
}

.admin-action-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-action-caret {
  width: 9px;
  height: 9px;
  border-right: 2px solid #8a98aa;
  border-bottom: 2px solid #8a98aa;
  transform: rotate(45deg);
  transition: transform 140ms ease;
  flex: 0 0 auto;
}

.admin-action-card[open] .admin-action-caret {
  transform: rotate(225deg);
}

.admin-form-shell {
  padding: 18px 22px 22px;
  border-top: 1px solid #e7eef7;
  background: #fcfdff;
}

.admin-panel,
.admin-auth-card {
  background: var(--surface);
  border: 1px solid #dce6f2;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(18, 32, 51, 0.06);
  padding: 22px;
}

.admin-panel h2,
.admin-auth-card h2 {
  margin: 0 0 14px;
  font-size: 1.04rem;
}

.admin-modal {
  width: min(760px, calc(100vw - 48px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid #dce6f2;
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(18, 32, 51, 0.22);
}

.admin-modal.admin-modal-wide {
  width: min(920px, calc(100vw - 48px));
}

.admin-modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.admin-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid #e7eef7;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.admin-modal-head strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.admin-modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-modal-close,
.admin-modal-close-link {
  flex-shrink: 0;
  border: 1px solid #d7e2ee;
  background: #ffffff;
  color: #4f6278;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.admin-modal-form {
  padding: 20px 24px 24px;
}

.admin-export-confirm {
  display: grid;
  gap: 16px;
}

.admin-export-confirm p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: start;
}

.single-column {
  grid-template-columns: 1fr;
}

.admin-form label,
.inline-form {
  display: grid;
  gap: 8px;
}

.checkbox-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.admin-form label span {
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.inline-form input,
.inline-form select {
  width: 100%;
  border: 1px solid #d9e3ef;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
}

.admin-form textarea {
  min-height: 96px;
  resize: vertical;
}

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

.button-primary,
.button-secondary {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
}

.button-link,
.table-link {
  color: #2149b6;
  text-decoration: none;
  font-size: 0.92rem;
}

.button-link {
  display: inline-block;
  padding-top: 4px;
}

.button-anchor {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.button-danger {
  border: 0;
  background: transparent;
  color: #c81e3a;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.button-primary {
  background: #122033;
  color: #fff;
}

.button-secondary {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
}

.compact-button {
  min-height: 32px;
  padding: 7px 12px;
  font-size: 0.84rem;
  border-radius: 10px;
}

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

.flash {
  background: #ecfdf3;
  color: #136c47;
  border: 1px solid #b7ebcf;
  border-radius: 10px;
  padding: 12px 14px;
}

.flash-error {
  background: #fff1f2;
  color: #b42318;
  border-color: #fecdd3;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid #e8eef6;
  border-radius: 12px;
  background: #fbfdff;
}

.admin-section .admin-table-wrap {
  max-height: 680px;
  overflow: auto;
}

.component-history-table-wrap {
  max-height: 720px;
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #e8eef6;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.9rem;
  background: #f8fbff;
}

.admin-table tbody tr:hover {
  background: #fcfdff;
}

.component-list-table .component-col-name {
  width: 13%;
}

.component-list-table .component-col-group {
  width: 10%;
}

.component-list-table .component-col-status {
  width: 14%;
}

.component-list-table .component-col-check {
  width: 24%;
}

.component-list-table .component-col-last-check {
  width: 17%;
}

.component-list-table .component-col-actions {
  width: 22%;
}

.admin-events-table th:nth-child(1) { width: 24%; }
.admin-events-table th:nth-child(2) { width: 12%; }
.admin-events-table th:nth-child(3) { width: 18%; }
.admin-events-table th:nth-child(4) { width: 18%; }
.admin-events-table th:nth-child(5) { width: 28%; }

.admin-maintenances-table th:nth-child(1) { width: 30%; }
.admin-maintenances-table th:nth-child(2) { width: 12%; }
.admin-maintenances-table th:nth-child(3) { width: 28%; }
.admin-maintenances-table th:nth-child(4) { width: 12%; }
.admin-maintenances-table th:nth-child(5) { width: 18%; }

.component-name-cell,
.component-group-cell,
.component-last-check-cell {
  min-width: 0;
}

.admin-nowrap {
  white-space: nowrap;
}

.component-status-cell,
.component-actions-cell {
  white-space: nowrap;
  vertical-align: middle;
}

.component-status-cell .badge {
  justify-self: start;
  font-size: 0.8rem;
  padding: 5px 9px;
}

.component-check-cell {
  min-width: 0;
}

.component-check-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
}

.component-check-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1.2;
}

.component-method-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #dbe5f0;
  background: #f7faff;
  color: #48607c;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.component-check-url {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

.component-check-meta {
  color: #6a7d93;
  font-size: 0.82rem;
  line-height: 1.2;
}

.small-copy {
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-ellipsis-tooltip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.admin-cell-clip {
  display: block;
  width: 100%;
}

.admin-floating-tooltip {
  position: fixed;
  z-index: 999;
  display: none;
  max-width: min(420px, 80vw);
  padding: 10px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
  box-shadow: 0 16px 36px rgba(18, 32, 51, 0.12);
  color: #41546c;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
  pointer-events: none;
  transform: translateY(-4px);
}

.component-history-table .history-col-time {
  width: 220px;
}

.component-history-table .history-col-result {
  width: 88px;
}

.component-history-table .history-col-code {
  width: 76px;
}

.component-history-table .history-col-latency {
  width: 112px;
}

.component-history-table .history-col-response {
  width: 34%;
}

.component-history-table .history-col-error {
  width: auto;
}

.component-history-table td {
  vertical-align: middle;
}

.history-time-cell,
.history-code-cell,
.history-latency-cell,
.history-result-cell {
  white-space: nowrap;
}

.history-result-cell,
.history-code-cell,
.history-latency-cell {
  color: #223045;
  font-weight: 600;
}

.history-result-cell .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
}

.response-preview-cell {
  min-width: 0;
}

.response-preview-trigger {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.response-preview-trigger:hover {
  border-color: #c4d4e7;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fe 100%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.response-preview-trigger:focus-visible {
  outline: 2px solid #7aa2ff;
  outline-offset: 2px;
}

.response-preview-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.45;
  word-break: break-word;
  font-size: 0.88rem;
  color: #5d6f87;
  flex: 1;
}

.response-preview-link {
  flex-shrink: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: #2f5fa7;
  white-space: nowrap;
}

.response-dialog {
  width: min(760px, calc(100vw - 48px));
  max-height: min(80vh, 720px);
  padding: 0;
  border: 1px solid #dbe5f0;
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.response-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.response-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid #e8eef6;
  background: #fbfdff;
}

.response-dialog-close {
  border: 1px solid #d7e2ee;
  background: #ffffff;
  color: #4f6278;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.response-dialog-close:hover {
  border-color: #bfd0e1;
  color: #223045;
  background: #f8fbff;
}

.response-dialog-close:focus-visible {
  outline: 2px solid #7aa2ff;
  outline-offset: 2px;
}

.response-dialog-body {
  margin: 0;
  padding: 20px 22px 24px;
  max-height: calc(80vh - 72px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #223045;
  background: #ffffff;
}

.admin-list {
  display: grid;
  gap: 14px;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid #e2e9f2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
}

.admin-actions,
.update-form {
  display: grid;
  gap: 10px;
}

.admin-actions {
  width: min(420px, 100%);
}

.update-form {
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: center;
}

.incident-update-form {
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 8px;
}

.table-inline-form {
  width: 100%;
}

.incident-update-form select,
.incident-update-form input {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.9rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}

.row-actions form,
.admin-actions form {
  margin: 0;
}

.compact-actions {
  gap: 8px;
}

.component-row-actions {
  flex-wrap: nowrap;
  margin-top: 0;
  gap: 6px;
}

.component-action-link {
  font-size: 0.84rem;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.component-action-danger {
  font-size: 0.84rem;
  padding: 0;
}

.action-chip,
.action-chip-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.action-chip {
  color: #2b5aa6;
  border: 1px solid #d7e2ee;
  background: #ffffff;
}

.action-chip:hover {
  border-color: #c3d3e4;
  background: #f7faff;
}

.action-chip-danger {
  border: 1px solid #f1c7cf;
  background: #fff6f7;
  color: #bf1e38;
  padding: 5px 8px;
}

.action-chip-danger:hover {
  border-color: #e8aeba;
  background: #fff0f2;
}

.maintenance-item-actions {
  align-items: center;
  justify-content: flex-end;
  width: auto;
}

.incident-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.table-actions {
  justify-content: flex-start;
  margin-top: 0;
}

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

.detail-stat {
  display: grid;
  gap: 10px;
  align-content: start;
}

.detail-stat .muted {
  margin: 0;
  font-size: 0.84rem;
}

.detail-stat strong,
.detail-stat .badge {
  align-self: start;
}

.detail-stat .badge {
  justify-self: start;
}

.break-cell {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.custom-data-inline {
  display: grid;
  gap: 2px;
  margin-top: 0;
}

.admin-table-panel {
  overflow: hidden;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 16px;
}

.service-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.service-card.status-operational {
  box-shadow: inset 0 0 0 1px rgba(15, 159, 110, 0.14);
}

.service-card.status-degraded,
.service-card.status-partial_outage,
.service-card.status-major_outage,
.service-card.status-maintenance {
  box-shadow: inset 0 0 0 1px rgba(208, 138, 0, 0.12);
}

.service-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.service-card-head h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.service-card-head p {
  margin: 0;
  color: var(--muted);
}

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

.service-window-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: #f7fafc;
  border: 1px solid var(--border);
}

.service-window-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.service-stat,
.service-data-item {
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 12px;
}

.service-stat span,
.service-data-item span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.service-empty {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .admin-grid,
  .admin-actions-grid {
    grid-template-columns: 1fr;
  }

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

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

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

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

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

  .monitor-sidebar {
    position: static;
  }

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

  .toolbar-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .site-header,
  .component-row,
  .incident-row,
  .detail-head,
  .timeline-head,
  .admin-toolbar,
  .admin-list-item,
  .monitor-hero-head,
  .monitor-row-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .component-meta {
    justify-content: flex-start;
  }

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

  .admin-form-actions {
    justify-content: stretch;
  }

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

  .admin-table {
    table-layout: auto;
  }

  .admin-table th,
  .admin-table td {
    min-width: 120px;
  }

  .monitor-summary-grid,
  .service-grid,
  .service-stat-grid,
  .service-data-grid,
  .service-window-grid {
    grid-template-columns: 1fr;
  }

  .service-window-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitor-summary-metrics {
    justify-content: flex-start;
    white-space: normal;
  }

  .monitor-group-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .timeline-block {
    height: 24px;
  }

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

  .monitor-maintenance-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitor-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-site-headline {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-site-titlebar {
    flex-direction: column;
    align-items: flex-start;
  }
}
