﻿:root {
  --bg: #f8f9ff;
  --canvas: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --nav: #213145;
  --nav-muted: #bec6e0;
  --ink: #0b1c30;
  --muted: #565e74;
  --line: #d9e3de;
  --line-strong: #bccac0;
  --green: #00855d;
  --green-dark: #006948;
  --green-soft: #f5fff7;
  --amber: #a36700;
  --amber-soft: #fff7e8;
  --red: #ba1a1a;
  --red-soft: #fff0f0;
  --blue-soft: #e5eeff;
  --neutral: #6d7a72;
  --shadow: 0 18px 40px rgba(11, 28, 48, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-root {
  min-height: 100vh;
}

.boot-screen,
.loading-state,
.error-state,
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.boot-screen p,
.loading-state p,
.error-state p,
.auth-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.brand-mark,
.brand-shield,
.pulse-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.brand-shield.large,
.pulse-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  font-size: 28px;
}

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

.layout-shell.login-mode {
  grid-template-columns: 1fr;
}

.layout-shell.login-mode .side-nav,
.layout-shell.login-mode .topbar,
.layout-shell.login-mode .mobile-nav {
  display: none;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 18px;
  background: var(--nav);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

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

.brand-block strong {
  display: block;
  color: #85f8c4;
  font-size: 20px;
  line-height: 1.4;
}

.brand-block span,
.nav-footer span {
  display: block;
  color: var(--nav-muted);
  font-size: 12px;
}

.side-nav nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--nav-muted);
  text-decoration: none;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(0, 133, 93, 0.18);
  color: #85f8c4;
}

.nav-icon {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 2px solid currentColor;
}

.nav-footer {
  margin-top: auto;
  border-top: 1px solid rgba(190, 198, 224, 0.22);
  padding-top: 16px;
}

.nav-footer strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 13px;
  direction: ltr;
  text-align: right;
}

.main-shell {
  min-width: 0;
  background: var(--bg);
}

.topbar {
  min-height: 64px;
  padding: 12px 24px;
  background: var(--bg);
  border-bottom: 1px solid #e4e9f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.search-box {
  width: min(340px, 42vw);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid #e5edf5;
}

.search-box span {
  width: 13px;
  height: 13px;
  border: 2px solid #6b7280;
  border-radius: 50%;
  position: relative;
}

.search-box span::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  background: #6b7280;
  transform: rotate(45deg);
  left: -4px;
  bottom: -3px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
}

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

.env-pill,
.status-pill,
.last-update {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.env-pill {
  background: var(--blue-soft);
  color: var(--green-dark);
}

.last-update {
  color: var(--muted);
  background: #fff;
  border: 1px solid #e5edf5;
}

.icon-button,
.logout-button,
.secondary-action,
.text-button,
.error-state button,
.auth-form button {
  min-height: 36px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 13px;
}

.icon-button,
.secondary-action,
.text-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  padding: 0 14px;
}

.logout-button,
.auth-form button,
.error-state button {
  border: 0;
  background: var(--green);
  color: #fff;
  padding: 0 16px;
}

.content-shell {
  width: min(1024px, 100%);
  margin-right: auto;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 217px minmax(0, 1fr) 286px;
  gap: 16px;
  align-items: start;
}

.title-block {
  grid-column: 3;
  text-align: right;
}

.title-block h1,
.section-head h2,
.detail-drawer h2,
.auth-card h1,
.error-state h1,
.loading-state h1 {
  margin: 0;
  color: var(--ink);
}

.title-block h1 {
  font-size: 30px;
  line-height: 1.35;
  font-weight: 800;
}

.title-block p,
.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.quick-actions {
  grid-column: 1;
  display: flex;
  gap: 8px;
  align-self: end;
}

.health-card,
.metric-tile,
.panel-card,
.events-panel,
.detail-drawer,
.auth-card,
.empty-state,
.error-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.health-card {
  grid-column: 3;
  min-height: 150px;
  padding: 18px 24px;
  display: grid;
  gap: 8px;
}

.health-card span,
.metric-tile span,
.section-head span,
.progress-row span,
.security-metrics span,
.service-chip span,
.check-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.health-card strong {
  color: var(--green);
  font-size: 48px;
  line-height: 1;
}

