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

:root {
  --color-bg:          #f4f6fa;
  --color-surface:     #ffffff;
  --color-border:      #e2e8f0;
  --color-primary:     #0f62fe;
  --color-primary-h:   #0043ce;
  --color-danger:      #da1e28;
  --color-success:     #198038;
  --color-text:        #161616;
  --color-muted:       #6f6f6f;
  --color-brand-appx:  #0f62fe;
  --radius:            10px;
  --shadow:            0 2px 12px rgba(0,0,0,.08);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: .25rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.01em;
}

.brand-appx {
  color: var(--color-brand-appx);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  border: 1.5px solid var(--color-brand-appx);
  border-radius: 3px;
  padding: .05em .35em;
  line-height: 1.4;
}

.brand-name {
  color: var(--color-text);
  font-size: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  color: var(--color-muted);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.app-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: .75rem;
  color: var(--color-muted);
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem;
  width: 100%;
  max-width: 560px;
}

.card h1 { font-size: 1.5rem; margin-bottom: .75rem; }
.card h2 { font-size: 1.25rem; margin-bottom: 1.25rem; }
.card h3 { font-size: .875rem; font-weight: 600; text-transform: uppercase;
           letter-spacing: .05em; color: var(--color-muted); margin-bottom: .75rem; }

/* ── Typography helpers ────────────────────────────────────────────────────── */
.lead {
  font-size: 1rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.note {
  font-size: .875rem;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}

/* ── Feature list ──────────────────────────────────────────────────────────── */
.feature-list {
  list-style: none;
  margin-bottom: 2rem;
}

.feature-list li {
  padding: .35rem 0 .35rem 1.4rem;
  position: relative;
  font-size: .9375rem;
  color: var(--color-muted);
}

.feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-weight: 700;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: .9375rem;
  font-weight: 500;
  padding: .625rem 1.25rem;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}

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

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

.btn-primary:hover:not(:disabled) { background: var(--color-primary-h); }

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-ghost:hover:not(:disabled) { background: rgba(15,98,254,.06); }

.btn-large { padding: .875rem 2rem; font-size: 1rem; width: 100%; }

.link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

/* ── Date filter ───────────────────────────────────────────────────────────── */
.filter-section {
  margin-bottom: 1.75rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.preset-btn {
  font-size: .8125rem;
  padding: .375rem .875rem;
}

.preset-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field { display: flex; flex-direction: column; gap: .375rem; }

.field label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--color-muted);
}

.field input[type="date"] {
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: .9375rem;
  padding: .5rem .75rem;
  color: var(--color-text);
  width: 100%;
}

.field input[type="date"]:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.field-error {
  color: var(--color-danger);
  font-size: .8125rem;
  margin-top: .5rem;
}

/* ── Progress ──────────────────────────────────────────────────────────────── */
.progress-bar-track {
  background: var(--color-border);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar-fill {
  background: var(--color-primary);
  height: 100%;
  width: 0%;
  border-radius: 100px;
  transition: width .3s ease;
  animation: indeterminate 1.6s infinite linear;
  background: linear-gradient(90deg, var(--color-primary) 40%, #85b3ff 60%, var(--color-primary) 100%);
  background-size: 200%;
}

@keyframes indeterminate {
  0%   { background-position: 200% center; }
  100% { background-position: 0% center; }
}

.progress-label {
  font-size: .9375rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
  min-height: 1.4em;
}

/* ── Success & Error states ────────────────────────────────────────────────── */
.success-icon, .error-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.success-icon {
  background: #d4edda;
  color: var(--color-success);
}

.error-icon {
  background: #fde8e8;
  color: var(--color-danger);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.action-row .btn { flex: 1; min-width: 140px; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 1.5rem; }
  .date-inputs { grid-template-columns: 1fr; }
  .preset-buttons { gap: .375rem; }
  .preset-btn { font-size: .75rem; padding: .3rem .6rem; }
}
