:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dde5ee;
  --text: #172033;
  --muted: #667085;
  --brand: #14745f;
  --brand-strong: #0f5d4d;
  --accent: #b88922;
  --danger: #c2413a;
  --sidebar: #10231f;
  --sidebar-muted: #9fb4ad;
  --shadow: 0 14px 36px rgba(20, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-strong);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: #fff;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e2f4ed;
  color: var(--brand-strong);
  font-weight: 800;
}

.brand-title {
  font-weight: 750;
  line-height: 1.15;
}

.brand-subtitle,
.nav-label,
.topbar-meta,
.page-kicker,
.text-soft {
  color: var(--muted);
}

.sidebar .brand-subtitle,
.sidebar .nav-label {
  color: var(--sidebar-muted);
}

.nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 10px;
  margin-bottom: 8px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-link {
  color: #dce9e5;
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.side-link:hover,
.side-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.side-icon {
  width: 22px;
  text-align: center;
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.main-shell {
  min-width: 0;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.content-shell {
  padding: 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-title {
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 780;
  margin: 0;
  letter-spacing: 0;
}

.page-kicker {
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.panel,
.metric-card,
.form-panel,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.form-panel {
  padding: 20px;
}

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

.panel-title h2,
.panel-title h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 760;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric-card {
  padding: 16px;
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: var(--brand);
}

.metric-card.warning::before {
  background: var(--accent);
}

.metric-card.danger::before {
  background: var(--danger);
}

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

.metric-value {
  font-size: 2rem;
  font-weight: 820;
  line-height: 1;
}

.table-modern {
  margin: 0;
}

.table-modern thead th {
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-modern td,
.table-modern th {
  padding: 14px 16px;
  vertical-align: middle;
}

.table-modern tbody tr:hover {
  background: #fbfcfd;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 750;
  border: 1px solid transparent;
}

.status-success {
  background: #eaf8f1;
  color: #126047;
  border-color: #c9ecdc;
}

.status-muted {
  background: #eef2f6;
  color: #596579;
  border-color: #dde5ee;
}

.status-danger {
  background: #fdeceb;
  color: #a8322d;
  border-color: #f7cfcc;
}

.status-warning {
  background: #fff6df;
  color: #825c12;
  border-color: #f4dfa8;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
}

.form-section-title {
  font-weight: 760;
  margin: 4px 0 14px;
}

.form-control,
.form-select {
  border-color: #d5dde7;
  border-radius: 8px;
  min-height: 42px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.18rem rgba(20, 116, 95, 0.15);
}

.btn {
  border-radius: 8px;
  font-weight: 700;
}

.btn-success {
  background: var(--brand);
  border-color: var(--brand);
}

.btn-success:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.public-shell,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(20, 116, 95, 0.1), rgba(184, 137, 34, 0.1)),
    var(--bg);
}

.auth-card {
  width: min(100%, 440px);
  padding: 28px;
}

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

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-radius: 0;
  }

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

  .sidebar-footer {
    display: none;
  }

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

@media (max-width: 640px) {
  .content-shell,
  .topbar {
    padding: 18px;
  }

  .page-header,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .side-nav,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .form-panel {
    padding: 16px;
  }
}
