:root {
  --color-bg: #0a0f1e;
  --color-surface: #111827;
  --color-surface-raised: #1a2236;
  --color-border: #1e2d45;
  --color-border-hover: #2e4066;
  --color-confirmed: #22c55e;
  --color-high: #f59e0b;
  --color-medium: #818cf8;
  --color-low: #64748b;
  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #4b5563;
  --color-accent: #f59e0b;
  --color-link: #38bdf8;
  --color-error: #ef4444;
  --color-source-sam: #60a5fa;
  --color-source-sam-bg: rgba(29, 78, 216, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

body {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.06), transparent 24rem),
    radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.08), transparent 26rem),
    var(--color-bg);
}

body.is-help-open {
  overflow: hidden;
}

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

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.auth-shell {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
}

.login-brand {
  margin-bottom: 18px;
}

.login-logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
}

.login-copy h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.login-copy p {
  margin: 8px 0 0;
  color: var(--color-text-secondary);
}

.login-form {
  margin-top: 20px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.field-label + .login-input {
  margin-bottom: 14px;
}

.login-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 120ms ease;
}

.login-input:focus {
  border-color: var(--color-border-hover);
}

.login-button {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  min-height: 22px;
}

.login-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 24px;
  background: rgba(10, 15, 30, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-dialog {
  width: 100%;
  max-width: 880px;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.help-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
}

.help-header p {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

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

.help-card {
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
}

.help-step {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 600;
}

.help-card h3 {
  margin: 12px 0 8px;
  font-size: 16px;
  font-weight: 500;
}

.help-card p {
  margin: 0;
  color: var(--color-text-secondary);
}

.help-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.app-shell[hidden],
.auth-shell[hidden],
.help-overlay[hidden] {
  display: none;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #1a2236;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.logo-area {
  height: 92px;
  padding: 10px 8px 0 8px;
  display: flex;
  align-items: flex-start;
}

.logo-image {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 0;
}

.sidebar-button {
  width: 100%;
}

.nav-link {
  width: 100%;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.nav-link.is-active {
  border-left-color: var(--color-accent);
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
}

.inventory-status {
  display: none;
  padding: 10px 20px 0;
}

.inventory-status.is-visible {
  display: block;
}

.inventory-filename {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inventory-date {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.status-panel {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

#status-sources {
  display: flex;
  flex-direction: column;
}

.status-line + .status-line {
  margin-top: 10px;
}

.status-label {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.status-value {
  color: var(--color-text-primary);
}

.status-source-line {
  display: block;
}

.status-meta {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
}

.status-summary {
  display: flex;
  gap: 10px;
}

.status-value.is-confirmed {
  color: var(--color-confirmed);
}

.status-value.is-high {
  color: var(--color-high);
}

.status-value.is-medium {
  color: var(--color-medium);
}

.main-content {
  margin-left: 240px;
  min-height: 100vh;
  padding: 40px;
}

.view {
  display: none;
  width: 100%;
  max-width: 960px;
}

.view.is-active {
  display: block;
}

.view-header {
  margin-bottom: 32px;
}

.view-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tooltip-button {
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  position: relative;
}

.tooltip-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.tooltip-button:hover::after,
.tooltip-button:focus-visible::after {
  opacity: 1;
}

.view-header p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.search-form input {
  width: 100%;
  max-width: 600px;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 120ms ease;
}

.search-form input::placeholder {
  color: var(--color-text-muted);
}

.search-form input:focus {
  border-color: var(--color-border-hover);
}

.primary-button {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  background: var(--color-accent);
  color: #000;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.inline-error {
  margin-top: 12px;
  color: var(--color-error);
}

.inline-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.search-results {
  margin-top: 28px;
}

.results-group {
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(6px);
  animation: fade-in-up 150ms ease forwards;
}

.results-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.results-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.count-badge.is-confirmed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-confirmed);
}

.count-badge.is-high {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-high);
}

.count-badge.is-medium {
  background: rgba(129, 140, 248, 0.15);
  color: var(--color-medium);
}

.count-badge.is-low {
  background: rgba(100, 116, 139, 0.15);
  color: var(--color-low);
}

.match-card {
  position: relative;
  margin-bottom: 12px;
  padding: 16px 20px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
  overflow: hidden;
  transition: border-color 120ms ease;
}

.match-card:hover {
  border-color: var(--color-border-hover);
}

.match-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.match-card[data-tier="confirmed"]::before {
  background: var(--color-confirmed);
}

.match-card[data-tier="high"]::before {
  background: var(--color-high);
}

.match-card[data-tier="medium"]::before {
  background: var(--color-medium);
}

.match-card[data-tier="low"]::before {
  background: var(--color-low);
}

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

.card-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.match-badge {
  display: inline-block;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.match-badge.is-confirmed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-confirmed);
}

.match-badge.is-high {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-high);
}

.match-badge.is-medium {
  background: rgba(129, 140, 248, 0.15);
  color: var(--color-medium);
}

.match-badge.is-low {
  background: rgba(100, 116, 139, 0.15);
  color: var(--color-low);
}

.source-badge {
  display: inline-block;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 2px 8px;
  background: var(--color-surface);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.source-badge.is-sam {
  border-color: transparent;
  background: var(--color-source-sam-bg);
  color: var(--color-source-sam);
}

.buyer-pn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.card-headline {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.card-pill {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 3px 10px;
  background: var(--color-surface);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.matched-keywords {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.matched-keywords-label {
  color: var(--color-text-muted);
}

.downgrade-reason {
  margin-top: 6px;
  font-size: 13px;
  font-style: italic;
  color: var(--color-high);
}

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

.scraped-at {
  font-size: 12px;
  color: var(--color-text-muted);
}

.card-link {
  font-size: 13px;
}

.empty-state {
  margin-top: 40px;
  text-align: center;
  color: var(--color-text-muted);
  opacity: 0;
  transform: translateY(6px);
  animation: fade-in-up 150ms ease forwards;
}

.drop-zone {
  width: 100%;
  max-width: 600px;
  height: 160px;
  padding: 24px;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.drop-zone.is-dragover {
  border-color: var(--color-accent);
}

.drop-zone-icon {
  width: 32px;
  height: 32px;
  color: var(--color-text-muted);
}

.drop-zone-icon svg {
  width: 100%;
  height: 100%;
}

.drop-zone-title {
  margin-top: 12px;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.drop-zone-subtitle {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.batch-filename {
  color: var(--color-text-secondary);
}

.batch-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--color-text-secondary);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 700ms ease infinite;
}

.batch-results {
  margin-top: 28px;
}

.batch-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-top: 18px;
}

.tab-button {
  padding: 10px 20px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.tab-button.is-active {
  border-bottom-color: var(--color-accent);
  color: var(--color-text-primary);
}

.outline-button {
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}

.outline-button:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.results-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

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

.results-table thead th {
  padding: 10px 12px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.results-table tbody tr:nth-child(odd) {
  background: var(--color-surface-raised);
}

.results-table tbody tr:nth-child(even) {
  background: var(--color-surface);
}

.results-table tbody td {
  height: 44px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--color-text-primary);
}

.results-table .source-cell {
  white-space: nowrap;
}

.results-table .listing-cell {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.results-table .link-cell a {
  white-space: nowrap;
}

.no-results-table {
  margin-top: 16px;
  color: var(--color-text-muted);
}

.unmatched-disclosure {
  margin-top: 20px;
  color: var(--color-text-muted);
}

.unmatched-disclosure summary {
  cursor: pointer;
  font-size: 13px;
}

.unmatched-list {
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  columns: 1;
  column-gap: 24px;
}

.unmatched-list.two-columns {
  columns: 2;
}

.unmatched-list div {
  break-inside: avoid;
  margin-bottom: 6px;
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-pill {
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.filter-pill.is-active {
  border-color: var(--color-accent);
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
}

.recent-item {
  border-bottom: 1px solid var(--color-border);
}

.recent-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px 0 0;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.recent-row:hover {
  background: var(--color-surface-raised);
}

.recent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 12px;
  flex: 0 0 auto;
}

.recent-dot.is-confirmed {
  background: var(--color-confirmed);
}

.recent-dot.is-high {
  background: var(--color-high);
}

.recent-dot.is-medium {
  background: var(--color-medium);
}

.recent-dot.is-low {
  background: var(--color-low);
}

.recent-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.recent-headline {
  font-size: 14px;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-buyer {
  font-size: 12px;
  color: var(--color-text-muted);
}

.recent-time {
  min-width: 110px;
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: right;
}

.recent-arrow {
  padding-right: 4px;
  font-size: 18px;
  line-height: 1;
}

.recent-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 180ms ease, opacity 180ms ease;
}

.recent-item.is-open .recent-details {
  max-height: 500px;
  opacity: 1;
}

.recent-details-inner {
  padding: 0 0 12px;
}

.recent-pagination {
  margin-top: 20px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pagination-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.pagination-indicator {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.cs-hero {
  position: relative;
  margin-bottom: 44px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.cs-hero::after {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 480px;
  height: 280px;
  background: radial-gradient(ellipse at center, rgba(245, 158, 11, 0.07), transparent 68%);
  pointer-events: none;
}

.cs-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 14px;
}

.cs-eyebrow-line {
  display: block;
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-accent);
  flex-shrink: 0;
}

.cs-title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.25;
}

.cs-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.cs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.cs-card {
  position: relative;
  padding: 22px 22px 22px 22px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: 8px;
  background: var(--color-surface-raised);
  overflow: hidden;
  transition: box-shadow 240ms ease, transform 240ms ease, border-color 240ms ease;
  opacity: 0;
  animation: fade-in-up 280ms ease forwards;
}

.cs-card:nth-child(1) { animation-delay: 40ms; }
.cs-card:nth-child(2) { animation-delay: 100ms; }
.cs-card:nth-child(3) { animation-delay: 160ms; }
.cs-card:nth-child(4) { animation-delay: 220ms; }
.cs-card:nth-child(5) { animation-delay: 280ms; }
.cs-card:nth-child(6) { animation-delay: 340ms; }
.cs-card:nth-child(7) { animation-delay: 400ms; }

.cs-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.045) 0%, transparent 55%);
  pointer-events: none;
}

.cs-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.07), transparent);
  pointer-events: none;
  animation: cs-shimmer 7s ease-in-out infinite;
}

.cs-card:nth-child(2)::after { animation-delay: 1.2s; }
.cs-card:nth-child(3)::after { animation-delay: 2.4s; }
.cs-card:nth-child(4)::after { animation-delay: 3.6s; }
.cs-card:nth-child(5)::after { animation-delay: 4.8s; }
.cs-card:nth-child(6)::after { animation-delay: 6s; }
.cs-card:nth-child(7)::after { animation-delay: 0.6s; }

.cs-card:hover {
  transform: translateY(-3px);
  border-left-color: var(--color-accent);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 8px 30px rgba(245, 158, 11, 0.09), 0 0 0 1px rgba(245, 158, 11, 0.08);
}

.cs-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.cs-icon {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.15);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cs-icon svg {
  width: 20px;
  height: 20px;
}

.cs-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.cs-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
  animation: cs-pulse 2.2s ease-in-out infinite;
}

.cs-card-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.cs-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--color-text-secondary);
}

