:root {
  --bg: #120b0d;
  --panel: #1f1215;
  --panel-alt: #2a171b;
  --border: rgba(245, 197, 66, 0.28);
  --gold: #f5c542;
  --gold-soft: #fef08a;
  --text: #f9fafb;
  --muted: #d1b7a8;
  --green: #22c55e;
  --red: #ef4444;
}

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

body {
  font-family: "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

.brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-soft);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a, .nav-logout-btn {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.nav a:hover, .nav a.active, .nav-logout-btn:hover {
  background: rgba(245, 197, 66, 0.16);
  color: var(--gold-soft);
}

.inline-form {
  display: inline;
}

.container {
  max-width: 1080px;
  margin: 22px auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.card h2 {
  font-size: 17px;
  color: var(--gold-soft);
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }
.mt-sm { margin-top: 10px; }

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

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

.card-header-row h2 {
  margin: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

textarea { min-height: 76px; resize: vertical; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.btn-row.no-margin {
  margin-top: 0;
}

.btn-row.centered {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  background: var(--gold);
  color: #1f0a05;
  border-color: var(--gold);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}

.btn.success {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.45);
}

.btn.sm { padding: 5px 10px; font-size: 12px; }

.alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}

.alert.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}

.alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.status-pill.online {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.url-box {
  background: #0d0708;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--gold-soft);
  margin: 8px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th { color: var(--gold-soft); font-weight: 700; }

.col-xs { width: 60px; }
.col-sm { width: 90px; }
.col-md { width: 125px; }
.col-lg { width: 170px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #1f0a05;
  background: var(--gold);
}

.badge-work    { background: #f59e0b; }
.badge-luck    { background: #eab308; }
.badge-love    { background: #f472b6; }
.badge-health  { background: #34d399; }
.badge-general { background: #fbbf24; }
.badge-chat    { background: #94a3b8; }

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.landing-card {
  max-width: 460px;
  text-align: center;
}

.landing-title {
  color: var(--gold-soft);
  margin-bottom: 8px;
}
