:root {
  color-scheme: dark;
  --bg: #0b1117;
  --bg-2: #101820;
  --surface: #151f29;
  --surface-2: #1b2733;
  --surface-3: #22313f;
  --ink: #f4f8fb;
  --muted: #b8c5cf;
  --quiet: #83919d;
  --line: rgba(212, 228, 239, 0.16);
  --line-strong: rgba(212, 228, 239, 0.28);
  --primary: #46d7f2;
  --primary-soft: rgba(70, 215, 242, 0.14);
  --violet: #9b8cff;
  --violet-soft: rgba(155, 140, 255, 0.14);
  --green: #65d987;
  --green-soft: rgba(101, 217, 135, 0.15);
  --amber: #f0bd52;
  --amber-soft: rgba(240, 189, 82, 0.16);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.15);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(70, 215, 242, 0.12), transparent 330px),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  font-family: var(--font);
  line-height: 1.5;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 14px;
  color: #071015;
  background: var(--primary);
  border-radius: var(--radius);
  font-weight: 800;
}

.skip-link:focus {
  top: 14px;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.site-header,
.dashboard-header,
.footer,
.header-actions,
.site-header nav,
.wordmark,
.trust-row,
.upload-actions,
.mode-row,
.copy-row,
.filter-row,
.term-meta,
.finding-meta {
  display: flex;
  align-items: center;
}

.site-header,
.dashboard-header,
.footer {
  justify-content: space-between;
  gap: 18px;
}

.site-header {
  min-height: 56px;
  margin-bottom: 46px;
}

.dashboard-active .site-header {
  display: none;
}

.site-header nav,
.header-actions,
.upload-actions,
.copy-row,
.filter-row {
  flex-wrap: wrap;
  gap: 10px;
}

.site-header nav a {
  color: var(--muted);
  font-weight: 700;
}

.site-header nav a:hover {
  color: var(--ink);
}

.nav-separator {
  color: var(--quiet);
  opacity: 0.56;
  font-weight: 700;
}

.tools-hub-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(70, 215, 242, 0.34);
  border-radius: 999px;
  color: var(--primary) !important;
  background: rgba(70, 215, 242, 0.1);
  font-size: 0.84rem;
  white-space: nowrap;
}

.tools-hub-pill:hover {
  background: rgba(70, 215, 242, 0.16);
  border-color: rgba(70, 215, 242, 0.52);
}

.wordmark {
  gap: 10px;
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.wordmark.compact {
  margin-bottom: 4px;
}

.mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--primary);
  border-radius: 5px;
  box-shadow: inset 0 0 0 4px rgba(70, 215, 242, 0.15), 0 0 20px rgba(70, 215, 242, 0.38);
}

.primary-button,
.secondary-button,
.danger-button,
.tab-button,
.chip-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.primary-button,
.secondary-button,
.danger-button,
.chip-button {
  padding: 0 14px;
}

.primary-button {
  color: #071015;
  background: var(--primary);
  border-color: transparent;
}

.secondary-button:hover,
.tab-button:hover,
.chip-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.09);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.chip-button:hover {
  transform: translateY(-1px);
}

.danger-button {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(255, 107, 107, 0.32);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.64fr);
  gap: 36px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  max-width: 790px;
  margin-bottom: 18px;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  letter-spacing: 0;
}

.hero-text {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.12rem;
}

.trust-row {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.trust-row span,
.badge,
.severity,
.status-pill,
.keyword-chip,
.demo-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  font-weight: 850;
}

.upload-panel,
.card,
.info-grid article,
.trust-section,
.text-viewer,
.report-sheet {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 31, 41, 0.82);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 22px;
}

.privacy-note {
  margin-bottom: 16px;
  color: var(--muted);
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 266px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  background:
    linear-gradient(145deg, rgba(70, 215, 242, 0.14), transparent 46%),
    rgba(255, 255, 255, 0.04);
}

.drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #071015;
  background: var(--primary);
  font-size: 2rem;
  font-weight: 900;
}

.fine-print,
.current-file,
.muted {
  color: var(--quiet);
  font-size: 0.92rem;
}

.processing-panel,
.error-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.error-panel {
  background: var(--red-soft);
  border-color: rgba(255, 107, 107, 0.34);
}

.progress-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.progress-steps li.active {
  color: var(--primary);
  font-weight: 900;
}

.progress-steps li.done {
  color: var(--green);
}

.info-band {
  margin-top: 58px;
}

