:root {
  --bg: #eef3f9;
  --bg-accent: radial-gradient(circle at 10% 0%, #dbe8ff 0%, transparent 42%),
    radial-gradient(circle at 90% 10%, #d9f5ea 0%, transparent 36%),
    #eef3f9;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --surface-3: #edf2f7;
  --text: #152033;
  --muted: #66758d;
  --line: #dce5f0;
  --primary: #1f5fe0;
  --primary-2: #4b84f5;
  --primary-soft: #e8f0ff;
  --success: #0f9f72;
  --success-soft: #dff8ee;
  --danger: #d64545;
  --danger-soft: #ffe7e7;
  --warning: #d88912;
  --warning-soft: #fff2d7;
  --unknown: #7b879c;
  --shadow: 0 14px 40px rgba(24, 48, 86, 0.08);
  --shadow-sm: 0 6px 18px rgba(24, 48, 86, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-width: 268px;
  --topbar-height: 74px;
  --pulse: #0f9f72;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-accent: radial-gradient(circle at 12% 0%, #1a2c4d 0%, transparent 40%),
    radial-gradient(circle at 88% 8%, #16352d 0%, transparent 34%),
    #0b1220;
  --surface: #121a2b;
  --surface-2: #182235;
  --surface-3: #1d2940;
  --text: #edf3ff;
  --muted: #9aa8bd;
  --line: #273449;
  --primary: #78a6ff;
  --primary-2: #4d7fe0;
  --primary-soft: #1b2d4f;
  --success: #36c997;
  --success-soft: #16352d;
  --danger: #ff7a7a;
  --danger-soft: #3a1d24;
  --warning: #ffc14d;
  --warning-soft: #3a2d16;
  --unknown: #8ea0b8;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.2);
  --pulse: #36c997;
}

* { box-sizing: border-box; }

html {
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-accent);
}

a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, var(--primary-soft)), var(--surface));
  border-left: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  padding: 4px 8px 24px;
  font-weight: 800;
  font-size: 1.15rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 20px rgba(31, 95, 224, 0.28);
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 2px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  transition: 0.15s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-ico {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: inherit;
  font-size: 0.85rem;
}

.sidebar-foot {
  margin-top: 28px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.main { min-width: 0; }

.topbar {
  height: var(--topbar-height);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.topbar-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.topbar-actions,
.actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Inside tables, .actions must stay a real cell or rows fall out of line. */
td.actions {
  display: table-cell;
  white-space: nowrap;
}

td.actions .btn,
td.actions form {
  display: inline-flex;
  vertical-align: middle;
}

td.actions .btn + .btn,
td.actions .btn + form,
td.actions form + .btn {
  margin-inline-start: 6px;
}

.user-chip {
  color: var(--muted);
  font-size: 0.84rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}

.content {
  padding: 28px;
  max-width: 1540px;
  margin: 0 auto;
}

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

.page-head h1,
.panel h1 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.page-head p,
.muted { margin: 0; color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.stat::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.stat strong {
  display: block;
  font-size: 1.9rem;
  margin-top: 12px;
  letter-spacing: -0.03em;
}

.stat em {
  display: block;
  margin-top: 8px;
  font-style: normal;
  color: var(--muted);
  font-size: 0.75rem;
}

.stat.success::after { background: var(--success); }
.stat.danger::after { background: var(--danger); }
.stat.warning::after { background: var(--warning); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

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

.panel h2 {
  font-size: 1.05rem;
  margin: 0;
}

.layout-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}

.table-wrap { overflow: auto; }

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

th, td {
  text-align: right;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
  position: sticky;
  top: 0;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-success,
.badge-online {
  background: var(--success-soft);
  color: var(--success);
}

.badge-offline,
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warning,
.badge-stale {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-muted,
.badge-unknown {
  color: var(--unknown);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
}

.live-dot.pulse {
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pulse) 55%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: 0.15s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm.btn-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: wait; }

form.inline { display: inline; margin: 0; }

.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
}

.filters,
.map-search,
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filters .form-control:first-child,
.map-search .form-control { flex: 1; }

.form-control {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

textarea.form-control {
  height: auto;
  min-height: 96px;
  padding: 11px 13px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    left 18px center,
    left 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

select.form-control[multiple] {
  height: auto;
  min-height: 120px;
  padding: 8px;
  background-image: none;
}

input[type="date"].form-control { direction: ltr; text-align: right; }
input[type="file"].form-control { padding-top: 9px; }

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
  align-items: start;
}

.form-grid label,
.stack label,
.form-panel > label,
.mode-section > label {
  display: grid;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 700;
  align-content: start;
}

/* Checkbox labels sit horizontally so the box aligns with its text. */
.form-grid label:has(> .checkbox),
.check-label {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
}

.form-grid .helptext,
.helptext {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.7;
}

.form-grid ul.errorlist,
.errorlist {
  color: var(--danger);
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 500;
}

.checkbox { width: 18px; height: 18px; }
.hidden { display: none !important; }

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

.details {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 0 16px;
  margin: 0;
}

.details .details-row { display: contents; }

.details dt,
.details dd {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.details dd { flex-wrap: wrap; gap: 6px; }
.details dt { color: var(--muted); font-size: 0.84rem; }

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.alert {
  padding: 12px 15px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error,
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

.map {
  height: 380px;
  border-radius: 16px;
  border: 1px solid var(--line);
  margin: 15px 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.map-readout {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 18px;
}

.map-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.map-hint {
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.stepper {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 0 0 24px;
  overflow: auto;
}

.stepper b {
  padding: 12px 18px;
  color: var(--muted);
  border-bottom: 3px solid var(--line);
  font-size: 0.82rem;
  white-space: nowrap;
}

.stepper .active { color: var(--primary); border-color: var(--primary); }
.stepper .done { color: var(--success); border-color: var(--success); }

.success-panel { text-align: center; max-width: 720px; margin: auto; }
.success-mark {
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.8rem;
}

.summary { text-align: right; max-width: 520px; margin: 20px auto; }
.ltr { direction: ltr; text-align: right; unicode-bidi: plaintext; }
.inline { display: inline; }
.link-danger { border: 0; background: none; color: var(--danger); cursor: pointer; }

.search-results {
  border: 1px solid var(--line);
  border-radius: 11px;
  display: none;
  overflow: hidden;
  margin-top: 8px;
  background: var(--surface);
}

.search-results.open { display: block; }

.search-result {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: right;
  cursor: pointer;
}

.search-result:hover { background: var(--primary-soft); }

.attempt {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 4px 0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-accent);
}

.login-card {
  width: min(430px, 100%);
  background: var(--surface);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-brand { padding: 0 0 22px; }
.login-card h1 { margin: 0 0 8px; }
.stack { display: grid; gap: 18px; margin-top: 26px; }
.mobile-only { display: none; }

.health-monitor {
  display: grid;
  gap: 18px;
}

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

.monitor-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.monitor-card .label { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.monitor-card .value { font-size: 1.8rem; font-weight: 800; margin-top: 10px; }
.monitor-card .meta { color: var(--muted); font-size: 0.78rem; margin-top: 8px; }

.health-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 800;
}

.live-pill.paused {
  background: var(--warning-soft);
  color: var(--warning);
}

.health-row.offline { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.health-row.stale { background: color-mix(in srgb, var(--warning-soft) 45%, transparent); }
.health-row.online { background: color-mix(in srgb, var(--success-soft) 35%, transparent); }

.latency-bar {
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}

.latency-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
}

.status-stack {
  display: grid;
  gap: 4px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline-item::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--primary);
}

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

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .health-kpis { grid-template-columns: repeat(2, 1fr); }
  .layout-2 { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    right: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    transition: right 0.2s ease;
  }
  .sidebar.open { right: 0; box-shadow: var(--shadow); }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .user-chip { display: none; }
  .content { padding: 18px 12px; }
  .page-head { flex-direction: column; }
  .stats-grid,
  .health-kpis { grid-template-columns: repeat(2, 1fr); }
  .form-grid,
  .detail-grid,
  .review-grid { grid-template-columns: 1fr; }
  .filters { flex-wrap: wrap; }
  .stepper { justify-content: flex-start; }
  .panel { padding: 16px; }
}

@media print {
  .sidebar,
  .topbar,
  .page-head .btn,
  .health-toolbar { display: none !important; }
  .app-shell { display: block; }
  .content { padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}

/* Operations dashboard */
.sidebar {
  background:
    radial-gradient(circle at 20% 0%, rgba(64, 122, 255, 0.22), transparent 32%),
    linear-gradient(180deg, #111b2f 0%, #0d1628 100%);
  border-left: 0;
  color: #fff;
}

.brand { color: #fff; padding: 4px 8px 26px; }
.brand-mark {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #3878f4, #22b8a7);
  box-shadow: 0 10px 26px rgba(35, 112, 230, 0.3);
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}
.brand-mark span { position: relative; z-index: 1; }
.brand small { color: #8fa1bd; }

.sidebar nav { gap: 4px; }
.nav-section {
  display: block;
  color: #657995;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 20px 14px 7px;
}
.sidebar nav a {
  color: #aebbd0;
  padding: 10px 12px;
  border: 1px solid transparent;
}
.sidebar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
}
.sidebar nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(54, 116, 240, 0.24), rgba(54, 116, 240, 0.08));
  border-color: rgba(102, 151, 248, 0.18);
  box-shadow: inset -3px 0 #4a86fa;
}
.sidebar .nav-ico {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.07);
  color: #aebbd0;
}
.sidebar nav a.active .nav-ico {
  background: #3473ed;
  color: #fff;
  box-shadow: 0 6px 15px rgba(31, 95, 224, 0.28);
}
.nav-live {
  width: 7px;
  height: 7px;
  margin-right: auto;
  border-radius: 50%;
  background: #38d49f;
  box-shadow: 0 0 0 4px rgba(56, 212, 159, 0.12);
}
.sidebar nav .nav-create {
  color: #dce8ff;
  background: rgba(62, 126, 249, 0.1);
  border-color: rgba(91, 146, 255, 0.12);
}
.sidebar-foot {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
  color: #8fa1bd;
}
.sidebar-foot small { display: block; margin-top: 8px; line-height: 1.7; }
.sidebar-status { display: flex; align-items: center; gap: 8px; color: #c9d6e9; font-weight: 700; }
.sidebar-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38d49f;
  box-shadow: 0 0 0 5px rgba(56, 212, 159, 0.1);
}

.topbar { box-shadow: 0 1px 0 rgba(24, 48, 86, 0.02); }
.theme-button { font-size: 1.05rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px;
  color: var(--text);
}
.user-chip > i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-style: normal;
}
.user-chip > span { display: grid; line-height: 1.35; }
.user-chip small { color: var(--muted); font-size: 0.65rem; }
.logout-button { color: var(--muted); }

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  overflow: hidden;
  position: relative;
  min-height: 190px;
  margin-bottom: 18px;
  padding: 30px 34px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 20%, rgba(55, 211, 178, 0.2), transparent 31%),
    radial-gradient(circle at 82% -15%, rgba(110, 155, 255, 0.35), transparent 35%),
    linear-gradient(120deg, #142440 0%, #183867 62%, #20529a 100%);
  box-shadow: 0 18px 38px rgba(20, 54, 106, 0.18);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto auto -110px -50px;
  width: 270px;
  height: 270px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.025), 0 0 0 80px rgba(255, 255, 255, 0.018);
}
.hero-copy, .hero-actions { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #bcd0ef;
  font-size: 0.8rem;
  font-weight: 700;
}
.eyebrow .live-dot { color: #3ed1a3; background: #3ed1a3; }
.dashboard-hero h1 { margin: 12px 0 7px; font-size: clamp(1.45rem, 2.3vw, 2.1rem); }
.dashboard-hero p { margin: 0; color: #c7d5ea; }
.hero-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 22px; color: #aebfda; font-size: 0.76rem; }
.hero-meta strong { color: #fff; margin-right: 4px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn-hero, .btn-hero-secondary {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 11px 15px;
}
.btn-hero { background: #fff; color: #183766; border-color: #fff; }
.btn-hero-secondary { background: rgba(255, 255, 255, 0.08); backdrop-filter: blur(8px); }
.btn-icon { font-size: 1rem; }

.operator-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.operator-kpi {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.operator-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 1.2rem;
  font-weight: 800;
}
.kpi-icon-primary { color: var(--primary); background: var(--primary-soft); }
.kpi-icon-success { color: var(--success); background: var(--success-soft); }
.kpi-icon-warning { color: var(--warning); background: var(--warning-soft); }
.kpi-icon-violet { color: #7a5ce0; background: #eee9ff; }
html[data-theme="dark"] .kpi-icon-violet { background: #2c244d; color: #aa91ff; }
.kpi-copy { display: grid; min-width: 0; }
.kpi-copy small { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.kpi-copy strong { margin: 2px 0; font-size: 1.55rem; line-height: 1.2; }
.kpi-copy strong b { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.kpi-copy em { overflow: hidden; color: var(--muted); font-size: 0.69rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.kpi-arrow { color: var(--muted); opacity: 0.7; }

.dashboard-main-grid, .dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
}
.operational-panel, .attention-panel, .recent-panel, .alerts-panel { margin-bottom: 18px; }
.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
}
.danger-text { color: var(--danger); }
.text-link { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.text-link:hover { color: var(--primary); }

.capacity-overview {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 28px;
  padding: 8px 4px 22px;
}
.capacity-ring {
  display: grid;
  place-items: center;
  width: 138px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--progress) * 1%), var(--surface-3) 0);
  position: relative;
}
.capacity-ring::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--surface);
}
.capacity-ring > div { position: relative; z-index: 1; display: grid; text-align: center; }
.capacity-ring strong { font-size: 1.45rem; }
.capacity-ring span { color: var(--muted); font-size: 0.7rem; }
.capacity-data { display: grid; gap: 13px; }
.capacity-data > div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.capacity-data small { color: var(--muted); }
.capacity-data strong { font-size: 0.82rem; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.used { background: var(--primary); }
.legend-dot.free { background: var(--success); }
.legend-dot.total { background: var(--unknown); }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 17px; }
.mini-metrics > div { display: grid; gap: 3px; padding: 0 15px; border-left: 1px solid var(--line); }
.mini-metrics > div:last-child { border-left: 0; }
.mini-metrics strong { font-size: 1.05rem; }
.mini-metrics span { color: var(--muted); font-size: 0.7rem; }

.attention-count {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 0.8rem;
  font-weight: 800;
}
.attention-list { display: grid; }
.attention-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.attention-item:last-child { border-bottom: 0; }
.attention-item > span:nth-child(2) { display: grid; gap: 3px; }
.attention-item small { color: var(--muted); font-size: 0.7rem; }
.attention-item > b { color: var(--muted); font-weight: 500; }
.attention-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 11px;
  font-style: normal;
  font-weight: 800;
}
.attention-icon.danger { color: var(--danger); background: var(--danger-soft); }
.attention-icon.warning { color: var(--warning); background: var(--warning-soft); }
.attention-icon.primary { color: var(--primary); background: var(--primary-soft); }
.attention-icon.violet { color: #7a5ce0; background: #eee9ff; }
html[data-theme="dark"] .attention-icon.violet { background: #2c244d; color: #aa91ff; }

.quick-actions { margin: 4px 0 18px; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 11px; }
.section-title h2 { margin: 0; font-size: 1rem; }
.quick-action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-action-grid a {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 11px;
  padding: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}
.quick-action-grid a:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow-sm); }
.quick-action-grid a > span { grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-size: 1.05rem; }
.quick-action-grid strong { font-size: 0.8rem; align-self: end; }
.quick-action-grid small { color: var(--muted); font-size: 0.65rem; align-self: start; margin-top: 2px; }

.dashboard-bottom-grid { grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr); }
.modern-table th { background: transparent; border-top: 1px solid var(--line); font-size: 0.72rem; }
.modern-table td { padding-top: 12px; padding-bottom: 12px; }
.row-link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-2);
}
.status-alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.status-alert > span:nth-child(2) { display: grid; gap: 3px; }
.status-alert small { color: var(--muted); font-size: 0.7rem; }
.status-indicator { width: 8px; height: 34px; border-radius: 999px; background: var(--unknown); }
.status-indicator.offline { background: var(--danger); }
.status-indicator.stale, .status-indicator.warning { background: var(--warning); }
.subsection-head { margin-top: 18px; padding-bottom: 5px; color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.all-clear { display: grid; justify-items: center; gap: 5px; padding: 25px 10px; text-align: center; }
.all-clear > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--success); background: var(--success-soft); font-size: 1.2rem; }
.all-clear small { color: var(--muted); }
.compact-empty { padding: 24px; }

/* Wizard: server selection step */
.wizard-panel { max-width: 860px; margin-inline: auto; }
.wizard-panel h1 { font-size: 1.25rem; margin: 0 0 6px; }
.wizard-panel > .muted { margin-bottom: 22px; }

.mode-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.mode-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mode-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }

.mode-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.mode-card input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.mode-card-body { display: grid; gap: 4px; }
.mode-card-body strong { font-size: 0.88rem; }
.mode-card-body small { color: var(--muted); font-size: 0.72rem; line-height: 1.7; }

.mode-section {
  margin: 0 0 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.mode-section legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mode-section .form-grid { margin-bottom: 0; }

@media (max-width: 1280px) {
  .operator-kpis { grid-template-columns: repeat(2, 1fr); }
  .dashboard-main-grid, .dashboard-bottom-grid { grid-template-columns: 1fr; }
  .quick-action-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .mode-cards { grid-template-columns: 1fr; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; padding: 24px 20px; }
  .hero-actions { justify-content: flex-start; }
  .operator-kpis { grid-template-columns: 1fr; }
  .capacity-overview { grid-template-columns: 1fr; justify-items: center; }
  .capacity-data { width: 100%; }
  .mini-metrics { grid-template-columns: 1fr; gap: 10px; }
  .mini-metrics > div { border-left: 0; border-bottom: 1px solid var(--line); padding: 0 0 10px; }
  .quick-action-grid { grid-template-columns: 1fr; }
  .dashboard-main-grid, .dashboard-bottom-grid { display: block; }
}
