:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text2: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --purple: #bc8cff;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

/* NAV */
nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  margin-right: 32px;
  text-decoration: none;
  letter-spacing: 0.5px;
}

nav a {
  color: var(--text2);
  text-decoration: none;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

nav a:hover { color: var(--text); }
nav a.active { color: var(--text); border-bottom-color: var(--accent); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-right .time { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; }

/* LAYOUT */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 { font-size: 22px; font-weight: 600; }
.page-header p { color: var(--text2); font-size: 14px; margin-top: 4px; }

/* CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.stat-card .label { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: 12px; color: var(--text2); margin-top: 4px; }

.value.green { color: var(--green); }
.value.red { color: var(--red); }
.value.yellow { color: var(--yellow); }
.value.blue { color: var(--accent); }

/* PANELS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-header h2 { font-size: 14px; font-weight: 600; }
.panel-body { padding: 16px 20px; }
.panel-body.no-pad { padding: 0; }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 16px; color: var(--text2); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge.green { background: rgba(63,185,80,0.15); color: var(--green); }
.badge.red { background: rgba(248,81,73,0.15); color: var(--red); }
.badge.yellow { background: rgba(210,153,34,0.15); color: var(--yellow); }
.badge.grey { background: rgba(139,148,158,0.15); color: var(--text2); }
.badge.blue { background: rgba(88,166,255,0.15); color: var(--accent); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.grey { background: var(--text2); }

/* BUTTONS */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn.primary:hover { background: #79bfff; }
.btn.danger { background: rgba(248,81,73,0.2); border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: rgba(248,81,73,0.35); }
.btn.success { background: rgba(63,185,80,0.2); border-color: var(--green); color: var(--green); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* STATUS HTTP */
.s2xx { color: var(--green); }
.s3xx { color: var(--accent); }
.s4xx { color: var(--yellow); }
.s5xx { color: var(--red); }

/* LOG VIEWER */
.log-viewer {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text2);
  line-height: 1.6;
}

/* TOAST */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 14px;
  z-index: 1000;
  display: none;
  gap: 10px;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-width: 360px;
}
#toast.show { display: flex; }
#toast.toast-ok { border-color: var(--green); }
#toast.toast-err { border-color: var(--red); }

/* REFRESH BADGE */
.refresh-info { font-size: 12px; color: var(--text2); }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  min-width: 500px;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; font-size: 16px; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* EMPTY STATE */
.empty { text-align: center; padding: 48px; color: var(--text2); font-size: 14px; }

/* SPINNER */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* BAR */
.bar-wrap { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar { height: 100%; border-radius: 3px; transition: width 0.4s; }

/* COUNTDOWN PAGE */
.countdown-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #161b22 0%, #0d1117 70%);
}

.countdown-page .tagline {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--accent);
  margin-bottom: 24px;
  font-weight: 600;
}

.countdown-page h1 {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
  max-width: 700px;
}

.countdown-page .subtitle {
  font-size: 18px;
  color: var(--text2);
  margin-bottom: 56px;
  max-width: 500px;
}

.countdown-display {
  display: flex;
  gap: 32px;
  margin-bottom: 56px;
  flex-wrap: wrap;
  justify-content: center;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.countdown-unit .num {
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.countdown-unit .lbl {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text2);
  font-weight: 500;
}

.countdown-sep {
  font-size: 60px;
  font-weight: 300;
  color: var(--border);
  line-height: 1;
  align-self: flex-start;
  padding-top: 8px;
}

.countdown-date {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 48px;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  display: inline-block;
}

.notify-form {
  display: flex;
  gap: 8px;
  max-width: 380px;
  width: 100%;
}

.notify-form input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.notify-form input:focus { border-color: var(--accent); }
.notify-form input::placeholder { color: var(--text2); }

.particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; display: block; }
.countdown-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }

.progress-bar-wrap {
  width: min(500px, 90vw);
  margin-bottom: 48px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 8px;
}
.progress-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 2px;
  transition: width 1s;
}