.section-heading {
  margin-bottom: 18px;
}

.info-grid,
.summary-grid,
.score-grid,
.structure-grid,
.job-grid,
.recommendation-grid,
.report-grid {
  display: grid;
  gap: 14px;
}

.info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-grid article,
.trust-section,
.card {
  padding: 18px;
}

.step {
  color: var(--violet);
  font-family: var(--mono);
  font-weight: 900;
}

.trust-section {
  display: grid;
  grid-template-columns: 0.8fr 1fr;
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

.trust-section p:last-child {
  margin: 0;
  color: var(--muted);
}

.dashboard-view {
  padding-bottom: 20px;
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 12;
  padding: 12px 0;
  margin-bottom: 12px;
  background: rgba(11, 17, 23, 0.86);
  backdrop-filter: blur(18px);
}

.demo-badge {
  margin: 6px 0 12px;
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(240, 189, 82, 0.34);
}

.tab-list {
  position: sticky;
  top: 82px;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 16px;
  background: rgba(11, 17, 23, 0.86);
  backdrop-filter: blur(18px);
}

.tab-button {
  flex: 0 0 auto;
  padding: 0 13px;
}

.tab-button.active {
  color: #071015;
  background: var(--primary);
  border-color: transparent;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.summary-grid {
  grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1fr);
  align-items: stretch;
}

.score-hero {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 344px;
  text-align: center;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 176px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 14px solid var(--primary);
  background: var(--surface);
}

.score-ring.good {
  border-color: var(--green);
}

.score-ring.mid {
  border-color: var(--amber);
}

.score-ring.low {
  border-color: var(--red);
}

.score-ring strong {
  font-size: 3rem;
  line-height: 1;
}

.score-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-card {
  display: grid;
  gap: 8px;
}

.score-meter {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.score-meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.score-meter::-webkit-meter-optimum-value,
.score-meter::-webkit-meter-suboptimum-value,
.score-meter::-webkit-meter-even-less-good-value {
  border-radius: 999px;
  background: var(--primary);
}

.score-meter.good::-webkit-meter-optimum-value,
.score-meter.good::-webkit-meter-suboptimum-value,
.score-meter.good::-webkit-meter-even-less-good-value {
  background: var(--green);
}

.score-meter.mid::-webkit-meter-optimum-value,
.score-meter.mid::-webkit-meter-suboptimum-value,
.score-meter.mid::-webkit-meter-even-less-good-value {
  background: var(--amber);
}

.score-meter.low::-webkit-meter-optimum-value,
.score-meter.low::-webkit-meter-suboptimum-value,
.score-meter.low::-webkit-meter-even-less-good-value {
  background: var(--red);
}

.score-meter::-moz-meter-bar {
  border-radius: 999px;
  background: var(--primary);
}

.score-meter.good::-moz-meter-bar {
  background: var(--green);
}

.score-meter.mid::-moz-meter-bar {
  background: var(--amber);
}

.score-meter.low::-moz-meter-bar {
  background: var(--red);
}

.finding-list,
.section-list,
.recommendation-list,
.term-list {
  display: grid;
  gap: 10px;
}

.finding,
.section-item,
.recommendation,
.term-item,
.contact-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.finding-meta,
.term-meta {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.severity.critical { color: var(--red); background: var(--red-soft); border-color: rgba(255, 107, 107, 0.34); }
.severity.moderate { color: var(--amber); background: var(--amber-soft); border-color: rgba(240, 189, 82, 0.34); }
.severity.minor { color: var(--primary); background: var(--primary-soft); border-color: rgba(70, 215, 242, 0.34); }
.severity.info { color: var(--muted); }
.status-pill.detected { color: var(--green); background: var(--green-soft); border-color: rgba(101, 217, 135, 0.34); }
.status-pill.missing { color: var(--red); background: var(--red-soft); border-color: rgba(255, 107, 107, 0.34); }
.status-pill.possible, .status-pill.unclear { color: var(--amber); background: var(--amber-soft); border-color: rgba(240, 189, 82, 0.34); }

.text-tools,
.text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.text-toolbar input,
.job-input textarea,
.filter-row select {
  width: 100%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.text-toolbar input {
  max-width: 340px;
  min-height: 42px;
  padding: 0 12px;
}

.text-viewer {
  max-height: 620px;
  overflow: auto;
  padding: 0;
  box-shadow: none;
}

.line {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.55;
}

.line-number {
  padding: 5px 10px;
  color: var(--quiet);
  text-align: right;
  user-select: none;
  background: rgba(255, 255, 255, 0.035);
}

.line-text {
  min-width: 0;
  padding: 5px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hide-line-numbers .line {
  grid-template-columns: 1fr;
}

.hide-line-numbers .line-number {
  display: none;
}

.line.heading .line-text {
  color: var(--primary);
  font-weight: 900;
}

.line.suspicious .line-text {
  background: var(--amber-soft);
}

.line.order-risk .line-text {
  box-shadow: inset 4px 0 0 var(--violet);
}

mark {
  color: #071015;
  background: var(--amber);
  border-radius: 3px;
}

.structure-grid,
.job-grid {
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 0.45fr);
}

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

.job-input textarea {
  min-height: 280px;
  resize: vertical;
  padding: 12px;
}

.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-chip.matched { color: var(--green); background: var(--green-soft); border-color: rgba(101, 217, 135, 0.34); }
.keyword-chip.missing { color: var(--amber); background: var(--amber-soft); border-color: rgba(240, 189, 82, 0.34); }
.keyword-chip.possible { color: var(--violet); background: var(--violet-soft); border-color: rgba(155, 140, 255, 0.34); }

details.score-details {
  margin-top: 14px;
}

details.score-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 900;
}

.report-sheet {
  padding: 28px;
  background: var(--surface);
}

.report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.footer {
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--quiet);
}

.footer strong {
  color: var(--ink);
}

.update-notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 80;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 28px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.update-notice button {
  margin-left: 8px;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(70, 215, 242, 0.74);
  outline-offset: 3px;
}

::selection {
  color: #071015;
  background: var(--primary);
}

@media (max-width: 980px) {
  .hero-grid,
  .summary-grid,
  .structure-grid,
  .job-grid,
  .trust-section {
    grid-template-columns: 1fr;
  }

  .info-grid,
  .score-grid,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 28px, 1240px);
    padding-top: 10px;
    padding-bottom: 28px;
  }

  .dashboard-header,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    min-height: 48px;
    margin-bottom: 26px;
    gap: 12px;
  }

  .site-header nav {
    justify-content: flex-end;
    gap: 8px;
    font-size: 0.9rem;
  }

  .tools-hub-pill {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .hero-grid {
    gap: 22px;
  }

  .eyebrow {
    margin-bottom: 8px;
  }

  h1 {
    margin-bottom: 14px;
    font-size: clamp(2.05rem, 10.8vw, 3.15rem);
    line-height: 1;
  }

  h2 {
    font-size: clamp(1.32rem, 7vw, 1.8rem);
  }

  .hero-text {
    font-size: 1rem;
  }

  .trust-row {
    gap: 8px;
    margin-top: 18px;
  }

  .upload-panel {
    padding: 16px;
  }

  .drop-zone {
    min-height: 204px;
    padding: 18px 14px;
  }

  .upload-icon {
    width: 46px;
    height: 46px;
    font-size: 1.75rem;
  }

  .info-band {
    margin-top: 38px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .info-grid,
  .summary-grid,
  .score-grid,
  .structure-grid,
  .job-grid,
  .recommendation-grid,
  .report-grid {
    gap: 10px;
  }

  .info-grid article,
  .trust-section,
  .card {
    padding: 16px;
  }

  .trust-section {
    gap: 10px;
    margin-top: 12px;
  }

  .dashboard-header {
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 8px;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .header-actions .primary-button,
  .header-actions .secondary-button {
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .info-grid,
  .score-grid,
  .contact-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .tab-list {
    top: 0;
  }

  .line {
    grid-template-columns: 44px minmax(0, 1fr);
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --surface-3: #fff;
    --ink: #111820;
    --muted: #384651;
    --quiet: #53616c;
    --line: #d8dde3;
    --line-strong: #b9c0c7;
    --shadow: none;
  }

  body {
    background: #fff;
  }

  .no-print,
  .site-header,
  .footer,
  .tab-list,
  #landingView,
  #overviewPanel,
  #atsPanel,
  #structurePanel,
  #jobPanel,
  #recommendationsPanel {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  #dashboardView,
  #reportPanel,
  #reportPanel.active {
    display: block !important;
  }

  .report-sheet,
  .card,
  .finding,
  .section-item,
  .recommendation,
  .term-item {
    border-color: #d8dde3;
    box-shadow: none;
    break-inside: avoid;
  }
}
