:root {
  --bg: #f3f7f5;
  --surface: #ffffff;
  --surface-alt: #edf3ef;
  --border: #d8e3dd;
  --text: #1b2a2a;
  --muted: #56706d;
  --primary: #2d6b62;
  --primary-strong: #1d4d48;
  --warning: #b8731f;
  --danger: #b83a3a;
  --success: #25734d;
  --shadow: rgba(20, 37, 30, 0.08);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-strong);
  color: white;
  padding: 0.75rem 1rem;
  z-index: 1000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary-strong);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text);
}
.nav-list a.active, .nav-list a:hover, .nav-list a:focus-visible {
  background: var(--surface-alt);
  text-decoration: none;
}

.page {
  width: min(1200px, calc(100% - 2rem));
  margin: 2rem auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  box-shadow: 0 8px 20px var(--shadow);
}
.panel + .panel { margin-top: 1.5rem; }

.card {
  padding: 1.5rem;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-header h1, .card-header h2, .card-header h3 {
  margin: 0;
}

.grid {
  display: grid;
  gap: 1rem;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat-card {
  padding: 1rem 1.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
}
.stat-card .label { display: block; color: var(--muted); font-size: 0.9rem; }
.stat-card .value {
  display: block;
  font-size: clamp(1.6rem, 2vw, 2.3rem);
  font-weight: 700;
  margin-top: 0.4rem;
}

.form-group { margin-bottom: 1rem; }
label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}
label.required::after {
  content: ' *';
  color: var(--danger);
}
input, select, textarea, button {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  background: #fff;
  color: var(--text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(45, 107, 98, 0.28);
  outline-offset: 2px;
}
textarea { min-height: 120px; resize: vertical; }
button {
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus-visible { background: var(--primary-strong); }
.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-small {
  padding: 0.45rem 0.8rem;
  width: auto;
}
.inline-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.alert {
  border-radius: 0.6rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: #eefaf3; border-color: #bfe7d4; color: var(--success); }
.alert-error { background: #fef0f0; border-color: #f0c2c2; color: var(--danger); }
.alert-info { background: #eef5ff; border-color: #bfd9ff; color: var(--primary-strong); }

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}
.table th, .table td {
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.table th {
  background: var(--surface-alt);
  font-weight: 700;
}
.table tbody tr:hover { background: rgba(45, 107, 98, 0.03); }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1.5rem;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #edf5f2 0%, #dfece7 100%);
}
.auth-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 18px 36px rgba(20, 37, 30, 0.08);
}
.auth-panel h1 { text-align: center; margin-top: 0; }
.auth-links { text-align: center; margin-top: 1rem; }
.auth-links a { font-weight: 600; }

ul.info-list { padding-left: 1.1rem; margin: 0.75rem 0 0; }
.pill {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--primary-strong);
  font-size: 0.75rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .page { width: min(100% - 1rem, 1200px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