.health-card em,
.metric-tile em,
.check-summary em,
.backup-card p {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.overview-grid {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-tile {
  min-height: 116px;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.metric-tile strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.metric-tile.healthy strong,
.status-pill.healthy {
  color: var(--green);
}

.metric-tile.warning strong,
.status-pill.warning {
  color: var(--amber);
}

.metric-tile.critical strong,
.status-pill.critical {
  color: var(--red);
}

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

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

.status-pill.critical {
  background: var(--red-soft);
}

.status-pill.offline {
  background: #eef2f3;
  color: var(--neutral);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 16px;
}

.panel-card,
.events-panel,
.detail-drawer {
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 18px;
  font-weight: 800;
}

.progress-row {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.progress-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.progress-row strong {
  color: var(--ink);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
}

.progress-track {
  height: 8px;
  background: #edf2f4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.progress-row.warning .progress-track i {
  background: var(--amber);
}

.progress-row.critical .progress-track i {
  background: var(--red);
}

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

.service-chip {
  min-height: 72px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-soft);
  display: grid;
  gap: 4px;
}

.service-chip strong {
  font-size: 16px;
  color: var(--ink);
}

.service-chip.healthy span {
  color: var(--green);
}

.service-chip.critical span {
  color: var(--red);
}

.security-card,
.backup-card {
  min-height: 220px;
}

.security-metrics {
  display: grid;
  gap: 10px;
}

.security-metrics p,
.check-summary {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid #edf2f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.security-metrics strong,
.check-summary strong {
  color: var(--ink);
  font-family: "JetBrains Mono", Consolas, monospace;
}

.check-summary {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--green-soft);
}

.check-summary.warning {
  background: var(--amber-soft);
}

.check-summary.critical {
  background: var(--red-soft);
}

.backup-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
}

.server-strip,
.empty-state {
  padding: 18px;
}

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

.server-summary-card {
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: inherit;
  text-align: right;
  display: grid;
  gap: 8px;
  position: relative;
}

.server-summary-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 133, 93, 0.13);
}

.server-summary-card b {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 16px;
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.server-summary-card.warning .state-dot {
  background: var(--amber);
}

.server-summary-card.critical .state-dot {
  background: var(--red);
}

.server-summary-card.offline .state-dot {
  background: var(--neutral);
}

.server-summary-card strong {
  max-width: calc(100% - 54px);
  color: var(--ink);
}

.server-summary-card small,
.server-summary-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mini-metrics span {
  padding: 8px 6px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.empty-state {
  text-align: center;
  display: grid;
  gap: 14px;
  place-items: center;
}

.empty-illustration {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--green-dark);
  font-size: 32px;
  font-weight: 900;
}

.empty-state h2 {
  margin: 0;
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.empty-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.empty-grid span,
.mini-empty {
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #edf2f4;
  text-align: right;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
}

th {
  color: var(--muted);
  font-weight: 800;
}

.detail-drawer {
  display: grid;
  gap: 16px;
}

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

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

.soft-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.soft-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 30px;
  text-align: right;
}

.auth-card .brand-shield {
  margin-right: 0;
  margin-left: auto;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
}

.auth-note,
.form-message {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

.form-message {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
}

.error-state {
  min-height: 360px;
}

.mobile-nav {
  display: none;
}

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

  .side-nav {
    display: none;
  }

  .content-shell {
    margin: 0 auto;
  }

  .mobile-nav {
    position: sticky;
    bottom: 0;
    z-index: 20;
    min-height: 72px;
    background: var(--blue-soft);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 8px;
  }

  .mobile-nav a {
    color: var(--muted);
    text-decoration: none;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    border-radius: var(--radius);
    padding: 10px 4px;
  }

  .mobile-nav a.active {
    background: var(--green);
    color: #fff;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .content-shell {
    padding: 18px;
    padding-bottom: 96px;
  }

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

  .title-block,
  .quick-actions,
  .health-card,
  .overview-grid {
    grid-column: auto;
  }

  .title-block h1 {
    font-size: 22px;
  }

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

  .health-card strong {
    font-size: 40px;
  }
}

@media (max-width: 520px) {
  .content-shell {
    padding: 14px;
    padding-bottom: 96px;
  }

  .overview-grid,
  .server-card-grid,
  .detail-grid,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .panel-card,
  .events-panel,
  .detail-drawer,
  .server-strip,
  .empty-state {
    padding: 14px;
  }

  .metric-tile {
    min-height: 88px;
  }

  .auth-card {
    padding: 22px;
  }
}
