:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --border: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --success-bg: #052e16;
  --success-border: #166534;
  --error-bg: #450a0a;
  --error-border: #991b1b;
  --shadow: 0 12px 28px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #020617, #111827 35%, #0f172a);
  color: var(--text);
  min-height: 100vh;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(2, 6, 23, .72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
}

h1, h2, h3 { margin: 0 0 8px; }
.subtitle, .muted { color: var(--muted); margin: 0; }

nav { display: flex; gap: 10px; flex-wrap: wrap; }

.button-link {
  font-size: 12pt;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--primary);
  padding: 10px 14px;
  border-radius: 10px;
  transition: .2s ease;
}

.button-link:hover, .button-link.active {
  background: var(--primary);
  color: #001018;
  border-color: var(--primary);
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  transition: .2s ease;
}

.nav-link:hover, .nav-link.active {
  background: var(--primary);
  color: #001018;
  border-color: var(--primary);
}

.page-grid {
  display: grid;
  gap: 20px;
  padding: 28px 0 40px;
}

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

.card {
  background: rgba(17, 24, 39, .92);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.compact-card {
  padding: 16px 18px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.filters-form-inline {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(220px, 1.6fr) minmax(110px, .7fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 10px;
}

.form-group,
.form-group-full {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full {
  grid-column: 1 / -1;
}

label {
  font-size: .9rem;
  color: #cbd5e1;
}

input, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
}

.filters-form-inline input {
  padding: 10px 12px;
}

.compact-year {
  max-width: 130px;
}

.compact-year input {
  text-align: center;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .18);
}

.actions-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

.inline-actions {
  grid-column: auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-self: end;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }

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

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.compact-header {
  margin-bottom: 4px;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

thead {
  background: rgba(255,255,255,.04);
}

th, td {
  text-align: left;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(255,255,255,.025);
}

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
}

.feedback.success {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.feedback.error {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.hidden {
  display: none;
}

.empty-state {
  margin-top: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, .15);
  color: #7dd3fc;
  font-size: .85rem;
}

@media (max-width: 980px) {
  .filters-form-inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .compact-year {
    max-width: 100%;
  }
}

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

  .topbar-content,
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .filters-form-inline {
    grid-template-columns: 1fr;
  }

  .inline-actions {
    flex-wrap: wrap;
  }
}

.footer {
  margin-top: 40px;
  padding: 16px 24px;
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 14px;
  color: #6b7280;
}

.footer-links a {
  margin-left: 16px;
  font-size: 14px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}