@keyframes cs-shimmer {
  0%   { left: -120%; }
  40%  { left: 160%; }
  100% { left: 160%; }
}

@keyframes cs-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.28; transform: scale(0.75); }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ── Recent filter bar (sticky) ─────────────────────────────────────────── */

.recent-filter-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-bg);
  padding: 16px 0 4px;
  margin-top: -8px;
}

.ata-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ata-filter-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.ata-select {
  -webkit-appearance: none;
  appearance: none;
  height: 34px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background-color: #111827;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  min-width: 0;
  flex: 1;
  max-width: 340px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.ata-select:hover {
  border-color: var(--color-border-hover);
}

.ata-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.ata-select option {
  background: #111827;
  color: var(--color-text-primary);
}

/* ── Copy PN button ──────────────────────────────────────────────────────── */

.pn-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 120ms ease, color 120ms ease;
}

.pn-copy-btn:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-secondary);
}

.pn-copy-btn svg {
  width: 12px;
  height: 12px;
}

.pn-copy-btn.is-copied {
  border-color: var(--color-confirmed);
  color: var(--color-confirmed);
}

.pn-copy-tooltip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 0 2px;
}

/* ── Batch run info bar ──────────────────────────────────────────────────── */

.batch-run-info {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ── AOG Critical tier ──────────────────────────────────────────────────── */

.match-card[data-tier="aog"]::before {
  background: #ef4444;
}

.match-badge.is-aog {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.aog-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: aog-pulse 1.6s ease-in-out infinite;
}

.aog-reason-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.recent-dot.is-aog {
  background: #ef4444;
  animation: aog-pulse 1.6s ease-in-out infinite;
}

.count-badge.is-aog {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.tab-button.is-critical-tab.is-active {
  border-bottom-color: #ef4444;
  color: #ef4444;
}

.filter-pill.is-critical {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.filter-pill.is-critical.is-active {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.status-value.is-aog {
  color: #ef4444;
  font-weight: 600;
}

/* ── ATA chapter tags ────────────────────────────────────────────────────── */

.ata-tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.ata-tag.is-upgraded {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--color-high);
}

.ata-tag.is-mismatch {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

@keyframes aog-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

/* ── Mobile header & hamburger ───────────────────────────────────────────── */

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  padding: 0 16px;
  background: #1a2236;
  border-bottom: 1px solid var(--color-border);
  z-index: 20;
}

.mobile-logo {
  height: 32px;
  width: auto;
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.hamburger-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-text-primary);
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease;
  transform-origin: center;
}

.hamburger-btn.is-open .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.is-open .hamburger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.is-open .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 24;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.is-nav-open {
  overflow: hidden;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 920px) {
  .auth-shell {
    padding: 16px;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .mobile-header {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar-nav {
    flex-direction: column;
    padding-top: 4px;
    gap: 0;
  }

  .nav-link {
    width: 100%;
    height: 52px;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    min-width: 0;
    background: transparent;
  }

  .nav-link.is-active {
    border-left-color: var(--color-accent);
    background: var(--color-surface-raised);
  }

  .sidebar-actions {
    flex-direction: column;
    padding-top: 12px;
    gap: 8px;
  }

  .sidebar-button {
    width: 100%;
    height: 44px;
  }

  .main-content {
    margin-left: 0;
    padding: 72px 20px 40px;
  }

  .recent-filter-bar {
    top: 56px;
  }

  .status-panel {
    margin-top: auto;
  }

  .card-topline,
  .card-footer,
  .batch-results-header,
  .pagination-controls,
  .recent-row {
    align-items: flex-start;
  }

  .card-topline,
  .card-footer,
  .batch-results-header,
  .pagination-controls {
    flex-direction: column;
  }

  .recent-row {
    flex-wrap: wrap;
    padding: 12px 12px 12px 0;
  }

  .recent-time {
    min-width: 0;
    text-align: left;
  }

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

@media (max-width: 640px) {
  .login-card,
  .help-dialog {
    padding: 18px;
  }

  .logo-area {
    height: auto;
    padding-bottom: 6px;
  }

  .main-content {
    padding: 68px 14px 32px;
  }

  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form input,
  .primary-button {
    max-width: none;
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tab-button {
    white-space: nowrap;
  }

  .results-table thead th,
  .results-table tbody td {
    padding-left: 10px;
    padding-right: 10px;
  }

  .tooltip-button::after {
    left: 0;
    transform: none;
    width: 200px;
  }

  .cs-grid {
    grid-template-columns: 1fr;
  }

  .cs-title {
    font-size: 22px;
  }

  .filter-pill {
    min-height: 44px;
    padding: 10px 14px;
  }

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

  .ata-select {
    max-width: none;
    width: 100%;
    height: 44px;
    padding: 0 36px 0 12px;
    font-size: 14px;
  }
}
