:root {
  --ink: #16212f;
  --muted: #64748b;
  --line: #d9e2ec;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #b45309;
  --soft: #f5f7fb;
  --panel: #ffffff;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f8fafc;
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: var(--brand);
}

.app-nav {
  background: #101827;
  box-shadow: 0 12px 28px rgba(16, 24, 39, 0.18);
}

.navbar-brand {
  letter-spacing: 0;
}

.token-badge {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 4px 10px;
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 999px;
  color: #ccfbf1;
  background: rgba(15, 118, 110, 0.22);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.18);
  border-color: var(--brand);
}

.hero-section {
  padding: 88px 0 42px;
  color: #fff;
  background:
    linear-gradient(rgba(16, 24, 39, 0.84), rgba(16, 24, 39, 0.78)),
    url("https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 42px;
  align-items: center;
}

.hero-section h1,
.page-header h1 {
  max-width: 900px;
  font-size: 3.25rem;
  line-height: 1.05;
  margin: 12px 0 18px;
  font-weight: 800;
}

.hero-section .lead,
.page-header p {
  max-width: 780px;
  color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5eead4;
}

.hero-panel,
.feature-card,
.pricing-card,
.auth-card,
.module-card,
.report-panel,
.metric-panel,
.chart-card,
.notice-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.hero-panel {
  padding: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
}

.signal-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.signal-row:last-child {
  border-bottom: 0;
}

.content-band {
  padding: 56px 0;
}

.content-band.muted {
  background: #eaf2f2;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 28px;
}

.section-heading .eyebrow,
.page-header .eyebrow,
.auth-card .eyebrow {
  color: var(--brand);
}

.section-heading h2 {
  font-size: 2rem;
  font-weight: 800;
}

.feature-grid,
.pricing-grid,
.module-grid,
.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card,
.pricing-card,
.module-card,
.chart-card,
.report-panel,
.metric-panel,
.notice-panel {
  padding: 24px;
}

.feature-card h3,
.pricing-card h2,
.module-card h2,
.chart-card h2,
.report-panel h2 {
  font-size: 1.22rem;
  font-weight: 800;
}

.feature-card p,
.pricing-card p,
.module-card p,
.report-panel p,
.notice-panel p {
  color: var(--muted);
  margin-bottom: 0;
}

.page-header {
  padding: 54px 0;
  color: #fff;
  background: linear-gradient(135deg, #101827, #0f766e);
}

.page-header h1 {
  font-size: 2.7rem;
}

.auth-section {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 54px 16px;
  background: linear-gradient(135deg, #eaf2f2, #f8fafc);
}

.auth-card {
  width: min(100%, 460px);
  padding: 30px;
}

.auth-card.wide {
  width: min(100%, 620px);
}

.auth-card h1 {
  font-size: 2rem;
  font-weight: 800;
}

.auth-link {
  display: inline-block;
  margin-top: 18px;
  font-weight: 700;
}

.price {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--brand-strong);
  margin: 20px 0;
}

.pricing-card {
  display: flex;
  min-height: 430px;
  flex-direction: column;
}

.pricing-card ul {
  color: var(--muted);
  padding-left: 18px;
  flex: 1;
}

.access-code {
  margin: 22px 0;
  padding: 18px;
  border: 1px dashed var(--brand);
  border-radius: 8px;
  background: #ecfdf5;
  color: var(--brand-strong);
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
}

.details-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
}

.details-list dt {
  color: var(--muted);
}

.module-card {
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.module-card:hover {
  color: var(--ink);
  border-color: var(--brand);
  transform: translateY(-2px);
}

.narrow {
  max-width: 820px;
}

.work-form {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.5fr);
  gap: 18px;
}

.metric-panel,
.stat-list {
  display: grid;
  gap: 12px;
}

.metric-panel div,
.stat-list div {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
}

.metric-panel strong,
.stat-list strong,
.ai-score strong {
  display: block;
  font-size: 2rem;
  color: var(--brand-strong);
}

.metric-panel span,
.stat-list span,
.ai-score span {
  color: var(--muted);
}

.bar-chart {
  height: 260px;
  display: flex;
  gap: 18px;
  align-items: end;
  padding: 18px;
  border-radius: 8px;
  background: var(--soft);
}

.bar-chart span {
  flex: 1;
  min-height: 42px;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 10px 6px;
  border-radius: 8px 8px 0 0;
  color: #fff;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}

.ai-score {
  margin: 22px 0;
  padding: 22px;
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: #fff7ed;
}

.report-text pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--soft);
  border-radius: 8px;
  padding: 18px;
}

