:root {
  color-scheme: dark;
  --bg: #07101f;
  --surface: rgba(14, 27, 48, 0.88);
  --surface-solid: #0e1b30;
  --surface-soft: #132540;
  --border: rgba(150, 174, 211, 0.16);
  --text: #f3f7ff;
  --muted: #91a4c2;
  --muted-strong: #b8c5da;
  --accent: #33c7a0;
  --accent-soft: rgba(51, 199, 160, 0.14);
  --temperature: #ff9b57;
  --temperature-soft: rgba(255, 155, 87, 0.14);
  --humidity: #59a8ff;
  --humidity-soft: rgba(89, 168, 255, 0.14);
  --signal: #b386ff;
  --signal-soft: rgba(179, 134, 255, 0.14);
  --danger: #ff667d;
  --warning: #ffc857;
  --success: #42d6a4;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf3f8;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-soft: #f5f8fc;
  --border: rgba(39, 60, 91, 0.12);
  --text: #122139;
  --muted: #62728a;
  --muted-strong: #40516b;
  --accent-soft: rgba(26, 159, 124, 0.11);
  --temperature-soft: rgba(225, 112, 42, 0.11);
  --humidity-soft: rgba(49, 132, 220, 0.11);
  --signal-soft: rgba(123, 77, 213, 0.11);
  --shadow: 0 24px 70px rgba(30, 60, 96, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(39, 104, 176, 0.18), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(32, 173, 139, 0.12), transparent 28%),
    var(--bg);
}

