:root {
  --primary: #1e6f5c;
  --primary-dark: #144f42;
  --bg: #f4f6f5;
  --card-bg: #ffffff;
  --border: #dfe5e2;
  --text: #1f2a27;
  --muted: #6b7a75;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 22px; }
.subtitle { margin: 4px 0 0; opacity: 0.85; font-size: 14px; }

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
}
.nav-links a:hover { background: rgba(255,255,255,0.18); }
.nav-links a.active {
  background: rgba(255,255,255,0.28);
  color: white;
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.who button.secondary {
  background: rgba(255,255,255,0.12);
  color: white;
  border-color: rgba(255,255,255,0.4);
}
.who button.secondary:hover { background: rgba(255,255,255,0.25); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 16px;
}
.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.login-card h1 { margin: 0; font-size: 20px; color: var(--primary-dark); }
.login-card .subtitle { color: var(--muted); margin: 0 0 8px; }
.login-card button { margin-top: 4px; }
.login-card .hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.login-card .hint code { background: #eef1f0; padding: 1px 5px; border-radius: 4px; }

.container {
  max-width: 80%;
  margin: 24px auto;
  padding: 0 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
}
.card h2 { margin-top: 0; font-size: 16px; color: var(--primary-dark); }


.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 16px;
  margin-bottom: 10px;
}

.grid-1 {
  display: grid;
  gap: 14px 16px;
  margin-bottom: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px 16px;
  margin-bottom: 10px;
}

@media (max-width:992px){
    .grid-3 {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width:768px){
    .grid-3 {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: 1 / -1; }

label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
input[readonly] { background: #f0f2f1; color: var(--muted); }

.form-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary);
  color: white;
}
button:hover { background: var(--primary-dark); }
button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
button.secondary:hover { background: #eef1f0; }

.msg { font-size: 13px; }
.msg.ok { color: #1e7a3a; }
.msg.err { color: #b3261e; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  align-items: flex-end;
}
.filter-row .field { min-width: 160px; }
.field-btn { justify-content: flex-end; }

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.card-head-row h2 { margin: 0; }

.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.export-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th { color: var(--muted); font-weight: 600; }
tbody tr:hover { background: #f7faf9; }

.row-actions button {
  padding: 4px 10px;
  font-size: 12px;
  margin-right: 6px;
}
.row-actions .edit { background: #2f7d67; }
.row-actions .delete { background: #b3261e; }
