/* ============================================================
   AlphaStatus — تم تیره لوکس (RTL)
   ============================================================ */

:root {
  color-scheme: dark;

  /* سطوح */
  --bg-page:    #070b16;
  --surface:    #0e1424;
  --glass:      rgba(255, 255, 255, 0.035);
  --glass-hi:   rgba(255, 255, 255, 0.065);
  --line:       rgba(255, 255, 255, 0.07);
  --line-soft:  rgba(255, 255, 255, 0.045);

  /* جوهر متن */
  --ink:    #eef2fa;
  --ink-2:  #a9b4c9;
  --muted:  #67718a;

  /* وضعیت‌ها — اعتبارسنجی‌شده برای CVD روی سطح تیره */
  --ok:     #34d399;
  --warn:   #fbbf24;
  --down:   #e14b5f;
  --nodata: #3e4a61;

  /* لهجه‌ها */
  --accent:  #8b9cf9;
  --gold:    #d9c08a;

  --radius:    18px;
  --radius-sm: 10px;
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.8;
  overflow-x: hidden;
}

/* ---------- پس‌زمینه aurora ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(55rem 40rem at 85% -10%, rgba(139, 156, 249, 0.14), transparent 60%),
    radial-gradient(50rem 36rem at -10% 20%, rgba(52, 211, 153, 0.10), transparent 60%),
    radial-gradient(46rem 40rem at 55% 115%, rgba(120, 90, 220, 0.12), transparent 60%),
    var(--bg-page);
}
.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  width: 44rem;
  height: 44rem;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.20;
  will-change: transform;
}
.aurora::before {
  background: radial-gradient(circle, #4a5fd0, transparent 65%);
  top: -16rem;
  right: -10rem;
  animation: drift-a 26s ease-in-out infinite alternate;
}
.aurora::after {
  background: radial-gradient(circle, #14805e, transparent 65%);
  bottom: -18rem;
  left: -12rem;
  animation: drift-b 32s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(-8rem, 7rem) scale(1.15); } }
@keyframes drift-b { to { transform: translate(9rem, -6rem) scale(1.1); } }

@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after { animation: none; }
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- چیدمان ---------- */
.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* ---------- هدر ---------- */
.site-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}
.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(139,156,249,0.22), rgba(52,211,153,0.16));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 24px rgba(0,0,0,0.35);
  font-size: 22px;
}
.site-title { font-size: 21px; font-weight: 800; margin: 0; letter-spacing: -0.2px; }
.site-sub   { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- کارت شیشه‌ای پایه ---------- */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ---------- هرو وضعیت کلی ---------- */
.hero {
  position: relative;
  padding: 30px 32px;
  margin-bottom: 26px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(38rem 14rem at 50% 0%, var(--hero-glow, rgba(52,211,153,0.16)), transparent 70%);
  pointer-events: none;
  transition: background 0.6s ease;
}
.hero[data-status="up"]       { --hero-glow: rgba(52, 211, 153, 0.17); }
.hero[data-status="degraded"] { --hero-glow: rgba(251, 191, 36, 0.15); }
.hero[data-status="down"]     { --hero-glow: rgba(225, 75, 95, 0.18); }
.hero[data-status="unknown"]  { --hero-glow: rgba(103, 113, 138, 0.15); }

.hero-icon {
  position: relative;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: var(--glass-hi);
  border: 1px solid var(--line);
}
.hero-icon::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1.5px solid var(--pulse-color, var(--ok));
  opacity: 0;
  animation: ripple 2.6s ease-out infinite;
}
.hero[data-status="up"]       .hero-icon::after { --pulse-color: var(--ok); }
.hero[data-status="degraded"] .hero-icon::after { --pulse-color: var(--warn); }
.hero[data-status="down"]     .hero-icon::after { --pulse-color: var(--down); }
.hero[data-status="unknown"]  .hero-icon::after { animation: none; }
@keyframes ripple {
  0%   { transform: scale(0.85); opacity: 0.75; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

.hero-text { flex: 1 1 auto; min-width: 220px; position: relative; }
.hero-title { margin: 0 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.hero-meta  { margin: 0; color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn-refresh {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass-hi);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
}
.btn-refresh:hover  { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.16); }
.btn-refresh:active { transform: scale(0.97); }
.btn-refresh[disabled] { opacity: 0.55; cursor: wait; }
.btn-refresh .spin { display: inline-block; transition: transform 0.5s; }
.btn-refresh.loading .spin { animation: rotate 0.9s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

/* ---------- عنوان بخش‌ها ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 34px 4px 14px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.section-title .tick {
  width: 5px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), rgba(139,156,249,0.25));
}

/* ---------- رخدادها ---------- */
.incident {
  padding: 22px 24px;
  margin-bottom: 14px;
  border-right: 3px solid var(--inc-color, var(--warn));
}
.incident[data-severity="minor"]    { --inc-color: var(--warn); }
.incident[data-severity="major"]    { --inc-color: #f59e0b; }
.incident[data-severity="critical"] { --inc-color: var(--down); }
.incident.maint                     { --inc-color: var(--accent); }

.incident-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.incident-title { font-size: 15.5px; font-weight: 700; margin: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2.5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip.c-warn  .dot { background: var(--warn); }
.chip.c-down  .dot { background: var(--down); }
.chip.c-ok    .dot { background: var(--ok); }
.chip.c-acc   .dot { background: var(--accent); }

.incident-affected { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 5px;
  width: 1.5px;
  background: var(--line);
}
.timeline li { position: relative; padding: 4px 24px 10px 0; }
.timeline li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 11px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--tl-color, var(--muted));
  box-shadow: 0 0 0 3.5px var(--bg-page);
}
.timeline li[data-st="investigating"] { --tl-color: var(--warn); }
.timeline li[data-st="identified"]    { --tl-color: #f59e0b; }
.timeline li[data-st="monitoring"]    { --tl-color: var(--accent); }
.timeline li[data-st="resolved"]      { --tl-color: var(--ok); }
.tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tl-status { font-weight: 700; font-size: 13.5px; }
.tl-time   { color: var(--muted); font-size: 12px; }
.tl-msg    { margin: 1px 0 0; color: var(--ink-2); font-size: 13.5px; }

/* ---------- گروه‌ها و سرویس‌ها ---------- */
.group { margin-bottom: 18px; overflow: hidden; }
.group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.group-head:hover { background: rgba(255,255,255,0.03); }
.group-name { font-size: 15.5px; font-weight: 800; flex: 1; display: flex; align-items: center; gap: 10px; }
.group-count { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.group-chevron { color: var(--muted); transition: transform 0.3s; font-size: 12px; }
.group.collapsed .group-chevron { transform: rotate(90deg); }
.group-body { border-top: 1px solid var(--line-soft); }
.group.collapsed .group-body { display: none; }

/* وضعیت‌نقطه با ضربان */
.sdot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--sd, var(--nodata));
}
.sdot[data-s="up"]       { --sd: var(--ok); }
.sdot[data-s="degraded"] { --sd: var(--warn); }
.sdot[data-s="down"]     { --sd: var(--down); }
.sdot[data-s="up"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--ok);
  opacity: 0.35;
  animation: pulse 2.2s ease-out infinite;
}
.sdot[data-s="down"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--down);
  opacity: 0.4;
  animation: pulse 1.2s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(1.7); opacity: 0; }
}