.record-button { width: min(100%, 430px); min-height: 170px; padding: 28px; border: 2px solid #fecaca; border-radius: 18px; color: var(--ink); background: #fff7f7; touch-action: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: transform .15s, background .15s, box-shadow .15s; }
.record-button small { color: var(--muted); }
.record-dot { width: 44px; height: 44px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 10px #fee2e2; }
.record-button.recording { color: white; background: #b91c1c; transform: scale(.98); box-shadow: 0 0 0 8px #fee2e2; }
.record-button.recording small { color: #fee2e2; }
.record-button.recording .record-dot { background: white; animation: pulse 1s infinite; }
.transcript-grid, .metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; text-align: left; }
.transcript-grid label { font-weight: 700; }
.transcript-grid textarea { margin-top: 8px; font-weight: 400; }
.query-results { display: grid; gap: 14px; }
.query-results .report-panel { padding: 18px; box-shadow: none; }
.query-results code { display: block; margin-top: 10px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.metric-grid .metric-panel { box-shadow: none; }
.metric-panel b { color: var(--brand); }
.code-output { max-height: 680px; overflow: auto; margin: 12px 0 0; padding: 18px; border-radius: 8px; color: #e2e8f0; background: #0f172a; white-space: pre-wrap; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 18px; align-items: start; }
.evidence-table { user-select: text; margin-bottom: 0; }
.evidence-table th { background: #eaf2f2; white-space: nowrap; }
.evidence-table td { min-width: 130px; }
.status-pill { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: #e2e8f0; color: #475569; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-analyzed, .status-completed { background: #d1fae5; color: #065f46; }
.score-form { display: grid; grid-template-columns: 95px 110px auto; gap: 8px; align-items: end; min-width: 330px; }
.score-form label { font-size: .78rem; font-weight: 700; }
.document-link { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; vertical-align: middle; }
.wos-search-summary { padding: 26px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #101827, #0f766e); }
.wos-search-summary h2 { margin: 8px 0 22px; font-size: 1.3rem; }
.wos-total { display: flex; align-items: baseline; gap: 12px; }
.wos-total strong { font-size: 2.7rem; }
.wos-total span { color: #ccfbf1; }
.wos-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.wos-metrics article { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.wos-metrics strong { display: block; font-size: 1.65rem; color: var(--brand-strong); }
.wos-metrics span { color: var(--muted); font-size: .85rem; }
.wos-filter { max-width: 310px; }
.wos-category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.wos-category ol { margin: 16px 0 0; padding: 0; list-style: none; }
.wos-category li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.wos-category li:last-child { border: 0; }
.wos-category li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wos-category li div { display: flex; gap: 9px; align-items: baseline; }
.wos-category li small { color: var(--muted); min-width: 46px; text-align: right; }
.dataset-search-form { max-width: 920px; margin: 0 auto; }
.dataset-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dataset-card { display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 26px rgba(15,23,42,.06); }
.dataset-card-top, .dataset-meta, .dataset-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dataset-card h2 { margin: 14px 0 8px; font-size: 1.15rem; line-height: 1.35; }
.dataset-card .btn { margin-top: auto; align-self: start; }
.dataset-source, .dataset-meta span { padding: 4px 8px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: .76rem; }
.access-badge, .dataset-legend span { padding: 5px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.access-public { color: #065f46; background: #d1fae5; }
.access-private { color: #991b1b; background: #fee2e2; }
.access-unknown { color: #475569; background: #e2e8f0; }
.dataset-creators { margin: 12px 0 6px; color: var(--brand-strong); font-size: .85rem; font-weight: 700; }
.dataset-description { display: -webkit-box; margin: 8px 0 18px; overflow: hidden; color: var(--muted); font-size: .9rem; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
@keyframes pulse { 50% { transform: scale(.78); opacity: .65; } }

.footer {
  padding: 22px 0;
  color: #d1d5db;
  background: #101827;
}

@media (max-width: 992px) {
  .hero-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .pricing-grid,
  .module-grid,
  .chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .hero-section h1,
  .page-header h1 {
    font-size: 2.2rem;
  }

  .feature-grid,
  .pricing-grid,
  .module-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .details-list {
    grid-template-columns: 1fr;
  }
  .transcript-grid, .metric-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .wos-category-grid { grid-template-columns: 1fr; }
  .dataset-results { grid-template-columns: 1fr; }
  .wos-filter { max-width: 100%; }
}
