@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --bg0: #0a1210;
  --bg1: #12201c;
  --panel: rgba(20, 36, 32, 0.82);
  --panel-solid: #142420;
  --line: rgba(140, 200, 180, 0.14);
  --text: #e8f3ee;
  --muted: #8eaaa0;
  --accent: #2fd4a1;
  --accent-2: #7ee0c3;
  --warn: #f0b429;
  --danger: #ff6b7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Sora", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(47, 212, 161, 0.18), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(56, 120, 100, 0.22), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #0d1714);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #fff; }

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 28, 24, 0.95), rgba(10, 18, 16, 0.92));
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 5;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.brand span {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.nav a:hover {
  background: rgba(47, 212, 161, 0.08);
  color: var(--text);
  transform: translateX(2px);
}

.nav a.active {
  background: linear-gradient(90deg, rgba(47, 212, 161, 0.18), rgba(47, 212, 161, 0.05));
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(47, 212, 161, 0.2);
}

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.user-chip {
  font-size: 0.86rem;
  margin-bottom: 10px;
}

.user-chip strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.user-chip .muted { font-size: 0.78rem; }

.main {
  padding: 28px 32px 48px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.topbar .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: rise .45s ease both;
}

.stat:nth-child(2) { animation-delay: .05s; }
.stat:nth-child(3) { animation-delay: .1s; }
.stat:nth-child(4) { animation-delay: .15s; }

.stat .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  animation: rise .5s ease both;
}

.card h2, .card h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1.1fr 1fr; }

.msg {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  animation: rise .35s ease both;
}
.msg.good { background: rgba(47, 212, 161, 0.1); border-color: rgba(47, 212, 161, 0.3); }
.msg.bad { background: rgba(255, 107, 122, 0.1); border-color: rgba(255, 107, 122, 0.3); }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(47, 212, 161, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 212, 161, 0.12);
}

textarea {
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.row { display: grid; gap: 12px; }
@media (min-width: 860px) { .row.two { grid-template-columns: 1fr 1fr; } }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform .15s ease, filter .15s ease, background .15s ease;
}

.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, #2fd4a1, #1f9f7a);
  border-color: transparent;
  color: #062019;
}
.btn.danger {
  background: rgba(255, 107, 122, 0.12);
  border-color: rgba(255, 107, 122, 0.35);
  color: #ffb0b8;
}
.btn.small { padding: 7px 10px; font-size: 0.8rem; border-radius: 10px; }
.btn.disabled { opacity: 0.35; pointer-events: none; }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-bar label {
  margin: 0;
}

.filter-bar select {
  min-width: 220px;
  width: auto;
}

tr.row-bad td {
  background: rgba(255, 107, 122, 0.08);
}

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
}
.pill.good { color: var(--accent); border-color: rgba(47, 212, 161, 0.35); }
.pill.bad { color: var(--danger); border-color: rgba(255, 107, 122, 0.35); }
.pill.warn { color: var(--warn); border-color: rgba(240, 180, 41, 0.35); }

.muted { color: var(--muted); }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

pre.keybox {
  background: #07110e;
  color: #d7efe6;
  padding: 14px;
  border-radius: 12px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--line);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px 28px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(16, 28, 24, 0.88);
  box-shadow: var(--shadow);
  animation: rise .55s ease both;
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.login-card .lead {
  margin: 8px 0 20px;
  color: var(--muted);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
}