.service {
  padding: 16px 22px 14px;
  border-top: 1px solid var(--line-soft);
  transition: background 0.2s;
  cursor: pointer;
}
.service:first-child { border-top: none; }
.service:hover { background: rgba(255,255,255,0.025); }

.service-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.service-name { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.service-status-label { font-size: 12.5px; font-weight: 600; }
.service-status-label[data-s="up"]       { color: var(--ok); }
.service-status-label[data-s="degraded"] { color: var(--warn); }
.service-status-label[data-s="down"]     { color: var(--down); }
.service-status-label[data-s="unknown"]  { color: var(--muted); }

.service-spacer { flex: 1; }

.service-kpis {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
}
.kpi b { color: var(--ink); font-weight: 700; }
.kpi .u { color: var(--muted); font-size: 11px; }

/* اسپارک‌لاین */
.spark { width: 120px; height: 30px; flex: 0 0 auto; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: url(#sparkFill); stroke: none; opacity: 0.55; }

/* نوار آپتایم ۹۰ روزه */
.upbar-row { margin-top: 12px; }
.upbar {
  direction: ltr; /* قدیمی→جدید از چپ به راست، مثل استاتوس‌پیج‌های مرسوم */
  display: flex;
  gap: 2px;
  height: 30px;
  align-items: stretch;
}
.upbar i {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 3px;
  background: var(--nodata);
  opacity: 0.55; /* بدون داده: محو */
  transition: transform 0.12s ease, opacity 0.12s;
  cursor: pointer;
}
.upbar i[data-q="ok"]   { background: var(--ok);   opacity: 1; }
.upbar i[data-q="warn"] { background: var(--warn); opacity: 1; }
.upbar i[data-q="down"] { background: var(--down); opacity: 1; height: 72%; align-self: end; border-radius: 3px 3px 3px 3px; }
.upbar i:hover { transform: scaleY(1.12); filter: brightness(1.25); }

.upbar-legend {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

/* بج SSL */
.badge-ssl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid;
}
.badge-ssl.warn { color: var(--warn); border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.08); }
.badge-ssl.crit { color: var(--down); border-color: rgba(225,75,95,0.45); background: rgba(225,75,95,0.09); }

/* پنل جزئیات سرویس */
.service-detail { display: none; margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.service.open .service-detail { display: block; animation: fadein 0.3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.detail-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
}
.detail-item .k { color: var(--muted); font-size: 11px; display: block; margin-bottom: 2px; }
.detail-item .v { color: var(--ink); font-weight: 600; word-break: break-all; direction: ltr; text-align: right; }
.detail-item .v.fa { direction: rtl; }

.bigchart-wrap { position: relative; }
.bigchart-title { color: var(--ink-2); font-size: 12.5px; margin: 0 0 6px; font-weight: 600; }
.bigchart { width: 100%; height: 120px; display: block; }
.bigchart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.bigchart .area { stroke: none; opacity: 0.5; }
.bigchart .grid { stroke: rgba(255,255,255,0.06); stroke-width: 1; }
.bigchart .axis-label { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.bigchart .hoverline { stroke: rgba(255,255,255,0.25); stroke-width: 1; stroke-dasharray: 3 3; }
.bigchart .hoverdot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-empty { color: var(--muted); font-size: 12.5px; padding: 18px 0; text-align: center; }

/* ---------- سابقه قطعی‌ها ---------- */
.history { padding: 6px 0; }
.history-empty { padding: 26px 24px; color: var(--muted); text-align: center; font-size: 13.5px; }
.outage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  flex-wrap: wrap;
}
.outage-row:first-child { border-top: none; }
.outage-service { font-weight: 700; min-width: 130px; }
.outage-time { color: var(--ink-2); flex: 1; }
.outage-dur {
  color: var(--down);
  font-weight: 700;
  font-size: 12.5px;
  background: rgba(225,75,95,0.09);
  border: 1px solid rgba(225,75,95,0.35);
  padding: 1.5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.outage-dur.ongoing { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.55; } }

/* ---------- تولتیپ سراسری ---------- */
.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: rgba(13, 18, 32, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
  max-width: 240px;
  line-height: 1.7;
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .t-title { font-weight: 700; margin-bottom: 2px; }
.tooltip .t-sub { color: var(--ink-2); }
.tooltip .t-status { font-weight: 700; }

/* ---------- فوتر ---------- */
.site-foot {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.site-foot .brand { color: var(--gold); font-weight: 600; }

/* ---------- انیمیشن ورود ---------- */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- ریسپانسیو ---------- */
@media (max-width: 640px) {
  .wrap { padding: 24px 14px 40px; }
  .hero { padding: 22px 18px; }
  .hero-title { font-size: 19px; }
  .service-kpis { gap: 10px; font-size: 11.5px; }
  .spark { width: 84px; }
  .kpi.hide-sm { display: none; }
  .outage-service { min-width: 0; }
}

/* ============================================================
   پنل مدیریت (admin.php)
   ============================================================ */

.admin-body { padding-bottom: 4rem; }

/* دکمه‌های عمومی */
.btn {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.1s;
}
.btn:hover  { background: var(--glass-hi); border-color: rgba(255,255,255,0.16); }
.btn:active { transform: scale(0.98); }
.btn.sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6f7fe0);
  border-color: transparent; color: #0b1020; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), #6f7fe0); }
.btn-danger { background: rgba(225,75,95,0.12); border-color: rgba(225,75,95,0.3); color: #ff8496; }
.btn-danger:hover { background: rgba(225,75,95,0.2); }

.icon-btn {
  background: transparent; border: 1px solid var(--line-soft);
  color: var(--ink-2); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 0.9rem; line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--glass-hi); color: var(--ink); }
.icon-btn.danger:hover { background: rgba(225,75,95,0.15); color: #ff8496; border-color: rgba(225,75,95,0.3); }

/* هدر پنل */
.admin-top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7,11,22,0.72); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.admin-top-in {
  max-width: 1100px; margin: 0 auto; padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-brand { font-weight: 700; font-size: 1.05rem; }
.admin-nav { display: flex; gap: 1.2rem; align-items: center; }
.admin-nav a { color: var(--ink-2); text-decoration: none; font-size: 0.9rem; transition: color 0.15s; }
.admin-nav a:hover { color: var(--ink); }
.admin-nav a.danger-link:hover { color: #ff8496; }

.admin-main { max-width: 1100px; margin: 0 auto; padding: 1.6rem 1.5rem; }

/* بنرها و پیام‌ها */
.banner {
  padding: 0.85rem 1.1rem; border-radius: var(--radius-sm);
  margin-bottom: 1.1rem; font-size: 0.9rem; border: 1px solid var(--line);
}
.banner.ok   { background: rgba(52,211,153,0.1);  border-color: rgba(52,211,153,0.3);  color: #7ff0c4; }
.banner.warn { background: rgba(251,191,36,0.1);  border-color: rgba(251,191,36,0.3);  color: #f5d488; }
.banner.err  { background: rgba(225,75,95,0.1);   border-color: rgba(225,75,95,0.3);   color: #ff9aa8; }
.banner code { background: rgba(255,255,255,0.08); padding: 0.1rem 0.4rem; border-radius: 5px; font-size: 0.85em; }
.msg.err { color: #ff9aa8; font-size: 0.85rem; margin: 0.3rem 0; }

/* تب‌ها */
.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.6rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  padding: 0.7rem 1.15rem; color: var(--ink-2); text-decoration: none;
  font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover  { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* چیدمان دو ستونه */
.panel-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.6rem; align-items: start; }
.single-col { max-width: 640px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sec-head h2 { font-size: 1.15rem; margin: 0; }
.empty { color: var(--muted); padding: 1.4rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.card.pad { padding: 1.2rem; }
.grp-label { font-size: 0.82rem; color: var(--gold); margin: 1.3rem 0 0.6rem; letter-spacing: 0.02em; }
.svc-list { display: flex; flex-direction: column; gap: 0.5rem; }

/* ردیف سرویس */
.svc-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.75rem 0.95rem; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); background: var(--glass);
  transition: border-color 0.15s, background 0.15s;
}
.svc-row:hover { border-color: var(--line); background: var(--glass-hi); }
.svc-row.is-off { opacity: 0.5; }
.svc-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.svc-row .dot.c-ok   { background: var(--ok);   box-shadow: 0 0 8px rgba(52,211,153,0.6); }
.svc-row .dot.c-warn { background: var(--warn); box-shadow: 0 0 8px rgba(251,191,36,0.6); }
.svc-row .dot.c-down { background: var(--down); box-shadow: 0 0 8px rgba(225,75,95,0.6); }
.svc-info { flex: 1; min-width: 0; }
.svc-name { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.svc-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem; flex-wrap: wrap; }
.svc-meta code { font-size: 0.78rem; color: var(--ink-2); direction: ltr; overflow: hidden; text-overflow: ellipsis; max-width: 260px; white-space: nowrap; }
.tag { font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 6px; background: rgba(255,255,255,0.06); color: var(--ink-2); }
.tag.off { background: rgba(225,75,95,0.15); color: #ff9aa8; }
.tag.ms  { background: rgba(139,156,249,0.14); color: #b9c4ff; direction: ltr; }
.svc-actions { display: flex; align-items: center; gap: 0.3rem; }
.inline { display: inline-flex; align-items: center; gap: 0.3rem; }
.inline.grow { flex: 1; }
.mini-check { font-size: 0.68rem; color: var(--muted); display: flex; align-items: center; gap: 0.2rem; }

/* فرم‌ها */
.fld { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.fld > span { font-size: 0.82rem; color: var(--ink-2); }
.fld.half { max-width: 300px; }
.fld input, .fld select, .fld textarea, .row-form input {
  font-family: var(--font); font-size: 0.9rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 0.6rem 0.75rem; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fld input:focus, .fld select:focus, .fld textarea:focus, .row-form input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,156,249,0.15);
}
.fld textarea { resize: vertical; }
.fld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.hint { font-size: 0.72rem; color: var(--muted); }
.chk { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--ink-2); margin-bottom: 0.9rem; cursor: pointer; }
.chk input { width: auto; }
.row-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.row-form input { flex: 1; }

/* مدیریت گروه‌ها */
.grp-manage { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.grp-manage li { display: flex; align-items: center; gap: 0.4rem; }
.grp-manage input { font-size: 0.85rem; padding: 0.45rem 0.6rem; }

/* دیالوگ */
.dlg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
/* اصلاح مهم: ویژگی hidden باید همیشه برنده شود (display:flex کلاس‌ها آن را خنثی می‌کرد) */
[hidden] { display: none !important; }
.dlg-back { position: absolute; inset: 0; background: rgba(3,6,14,0.7); backdrop-filter: blur(4px); }
.dlg-card {
  position: relative; z-index: 1; width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; padding: 1.4rem;
  animation: dlgIn 0.22s cubic-bezier(0.2,0.8,0.2,1);
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.dlg-head h3 { margin: 0; font-size: 1.1rem; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; }

/* تایم‌لاین مدیریت رخداد */
.incident-manage { margin-bottom: 1rem; }
.im-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.8rem; }
.im-head h3, .im-head h4 { margin: 0; flex: 1; font-size: 1.02rem; }
.im-timeline { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.im-timeline li {
  display: flex; align-items: center; gap: 0.7rem; font-size: 0.85rem;
  padding-right: 0.9rem; border-right: 2px solid var(--line); position: relative;
}
.im-timeline li::before {
  content: ""; position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
}
.im-timeline li[data-st="resolved"]::before { background: var(--ok); }
.im-timeline li[data-st="monitoring"]::before { background: var(--accent); }
.im-timeline li[data-st="identified"]::before { background: var(--warn); }
.im-timeline li[data-st="investigating"]::before { background: var(--down); }
.tl-status { font-weight: 600; white-space: nowrap; }
.tl-msg { flex: 1; color: var(--ink-2); }
.tl-time { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.update-form { display: flex; gap: 0.5rem; align-items: center; }
.update-form select { width: auto; }
.update-form input { flex: 1; }

/* تعمیرات */
.maint-item { margin-bottom: 0.8rem; }
.maint-time { font-size: 0.82rem; color: var(--accent); margin: 0.3rem 0; }
.muted.sm, .sm { font-size: 0.82rem; }
.muted { color: var(--muted); }

/* ابزارها */
.tool-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tool-card.col { flex-direction: column; align-items: stretch; }
.tool-card h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.tool-info { flex: 1; }
.tool-card select { width: auto; min-width: 180px; }
.code-block {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 0.9rem; font-size: 0.8rem; overflow-x: auto; margin-top: 0.6rem;
  white-space: pre-wrap; word-break: break-all; color: var(--ink-2);
}

/* صفحهٔ ورود */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; padding: 2.2rem; text-align: center; }
.login-brand { margin-bottom: 1.8rem; }
.login-logo { color: var(--accent); font-size: 1.5rem; }
.login-brand h1 { font-size: 1.3rem; margin: 0.5rem 0 0.2rem; }
.login-card .fld { text-align: right; }
.login-card .btn { width: 100%; margin-top: 0.5rem; }
.login-back { display: inline-block; margin-top: 1.2rem; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.login-back:hover { color: var(--ink-2); }
.chip.c-muted .dot { background: var(--muted); }

/* واکنش‌گرا */
@media (max-width: 860px) {
  .panel-grid { grid-template-columns: 1fr; }
  .admin-main { padding: 1.2rem 1rem; }
}
@media (max-width: 560px) {
  .fld-grid { grid-template-columns: 1fr; }
  .svc-meta code { max-width: 150px; }
  .update-form { flex-wrap: wrap; }
  .tool-card { flex-direction: column; align-items: stretch; }
}
