/* ===== CSS VARIABLES ===== */
:root {
  --bg: #090d0b;
  --panel: #0f1612;
  --panel-2: #141e18;
  --line: #244533;
  --ink: #daf7e7;
  --muted: #85a592;
  --good: #2cff85;
  --warn: #ffbf47;
  --bad: #ff6262;
  --cyan: #56d7ff;
  --font: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --fs-xs: 0.7rem;
  --fs-sm: 0.8rem;
  --fs-base: 0.9rem;
  --fs-lg: 1.1rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.8rem;
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;
  --radius: 4px;
  --radius-lg: 8px;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--good);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--cyan);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--panel);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--radius);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--panel);
}

/* ===== NAVIGATION ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.nav-brand {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--good);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.nav-brand:hover {
  color: var(--cyan);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  list-style: none;
}

.nav-links a {
  font-size: var(--fs-sm);
  color: var(--muted);
  padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--radius);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--panel-2);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--good);
  border-bottom: 2px solid var(--good);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-xs);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.page-body {
  padding: var(--sp-xl) 0;
}

/* ===== SECTIONS ===== */
.section-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: var(--sp-sm);
  letter-spacing: 0.02em;
}

.section-subtitle {
  font-size: var(--fs-base);
  color: var(--muted);
  margin-bottom: var(--sp-lg);
}

/* ===== PANELS ===== */
.panel {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-body {
  padding: var(--sp-md);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  background: linear-gradient(135deg, #1a7a44 0%, #0f4d29 100%);
  color: var(--good);
  border: 1px solid var(--good);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: linear-gradient(135deg, #22a058 0%, #155e34 100%);
  box-shadow: 0 0 12px rgba(44, 255, 133, 0.25);
  color: var(--good);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--muted);
  box-shadow: none;
}

.btn-sm {
  padding: var(--sp-xs) var(--sp-sm);
  font-size: var(--fs-xs);
}

.btn-icon {
  padding: var(--sp-xs);
  width: 32px;
  height: 32px;
  justify-content: center;
}

/* ===== INPUTS ===== */
.input {
  display: block;
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--fs-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.input:focus {
  border-color: var(--good);
  box-shadow: 0 0 0 2px rgba(44, 255, 133, 0.15);
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2385a592' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-sm) center;
  padding-right: var(--sp-xl);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-sm);
  border-radius: 99px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.badge-good {
  background: rgba(44, 255, 133, 0.1);
  color: var(--good);
  border-color: rgba(44, 255, 133, 0.3);
}

.badge-warn {
  background: rgba(255, 191, 71, 0.1);
  color: var(--warn);
  border-color: rgba(255, 191, 71, 0.3);
}

.badge-bad {
  background: rgba(255, 98, 98, 0.1);
  color: var(--bad);
  border-color: rgba(255, 98, 98, 0.3);
}

.badge-neutral {
  background: var(--panel-2);
  color: var(--muted);
  border-color: var(--line);
}

/* ===== TABLES ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table thead tr {
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.table th {
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.table tbody tr:nth-child(even) {
  background: rgba(36, 69, 51, 0.15);
}

.table tbody tr:hover {
  background: var(--panel-2);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== CODE ===== */
.code {
  display: inline;
  background: var(--panel-2);
  color: var(--cyan);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1px 6px;
  font-family: var(--font);
  font-size: 0.85em;
}

.code-block {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: auto;
}

.code-block pre {
  padding: var(--sp-md);
  font-family: var(--font);
  font-size: var(--fs-sm);
  color: var(--ink);
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

/* ===== CARDS ===== */
.card {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--muted);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

/* ===== GRID ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-md);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-md);
}

/* ===== FOOTER ===== */
.footer {
  margin-top: var(--sp-2xl);
  padding: var(--sp-lg);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.8;
}

.footer a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--good);
  text-decoration: none;
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-muted  { color: var(--muted); }
.text-good   { color: var(--good); }
.text-warn   { color: var(--warn); }
.text-bad    { color: var(--bad); }
.text-cyan   { color: var(--cyan); }
.text-ink    { color: var(--ink); }

.text-xs   { font-size: var(--fs-xs); }
.text-sm   { font-size: var(--fs-sm); }
.text-base { font-size: var(--fs-base); }
.text-lg   { font-size: var(--fs-lg); }
.text-xl   { font-size: var(--fs-xl); }
.text-2xl  { font-size: var(--fs-2xl); }

.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font); }

.mt-xs  { margin-top: var(--sp-xs); }
.mt-sm  { margin-top: var(--sp-sm); }
.mt-md  { margin-top: var(--sp-md); }
.mt-lg  { margin-top: var(--sp-lg); }
.mt-xl  { margin-top: var(--sp-xl); }
.mt-2xl { margin-top: var(--sp-2xl); }

.mb-xs  { margin-bottom: var(--sp-xs); }
.mb-sm  { margin-bottom: var(--sp-sm); }
.mb-md  { margin-bottom: var(--sp-md); }
.mb-lg  { margin-bottom: var(--sp-lg); }
.mb-xl  { margin-bottom: var(--sp-xl); }
.mb-2xl { margin-bottom: var(--sp-2xl); }

.p-xs  { padding: var(--sp-xs); }
.p-sm  { padding: var(--sp-sm); }
.p-md  { padding: var(--sp-md); }
.p-lg  { padding: var(--sp-lg); }
.p-xl  { padding: var(--sp-xl); }

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs { gap: var(--sp-xs); }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }

.w-full    { width: 100%; }
.hidden    { display: none !important; }
.sr-only   {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== RESPONSIVE — 768px ===== */
@media (max-width: 768px) {
  .nav {
    flex-wrap: wrap;
    gap: var(--sp-sm);
    padding: var(--sp-sm) var(--sp-md);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: var(--sp-xs);
    padding: var(--sp-sm) 0;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: var(--sp-sm) var(--sp-md);
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .container,
  .container-wide {
    padding: 0 var(--sp-md);
  }
}

/* ===== RESPONSIVE — 480px ===== */
@media (max-width: 480px) {
  .page-body {
    padding: var(--sp-md) 0;
  }

  .panel-body {
    padding: var(--sp-sm);
  }

  .btn {
    padding: var(--sp-xs) var(--sp-sm);
  }

  .table th,
  .table td {
    padding: var(--sp-xs) var(--sp-sm);
  }

  .section-title {
    font-size: var(--fs-lg);
  }
}
