@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #001a42;
  --primary-strong: #071832;
  --primary-soft: #eef4fb;
  --accent: #1f6f9d;
  --accent-strong: #12557a;
  --ink: #0f2747;
  --muted: #5d718b;
  --surface: #ffffff;
  --surface-soft: #f5f9fd;
  --surface-muted: #eaf1f8;
  --line: #d7e3ef;
  --line-strong: #c2d1e2;
  --success: #1f744f;
  --danger: #a43e3e;
  --shadow: 0 24px 60px rgba(0, 26, 66, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 111, 157, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(0, 26, 66, 0.08), transparent 24%),
    linear-gradient(180deg, #f9fcff 0%, #f2f7fb 54%, #ecf3f9 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), transparent 42%),
    radial-gradient(circle at 10% 0%, rgba(0, 26, 66, 0.06), transparent 26%);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: block;
  margin-bottom: 24px;
}

.hero-copy,
.panel {
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: 28px;
  color: white;
  background:
    radial-gradient(circle at top right, rgba(66, 138, 184, 0.32), transparent 28%),
    linear-gradient(135deg, #001a42 0%, #082554 58%, #11406f 100%);
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 58%, rgba(255, 255, 255, 0.05) 58% 64%, transparent 64%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%);
  pointer-events: none;
}

.brand-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px;
  margin-bottom: 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 34px rgba(0, 18, 46, 0.16);
}

.hero-logo {
  width: min(180px, 100%);
  height: auto;
  display: block;
  flex: 0 1 auto;
}

.hero-title {
  margin-left: auto;
  color: var(--primary);
  text-align: right;
  font-size: clamp(2rem, 3.2vw, 3.4rem);
  line-height: 0.95;
  font-weight: 800;
}

.panel {
  padding: 24px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
}

.eyebrow,
.panel-label,
.metric-label {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.panel-label,
.metric-label {
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  font-family: Inter, sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.6rem, 4vw, 4.5rem);
  line-height: 0.98;
  font-weight: 800;
}

h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
}

.hero-text,
.hint,
.stage-copy,
.empty-state,
.field span,
.field input,
.field textarea,
.field-note {
  line-height: 1.6;
}

.hero-text {
  max-width: 44rem;
  margin: 16px 0 0;
  font-size: 1.05rem;
  color: rgba(237, 245, 255, 0.92);
}

.auth-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 20px 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.auth-banner.locked {
  border-color: rgba(31, 111, 157, 0.18);
  background: linear-gradient(180deg, rgba(244, 249, 255, 0.98), rgba(237, 244, 251, 0.98));
}

.auth-banner.authenticated {
  border-color: rgba(31, 116, 79, 0.18);
  background: linear-gradient(180deg, rgba(246, 252, 248, 0.98), rgba(239, 249, 243, 0.98));
}

.auth-copy {
  min-width: 0;
}

.auth-message,
.auth-meta {
  margin: 8px 0 0;
  color: var(--muted);
}

