/* ========================================================
   SERVERS MONITOR - CLEAN FLAT DESIGN SYSTEM
   ======================================================== */

:root {
  --bg-app: #0d1117;
  --bg-surface: #151921;
  --bg-surface-hover: #1c212a;
  --bg-subtle: #1e232b;
  --bg-input: #0b0e14;

  --border: rgba(255, 255, 255, 0.07);
  --border-muted: rgba(255, 255, 255, 0.04);
  --border-focus: #58a6ff;

  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-faint: #6e7681;

  --color-brand: #2f81f7;
  --color-green: #3fb950;
  --color-amber: #d29922;
  --color-red: #f85149;
  --color-blue: #58a6ff;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --transition: all 0.15s ease-in-out;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ================== Top Navigation Bar ================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-blue);
}

.brand-icon svg {
  width: 16px;
  height: 16px;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav-stats {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-app);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xs);
}

.stat-item strong {
  color: var(--color-green);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ================== Button Styles ================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.btn-sm {
  padding: 0.32rem 0.65rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: #238636;
  color: #ffffff;
  border: 1px solid rgba(240, 246, 252, 0.1);
}

.btn-primary:hover {
  background: #2ea043;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: #8b949e;
}

.btn-icon {
  padding: 0.35rem 0.5rem;
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* Icon-only flat buttons */
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.icon-btn-danger:hover {
  background: rgba(248, 81, 73, 0.15);
  color: var(--color-red);
  border-color: rgba(248, 81, 73, 0.4);
}

/* ================== Main Container ================== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem 1.5rem;
}

/* View Mode Switcher */
.view-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.view-mode-toggle .btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  padding: 0.25rem 0.4rem;
}

.view-mode-toggle .btn.active {
  background: var(--bg-subtle);
  color: var(--text);
}

/* ================== Controls Toolbar (Search & Filter) ================== */
.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 380px;
  min-width: 240px;
}

.search-box svg {
  position: absolute;
  left: 0.65rem;
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 2.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-input);
}

.search-clear-btn {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.search-clear-btn:hover {
  color: var(--text);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  white-space: nowrap;
}

.filter-pill:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.filter-pill.active {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
}

.pill-count {
  font-size: 0.7rem;
  padding: 1px 5px;
  background: var(--bg-app);
  border-radius: 10px;
  color: var(--text-faint);
}

.filter-pill.active .pill-count {
  color: var(--text);
}

/* ================== Server Grid (Flat Cards) ================== */
.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

/* ================== Server List (Table View) ================== */
.servers-list-view {
  width: 100%;
}

.system-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.system-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.system-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.system-kpi-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.system-kpi-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.system-kpi-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.servers-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.servers-table th {
  background: transparent;
  color: var(--text-faint);
  font-weight: 500;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.servers-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
}

.servers-table tr:last-child td {
  border-bottom: none;
}

.servers-table tr:hover td {
  background: var(--bg-surface-hover);
}

.table-server-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.table-server-name {
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.table-server-host {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-metric-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 90px;
}

.table-metric-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

.table-metric-pct {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
}

.table-metric-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.table-metric-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.table-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  white-space: nowrap;
}

.server-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: var(--transition);
}

.server-card:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Card Header */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

.status-offline {
  background: var(--color-red);
}

.status-checking {
  background: var(--color-amber);
}

.server-name-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.server-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: var(--transition);
}

.server-name:hover {
  color: var(--color-blue);
}

/* Tooltip / Popover for Server Endpoint (user@host:port) */
.server-endpoint-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  background: #1c2128;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  display: none;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* Invisible bridge so mouse does not leave the hover boundary when moving down */
.server-endpoint-popover::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.server-name-wrapper:hover .server-endpoint-popover,
.server-name-wrapper.show-popover .server-endpoint-popover,
.server-endpoint-popover:hover {
  display: inline-flex;
}

.server-endpoint-text {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text);
  user-select: all;
}

