:root {
  --bg: #f7fbf7;
  --surface: #ffffff;
  --primary: #6fcf97;
  --primary-dark: #4fac77;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #e05858;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: #1f5133;
}

.topnav {
  display: flex;
  gap: 16px;
}

.topnav-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}

.topnav-link:hover {
  color: #1f5133;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.header h1 {
  margin: 0;
}

.header p {
  color: var(--muted);
  margin-top: 6px;
}

.hero {
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f3fbf6 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: center;
}

.hero-content h2 {
  margin: 0 0 10px;
  font-size: 30px;
  color: #1f5133;
}

.hero-content p {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
}

.hero-points {
  margin: 14px 0 0;
  padding-left: 18px;
  color: #3c4a57;
  display: grid;
  gap: 8px;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-media img {
  width: 100%;
  min-height: 260px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #d7eee0;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.auth-login-only {
  max-width: 420px;
  margin: 24px auto 16px;
}

.auth-login-wrap h2 {
  margin-top: 0;
  margin-bottom: 6px;
}

.auth-subtitle {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

form {
  display: grid;
  gap: 10px;
}

input, select, button {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.btn {
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

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

.btn.ghost {
  background: #ecfdf3;
  color: #1f5133;
}

.btn.danger {
  background: var(--danger);
}

.hidden {
  display: none;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.stat-card p {
  font-size: 24px;
  margin: 6px 0 0;
  color: #1f5133;
}

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
}

.summary-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.chart-wrap {
  width: 100%;
  min-height: 260px;
}

.message {
  min-height: 20px;
  color: #1f5133;
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.modal-card {
  position: relative;
  width: min(440px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-head h3 {
  margin: 0;
}

.modal-close {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .topbar-inner {
    padding: 12px 16px;
  }

  .brand {
    font-size: 18px;
  }

  .topnav {
    gap: 12px;
  }

  .container {
    padding: 16px;
  }

  .card {
    padding: 14px;
  }

  .hero-content h2 {
    font-size: 24px;
  }

  .hero-media img {
    min-height: 220px;
  }

  .nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions .btn {
    flex: 1;
  }

  .section-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    min-height: 220px;
  }

  .modal-card {
    width: calc(100% - 24px);
    padding: 14px;
  }
}

@media (max-width: 480px) {
  .topbar-inner {
    padding: 10px 12px;
  }

  .topnav-link {
    font-size: 13px;
  }

  .container {
    padding: 12px;
  }

  .hero-content h2 {
    font-size: 20px;
  }

  .hero-content p,
  .hero-points li {
    font-size: 14px;
  }

  .stat-card p {
    font-size: 20px;
  }

  th,
  td {
    padding: 8px;
    font-size: 13px;
  }

  .message {
    font-size: 13px;
  }
}
