:root {
  --lime: #c8ff14;
  --lime-2: #a8e600;
  --lime-dim: #7cb800;
  --olive: #2a3608;
  --bg: #050505;
  --bg-2: #0a0b07;
  --bg-3: #10120b;
  --card: #0d0f0a;
  --line: #1c240c;
  --line-2: #2a3610;
  --text: #f4f7ea;
  --muted: #8a9374;
  --danger: #ff3b4a;
  --warn: #ffb020;
  --ok: #c8ff14;
  --shadow: 0 0 0 1px var(--line), 0 18px 50px rgba(0, 0, 0, .45);
  --glow: 0 0 28px rgba(200, 255, 20, .22);
  --radius: 16px;
  --sidebar: 268px;
  --top: 68px;
  --font: "Kanit", "Noto Sans Thai", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--lime); text-decoration: none; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3610; border-radius: 99px; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(200, 255, 20, .16), transparent 55%),
    radial-gradient(700px 400px at 80% 110%, rgba(200, 255, 20, .07), transparent 50%),
    #050505;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(200,255,20,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,255,20,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}
.login-card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, #11140c, #0a0c07);
  border: 1px solid var(--line-2);
  border-radius: 28px;
  box-shadow: var(--glow), var(--shadow);
  padding: 28px 28px 32px;
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 210px;
  margin: 0 auto 8px;
  filter: drop-shadow(0 0 22px rgba(200,255,20,.35));
}
.login-card h1 {
  text-align: center;
  font-size: 28px;
  letter-spacing: .02em;
  color: var(--lime);
  text-shadow: 0 0 18px rgba(200,255,20,.35);
  margin-bottom: 4px;
}
.login-card p.sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 22px;
  font-size: 14px;
}
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: #c9d6a2; }
.field input {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #070806;
  padding: 0 14px;
  outline: none;
}
.field input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(200,255,20,.15); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  height: 46px;
  padding: 0 16px;
  font-weight: 600;
  background: var(--lime);
  color: #101400;
  box-shadow: 0 0 18px rgba(200,255,20,.28);
}
.btn:hover { filter: brightness(1.06); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
.btn-full { width: 100%; }
.hint { margin-top: 12px; text-align: center; font-size: 12px; color: var(--muted); }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(200,255,20,.08), transparent 50%),
    var(--bg);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: #070806;
  border-right: 1px solid var(--line);
  padding: 16px 12px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}
.brand img { width: 54px; height: 54px; object-fit: cover; border-radius: 14px; box-shadow: 0 0 16px rgba(200,255,20,.25); }
.brand b { display: block; font-size: 16px; color: var(--lime); line-height: 1.15; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.nav-label {
  color: #66704d;
  font-size: 11px;
  letter-spacing: .14em;
  padding: 14px 12px 6px;
}
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d5ddc0;
  text-align: left;
}
.nav-btn:hover { background: #12150c; }
.nav-btn.active {
  background: linear-gradient(90deg, rgba(200,255,20,.18), rgba(200,255,20,.04));
  color: var(--lime);
  box-shadow: inset 3px 0 0 var(--lime);
}
.nav-ico { width: 18px; text-align: center; opacity: .9; }

.main { min-width: 0; }
.topbar {
  height: var(--top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(5,5,5,.78);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.crumbs { color: var(--muted); font-size: 14px; }
.crumbs b { color: var(--text); }
.search {
  flex: 1;
  max-width: 420px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0b0c08;
  padding: 0 16px;
  outline: none;
}
.search:focus { border-color: var(--lime-dim); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #14180c;
  border: 1px solid var(--line-2);
  color: var(--lime);
}
.userchip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: #12150c;
  border: 1px solid var(--line);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--lime); color: #101400;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.content { padding: 22px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h2 { font-size: 28px; letter-spacing: .01em; }
.page-head p { color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: linear-gradient(180deg, #12150d, #0c0e09);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card:hover { border-color: #354512; }
.stat-k { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; }
.stat-v { font-size: 28px; font-weight: 700; margin: 8px 0 10px; letter-spacing: -.02em; }
.bar { height: 7px; background: #1a1e12; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime-dim), var(--lime)); box-shadow: 0 0 12px rgba(200,255,20,.45); }
.kpi { font-family: var(--mono); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: #9aa67a; font-weight: 500; font-size: 12px; }
tr:hover td { background: rgba(200,255,20,.03); }
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.ok { background: rgba(200,255,20,.14); color: var(--lime); }
.fail { background: rgba(255,59,74,.14); color: #ff7a84; }
.warn { background: rgba(255,176,32,.14); color: #ffc45c; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.input, .select {
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: #080906;
  padding: 0 12px;
  outline: none;
}
.input:focus, .select:focus { border-color: var(--lime); }

.files {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
}
.tree button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #d5ddc0;
  padding: 8px 10px;
  border-radius: 8px;
}
.tree button:hover, .tree button.on { background: #15190d; color: var(--lime); }

.term {
  background: #050605;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #d6f28a;
  min-height: 280px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #12170b;
  border: 1px solid var(--lime-dim);
  color: var(--lime);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--glow);
  display: none;
  z-index: 20;
}

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .g-4, .g-3 { grid-template-columns: repeat(2, 1fr); }
  .files { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .g-4, .g-3, .g-2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px; }
}
