:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ee;
  --ink: #17201c;
  --muted: #65716b;
  --line: #dfe6df;
  --primary: #176c5f;
  --primary-dark: #0d4f45;
  --accent: #c86f3d;
  --danger: #b42318;
  --shadow: 0 20px 60px rgba(23, 32, 28, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
.link-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(140deg, rgba(23, 108, 95, 0.12), transparent 42%),
    var(--bg);
}

.auth-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin: 6px 0 24px;
  font-size: clamp(2rem, 9vw, 3rem);
}

.stack {
  display: grid;
  gap: 16px;
}

.app {
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #101915;
  color: #fff;
}

.sidebar h1 {
  font-size: 1.45rem;
}

.sidebar nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.nav-button {
  background: rgba(255, 255, 255, 0.08);
  color: #dce7e1;
}

.nav-button.active {
  background: #fff;
  color: #101915;
}

.content {
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: clamp(1.8rem, 8vw, 3rem);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.metrics {
  display: grid;
  gap: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 35px rgba(23, 32, 28, 0.05);
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.metric strong {
  font-size: 2.25rem;
}

.panel {
  padding: 16px;
}

.panel h3 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.grid {
  display: grid;
  gap: 16px;
}

.form-grid,
.filters {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: var(--surface-2);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
}

.danger {
  background: #fff2f0;
  color: var(--danger);
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 700;
}

.list {
  display: grid;
  gap: 10px;
}

.stat-row,
.table-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.stat-row span,
.muted {
  color: var(--muted);
}

.table {
  display: grid;
  gap: 10px;
}

.table-head {
  display: none;
}

.table-row {
  align-items: center;
}

.cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cell::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.status {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  background: #e8f6ef;
  color: #12613d;
}

.status.inactive {
  background: #f1f1f1;
  color: #6c7170;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #101915;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 760px) {
  .app {
    display: grid;
    grid-template-columns: 260px 1fr;
  }

  .sidebar {
    min-height: 100vh;
    align-content: start;
    padding: 24px;
  }

  .sidebar nav {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 28px;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .table-head,
  .table-row {
    display: grid;
    grid-template-columns: var(--columns);
    gap: 12px;
  }

  .table-head {
    padding: 0 12px 4px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .cell::before {
    display: none;
  }
}
