﻿:root {
  --bg: #0f1117;
  --panel: #1a1d28;
  --panel-2: #232634;
  --line: #2a2e3f;
  --text: #e6e8ee;
  --muted: #8a8fa3;
  --pink: #ff2e8a;
  --green: #22c55e;
  --red: #ef4444;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Thai', sans-serif;
}
.topnav {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel);
  border-bottom: 2px solid var(--line);
  padding: 12px 20px;
}
.topnav .brand { font-weight: bold; font-size: 1.1rem; }
.topnav .links { display: flex; gap: 8px; flex: 1; margin-left: 24px; }
.topnav .links a {
  color: var(--muted); text-decoration: none;
  padding: 8px 14px; border-radius: 8px;
}
.topnav .links a:hover { background: var(--panel-2); color: var(--text); }
.topnav .links a.active { background: var(--pink); color: white; }
.topnav .user { display: flex; gap: 12px; align-items: center; }
.topnav .user button {
  background: transparent; border: 1px solid var(--line);
  color: var(--text); padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
h1 { font-size: 1.5rem; margin: 0 0 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.big-number { font-size: 2.5rem; font-weight: bold; }
.muted { color: var(--muted); font-size: 0.9rem; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
input, textarea, select {
  width: 100%; padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--pink); }
button {
  padding: 10px 16px; border: none; border-radius: 8px;
  background: var(--panel-2); color: var(--text); cursor: pointer;
  font: inherit;
}
button:hover { background: var(--line); }
.btn-primary { background: var(--pink); color: white; font-weight: 600; }
.btn-primary:hover { background: #d12572; }
.btn-sm { padding: 4px 10px; font-size: 0.85rem; margin-right: 4px; }
.btn-sm.danger { background: var(--red); color: white; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.toolbar input { flex: 1; }
.toolbar select { width: 180px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 0.75rem; background: var(--panel-2);
}
.badge.ok { background: rgba(34,197,94,0.2); color: var(--green); }
.badge.ban { background: rgba(239,68,68,0.2); color: var(--red); }
.log-box {
  background: #000; color: #0f0; padding: 12px;
  border-radius: 8px; overflow: auto; font-family: 'Consolas', monospace;
  font-size: 0.85rem; white-space: pre-wrap;
}
.result { margin-top: 12px; padding: 10px 14px; border-radius: 8px; }
.result.ok { background: rgba(34,197,94,0.15); color: var(--green); }
.result.err { background: rgba(239,68,68,0.15); color: var(--red); }
.history-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: none; }
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--panel); padding: 32px; border-radius: 16px;
  width: 380px; border: 1px solid var(--line);
}
.login-box h1 { margin: 0 0 8px; text-align: center; }
.login-box .hint { color: var(--muted); text-align: center; margin: 0 0 24px; font-size: 0.9rem; }
.login-box input { margin-bottom: 12px; }
.login-box button { width: 100%; background: var(--pink); color: white; font-weight: 600; }
.login-box .error {
  background: rgba(239,68,68,0.15); color: var(--red);
  padding: 10px; border-radius: 8px; margin-bottom: 12px;
}
/* Progress Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 90%; max-width: 700px;
  max-height: 80vh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; }
.modal-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 1.5rem; cursor: pointer; padding: 0 8px;
}
.modal-body { padding: 20px; overflow: auto; }
.progress-bar {
  height: 8px; background: var(--panel-2); border-radius: 4px;
  overflow: hidden; margin-bottom: 12px;
}
.progress-fill {
  height: 100%; width: 10%;
  background: var(--pink);
  transition: width 0.3s ease;
  animation: pulse 1.2s ease-in-out infinite;
}
.progress-fill.ok { background: var(--green); animation: none; }
.progress-fill.err { background: var(--red); animation: none; }
@keyframes pulse { 50% { opacity: 0.6; } }
.step-msg { font-weight: 600; margin-bottom: 12px; }
.modal-log {
  background: #000; max-height: 300px; min-height: 200px;
  font-size: 0.8rem;
}
.log-line { padding: 1px 0; }
.log-line.error { color: #ff6b6b; }
