/* ═══════════════════════════════════════════════
   Lynx — استایل داشبورد مانیتورینگ
   ═══════════════════════════════════════════════ */

/* فونت اختصاصی: انجمن (Variable — همه وزن‌ها در یک فایل) */
@font-face {
  font-family: "Anjoman";
  src: url("../fonts/AnjomanMaxVF.woff2") format("woff2-variations"),
       url("../fonts/AnjomanMaxVF.woff2") format("woff2"),
       url("../fonts/AnjomanMaxVF.woff") format("woff");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Anjoman", system-ui, Tahoma, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
}

/* ── تم تیره (پیش‌فرض) ── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232322;
  --surface-3: #2c2c2a;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid-line: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #199e70;
  --accent: #3987e5;
  --accent-soft: rgba(57, 135, 229, 0.14);
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-soft: rgba(12, 163, 12, 0.14);
  --warning-soft: rgba(250, 178, 25, 0.14);
  --serious-soft: rgba(236, 131, 90, 0.16);
  --critical-soft: rgba(208, 59, 59, 0.16);
  --meter-track: rgba(57, 135, 229, 0.16);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* ── تم روشن ── */
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f3f3f0;
  --surface-3: #eae9e4;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid-line: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-2: #1baf7a;
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-soft: rgba(12, 163, 12, 0.10);
  --warning-soft: rgba(250, 178, 25, 0.14);
  --serious-soft: rgba(236, 131, 90, 0.14);
  --critical-soft: rgba(208, 59, 59, 0.10);
  --meter-track: rgba(42, 120, 214, 0.14);
  --shadow: 0 6px 22px rgba(11, 11, 11, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ═══════════ چیدمان کلی ═══════════ */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: none;
  width: 100%;
  margin-inline: auto;
}

/* هر نما: فاصله عمودی ردیف‌ها */
.view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ═══════════ برند ═══════════ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-logo svg { width: 22px; height: 22px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.4; }
.brand-text strong { font-size: 16px; font-weight: 800; }
.brand-text span { font-size: 11.5px; color: var(--text-muted); }

/* ═══════════ نوار تب‌های افقی ═══════════ */
.tabbar-wrap {
  position: relative;
}

.tabbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 18px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

/* ── پنل بازشونده هدر (مگامنو) ── */
.megamenu {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.28);
  padding: 14px 18px 16px;
  display: none;
}
.megamenu.open {
  display: block;
  animation: megaDrop 0.18s ease;
}
@keyframes megaDrop {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mega-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.mega-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.mega-item:hover { background: var(--surface-3); border-color: var(--accent); }
.mega-item .mi-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.mega-item .mi-icon svg { width: 16px; height: 16px; }
.mega-item .mi-icon.good { background: var(--good-soft); color: var(--good); }
.mega-item .mi-icon.warning { background: var(--warning-soft); color: var(--warning); }
.mega-item .mi-icon.serious { background: var(--serious-soft); color: var(--serious); }
.mega-item .mi-icon.critical { background: var(--critical-soft); color: var(--critical); }
.mega-item .mi-body { min-width: 0; flex: 1; }
.mega-item .mi-body strong { display: block; font-size: 12.5px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mega-item .mi-body span { font-size: 11px; color: var(--text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mega-item .mi-side { font-size: 11px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; white-space: nowrap; }

.tabbar-sync {
  margin-inline-start: auto;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-inline-start: 14px;
}

.nav-item {
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.nav-badge {
  margin-inline-start: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 1px 8px;
  min-width: 24px;
  text-align: center;
}
.nav-badge.danger { background: var(--critical-soft); color: var(--critical); }

/* ═══════════ هدر بازشونده با هاور ═══════════ */
.header-zone {
  position: sticky;
  top: 0;
  z-index: 60;
}

/* ── نوار باریک همیشه‌نمایان ── */
.header-peek {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 38px;
  padding: 0 26px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  cursor: default;
  user-select: none;
}
.peek-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}
.peek-brand svg { width: 15px; height: 15px; color: var(--accent); }
.peek-hint {
  position: absolute;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}
.peek-hint .chevron { width: 14px; height: 14px; transition: transform 0.25s; }
.header-zone:hover .peek-hint { color: var(--accent); }
.header-zone:hover .peek-hint .chevron { transform: rotate(180deg); }
.peek-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--good);
}

/* ── ساعت سرور (heartbeat) ── */
.peek-clock {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.clock-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  flex-shrink: 0;
}
.peek-clock.offline { color: var(--critical); }
.peek-clock.offline .clock-dot {
  background: var(--critical);
  animation: blink 1s ease-in-out infinite;
}

/* ── بدنه کامل هدر: کشویی ── */
.header-body {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  z-index: 1;
  transform: translateY(calc(-100% - 39px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease 0.35s, opacity 0.28s ease 0.35s;
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.3);
}
.header-zone:hover .header-body,
.header-zone:focus-within .header-body {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 18px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--good);
  background: var(--good-soft);
  padding: 3px 11px;
  border-radius: 20px;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

.topbar-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  width: 260px;
  transition: border-color 0.15s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  width: 100%;
  font-size: 13px;
}
.search-box input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.has-dot::after {
  content: "";
  position: absolute;
  top: 8px; inset-inline-end: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--critical);
  border: 2px solid var(--surface-1);
}

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
}