button,
select,
a {
  font: inherit;
}

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

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 28px 4px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #06141d;
  background:
    linear-gradient(135deg, #73efd0 0%, #28b891 100%);
  box-shadow: 0 14px 40px rgba(51, 199, 160, 0.23);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 2.8vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
  letter-spacing: -0.015em;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.clock-block {
  text-align: right;
}

.clock-block span,
.clock-block strong {
  display: block;
}

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

.clock-block strong {
  font-size: 1.05rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(51, 199, 160, 0.45);
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 76px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 170px;
}

.status-item small,
.status-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.status-item strong,
.status-meta strong,
.status-meta code {
  display: block;
  margin-top: 3px;
  font-size: 0.82rem;
}

.status-meta {
  min-width: 0;
}

.status-meta code {
  overflow: hidden;
  max-width: 280px;
  color: var(--muted-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(145, 164, 194, 0.12);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(66, 214, 164, 0.13);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(255, 102, 125, 0.13);
}

.divider {
  width: 1px;
  height: 38px;
  background: var(--border);
}

.status-strip .status-meta:first-of-type {
  margin-left: auto;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.metric-card {
  min-height: 218px;
  padding: 22px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.metric-card::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -65px;
  bottom: -90px;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.55;
}

.temperature-card::after {
  background: var(--temperature-soft);
}

.humidity-card::after {
  background: var(--humidity-soft);
}

.signal-card::after {
  background: var(--signal-soft);
}

.uptime-card::after {
  background: var(--accent-soft);
}

.metric-header,
.metric-footer,
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.metric-label {
  margin-bottom: 7px;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.metric-caption {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.metric-chip,
.soft-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-strong);
  background: var(--surface-soft);
  font-size: 0.7rem;
  font-weight: 750;
  white-space: nowrap;
}

.metric-chip.ok {
  color: var(--success);
  background: rgba(66, 214, 164, 0.1);
}

.metric-chip.warning {
  color: var(--warning);
  background: rgba(255, 200, 87, 0.1);
}

.metric-chip.danger {
  color: var(--danger);
  background: rgba(255, 102, 125, 0.1);
}

.metric-value-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 28px;
}

.metric-value-row.compact {
  min-height: 74px;
  align-items: center;
}

.metric-value {
  font-size: clamp(3rem, 5vw, 4.25rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
}

.metric-value.uptime {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: -0.04em;
}

.metric-unit {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.metric-footer {
  align-items: center;
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.72rem;
}

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

.signal-track {
  height: 7px;
  margin-top: 31px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.signal-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  transition: width 400ms ease;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.75fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: var(--radius-lg);
}

.chart-panel,
.insight-panel,
.table-panel {
  padding: 22px;
}

.panel-header {
  align-items: center;
  margin-bottom: 20px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

select,
.button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface-soft);
}

select {
  outline: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 750;
  transition: 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(51, 199, 160, 0.45);
}

.chart-wrapper {
  position: relative;
  height: 350px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-legend-note {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.72rem;
}

.chart-legend-note span:last-child {
  margin-left: auto;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
}

.legend-dot.temp {
  background: var(--temperature);
}

.legend-dot.humidity {
  background: var(--humidity);
}

.overall-condition {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.condition-indicator {
  width: 12px;
  height: 38px;
  border-radius: 999px;
  background: var(--muted);
}

.overall-condition.ok .condition-indicator {
  background: var(--success);
}

.overall-condition.warning .condition-indicator {
  background: var(--warning);
}

.overall-condition.danger .condition-indicator {
  background: var(--danger);
}

.overall-condition small,
.overall-condition strong {
  display: block;
}

.overall-condition small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.insight-list {
  margin: 20px 0 0;
}

.insight-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.insight-list dt {
  color: var(--muted);
  font-size: 0.76rem;
}

.insight-list dd {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 750;
}

.security-note {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid rgba(51, 199, 160, 0.18);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.security-note strong {
  color: var(--accent);
  font-size: 0.78rem;
}

.security-note p {
  margin: 7px 0 0;
  color: var(--muted-strong);
  font-size: 0.72rem;
  line-height: 1.55;
}

.security-note code {
  color: var(--text);
}

.table-panel {
  margin-top: 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.78rem;
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

td {
  color: var(--muted-strong);
}

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

.table-empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 6px 36px;
  color: var(--muted);
  font-size: 0.72rem;
}

footer div {
  display: flex;
  gap: 10px;
}

footer strong {
  color: var(--muted-strong);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100% - 44px));
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .status-strip {
    flex-wrap: wrap;
  }

  .status-strip .status-meta:first-of-type {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
  }

  .topbar {
    min-height: 0;
    align-items: flex-start;
    padding-top: 20px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .subtitle,
  .clock-block {
    display: none;
  }

  .status-strip {
    gap: 14px;
    padding: 15px;
  }

  .divider {
    display: none;
  }

  .status-item {
    min-width: calc(50% - 8px);
  }

  .status-meta {
    width: 100%;
  }

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

  .metric-card {
    min-height: 200px;
  }

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

  .panel-actions {
    width: 100%;
  }

  .panel-actions select,
  .panel-actions .button {
    flex: 1;
  }

  .chart-wrapper {
    height: 300px;
  }

  .chart-legend-note {
    flex-wrap: wrap;
  }

  .chart-legend-note span:last-child {
    width: 100%;
    margin-left: 0;
  }

  footer,
  footer div {
    align-items: flex-start;
    flex-direction: column;
  }
}

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


/* Operational monitoring */
.office-monitor-section {
  margin: 34px 0 18px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 2px 16px;
}

.section-heading h2 {
  max-width: 680px;
  line-height: 1.25;
}

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

.service-card,
.incident-card {
  min-width: 0;
  padding: 22px;
}

.service-card {
  display: flex;
  flex-direction: column;
  min-height: 330px;
}

.incident-card {
  grid-column: 1 / -1;
}

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

.service-card-header > div {
  min-width: 0;
}

.service-card h3 {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.35;
}

.service-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  min-width: 94px;
  min-height: 31px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(148, 163, 184, 0.1);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.service-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.1);
}

.service-status.online {
  color: var(--success);
  border-color: rgba(66, 214, 164, 0.28);
  background: rgba(66, 214, 164, 0.1);
}

.service-status.offline {
  color: var(--danger);
  border-color: rgba(255, 102, 125, 0.3);
  background: rgba(255, 102, 125, 0.1);
}

.service-status.warning {
  color: var(--warning);
  border-color: rgba(255, 200, 87, 0.3);
  background: rgba(255, 200, 87, 0.1);
}

.service-status.checking,
.service-status.waiting {
  color: var(--muted-strong);
}

.service-description,
.service-link {
  min-height: 48px;
  margin: 18px 0;
  line-height: 1.58;
}

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

.service-link {
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  color: var(--accent);
  text-decoration: none;
}

.service-link:hover {
  text-decoration: underline;
}

.service-details {
  display: grid;
  gap: 11px;
  margin: 0;
}

.heartbeat-card .service-details {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.service-details div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(148, 163, 184, 0.055);
}

.service-details dt {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.service-details dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.service-note {
  margin: auto 0 0;
  padding: 13px 14px;
  border: 1px solid rgba(51, 199, 160, 0.16);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  color: var(--muted-strong);
  background: var(--accent-soft);
  font-size: 0.72rem;
  line-height: 1.58;
}

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

.incident-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.05);
}

.incident-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--danger);
  background: rgba(255, 102, 125, 0.12);
  font-weight: 900;
}

.incident-item.recovered .incident-icon {
  color: var(--success);
  background: rgba(66, 214, 164, 0.12);
}

.incident-item strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.4;
}

.incident-item p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.incident-item time {
  color: var(--muted);
  font-size: 0.66rem;
}

.incident-empty {
  padding: 28px 18px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 960px) {
  .office-monitor-grid {
    grid-template-columns: 1fr;
  }

  .incident-card {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .service-card,
  .incident-card {
    padding: 18px;
  }

  .service-card {
    min-height: 0;
  }

  .service-card-header {
    align-items: flex-start;
  }

  .heartbeat-card .service-details,
  .website-card .service-details {
    grid-template-columns: 1fr;
  }

  .service-note {
    margin-top: 15px;
  }
}

@media (max-width: 480px) {
  .service-card-header {
    flex-direction: column;
  }

  .service-status {
    align-self: flex-start;
  }
}
