:root {
  --black: #060504;
  --panel: #12100d;
  --panel-2: #1b1712;
  --gold: #bd832f;
  --gold-2: #f5d88c;
  --cream: #fff8ea;
  --muted: #cfc4ad;
  --line: rgba(245, 216, 140, 0.18);
  --danger: #f2a7a7;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 14px 42px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 10% 0%, rgba(189, 131, 47, 0.22), transparent 26rem),
    linear-gradient(135deg, #020201 0%, #14100b 48%, #020201 100%);
  font-family: "Poppins", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.admin-page {
  width: 100%;
  max-width: 1180px;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-items: center;
  margin-inline: auto;
  padding: 22px 16px 46px;
}

.admin-hero,
.login-screen,
.toolbar,
.report-card,
.stats-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 248, 234, 0.08), rgba(255, 248, 234, 0.02));
  box-shadow: var(--shadow);
}

.admin-hero,
.toolbar,
.report-card,
.stats-grid article {
  box-shadow: var(--shadow-soft);
}

.login-screen {
  width: min(360px, calc(100vw - 20px)) !important;
  max-width: calc(100vw - 20px) !important;
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: center;
  align-self: center;
  margin-inline: auto;
  padding: clamp(28px, 5vw, 42px);
}

.back-link {
  width: max-content;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard {
  display: block;
  width: 100%;
  min-width: 0;
}

.admin-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 3vw, 30px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 28px;
  height: 1px;
  content: "";
  background: var(--gold);
}

h1,
h2 {
  margin: 0;
  color: var(--gold-2);
  font-family: "Playfair Display", serif;
  letter-spacing: 0;
}

h1 {
  max-width: 560px;
  font-size: clamp(2.1rem, 3.6vw, 3.35rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1;
}

p {
  max-width: 520px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.access-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.access-form label {
  display: grid;
  gap: 8px;
  color: var(--gold-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.access-form small {
  min-height: 20px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.btn-gold {
  color: #080603;
  background: linear-gradient(110deg, #b9862f 0%, #f9df9b 52%, #b57a24 100%);
}

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(255, 255, 255, 0.05);
}

.btn-tab {
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(255, 255, 255, 0.04);
}

.btn-tab.is-active {
  color: #080603;
  background: linear-gradient(110deg, #b9862f 0%, #f9df9b 52%, #b57a24 100%);
}

.access-form input,
.toolbar input,
.toolbar select {
  min-width: 0;
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.3);
  padding: 0 14px;
}

.toolbar input[type="date"] {
  cursor: pointer;
  color-scheme: dark;
}

.toolbar input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.86) sepia(0.42) saturate(1.8);
  opacity: 0.95;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 0.85fr) repeat(2, minmax(145px, 0.75fr)) auto;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
}

.toolbar label {
  display: grid;
  gap: 8px;
  color: var(--gold-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-clear {
  min-width: 132px;
  min-height: 46px;
}

.stats-grid,
.charts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.charts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid article {
  min-height: 102px;
  padding: 16px;
  overflow: hidden;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stats-grid strong {
  display: block;
  margin-top: 12px;
  color: var(--gold-2);
  font-family: "Playfair Display", serif;
  font-size: clamp(1.65rem, 2.8vw, 2.35rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.report-card {
  margin-top: 14px;
  padding: 16px;
  overflow: hidden;
}

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

.generated {
  color: var(--muted);
  font-size: 0.84rem;
}

.lead-cards,
.partner-cards {
  display: grid;
  gap: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pagination span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.pagination .btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.lead-card,
.partner-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.035);
}

.lead-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 0;
  color: var(--cream);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.lead-card-head strong,
.partner-card strong {
  display: block;
  color: var(--gold-2);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.lead-card-head b {
  display: block;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.lead-card-head small,
.partner-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.lead-card-body {
  display: none;
  padding: 0 16px 16px;
}

.lead-card.is-open .lead-card-body {
  display: block;
}

.lead-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.lead-card dl div {
  padding: 12px;
  border: 1px solid rgba(245, 216, 140, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.lead-card dt {
  color: var(--gold-2);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lead-card dd {
  margin: 6px 0 0;
  color: #f6f0e3;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.partner-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-top: 14px;
}

.partner-form {
  align-self: start;
}

.partner-form label {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.partner-form input,
.partner-link input {
  min-width: 0;
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.28);
  padding: 0 12px;
}

.partner-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.partner-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.partner-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.partner-metrics span {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}

.partner-metrics b {
  color: var(--gold-2);
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--cream);
  font-size: 0.88rem;
  min-width: 0;
}

.bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, #bd832f, #f5d88c);
}

@media (max-width: 820px) {
  .admin-hero,
  .section-title {
    display: grid;
    align-items: start;
  }

  .toolbar,
  .stats-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .hero-actions .btn {
    width: 100%;
  }

  .login-screen {
    align-self: center;
  }

  .filter-clear {
    width: 100%;
  }

  .lead-card-head,
  .lead-card dl,
  .partner-grid,
  .partner-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .admin-page {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px 28px;
    justify-items: center;
  }

  .login-screen {
    width: min(360px, 100%) !important;
    max-width: 360px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 24px 18px;
  }

  .access-form .btn {
    width: 100%;
  }

  .admin-hero,
  .toolbar,
  .report-card,
  .stats-grid article {
    border-radius: 7px;
  }

  .admin-hero {
    padding: 18px;
  }

  h1 {
    font-size: clamp(1.85rem, 12vw, 2.45rem);
  }

  h2 {
    font-size: 1.35rem;
  }

  p {
    font-size: 0.9rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stats-grid article {
    min-height: 94px;
    padding: 13px;
  }

  .stats-grid strong {
    font-size: 1.55rem;
  }

  .toolbar,
  .report-card {
    padding: 12px;
  }

  .section-title {
    gap: 8px;
  }

  .generated {
    font-size: 0.76rem;
  }

  .partner-link {
    grid-template-columns: 1fr;
  }

  .pagination {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    color: #111;
    background: #fff;
  }

  .admin-page {
    width: 100%;
    padding: 0;
  }

  .hero-actions,
  .login-screen,
  .toolbar {
    display: none !important;
  }

  .admin-hero,
  .report-card,
  .stats-grid article {
    break-inside: avoid;
    box-shadow: none;
    border-color: #ddd;
    background: #fff;
  }

  h1,
  h2,
  .stats-grid strong,
  .eyebrow {
    color: #111;
  }

  p,
  .generated,
  .stats-grid span,
  td small {
    color: #444;
  }

  table {
    min-width: 0;
  }

  th {
    color: #111;
    background: #f1f1f1;
  }

  td {
    color: #111;
  }
}
