/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   #22263a;
  --border:     #2e3350;
  --accent:     #6c63ff;
  --accent-h:   #857dff;
  --accent-d:   #4f48cc;
  --text:       #e8eaf6;
  --text-muted: #7b82a8;
  --success:    #4caf7d;
  --error:      #ff5c6c;
  --radius:     14px;
  --shadow:     0 8px 40px rgba(0,0,0,.45);
}

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── Background decoration ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(108,99,255,.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(108,99,255,.12) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ── Card ── */
.card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 40px 36px;
  backdrop-filter: blur(8px);
}

/* ── Header ── */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.card-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg { width: 22px; height: 22px; fill: #fff; }

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

.card-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Form ── */
.form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-wrap { position: relative; }

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.field-icon svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

select, input[type="date"] {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: .92rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

select:focus, input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.2);
  background: #262a40;
}

select:disabled { opacity: .5; cursor: not-allowed; }

/* Custom select arrow */
.select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-muted);
  pointer-events: none;
}

/* Date picker icon */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(.6) sepia(1) saturate(3) hue-rotate(200deg);
  cursor: pointer;
  opacity: .7;
}

/* ── Date row ── */
.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Button ── */
.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 20px rgba(108,99,255,.35);
  letter-spacing: .2px;
  margin-top: 4px;
}

.btn-download:hover:not(:disabled) {
  opacity: .92;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(108,99,255,.5);
}

.btn-download:active:not(:disabled) { transform: translateY(0); }

.btn-download:disabled {
  background: var(--surface2);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.btn-download svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Loader overlay ── */
.loader-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,11,18,.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.loader-overlay.active { display: flex; }

.spinner {
  width: 52px; height: 52px;
  border: 3.5px solid rgba(108,99,255,.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-text { font-size: .95rem; color: var(--text-muted); letter-spacing: .3px; }

/* ── Banner ── */
.banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: .875rem;
  line-height: 1.5;
  margin-top: 4px;
}

.banner.error {
  display: flex;
  background: rgba(255,92,108,.1);
  border: 1px solid rgba(255,92,108,.3);
  color: #ff8a94;
}

.banner.success {
  display: flex;
  background: rgba(76,175,125,.1);
  border: 1px solid rgba(76,175,125,.3);
  color: #6fcf97;
}

.banner svg {
  width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Skeleton ── */
.skeleton {
  height: 44px;
  background: linear-gradient(90deg, var(--surface2) 25%, #2a2f48 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
  border: 1.5px solid var(--border);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Responsive ── */
@media (max-width: 560px) {
  .card { padding: 28px 20px 24px; }
  .date-row { grid-template-columns: 1fr; }
}
