:root {
  --bg: #08110c;
  --panel: rgba(10, 20, 15, 0.78);
  --panel-strong: rgba(13, 27, 20, 0.92);
  --line: rgba(118, 255, 143, 0.18);
  --line-strong: rgba(118, 255, 143, 0.5);
  --text: #ebfff1;
  --muted: #9bb3a4;
  --accent: #7cff97;
  --accent-strong: #35e36d;
  --danger: #ff7f88;
  --warn: #ffd166;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(53, 227, 109, 0.12), transparent 25%),
    radial-gradient(circle at top right, rgba(124, 255, 151, 0.08), transparent 20%),
    linear-gradient(180deg, #06100a 0%, #08110c 46%, #030705 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 100%);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

#matrix-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.12;
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 24px;
  padding: 32px;
  overflow: hidden;
}

.hero-copy h1,
.panel-heading h2,
.section-heading h3 {
  margin: 0;
}

.hero-copy h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero-text,
.supporting-text,
.section-heading p,
.notice-card p,
.summary-subtext,
.dropzone-help,
.status-line,
.inventory-list,
.table-shell,
.insights-card,
.summary-label {
  color: var(--muted);
}

.hero-text {
  max-width: 58ch;
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-badges,
.action-row,
.notice-grid,
.summary-grid,
.metrics-grid,
.split-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.badge,
.risk-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(124, 255, 151, 0.08);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
}

.hero-orb {
  position: relative;
  min-height: 280px;
  display: grid;
  place-items: center;
}

.orb-core,
.orb-ring {
  position: absolute;
  border-radius: 50%;
}

.orb-core {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle at 30% 30%, rgba(124, 255, 151, 0.95), rgba(53, 227, 109, 0.25) 45%, rgba(3, 7, 5, 0) 72%);
  box-shadow: 0 0 90px rgba(53, 227, 109, 0.35);
}

.orb-ring {
  border: 1px solid rgba(124, 255, 151, 0.25);
}

.orb-ring-a {
  width: 240px;
  height: 240px;
  animation: rotate 18s linear infinite;
}

.orb-ring-b {
  width: 310px;
  height: 310px;
  border-style: dashed;
  animation: rotateReverse 24s linear infinite;
}

.upload-panel,
.results-panel {
  padding: 28px;
}

.panel-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 20px;
}

.supporting-text {
  max-width: 58ch;
  line-height: 1.6;
}

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

.dropzone {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 26px;
  border-radius: 24px;
  border: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, rgba(14, 30, 21, 0.82), rgba(8, 18, 13, 0.75));
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dropzone:hover,
.dropzone.is-active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(18, 38, 27, 0.88), rgba(11, 24, 17, 0.82));
}

.dropzone.secondary {
  border-style: solid;
}

.dropzone-label,
.summary-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dropzone strong,
.summary-value {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
}

.notice-grid {
  margin: 18px 0;
}

.ai-options {
  margin-top: 8px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(124, 255, 151, 0.12);
}

.ai-options-header h3 {
  margin: 0;
}

.ai-options-header p {
  margin: 4px 0 14px;
  color: var(--muted);
}

.ai-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.toggle-wrap,
.provider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.provider-wrap select {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 8px 10px;
}

.provider-wrap select:disabled {
  opacity: 0.55;
}

.ai-help {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.oauth-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.oauth-status {
  color: var(--muted);
  font-size: 0.92rem;
}

.oauth-status.ok {
  color: var(--accent);
}

.oauth-status.warn {
  color: var(--warn);
}

.oauth-actions {
  display: inline-flex;
  gap: 10px;
}

.ai-readiness {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.9rem;
}

.ai-readiness.ready {
  color: var(--accent);
  border-color: rgba(124, 255, 151, 0.3);
  background: rgba(124, 255, 151, 0.08);
}

.ai-readiness.warn {
  color: var(--warn);
  border-color: rgba(255, 209, 102, 0.3);
  background: rgba(255, 209, 102, 0.08);
}

.ai-readiness.pending {
  color: var(--muted);
}

.notice-card,
.summary-card,
.chart-card,
.table-card,
.insights-card,
.metric-card {
  background: var(--panel-strong);
  border: 1px solid rgba(124, 255, 151, 0.12);
  border-radius: 22px;
}

.notice-card {
  flex: 1 1 280px;
  padding: 18px;
}

.notice-card h3 {
  margin: 0 0 8px;
}

.action-row {
  align-items: center;
  margin-top: 20px;
}

.action-row.compact {
  justify-content: flex-end;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  min-height: 48px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease, color 180ms ease;
}

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

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

.button.primary {
  color: #06250d;
  background: linear-gradient(135deg, var(--accent), #4ef08a);
  font-weight: 700;
}

.button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
}

.status-line.is-active {
  color: var(--accent);
}

.progress-shell {
  margin-top: 14px;
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 180ms ease;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.summary-card {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.summary-card.highlight {
  background: linear-gradient(145deg, rgba(23, 59, 40, 0.95), rgba(11, 29, 20, 0.88));
}

.risk-pill {
  width: fit-content;
}

.risk-pill.low {
  color: var(--accent);
}

.risk-pill.medium {
  color: var(--warn);
  border-color: rgba(255, 209, 102, 0.35);
  background: rgba(255, 209, 102, 0.08);
}

.risk-pill.high,
.risk-pill.critical {
  color: var(--danger);
  border-color: rgba(255, 127, 136, 0.35);
  background: rgba(255, 127, 136, 0.08);
}

.section-block {
  margin-top: 24px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.metric-card {
  padding: 18px;
}

.metric-card .metric-value {
  display: block;
  margin-top: 10px;
  font-size: 1.7rem;
  color: var(--accent);
}

.metric-card .metric-note {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.split-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-card,
.table-card {
  padding: 20px;
}

.chart-card canvas {
  width: 100%;
  min-height: 280px;
}

.table-shell {
  overflow-x: auto;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
 td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
}

.inventory-list {
  margin: 14px 0 0;
  padding-left: 18px;
  line-height: 1.7;
}

.inventory-list li.is-missing {
  color: var(--danger);
}

.insights-card {
  margin-top: 14px;
  padding: 24px;
  line-height: 1.7;
}

.insights-card h4 {
  margin: 18px 0 8px;
  color: var(--text);
}

.insights-card ul,
.insights-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

[hidden] {
  display: none !important;
}

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

@keyframes rotateReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@media (max-width: 980px) {
  .hero,
  .dropzone-grid,
  .summary-grid,
  .metrics-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .panel-heading,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .ai-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .oauth-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    margin: 10px auto 32px;
  }

  .upload-panel,
  .results-panel,
  .hero {
    padding: 20px;
  }

  .hero-copy h1 {
    font-size: 2.6rem;
  }
}
