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

/* ===================== HOME ===================== */

.home-body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.home-body header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 48px;
  gap: 0;
}

.home-body header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f1f5f9;
}

.home-body header p {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #475569;
  letter-spacing: 0.03em;
}

.home-body .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 760px;
}

.home-body a.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  text-decoration: none;
  color: #e2e8f0;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.home-body a.card:hover {
  background: #273548;
  border-color: #4f6a8a;
  transform: translateY(-2px);
}

.home-body a.card .label {
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.home-body a.card .url {
  font-size: 0.75rem;
  color: #64748b;
  font-family: monospace;
}

.home-body footer {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.home-body footer span {
  font-size: 0.75rem;
  color: #334155;
}

.monitoring-link {
  font-size: 0.8rem;
  color: #94a3b8;
  text-decoration: none;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.monitoring-link:hover {
  color: #f1f5f9;
  border-color: #4f6a8a;
  background: #1e293b;
}

.github-link {
  color: #475569;
  text-decoration: none;
  transition: color 0.15s;
}

.github-link:hover {
  color: #94a3b8;
}

body {
  font-family: monospace;
  background: #0f0f0f;
  color: #e0e0e0;
  padding: 2rem;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.4rem;
}

h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.badge {
  padding: 0.2rem 0.7rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
}

.badge.ok    { background: #1a3a1a; color: #4caf50; }
.badge.ko    { background: #3a1a1a; color: #f44336; }
.badge.degraded { background: #3a2e00; color: #ffc107; }

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

.card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-name {
  font-weight: bold;
  font-size: 0.95rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.running   { background: #4caf50; }
.dot.exited    { background: #f44336; }
.dot.restarting { background: #ffc107; }

.card-meta {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.6;
}

.summary {
  font-size: 0.85rem;
  color: #888;
}

.ok-count { color: #4caf50; }
.ko-count { color: #f44336; }

section {
  margin-bottom: 2.5rem;
}

.dot.ok { background: #4caf50; }

.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.card-actions button {
  flex: 1;
  padding: 0.3rem 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 4px;
  color: #aaa;
  font-family: monospace;
  font-size: 0.75rem;
  cursor: pointer;
}

.card-actions button:hover:not(:disabled) {
  background: #2a2a2a;
  color: #e0e0e0;
}

.card-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.card-link {
  flex: 1;
  padding: 0.3rem 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 4px;
  color: #aaa;
  font-family: monospace;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.card-link:hover {
  background: #2a2a2a;
  color: #e0e0e0;
}

.logout-btn {
  margin-left: auto;
  padding: 0.2rem 0.7rem;
  background: transparent;
  border: 1px solid #333;
  border-radius: 4px;
  color: #666;
  font-family: monospace;
  font-size: 0.8rem;
  cursor: pointer;
}

.logout-btn:hover {
  color: #e0e0e0;
  border-color: #555;
}

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

.login-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 320px;
}

.login-card h1 {
  text-align: center;
  font-size: 1.2rem;
  color: #e0e0e0;
  margin-bottom: 1.5rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-card label {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.6rem;
}

.login-card input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: #0f0f0f;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 0.9rem;
}

.login-card input:focus {
  outline: none;
  border-color: #555;
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 0.65rem;
  margin-top: 1rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.login-card button[type="submit"]:hover:not(:disabled) {
  background: #333;
}

.login-card button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: default;
}

.login-error {
  color: #f44336;
  font-size: 0.82rem;
  text-align: center;
  margin-bottom: 0.2rem;
}

.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  width: 100%;
  max-width: 860px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #2a2a2a;
  font-size: 0.85rem;
  color: #aaa;
}

.modal-close {
  background: transparent;
  border: none;
  color: #666;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}

.modal-close:hover {
  color: #e0e0e0;
}

.logs-content {
  padding: 1rem;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #c0c0c0;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
}

.back-link {
  display: block;
  font-size: 0.78rem;
  color: #475569;
  text-decoration: none;
  text-align: center;
  margin-top: 0.8rem;
}

.back-link:hover {
  color: #94a3b8;
}

/* ===================== TABS ===================== */

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 0;
}

.tab-btn {
  padding: 0.4rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: #666;
  font-family: monospace;
  font-size: 0.82rem;
  cursor: pointer;
  position: relative;
  bottom: -1px;
}

.tab-btn:hover { color: #aaa; }

.tab-btn.active {
  color: #e0e0e0;
  border-color: #2a2a2a;
  background: #0f0f0f;
}

/* ===================== CONFIGS ===================== */

.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.file-item {
  padding: 0.5rem 0.8rem;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #aaa;
  cursor: pointer;
}

.file-item:hover { background: #222; color: #e0e0e0; }

.file-empty {
  font-size: 0.82rem;
  color: #444;
  padding: 0.5rem 0;
}

.config-modal {
  max-width: 900px;
}

.config-content {
  flex: 1;
  padding: 1rem;
  background: #0f0f0f;
  border: none;
  border-top: 1px solid #2a2a2a;
  color: #c0c0c0;
  font-family: monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  white-space: pre;
  overflow: auto;
  min-height: 360px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-top: 1px solid #2a2a2a;
  gap: 1rem;
}

.modal-footer button {
  padding: 0.3rem 1rem;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 0.8rem;
  cursor: pointer;
}

.modal-footer button:hover { background: #2a2a2a; }

#config-save-status {
  font-size: 0.78rem;
  color: #888;
  white-space: pre-wrap;
}

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

#nginx-reload-btn {
  padding: 0.2rem 0.7rem;
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  border-radius: 4px;
  color: #4caf50;
  font-family: monospace;
  font-size: 0.75rem;
  cursor: pointer;
}

#nginx-reload-btn:hover { background: #223322; }

/* ===================== NGINX CARDS ===================== */

.nginx-meta {
  font-size: 0.78rem;
  color: #555;
  margin-bottom: 1rem;
}

.card-delete {
  background: transparent;
  border: 1px solid #3a1a1a;
  border-radius: 4px;
  color: #f44336;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  line-height: 1;
}

.card-delete:hover {
  background: #3a1a1a;
}

.nginx-apply-btn {
  padding: 0.4rem 1.2rem;
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  border-radius: 4px;
  color: #4caf50;
  font-family: monospace;
  font-size: 0.82rem;
  cursor: pointer;
}

.nginx-apply-btn:hover {
  background: #223322;
}

/* ===================== DEPLOY ===================== */

.deploy-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-family: monospace;
}

.deploy-badge.running { background: #1a3a1a; color: #4caf50; }
.deploy-badge.stopped { background: #3a2a00; color: #ffc107; }
.deploy-badge.absent  { background: #222; color: #555; }

.clone-form {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #2a2a2a;
}

.clone-inputs {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.clone-inputs input {
  flex: 1;
  min-width: 180px;
  padding: 0.4rem 0.7rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 0.82rem;
}

.clone-inputs input:focus { outline: none; border-color: #555; }

.clone-inputs button {
  padding: 0.4rem 1rem;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 0.82rem;
  cursor: pointer;
}

.clone-inputs button:hover { background: #2a2a2a; }

.clone-status {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #888;
  white-space: pre-wrap;
}