/* ═══════════ کارت‌ها و شبکه ═══════════ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 12.5px; font-weight: 800; }
.card-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.link-btn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.link-btn:hover { background: var(--accent-soft); }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(280px, 0.7fr);
  gap: 12px;
}
.grid-switch {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(300px, 0.75fr);
  gap: 12px;
}

/* ── شاخص‌های CRM ── */
.crm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 10px;
}
.crm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  min-width: 0;
  border-bottom: 1px solid var(--grid-line);
}
.crm-item:nth-last-child(-n+2) { border-bottom: none; }
.crm-item .ci-icon {
  width: 21px; height: 21px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}
.crm-item .ci-icon svg { width: 11px; height: 11px; }
.crm-item .ci-icon.good { background: var(--good-soft); color: var(--good); }
.crm-item .ci-icon.warning { background: var(--warning-soft); color: var(--warning); }
.crm-item .ci-icon.critical { background: var(--critical-soft); color: var(--critical); }
.crm-item .ci-body {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.crm-item .ci-body strong {
  font-size: 13px;
  font-weight: 800;
  order: 2;
  flex-shrink: 0;
}
.crm-item .ci-body span {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grid-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 12px;
}
@media (max-width: 1500px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-2 .card:last-child { grid-column: 1 / -1; }
  .grid-switch { grid-template-columns: 1fr 1fr; }
  .grid-switch .card:last-child { grid-column: 1 / -1; }
  .grid-status { grid-template-columns: 1fr 1fr; }
  .grid-status .card:last-child { grid-column: 1 / -1; }
}

/* ═══════════ نمودارها ═══════════ */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 260px; }
.chart-sm { height: 185px; }

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.legend .key {
  width: 14px; height: 4px;
  border-radius: 2px;
  display: inline-block;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 10;
  white-space: nowrap;
  direction: rtl;
}
.tooltip.visible { opacity: 1; }
.tooltip .tt-time { color: var(--text-muted); font-size: 11px; margin-bottom: 3px; }
.tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}
.tooltip .tt-row i {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ═══════════ کنترل بازه زمانی ═══════════ */
.seg-control {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.seg:hover { color: var(--text-primary); }
.seg.active {
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

/* ═══════════ جدول سرورها ═══════════ */
.table-scroll { overflow-x: auto; }

.server-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.server-table th {
  text-align: right;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 8px;
  border-bottom: 1px solid var(--grid-line);
  white-space: nowrap;
}
.server-table td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--grid-line);
  vertical-align: middle;
  white-space: nowrap;
}
.server-table tbody tr:last-child td { border-bottom: none; }
.server-table tbody tr { transition: background 0.12s; }
.server-table tbody tr:hover { background: var(--surface-2); }

.srv-name { display: flex; align-items: center; gap: 10px; }
.srv-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* ── سلول فشرده سرویس‌های میزبانی ── */
.svc-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: help;
}
.svc-dots { display: inline-flex; gap: 4px; }
.svc-dot2 {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--good);
}
.svc-dot2.warning { background: var(--warning); animation: blink 1.4s ease-in-out infinite; }
.svc-dot2.down { background: var(--critical); animation: blink 0.9s ease-in-out infinite; }
.svc-issue {
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.svc-issue.warning { background: var(--warning-soft); color: var(--warning); }
:root[data-theme="light"] .svc-issue.warning { color: #8a5c00; }
.svc-issue.down { background: var(--critical-soft); color: var(--critical); }

/* پاپ‌آپ شناور جزئیات سرویس‌ها */
.svc-pop {
  position: fixed;
  z-index: 300;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
  padding: 10px 13px;
  min-width: 180px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.svc-pop.open { opacity: 1; }
.svc-pop .sp-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 800;
  margin-bottom: 7px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--grid-line);
}
.svc-pop .sp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 3px 0;
  color: var(--text-secondary);
}
.svc-pop .sp-row i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  flex-shrink: 0;
}
.svc-pop .sp-row b { margin-inline-start: auto; font-weight: 700; color: var(--text-secondary); }
.svc-pop .sp-row.warning i { background: var(--warning); }
.svc-pop .sp-row.warning b { color: var(--warning); }
:root[data-theme="light"] .svc-pop .sp-row.warning b { color: #8a5c00; }
.svc-pop .sp-row.down i { background: var(--critical); }
.svc-pop .sp-row.down b { color: var(--critical); }
/* نوار ۲۴ خانه‌ای داخل پاپ‌آپ آپ‌تایم */
.svc-pop .sp-strip { display: flex; gap: 2px; margin: 8px 0 5px; }
.svc-pop .sp-strip i {
  display: block;
  width: 6px; height: 15px;
  border-radius: 2px;
  background: var(--good);
  opacity: 0.85;
}
.svc-pop .sp-strip i.warn { background: var(--warning); opacity: 1; }
.svc-pop .sp-strip i.down { background: var(--critical); opacity: 1; }
.svc-pop .sp-cap { font-size: 9.5px; color: var(--text-muted); }

.svc-load {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 12px;
  white-space: nowrap;
}
.svc-load.good { background: var(--good-soft); color: var(--good); }
:root[data-theme="light"] .svc-load.good { color: #006300; }
.svc-load.warning { background: var(--warning-soft); color: var(--warning); }
:root[data-theme="light"] .svc-load.warning { color: #8a5c00; }
.svc-load.critical { background: var(--critical-soft); color: var(--critical); }
.svc-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.svc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1px 8px;
  white-space: nowrap;
}
.svc-chip i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--good);
}
.svc-chip.warning { color: var(--warning); border-color: var(--warning); background: var(--warning-soft); }
:root[data-theme="light"] .svc-chip.warning { color: #8a5c00; }
.svc-chip.warning i { background: var(--warning); }
.svc-chip.down { color: var(--critical); border-color: var(--critical); background: var(--critical-soft); font-weight: 800; }
.svc-chip.down i { background: var(--critical); animation: blink 1s ease-in-out infinite; }

.srv-name strong { font-size: 12px; display: block; line-height: 1.4; }
/* نوار آپ‌تایم ۲۴ ساعته زیر نام سرور */
/* دایره وضعیت با درصد آپ‌تایم ۲۴ ساعته داخل آن */
.srv-pct {
  box-sizing: border-box;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 4px 2px 0 0;
  flex-shrink: 0;
  font-size: 7px;
  font-weight: 800;
  cursor: help;
  direction: ltr;
}
.srv-pct.d2 { padding-inline-end: 3px; }
.srv-pct.d1 { padding-inline-end: 4px; }
.srv-pct.good { background: var(--good-soft); color: var(--good); border: 1.5px solid var(--good); }
:root[data-theme="light"] .srv-pct.good { color: #006300; }
.srv-pct.warning { background: var(--warning-soft); color: var(--warning); border: 1.5px solid var(--warning); }
:root[data-theme="light"] .srv-pct.warning { color: #8a5c00; }
.srv-pct.critical { background: var(--critical-soft); color: var(--critical); border: 1.5px solid var(--critical); }
.srv-name span { font-size: 10px; color: var(--text-muted); direction: ltr; display: block; text-align: right; }

.type-chip {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── مترها ── */
.meter { display: flex; align-items: center; gap: 7px; min-width: 64px; }
.meter-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--meter-track);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s ease;
}
.meter.warning .meter-track { background: var(--warning-soft); }
.meter.warning .meter-fill { background: var(--warning); }
.meter.critical .meter-track { background: var(--critical-soft); }
.meter.critical .meter-fill { background: var(--critical); }
.meter-val {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 34px;
  text-align: left;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* ── نشان وضعیت ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
}
.status svg { width: 12px; height: 12px; }
.status.good { background: var(--good-soft); color: var(--good); }
.status.warning { background: var(--warning-soft); color: var(--warning); }
:root[data-theme="light"] .status.warning { color: #8a5c00; }
:root[data-theme="light"] .status.good { color: #006300; }
.status.serious { background: var(--serious-soft); color: var(--serious); }
:root[data-theme="light"] .status.serious { color: #a34518; }
.status.critical { background: var(--critical-soft); color: var(--critical); }

/* ═══════════ فهرست هشدارها ═══════════ */
.alert-list { list-style: none; display: flex; flex-direction: column; }

.alert-item {
  display: flex;
  gap: 9px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--grid-line);
}
.alert-list li:last-child .alert-item { border-bottom: none; }

.alert-icon {
  width: 27px; height: 27px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.alert-icon svg { width: 13px; height: 13px; }
.alert-icon.critical { background: var(--critical-soft); color: var(--critical); }
.alert-icon.serious { background: var(--serious-soft); color: var(--serious); }
.alert-icon.warning { background: var(--warning-soft); color: var(--warning); }
.alert-icon.good { background: var(--good-soft); color: var(--good); }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 12px; font-weight: 700; line-height: 1.5; }
.alert-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.alert-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.alert-list.full .alert-item { padding: 10px 6px; }

/* ═══════════ نمای سرورها (کارت) ═══════════ */
.view-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.server-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.server-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.server-card-head .srv-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.server-card-head .srv-icon svg { width: 20px; height: 20px; }
.server-card-head .info { flex: 1; min-width: 0; }
.server-card-head .info strong { display: block; font-size: 14.5px; }
.server-card-head .info span { font-size: 11.5px; color: var(--text-muted); direction: ltr; display: block; text-align: right; }

.server-card .rows { display: flex; flex-direction: column; gap: 10px; }
.res-row { display: flex; align-items: center; gap: 10px; }
.res-row .res-label { font-size: 12px; color: var(--text-secondary); width: 58px; flex-shrink: 0; }

.server-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--grid-line);
  padding-top: 12px;
}

/* ═══════════ برد آپ‌تایم ═══════════ */
.uptime-row { margin-bottom: 14px; }
.uptime-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.uptime-row-head strong { font-size: 13.5px; }
.uptime-pct { font-size: 12.5px; font-weight: 700; color: var(--good); }
:root[data-theme="light"] .uptime-pct { color: #006300; }

.uptime-cells {
  display: flex;
  gap: 3px;
  direction: ltr;
}
.uptime-cell {
  flex: 1;
  height: 18px;
  border-radius: 3px;
  background: var(--good);
  opacity: 0.85;
  transition: transform 0.1s;
  cursor: default;
}
.uptime-cell:hover { transform: scaleY(1.15); opacity: 1; }
.uptime-cell.warning { background: var(--warning); }
.uptime-cell.critical { background: var(--critical); }

.uptime-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 5px;
  direction: ltr;
}

/* ═══════════ حالت خالی ═══════════ */
.empty-state {
  text-align: center;
  padding: 70px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-state svg { width: 46px; height: 46px; color: var(--text-muted); }
.empty-state h2 { font-size: 17px; }
.empty-state p { color: var(--text-muted); font-size: 13px; max-width: 380px; }

.hidden { display: none !important; }

/* ═══════════ واکنش‌گرایی ═══════════ */
@media (max-width: 1150px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 .card:last-child { grid-column: auto; }
  .grid-switch { grid-template-columns: 1fr; }
  .grid-switch .card:last-child { grid-column: auto; }
  .grid-status { grid-template-columns: 1fr; }
  .grid-status .card:last-child { grid-column: auto; }
}

@media (max-width: 860px) {
  .search-box { display: none; }
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 12px 14px; }
  .tabbar { padding: 8px 14px; }
  .megamenu { padding: 14px; }
  .header-peek { padding: 0 14px; }
  .tabbar-sync { display: none; }
  .live-chip { display: none; }
  .brand-text span { display: none; }
}

/* ═══════════ حالت هشدار بحرانی باکس‌ها ═══════════
   وقتی وضعیت یک باکس بحرانی شود این کلاس می‌گیرد:
   قاب قرمز + هاله چشمک‌زن + ته‌رنگ قرمز ملایم */
.card.crit-alarm {
  border-color: var(--critical);
  animation: critBlink 1.3s ease-in-out infinite;
}
@keyframes critBlink {
  0%, 100% {
    box-shadow: 0 0 0 1px var(--critical), 0 6px 26px rgba(208, 59, 59, 0.22);
    background: color-mix(in srgb, var(--critical) 5%, var(--surface-1));
  }
  50% {
    box-shadow: 0 0 0 3px var(--critical), 0 6px 40px rgba(208, 59, 59, 0.5);
    background: color-mix(in srgb, var(--critical) 13%, var(--surface-1));
  }
}
@media (prefers-reduced-motion: reduce) {
  .card.crit-alarm {
    animation: none;
    box-shadow: 0 0 0 2px var(--critical);
    background: color-mix(in srgb, var(--critical) 8%, var(--surface-1));
  }
}

/* ═══════════ تنفس روشنایی (محافظ OLED) ═══════════
   یک لایه مشکی سراسری که شفافیتش در سیکل ۴ دقیقه‌ای
   بین ۰٪ تا ۸٪ نوسان می‌کند؛ به چشم نمی‌آید ولی استرس
   یکنواخت روی پیکسل‌های ثابت را کم می‌کند. */
.oled-breath {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  animation: oledBreath 240s ease-in-out infinite;
}
@keyframes oledBreath {
  0%   { opacity: 0; }
  50%  { opacity: 0.08; }
  100% { opacity: 0; }
}
/* اگر کاربر انیمیشن‌ها را محدود کرده باشد */
@media (prefers-reduced-motion: reduce) {
  .oled-breath { animation: none; }
}

/* ── دستگاه‌های لمسی: هدر همیشه باز (نوار ساعت هم می‌ماند) ── */
@media (hover: none) {
  .peek-hint { display: none; }
  .header-body {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    transition: none;
  }
}

/* اسکرول‌بار ظریف */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