.btn-copy-endpoint {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-copy-endpoint:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-copy-endpoint svg {
  width: 12px;
  height: 12px;
}

.card-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

/* Flat Metrics Strip (CPU / RAM / DISK) with Info Tooltip */
.metrics-strip {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.025);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.metrics-strip:hover {
  background: rgba(255, 255, 255, 0.045);
}

.metrics-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #1c2128;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Hover bridge */
.metrics-popover::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.metrics-strip:hover .metrics-popover,
.metrics-strip.show-popover .metrics-popover,
.metrics-popover:hover {
  display: flex;
}

.metrics-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metrics-popover-lbl {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.metrics-popover-val {
  color: var(--text);
  font-weight: 500;
}

.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem;
}

.metric-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.metric-mini-bar {
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--color-blue);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.metric-cell.val-alert .metric-num {
  color: var(--color-red);
}

.metric-cell.val-alert .bar-fill {
  background: var(--color-red);
}

/* Card Meta (OS, Uptime, Load) */
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.meta-separator {
  color: var(--text-faint);
}

/* Apps Drawer (Collapsible) */
.apps-drawer {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.apps-sub-title {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.apps-tag-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.app-row-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow: hidden;
}

.app-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.app-status-dot.online {
  background: var(--color-green);
}

.app-status-dot.stopped {
  background: var(--color-red);
}

.app-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.app-sla-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.app-row-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.app-restart-btn {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.app-restart-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--color-blue);
  border-color: var(--color-blue);
}

.app-restart-btn svg {
  width: 11px;
  height: 11px;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.tag-docker {
  border-color: rgba(88, 166, 255, 0.3);
  color: var(--color-blue);
}

.tag-pm2 {
  border-color: rgba(63, 185, 80, 0.3);
  color: var(--color-green);
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.2rem;
}

.card-footer .btn-terminal {
  flex: 1;
  background: #1f6feb;
  color: #ffffff;
  border: 1px solid rgba(240, 246, 252, 0.1);
  font-weight: 500;
}

.card-footer .btn-terminal:hover {
  background: #388bfd;
}

/* ================== Modals & Overlays ================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(1, 4, 9, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 16px 32px rgba(1, 4, 9, 0.85);
  overflow: hidden;
  transform: translateY(8px);
  transition: transform 0.15s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.modal-body {
  padding: 1.25rem;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* ================== Forms ================== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.form-textarea {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  resize: vertical;
  min-height: 90px;
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* 2FA Digit Input styling */
.otp-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.otp-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.5rem;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--color-blue);
  transition: var(--transition);
}

.otp-digit:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.25);
}

/* QR Code Display Container */
.qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0.75rem 0;
}

.qr-image {
  width: 170px;
  height: 170px;
  background: #ffffff;
  padding: 6px;
  border-radius: var(--radius-xs);
}

.secret-key-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-blue);
}

/* ================== Fullscreen Terminal Modal ================== */
.terminal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(1, 4, 9, 0.95);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.terminal-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.terminal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.term-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.term-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-green);
}

.term-server-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.term-server-target {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.terminal-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.terminal-screen-container {
  flex: 1;
  background: #06090e;
  padding: 0.5rem;
  overflow: hidden;
  position: relative;
}

#terminal-mount {
  width: 100%;
  height: 100%;
}

/* ================== Empty State ================== */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  max-width: 480px;
  margin: 3rem auto;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
}

.empty-icon svg {
  width: 24px;
  height: 24px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

/* ================== Toast Notifications ================== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 8px 24px rgba(1, 4, 9, 0.7);
  pointer-events: auto;
  animation: toast-in 0.15s ease forwards;
  max-width: 360px;
}

.toast.success {
  border-left: 3px solid var(--color-green);
}

.toast.error {
  border-left: 3px solid var(--color-red);
}

.toast.info {
  border-left: 3px solid var(--color-blue);
}

/* ================== Animations ================== */
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Spinner animations: rotate only SVG icon inside, never the button container */
.spin svg,
svg.spin {
  animation: icon-spin 0.8s linear infinite;
  transform-origin: center;
}

@keyframes icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .navbar {
    padding: 0.8rem 1rem;
  }
  .nav-stats {
    display: none;
  }
  .container {
    padding: 1.25rem 1rem 4rem 1rem;
  }
  .servers-grid {
    grid-template-columns: 1fr;
  }
  .otp-digit {
    width: 40px;
    height: 50px;
    font-size: 1.4rem;
  }
}