.auth-meta {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.auth-meta.error {
  color: var(--danger);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.panel-header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.pill {
  border: 1px solid rgba(31, 111, 157, 0.14);
  color: var(--accent-strong);
  background: #eff6fc;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.billing-summary {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(240, 246, 252, 0.98));
}

.billing-summary.configured {
  border-color: rgba(31, 111, 157, 0.2);
}

.billing-summary.missing_key {
  border-color: rgba(164, 62, 62, 0.18);
  background: linear-gradient(180deg, rgba(253, 246, 246, 0.98), rgba(250, 239, 239, 0.98));
}

.billing-summary-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.billing-summary-label {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.billing-title {
  display: block;
  color: var(--primary);
  font-size: 1rem;
}

.billing-link {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.billing-link:hover {
  text-decoration: underline;
}

.billing-copy {
  margin: 10px 0 0;
  color: var(--muted);
}

.billing-amount {
  margin: 12px 0 0;
  color: var(--primary);
  font-size: 1.22rem;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--primary);
}

.field-note {
  color: var(--muted);
  font-size: 0.83rem;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #7f90a6;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(31, 111, 157, 0.54);
  box-shadow: 0 0 0 4px rgba(31, 111, 157, 0.12);
}

.upload-field input {
  padding: 18px 16px;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(251, 253, 255, 0.98), rgba(240, 246, 252, 0.98));
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 1;
  transform: none;
}

.button.primary,
.button.accent {
  color: white;
  background: linear-gradient(135deg, var(--primary), #0c2f63);
  box-shadow: 0 16px 28px rgba(0, 26, 66, 0.18);
}

.button.primary:hover,
.button.accent:hover {
  box-shadow: 0 18px 30px rgba(0, 26, 66, 0.2);
}

.button.accent:disabled {
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(135deg, #a0a8b4, #8b94a1);
  box-shadow: none;
  cursor: not-allowed;
}

.button.ghost {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line-strong);
}

.button.secondary {
  color: var(--primary);
  background: #eef4fb;
  border: 1px solid var(--line-strong);
}

.button.secondary:disabled {
  color: rgba(15, 39, 71, 0.42);
  background: rgba(234, 241, 248, 0.8);
  border-color: rgba(194, 209, 226, 0.7);
  cursor: not-allowed;
}

.button.stop {
  color: var(--primary);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
}

.button.stop:disabled {
  color: rgba(15, 39, 71, 0.42);
  background: rgba(234, 241, 248, 0.8);
  border-color: rgba(194, 209, 226, 0.7);
  cursor: not-allowed;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row .button {
  flex: 1 1 220px;
}

.hint {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid #d4e4f2;
  background: #f1f7fc;
  color: #42627f;
}

.knowledge-status {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(240, 246, 252, 0.98));
}

.knowledge-status.ready {
  border-color: rgba(31, 116, 79, 0.18);
  background: linear-gradient(180deg, rgba(245, 252, 248, 0.98), rgba(237, 248, 242, 0.98));
}

.knowledge-status.syncing {
  border-color: rgba(31, 111, 157, 0.2);
  background: linear-gradient(180deg, rgba(242, 248, 253, 0.98), rgba(233, 243, 251, 0.98));
}

.knowledge-status.failed {
  border-color: rgba(164, 62, 62, 0.18);
  background: linear-gradient(180deg, rgba(253, 246, 246, 0.98), rgba(250, 239, 239, 0.98));
}

.knowledge-status-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.knowledge-status-header strong {
  color: var(--primary);
  font-size: 0.98rem;
}

.knowledge-counts {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.knowledge-stage {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.knowledge-list,
.preview-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.knowledge-item,
.preview-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  padding: 16px;
}

.knowledge-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.knowledge-item strong,
.preview-title {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
  color: var(--primary);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.link-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status-strip {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric {
  border-radius: 22px;
  padding: 18px 20px;
  min-height: 112px;
  background:
    radial-gradient(circle at top right, rgba(62, 136, 184, 0.22), transparent 34%),
    linear-gradient(160deg, #001a42 0%, #082654 100%);
  color: white;
  box-shadow: var(--shadow);
}

.metric-label {
  color: rgba(206, 225, 247, 0.78);
}

.metric strong {
  display: block;
  margin-top: 16px;
  font-size: 1.3rem;
  line-height: 1.2;
  color: white;
}

.progress-panel {
  min-height: 300px;
}

.stage-copy {
  margin-bottom: 16px;
  color: var(--muted);
}

.flash {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
}

.flash.success {
  color: var(--success);
  background: rgba(31, 116, 79, 0.12);
}

.flash.error {
  color: var(--danger);
  background: rgba(164, 62, 62, 0.12);
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  color: var(--muted);
  background: #f8fbfe;
  border: 1px dashed var(--line-strong);
}

.empty-state.compact {
  margin-top: 6px;
}

.preview-card {
  animation: rise 0.28s ease;
}

.preview-copy {
  margin: 0 0 12px;
  color: var(--muted);
  white-space: pre-wrap;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.confidence {
  color: var(--accent-strong);
  background: #edf5fb;
}

.badge.review {
  color: #815400;
  background: #fbf4df;
}

.badge.compliance {
  color: #0e4f2d;
  background: #e7f5ec;
}

.source-list {
  color: var(--muted);
  font-size: 0.86rem;
}

.preview-detail {
  margin: 0 0 12px;
}

.preview-detail summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.preview-copy-secondary {
  margin-top: 10px;
  color: var(--muted);
  opacity: 0.92;
}

.hidden {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100vw - 22px, 1180px);
    padding-top: 18px;
  }

  .panel-header,
  .knowledge-item,
  .auth-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-actions {
    justify-content: flex-start;
  }

  .auth-actions .button {
    flex: 1 1 220px;
  }

  .brand-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-title {
    margin-left: 0;
    text-align: left;
  }

  .pill {
    white-space: normal;
  }
}
