:root {
  --bg: #0f1714;
  --bg-elev: #18231e;
  --bg-soft: #1f2d27;
  --line: #2d3f36;
  --text: #e8f0eb;
  --muted: #9aafa3;
  --accent: #3dba8a;
  --accent-dim: #2a8f68;
  --warn: #e0a24a;
  --danger: #e07070;
  --radius: 12px;
  --font-display: "Figtree", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(61, 186, 138, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(45, 90, 70, 0.25), transparent);
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
  margin: 0;
}

.brand,
.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
  color: var(--accent);
}

/* Login */
.login-view {
  display: flex;
  min-height: 100vh;
}

.login-panel {
  flex: 1 1 42%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem clamp(1.5rem, 4vw, 4rem);
  max-width: 32rem;
}

.login-panel h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0.4rem 0 0.5rem;
  letter-spacing: -0.03em;
}

.login-aside {
  flex: 1 1 58%;
  background:
    linear-gradient(160deg, rgba(15, 23, 20, 0.2), rgba(15, 23, 20, 0.75)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath fill='none' stroke='%232d3f36' stroke-width='1' d='M0 60h120M60 0v120'/%3E%3C/svg%3E"),
    linear-gradient(145deg, #1a3a2e, #0f1714 60%);
  display: flex;
  align-items: flex-end;
  padding: 3rem;
}

.aside-copy {
  max-width: 28rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.aside-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.25;
  margin: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
button,
select {
  font: inherit;
}

input {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
}

input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover {
  border-color: var(--accent-dim);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #062116;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: rgba(24, 35, 30, 0.92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  gap: 1.5rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
  background: var(--bg-soft);
  color: var(--text);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-chip {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-all;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.pill {
  font-size: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.pill.ok {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.pill.bad {
  color: var(--danger);
  border-color: var(--danger);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat {
  flex: 1 1 140px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat strong {
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel h2 {
  font-family: var(--font-display);
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.hint-list {
  margin: 1rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar input {
  flex: 1 1 220px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--bg-soft);
}

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.split > .panel {
  flex: 1 1 320px;
}

.once-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background: #123528;
  border: 1px solid var(--accent-dim);
  word-break: break-all;
}

.once-box code {
  color: var(--accent);
}

.feature-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.feature-card {
  flex: 1 1 180px;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.feature-card.on {
  border-color: var(--accent-dim);
}

.feature-card .flag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.detail {
  margin-top: 1rem;
}

.code-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 860px) {
  .login-aside {
    display: none;
  }
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
