:root {
  --velvet-dark: #320204;
  --velvet-mid: #63060a;
  --gold-bright: #ffe28a;
  --gold-mid: #d99b26;
  --cream-top: #fdf7e9;
  --cream-mid: #f7ebd2;
  --crimson: #8e0c10;
  --emerald: #0d5e1e;
  --emerald-dark: #073e13;
  --text-dark: #2a120b;
  --error-red: #b91c1c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dark);
  background: radial-gradient(ellipse at top, #78080d 0%, #4a0306 58%, #280103 100%);
}

/* Login Layout */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: linear-gradient(165deg, var(--cream-top) 0%, var(--cream-mid) 100%);
  border: 3px solid var(--gold-mid);
  border-radius: 22px;
  padding: 32px 28px 28px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 244, 205, 0.85),
    0 24px 60px rgba(0, 0, 0, 0.65);
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.login-brand img {
  width: 190px;
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.login-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--crimson);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-subtitle {
  font-size: 0.82rem;
  color: #5c3a2e;
  margin-top: 4px;
}

.alert-error {
  background: rgba(185, 28, 28, 0.1);
  border: 1px solid rgba(185, 28, 28, 0.35);
  color: var(--error-red);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.field-group {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--crimson);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.field-control {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid rgba(217, 155, 38, 0.65);
  border-bottom: 2.5px solid var(--emerald);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
}

.field-control:focus {
  outline: none;
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 3px rgba(217, 155, 38, 0.25);
}

.btn-primary {
  width: 100%;
  padding: 12px 20px;
  border: 2px solid var(--gold-bright);
  border-radius: 999px;
  background: linear-gradient(180deg, #137a29 0%, var(--emerald) 55%, var(--emerald-dark) 100%);
  color: #fff8e7;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Dashboard Layout */
.topbar {
  background: rgba(40, 2, 4, 0.92);
  border-bottom: 2px solid var(--gold-mid);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand img {
  height: 44px;
  width: auto;
}

.topbar-title {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold-bright);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f7ebd2;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-logout {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--gold-bright);
  background: rgba(142, 12, 16, 0.85);
  color: var(--gold-bright);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s ease;
}

.btn-logout:hover {
  background: var(--crimson);
}

.dashboard-container {
  max-width: 1240px;
  margin: 26px auto 48px;
  padding: 0 18px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: linear-gradient(165deg, var(--cream-top) 0%, var(--cream-mid) 100%);
  border: 2px solid var(--gold-mid);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--crimson);
}

.stat-value {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--emerald-dark);
  margin-top: 4px;
}

/* Panel & Tabs */
.panel {
  background: linear-gradient(165deg, var(--cream-top) 0%, var(--cream-mid) 100%);
  border: 3px solid var(--gold-mid);
  border-radius: 20px;
  padding: 20px 22px 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1.5px solid rgba(217, 155, 38, 0.45);
  margin-bottom: 16px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  background: rgba(142, 12, 16, 0.08);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(217, 155, 38, 0.5);
}

.tab-link {
  padding: 9px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--crimson);
  transition: all 0.15s ease;
}

.tab-link.is-active {
  background: linear-gradient(180deg, #137a29 0%, var(--emerald-dark) 100%);
  color: #fff8e7;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  padding: 8px 14px;
  border: 1.5px solid rgba(217, 155, 38, 0.7);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  min-width: 220px;
}

.search-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--gold-mid);
  background: var(--crimson);
  color: #fff8e7;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.reset-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--crimson);
  text-decoration: none;
}

.export-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--gold-mid);
  background: linear-gradient(180deg, #137a29 0%, var(--emerald-dark) 100%);
  color: #fff8e7;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease;
}

.export-btn:hover {
  filter: brightness(1.1);
}

/* Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1.5px solid rgba(217, 155, 38, 0.5);
  background: rgba(255, 255, 255, 0.72);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 0.86rem;
}

thead th {
  background: linear-gradient(180deg, #7d0a0e 0%, #5c0609 100%);
  color: var(--gold-bright);
  text-align: left;
  padding: 12px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(217, 155, 38, 0.28);
  color: var(--text-dark);
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(255, 242, 200, 0.55);
}

.ref-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(13, 94, 30, 0.12);
  color: var(--emerald-dark);
  font-weight: 700;
  font-size: 0.76rem;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: #6b4c3b;
  font-weight: 600;
}

/* Pagination */
.pagination-bar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #5c3a2e;
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1.5px solid rgba(217, 155, 38, 0.65);
  background: #fff;
  color: var(--crimson);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
}

.page-btn.is-current {
  background: var(--emerald);
  border-color: var(--emerald-dark);
  color: #fff;
}

.page-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

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

  .search-input {
    min-width: 150px;
  }
}

