:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #22d3ee;
  --ok: #34d399;
  --fail: #f87171;
  --warn: #fbbf24;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}


/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: transparent; /* nền trong suốt */
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.5); /* màu tối trong suốt */
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.8); /* hover đậm hơn */
}


.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }

.header {
  background: linear-gradient(135deg, #0e7490 0%, #1e3a5f 100%);
  padding: 1.5rem 0;
  margin-bottom: 1.5rem;
}
.header h1 { margin: 0; font-size: 1.5rem; }
.subtitle { margin: 0.25rem 0 0; opacity: 0.9; font-size: 0.95rem; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.tab.active { border-color: var(--accent); background: #164e63; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.panel label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; }
.restart-quota-box {
  margin: 0.75rem 0 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.2), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 12px;
}

.quota-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.quota-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.quota-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.quota-badge {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  line-height: 1;
}

.quota-badge.low { color: var(--warn); }
.quota-badge.empty { color: var(--fail); }

.quota-slots {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.quota-slot {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  transition: background 0.3s, border-color 0.3s;
}

.quota-slot.used {
  background: linear-gradient(90deg, #0891b2, #22d3ee);
  border-color: #22d3ee;
}

.quota-slot.free {
  background: rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.5);
}

.quota-ready {
  font-size: 0.9rem;
  color: var(--ok);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.quota-countdown-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.quota-countdown-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.quota-countdown-time {
  font-family: ui-monospace, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--warn);
  letter-spacing: 0.05em;
}

.quota-status-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.hint code { background: #0f1419; padding: 0.1rem 0.35rem; border-radius: 4px; }

textarea, input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f1419;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
}
textarea { resize: vertical; min-height: 180px; }

.row { margin-top: 0.75rem; }
.inline { font-weight: normal; font-size: 0.9rem; }

.actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; align-items: center; }
.restart-run-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.875rem;
  color: var(--warn);
  line-height: 1.45;
}
.btn {
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}
.btn.primary { background: #0891b2; border-color: #22d3ee; color: #fff; }
.btn:hover:not(:disabled):not(.is-quota-blocked) { filter: brightness(1.08); }
.btn.primary:disabled,
.btn.primary.is-quota-blocked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #334155;
  border-color: #475569;
  color: #94a3b8;
  filter: none;
  box-shadow: none;
}

.stats {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.stats span strong { color: var(--accent); }

.results { margin-top: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
table td:nth-child(5),
table td:nth-child(6) { max-width: 220px; word-break: break-word; }
th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; }
.status-live { color: var(--ok); }
.status-dead { color: var(--fail); }
.status-warn { color: var(--warn); }

.restart-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.restart-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.restart-phase {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.spinner.hidden { display: none; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-wrap {
  height: 6px;
  background: #1a2332;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0891b2, #22d3ee);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-label {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.log-console {
  max-height: 280px;
  overflow-y: auto;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 0.75rem;
  background: #06090d;
  border: 1px solid #1e293b;
  border-radius: 8px;
}

.log-line {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(45, 58, 79, 0.35);
}

.log-line:last-child { border-bottom: none; }

.log-line.info { color: #94a3b8; }
.log-line.ok { color: var(--ok); }
.log-line.err { color: var(--fail); }
.log-line.warn { color: var(--warn); }

.log-time {
  color: #64748b;
  margin-right: 0.5rem;
}

.btn.primary.is-loading {
  opacity: 0.85;
  pointer-events: none;
}

.hidden { display: none !important; }
.error { color: var(--fail); margin-top: 1rem; }
.loading { color: var(--accent); margin-top: 1rem; }

.banner-section-wrap {
  margin-top: 1.5rem;
}

.footer {
  margin-top: 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
}

.footer-copy {
  margin: 0;
}

.visit-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.8125rem;
}

.visit-stat strong {
  color: var(--accent);
  font-weight: 600;
}

.visit-sep {
  opacity: 0.45;
  user-select: none;
}

.visit-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
  background: var(--muted);
}

.visit-dot.online {
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

@media (max-width: 600px) {
  .tabs { flex-direction: column; }
  .visit-sep { display: none; }
  .visit-stats {
    flex-direction: column;
    gap: 0.4rem;
  }
}
