* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fb;
  color: #1f2937;
  line-height: 1.6;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  background: #1f2937;
  color: white;
  padding: 1rem 2rem;
}

header .brand {
  font-size: 1.2rem;
  font-weight: 700;
}

nav {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

nav a {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.user-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.85);
}

.logout-button {
  padding: 0.55rem 0.85rem;
}

.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.auth-card h1 {
  margin-top: 0;
  font-size: 1.8rem;
  color: #111827;
}

.auth-card p {
  margin: 0.5rem 0 1.5rem;
  color: #475569;
}

.auth-card .form-field {
  margin-bottom: 1rem;
}

.auth-card label {
  margin-bottom: 0.5rem;
}

.auth-card input {
  width: 100%;
}

.auth-card .input-button {
  width: 100%;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #6b7280;
}

.card p {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin-top: 1rem;
}

thead {
  background: #111827;
  color: white;
}

th,
td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 0.95rem;
}

tr:hover {
  background: #f3f4f6;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  background: white;
  font-size: 0.95rem;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

button,
.input-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.2rem;
  border: none;
  border-radius: 0.75rem;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.secondary,
.input-button.secondary {
  background: #6b7280;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.nacrt {
  background: #6b7280;
}

.badge.izdata {
  background: #2563eb;
}

.badge.poslata {
  background: #0ea5e9;
}

.badge.nije-poslata {
  background: #6b7280;
}

.badge.placena {
  background: #16a34a;
}

.badge.placeno {
  background: #16a34a;
}

.badge.neplaceno {
  background: #f97316;
}

.badge.stornirana {
  background: #ef4444;
}

.badge.kasni {
  background: #dc2626;
}

.badge.delimicno-placeno {
  background: #f59e0b;
}

.badge.neplaceno {
  background: #f97316;
}

.badge.stornirano {
  background: #ef4444;
}

.badge.role-admin {
  background: #7c3aed;
}

.badge.role-user {
  background: #2563eb;
}

.badge.active-user {
  background: #16a34a;
}

.badge.inactive-user {
  background: #6b7280;
}

button:hover,
.input-button:hover {
  filter: brightness(1.05);
}

.alert {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-section {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem;
  margin-top: 1rem;
}

.form-help {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.item-row {
  display: grid;
  grid-template-columns: 2.5fr 0.9fr 0.8fr 1fr 0.9fr 1fr;
  gap: 0.75rem;
  align-items: center;
}

.item-row input,
.item-row select {
  min-width: 0;
}

.item-row .remove-button {
  background: #ef4444;
}

.sentence-link {
  font-size: 0.95rem;
}

footer {
  text-align: center;
  color: #6b7280;
  padding: 1rem 0;
  margin-top: 2rem;
}

@media (max-width: 900px) {
  .item-row {
    grid-template-columns: 1fr;
  }
}
.chart-card {
  width: 100%;
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 450px;
}

.section-title {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.success-alert {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.reports-header p {
  margin: 0.35rem 0 0;
  color: #64748b;
}

.report-panel,
.report-chart-card,
.report-table-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.report-panel {
  padding: 1.25rem;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 1rem;
  align-items: end;
}

.report-filter-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.report-kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.report-kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent, #2563eb);
}

.report-kpi-card span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 700;
}

.report-kpi-card strong {
  display: block;
  margin-top: 0.75rem;
  color: #0f172a;
  font-size: 1.35rem;
  line-height: 1.2;
}

.accent-blue { --accent: #2563eb; }
.accent-green { --accent: #16a34a; }
.accent-red { --accent: #ef4444; }
.accent-indigo { --accent: #7c3aed; }
.accent-amber { --accent: #f59e0b; }
.accent-slate { --accent: #64748b; }

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.report-chart-card,
.report-table-card {
  padding: 1.25rem;
}

.report-chart-card.wide {
  grid-column: span 2;
}

.report-chart-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-chart-title h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.05rem;
}

.report-chart-title span {
  color: #64748b;
  font-size: 0.9rem;
}

.report-chart-box {
  position: relative;
  height: 320px;
}

.report-table-card {
  margin-top: 1.25rem;
}

.report-table td,
.report-table th {
  white-space: nowrap;
}

.empty-cell {
  color: #64748b;
  text-align: center;
}

.input-button.danger,
button.danger {
  background: #dc2626;
}

.input-button:disabled,
button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.55;
}

.user-admin-section h2 {
  margin-top: 0;
}

.user-create-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 1rem;
  align-items: end;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 600;
}

.checkbox-field input {
  width: auto;
}

.checkbox-field.compact {
  justify-content: center;
}

.user-table-card {
  margin-top: 1.25rem;
}

.user-admin-table td {
  vertical-align: top;
}

.user-row-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.75fr 0.8fr 0.8fr 2.2fr;
  gap: 0.75rem;
  align-items: center;
}

.user-created {
  color: #64748b;
  font-size: 0.9rem;
}

.user-actions,
.user-secondary-actions,
.password-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.user-secondary-actions {
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.password-form input {
  width: 180px;
}

.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.payment-summary-grid div {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
}

.payment-summary-grid span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 700;
}

.payment-summary-grid strong {
  display: block;
  margin-top: 0.5rem;
  color: #0f172a;
  font-size: 1.25rem;
}

.payment-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 1rem;
  align-items: end;
}

@media (max-width: 1000px) {
  .report-filters,
  .report-kpi-grid,
  .user-create-form,
  .user-row-form,
  .payment-summary-grid,
  .payment-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .report-chart-grid {
    grid-template-columns: 1fr;
  }

  .report-chart-card.wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .report-filters,
  .report-kpi-grid,
  .user-create-form,
  .user-row-form,
  .payment-summary-grid,
  .payment-form {
    grid-template-columns: 1fr;
  }

  .report-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .report-chart-box {
    height: 280px;
  }
}
