/* ── App shell ── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  height: 60px;
  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
}

.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover, .nav-link.active { color: var(--accent); }

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5vw 6rem;
}

/* ── Page header ── */
.page-header {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.page-header-inner h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 1rem;
  margin-bottom: 0.6rem;
}

.page-sub {
  color: var(--fg-muted);
  font-size: 1rem;
  max-width: 600px;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

/* ── Section blocks ── */
.section-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid var(--border);
}

/* ── Upload row (overview) ── */
.uploads-list { }

.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.upload-row:last-child { border-bottom: none; }
.upload-row:hover { background: var(--bg-elevated); }

.upload-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.upload-meta {
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.upload-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* ── Buttons ── */
.btn-primary {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; }

.btn-accent {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s;
}

.btn-accent:hover { opacity: 0.85; }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s, border-color 0.15s;
}

.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.2); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

/* ── Badges ── */
.badge {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.badge-success {
  background: rgba(61,245,167,0.12);
  color: var(--accent);
}

/* ── Upload page ── */
.upload-area {
  max-width: 760px;
  margin: 0 auto;
}

.drop-zone {
  background: var(--bg-card);
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(61,245,167,0.04);
}

.drop-icon {
  color: var(--fg-dim);
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: center;
}

.drop-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.file-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.drop-hint {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* ── Preview ── */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.preview-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-right: 0.8rem;
}

.preview-meta {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

.schema-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.schema-table th {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 0.8rem 1.2rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.schema-table td {
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.schema-table tr:last-child td { border-bottom: none; }
.schema-table tr:hover td { background: var(--bg-elevated); }

.col-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
}

.col-sample, .col-stats {
  color: var(--fg-muted);
  font-size: 0.82rem;
}

.type-badge {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-number { background: rgba(61,245,167,0.12); color: var(--accent); }
.type-text { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.type-date { background: rgba(100,150,255,0.12); color: #7ba7ff; }
.type-boolean { background: rgba(255,200,80,0.12); color: #f5c842; }

.upload-actions-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.action-hint {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* ── Progress ── */
.progress-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
}

.progress-steps {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--fg-dim);
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--fg-dim);
  transition: all 0.3s;
}

.progress-step.active .step-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(61,245,167,0.2);
}

.progress-step.done .step-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.progress-step.active { color: var(--fg); }
.progress-step.done { color: var(--accent); }

.progress-msg {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ── Briefings layout ── */
.briefings-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  min-height: 600px;
}

.briefings-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  max-height: 75vh;
}

.briefing-item {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.briefing-item:last-child { border-bottom: none; }
.briefing-item:hover { background: var(--bg-elevated); }
.briefing-item.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }

.briefing-item-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.briefing-item-meta {
  font-size: 0.76rem;
  color: var(--fg-dim);
}

.briefing-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  color: var(--fg-dim);
  gap: 1rem;
}

.detail-empty-icon { color: var(--fg-dim); }

.briefing-content {
  padding: 2rem 2.5rem;
}

.briefing-content-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.briefing-content-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.briefing-content-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.82rem;
  color: var(--fg-dim);
}

.briefing-body {
  line-height: 1.75;
  color: var(--fg-muted);
}

.briefing-body p { margin-bottom: 1rem; }
.briefing-body strong { color: var(--fg); font-weight: 600; }
.briefing-body ul { margin: 0.5rem 0 1rem 1.5rem; }
.briefing-body li { margin-bottom: 0.4rem; }

/* ── Loading / empty / error states ── */
.loading-state, .empty-state, .error-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

.empty-state a { color: var(--accent); }

/* ── Landing page CTA button ── */
.hero-cta {
  display: inline-block;
  margin-top: 2rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 0.85rem 2rem;
  text-decoration: none;
  transition: opacity 0.15s;
}

.hero-cta:hover { opacity: 0.85; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .briefings-layout { grid-template-columns: 1fr; }
  .briefings-sidebar { max-height: 300px; }
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .upload-row { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .progress-steps { gap: 1.5rem; }
  .briefing-content { padding: 1.5rem; }
}
