:root {
  --bg: #07111f;
  --bg-soft: #0b1728;
  --panel: rgba(10, 18, 31, 0.9);
  --panel-2: rgba(16, 28, 46, 0.88);
  --border: rgba(120, 156, 212, 0.16);
  --border-strong: rgba(125, 211, 252, 0.32);
  --text: #e6edf7;
  --muted: #8ba3c7;
  --primary: #60a5fa;
  --primary-2: #38bdf8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, Arial, sans-serif; background:
  radial-gradient(circle at top left, rgba(56,189,248,0.15), transparent 22%),
  radial-gradient(circle at top right, rgba(96,165,250,0.12), transparent 28%),
  linear-gradient(180deg, #040913 0%, #08111e 100%); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1460px, calc(100% - 28px));
  margin: 22px auto 40px;
}

.topbar,
.panel-block,
.stat-card,
.vps-node,
.contract-card,
.process-card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-radius: 24px;
  margin-bottom: 18px;
}

.brand-wrap { display: flex; align-items: center; gap: 14px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 24px rgba(56,189,248,0.55);
}
.eyebrow, .section-kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.topbar h1, .section-head h2, .modal-card h3 { margin: 0; }
.topbar-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.search-box {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 0 14px; min-width: min(420px, 100%);
}
.search-box input {
  width: 100%; border: 0; outline: none; background: transparent; color: var(--text);
  padding: 14px 0;
}

.btn {
  border: 0; border-radius: 14px; padding: 12px 16px; color: white; transition: 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.btn-soft { background: rgba(255,255,255,0.06); border: 1px solid var(--border); }
.btn-icon { width: 42px; height: 42px; padding: 0; background: rgba(255,255,255,0.06); }

.stats-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px;
}
.stat-card { padding: 18px; border-radius: 20px; }
.stat-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat-card strong { font-size: 28px; }

.board-grid {
  display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start;
}
.panel-block { border-radius: 24px; padding: 18px; }
.panel-wide { min-width: 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px;
}
.section-head.compact { margin-bottom: 20px; }
.card-list { display: grid; gap: 12px; }

.contract-card,
.process-card {
  border-radius: 20px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.contract-card.paid,
.process-card.paid {
  border-color: rgba(34,197,94,0.35);
  box-shadow: 0 18px 36px rgba(34,197,94,0.08);
}
.card-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card-title { margin: 0; font-size: 18px; }
.card-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; word-break: break-all; }

.meta-row {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0;
}
.badge, .pm2-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
}
.badge.pending, .badge.unpaid { background: rgba(239,68,68,0.14); color: #fecaca; }
.badge.paid { background: rgba(34,197,94,0.14); color: #bbf7d0; }
.pm2-chip.online { background: rgba(34,197,94,0.14); color: #bbf7d0; }
.pm2-chip.stopped, .pm2-chip.errored, .pm2-chip.offline { background: rgba(239,68,68,0.14); color: #fecaca; }
.pm2-chip.launching, .pm2-chip.waiting, .pm2-chip.one-launch-status { background: rgba(245,158,11,0.14); color: #fde68a; }
.pm2-chip.unknown { background: rgba(148,163,184,0.14); color: #cbd5e1; }

.countdown {
  font-size: 15px; font-weight: 700; padding: 12px 14px; border-radius: 16px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
}
.actions-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.action-btn {
  flex: 1 1 74px; border: 1px solid transparent; border-radius: 14px; padding: 10px 12px; font-weight: 700;
  color: white;
}
.action-btn.pay { background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.22); }
.action-btn.plus { background: rgba(96,165,250,0.16); border-color: rgba(96,165,250,0.22); }
.action-btn.minus { background: rgba(148,163,184,0.15); border-color: rgba(148,163,184,0.22); }
.action-btn.minus-30 { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.22); }
.action-btn.start, .action-btn.restart { background: rgba(59,130,246,0.16); border-color: rgba(59,130,246,0.22); }
.action-btn.stop, .action-btn.delete { background: rgba(239,68,68,0.16); border-color: rgba(239,68,68,0.22); }

.vps-grid { display: grid; gap: 14px; }
.vps-node {
  border-radius: 22px; padding: 16px; background: rgba(8, 17, 31, 0.95);
}
.vps-node-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.vps-node h3 { margin: 0; font-size: 20px; }
.vps-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
@media (max-width: 600px) {
  .process-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.process-card {
  padding: 10px;
  border-radius: 12px;
  font-size: 12px;
}

.process-card .card-title {
  font-size: 13px;
}

.process-card .actions-grid {
  grid-template-columns: repeat(2, 1fr);
}

.empty-state { padding: 18px; border-radius: 18px; color: var(--muted); text-align: center; background: rgba(255,255,255,0.03); border: 1px dashed var(--border); }

.modal {
  position: fixed; inset: 0; display: none; place-items: center; padding: 20px;
  background: rgba(3, 7, 18, 0.72); backdrop-filter: blur(12px); z-index: 50;
}
.modal.show { display: grid; }
.modal-card { width: min(560px, 100%); border-radius: 24px; padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: grid; gap: 8px; }
.form-grid label span { color: var(--muted); font-size: 14px; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input {
  width: 100%; background: rgba(255,255,255,0.04); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast-stack {
  position: fixed; top: 18px; right: 18px; display: grid; gap: 10px; z-index: 70;
}
.toast {
  min-width: 250px; max-width: 340px; padding: 14px 16px; border-radius: 16px; color: white;
  background: rgba(10,18,31,0.95); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: slideIn .22s ease;
}
.toast.success { border-color: rgba(34,197,94,0.35); }
.toast.error { border-color: rgba(239,68,68,0.35); }
.toast.info { border-color: rgba(96,165,250,0.35); }

.hidden-by-search { display: none !important; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px) translateX(10px); }
  to { opacity: 1; transform: translateY(0) translateX(0); }
}

@media (max-width: 1100px) {
  .board-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-box { min-width: 0; }
}
@media (max-width: 560px) {
  .app-shell { width: min(100% - 16px, 100%); }
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .process-grid { grid-template-columns: 1fr; }
  .section-head, .vps-node-head { flex-direction: column; align-items: stretch; }
  .modal-actions, .topbar-actions { flex-direction: column; }
  .btn, .action-btn { width: 100%; }
}


.sub-section {
  margin-top: 20px;
}

.sub-title {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 10px;
  font-weight: 600;
}
